36 #define COPY_PICTURE(dst, src) \
39 (dst)->f.extended_data = (dst)->f.data;\
40 (dst)->tf.f = &(dst)->f;\
46 for (i = 0; i < 4; ++i) {
77 while (i[0] < len || i[1] < len) {
78 while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))
80 while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
103 best_poc = dir ? INT_MIN : INT_MAX;
105 for (i = 0; i <
len; i++) {
106 const int poc = src[i]->
poc;
107 if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) {
109 sorted[out_i] = src[i];
112 if (best_poc == (dir ? INT_MIN : INT_MAX))
114 limit = sorted[out_i++]->
poc - dir;
133 for (list = 0; list < 2; list++) {
145 if (len < h->ref_count[list])
150 if (lens[0] == lens[1] && lens[1] > 1) {
151 for (i = 0; i < lens[0] &&
169 if (len < h->ref_count[0])
219 int list,
index, pic_structure, i;
224 for (list = 0; list < h->
list_count; list++) {
231 for (index = 0; ; index++) {
237 if (reordering_of_pic_nums_idc == 3)
245 switch (reordering_of_pic_nums_idc) {
253 "abs_diff_pic_num overflow\n");
257 if (reordering_of_pic_nums_idc == 0)
258 pred -= abs_diff_pic_num;
260 pred += abs_diff_pic_num;
285 "long_term_pic_idx overflow\n");
290 if (ref && (ref->
reference & pic_structure)) {
301 "illegal reordering_of_pic_nums_idc\n");
307 "reference picture missing during reorder\n");
310 for (i = index; i + 1 < h->
ref_count[list]; i++) {
315 for (; i >
index; i--) {
326 for (list = 0; list < h->
list_count; list++) {
327 for (index = 0; index < h->
ref_count[list]; index++) {
350 for (list = 0; list < h->
list_count; list++) {
351 for (i = 0; i < h->
ref_count[list]; i++) {
355 for (j = 0; j < 3; j++)
356 field[0].f.linesize[j] <<= 1;
360 for (j = 0; j < 3; j++)
361 field[1].f.data[j] += frame->
f.
linesize[j];
367 for (j = 0; j < 2; j++) {
433 assert(i >= 0 && i < h->short_ref_count);
487 for (i = 0; i < 16; i++) {
526 for (i = 0; i < 16; i++) {
540 for (i = 0; i < n_mmcos; i++) {
541 if (mmco1[i].opcode != mmco2[i].opcode) {
543 mmco1[i].opcode, mmco2[i].opcode, i);
554 int mmco_index = 0, i;
572 }
else if (!first_slice && mmco_index >= 0 &&
576 "Inconsistent MMCO state between slices [%d, %d]\n",
587 int current_ref_assigned = 0, err = 0;
593 for (i = 0; i < mmco_count; i++) {
614 switch (mmco[i].opcode) {
655 for(j=0; j<16; j++) {
671 current_ref_assigned = 1;
674 assert(mmco[i].long_arg <= 16);
676 for (j = mmco[i].long_arg; j < 16; j++) {
684 for (j = 0; j < 16; j++) {
697 if (!current_ref_assigned) {
709 "assignment for second field "
710 "in complementary field pair "
711 "(first field is long term)\n");
737 "number of reference frames (%d+%d) exceeds max (%d; probably "
738 "corrupt input), discarding one\n",
743 for (i = 0; i < 16; ++i)
757 if (pic->invalid_gap) {
812 "illegal short ref in memory management control "
813 "operation %d\n", mmco);
821 if (long_arg >= 32 ||
826 "illegal long ref in memory management control "
827 "operation %d\n", opcode);
835 "illegal memory management control operation %d\n",
853 if (first_slice && mmco_index != -1) {
854 memcpy(h->
mmco, mmco_temp,
sizeof(h->
mmco));
856 }
else if (!first_slice && mmco_index >= 0 &&
860 "Inconsistent MMCO state between slices [%d, %d]\n",