Lines Matching +full:long +full:- +full:term

1 // SPDX-License-Identifier: GPL-2.0
13 #include <media/v4l2-h264.h>
16 * v4l2_h264_init_reflist_builder() - Initialize a P/B0/B1 reference list
33 max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4); in v4l2_h264_init_reflist_builder()
34 cur_frame_num = dec_params->frame_num; in v4l2_h264_init_reflist_builder()
37 if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) in v4l2_h264_init_reflist_builder()
38 b->cur_pic_order_count = min(dec_params->bottom_field_order_cnt, in v4l2_h264_init_reflist_builder()
39 dec_params->top_field_order_cnt); in v4l2_h264_init_reflist_builder()
40 else if (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) in v4l2_h264_init_reflist_builder()
41 b->cur_pic_order_count = dec_params->bottom_field_order_cnt; in v4l2_h264_init_reflist_builder()
43 b->cur_pic_order_count = dec_params->top_field_order_cnt; in v4l2_h264_init_reflist_builder()
51 b->refs[i].pic_num = dpb[i].pic_num; in v4l2_h264_init_reflist_builder()
53 b->refs[i].longterm = true; in v4l2_h264_init_reflist_builder()
62 b->refs[i].frame_num = (int)dpb[i].frame_num - in v4l2_h264_init_reflist_builder()
65 b->refs[i].frame_num = dpb[i].frame_num; in v4l2_h264_init_reflist_builder()
75 b->refs[i].pic_order_count = pic_order_count; in v4l2_h264_init_reflist_builder()
76 b->unordered_reflist[b->num_valid] = i; in v4l2_h264_init_reflist_builder()
77 b->num_valid++; in v4l2_h264_init_reflist_builder()
80 for (i = b->num_valid; i < ARRAY_SIZE(b->unordered_reflist); i++) in v4l2_h264_init_reflist_builder()
81 b->unordered_reflist[i] = i; in v4l2_h264_init_reflist_builder()
98 if (builder->refs[idxa].longterm != builder->refs[idxb].longterm) { in v4l2_h264_p_ref_list_cmp()
99 /* Short term pics first. */ in v4l2_h264_p_ref_list_cmp()
100 if (!builder->refs[idxa].longterm) in v4l2_h264_p_ref_list_cmp()
101 return -1; in v4l2_h264_p_ref_list_cmp()
107 * Short term pics in descending pic num order, long term ones in in v4l2_h264_p_ref_list_cmp()
110 if (!builder->refs[idxa].longterm) in v4l2_h264_p_ref_list_cmp()
111 return builder->refs[idxb].frame_num < in v4l2_h264_p_ref_list_cmp()
112 builder->refs[idxa].frame_num ? in v4l2_h264_p_ref_list_cmp()
113 -1 : 1; in v4l2_h264_p_ref_list_cmp()
115 return builder->refs[idxa].pic_num < builder->refs[idxb].pic_num ? in v4l2_h264_p_ref_list_cmp()
116 -1 : 1; in v4l2_h264_p_ref_list_cmp()
133 if (builder->refs[idxa].longterm != builder->refs[idxb].longterm) { in v4l2_h264_b0_ref_list_cmp()
134 /* Short term pics first. */ in v4l2_h264_b0_ref_list_cmp()
135 if (!builder->refs[idxa].longterm) in v4l2_h264_b0_ref_list_cmp()
136 return -1; in v4l2_h264_b0_ref_list_cmp()
141 /* Long term pics in ascending pic num order. */ in v4l2_h264_b0_ref_list_cmp()
142 if (builder->refs[idxa].longterm) in v4l2_h264_b0_ref_list_cmp()
143 return builder->refs[idxa].pic_num < in v4l2_h264_b0_ref_list_cmp()
144 builder->refs[idxb].pic_num ? in v4l2_h264_b0_ref_list_cmp()
145 -1 : 1; in v4l2_h264_b0_ref_list_cmp()
147 poca = builder->refs[idxa].pic_order_count; in v4l2_h264_b0_ref_list_cmp()
148 pocb = builder->refs[idxb].pic_order_count; in v4l2_h264_b0_ref_list_cmp()
151 * Short term pics with POC < cur POC first in POC descending order in v4l2_h264_b0_ref_list_cmp()
152 * followed by short term pics with POC > cur POC in POC ascending in v4l2_h264_b0_ref_list_cmp()
155 if ((poca < builder->cur_pic_order_count) != in v4l2_h264_b0_ref_list_cmp()
156 (pocb < builder->cur_pic_order_count)) in v4l2_h264_b0_ref_list_cmp()
157 return poca < pocb ? -1 : 1; in v4l2_h264_b0_ref_list_cmp()
158 else if (poca < builder->cur_pic_order_count) in v4l2_h264_b0_ref_list_cmp()
159 return pocb < poca ? -1 : 1; in v4l2_h264_b0_ref_list_cmp()
161 return poca < pocb ? -1 : 1; in v4l2_h264_b0_ref_list_cmp()
178 if (builder->refs[idxa].longterm != builder->refs[idxb].longterm) { in v4l2_h264_b1_ref_list_cmp()
179 /* Short term pics first. */ in v4l2_h264_b1_ref_list_cmp()
180 if (!builder->refs[idxa].longterm) in v4l2_h264_b1_ref_list_cmp()
181 return -1; in v4l2_h264_b1_ref_list_cmp()
186 /* Long term pics in ascending pic num order. */ in v4l2_h264_b1_ref_list_cmp()
187 if (builder->refs[idxa].longterm) in v4l2_h264_b1_ref_list_cmp()
188 return builder->refs[idxa].pic_num < in v4l2_h264_b1_ref_list_cmp()
189 builder->refs[idxb].pic_num ? in v4l2_h264_b1_ref_list_cmp()
190 -1 : 1; in v4l2_h264_b1_ref_list_cmp()
192 poca = builder->refs[idxa].pic_order_count; in v4l2_h264_b1_ref_list_cmp()
193 pocb = builder->refs[idxb].pic_order_count; in v4l2_h264_b1_ref_list_cmp()
196 * Short term pics with POC > cur POC first in POC ascending order in v4l2_h264_b1_ref_list_cmp()
197 * followed by short term pics with POC < cur POC in POC descending in v4l2_h264_b1_ref_list_cmp()
200 if ((poca < builder->cur_pic_order_count) != in v4l2_h264_b1_ref_list_cmp()
201 (pocb < builder->cur_pic_order_count)) in v4l2_h264_b1_ref_list_cmp()
202 return pocb < poca ? -1 : 1; in v4l2_h264_b1_ref_list_cmp()
203 else if (poca < builder->cur_pic_order_count) in v4l2_h264_b1_ref_list_cmp()
204 return pocb < poca ? -1 : 1; in v4l2_h264_b1_ref_list_cmp()
206 return poca < pocb ? -1 : 1; in v4l2_h264_b1_ref_list_cmp()
210 * v4l2_h264_build_p_ref_list() - Build the P reference list
213 * @reflist: 16-bytes array used to store the P reference list. Each entry
225 memcpy(reflist, builder->unordered_reflist, in v4l2_h264_build_p_ref_list()
226 sizeof(builder->unordered_reflist[0]) * builder->num_valid); in v4l2_h264_build_p_ref_list()
227 sort_r(reflist, builder->num_valid, sizeof(*reflist), in v4l2_h264_build_p_ref_list()
233 * v4l2_h264_build_b_ref_lists() - Build the B0/B1 reference lists
236 * @b0_reflist: 16-bytes array used to store the B0 reference list. Each entry
238 * @b1_reflist: 16-bytes array used to store the B1 reference list. Each entry
250 memcpy(b0_reflist, builder->unordered_reflist, in v4l2_h264_build_b_ref_lists()
251 sizeof(builder->unordered_reflist[0]) * builder->num_valid); in v4l2_h264_build_b_ref_lists()
252 sort_r(b0_reflist, builder->num_valid, sizeof(*b0_reflist), in v4l2_h264_build_b_ref_lists()
255 memcpy(b1_reflist, builder->unordered_reflist, in v4l2_h264_build_b_ref_lists()
256 sizeof(builder->unordered_reflist[0]) * builder->num_valid); in v4l2_h264_build_b_ref_lists()
257 sort_r(b1_reflist, builder->num_valid, sizeof(*b1_reflist), in v4l2_h264_build_b_ref_lists()
260 if (builder->num_valid > 1 && in v4l2_h264_build_b_ref_lists()
261 !memcmp(b1_reflist, b0_reflist, builder->num_valid)) in v4l2_h264_build_b_ref_lists()