39 #define COPY_PICTURE(dst, src) \
42 (dst)->f.extended_data = (dst)->f.data;\
43 (dst)->tf.f = &(dst)->f;\
49 for (i = 0; i < 4; ++i) {
80 while (i[0] < len || i[1] < len) {
81 while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))
83 while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
106 best_poc = dir ? INT_MIN : INT_MAX;
108 for (i = 0; i <
len; i++) {
109 const int poc = src[i]->
poc;
110 if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) {
112 sorted[out_i] = src[i];
115 if (best_poc == (dir ? INT_MIN : INT_MAX))
117 limit = sorted[out_i++]->
poc - dir;
136 for (list = 0; list < 2; list++) {
148 if (len < h->ref_count[list])
153 if (lens[0] == lens[1] && lens[1] > 1) {
154 for (i = 0; i < lens[0] &&
172 if (len < h->ref_count[0])
222 int list,
index, pic_structure, i;
227 for (list = 0; list < h->
list_count; list++) {
234 for (index = 0; ; index++) {
240 if (modification_of_pic_nums_idc == 3)
248 switch (modification_of_pic_nums_idc) {
256 "abs_diff_pic_num overflow\n");
260 if (modification_of_pic_nums_idc == 0)
261 pred -= abs_diff_pic_num;
263 pred += abs_diff_pic_num;
288 "long_term_pic_idx overflow\n");
293 if (ref && (ref->
reference & pic_structure)) {
304 "illegal modification_of_pic_nums_idc %u\n",
305 modification_of_pic_nums_idc);
311 "reference picture missing during reorder\n");
314 for (i = index; i + 1 < h->
ref_count[list]; i++) {
319 for (; i >
index; i--) {
330 for (list = 0; list < h->
list_count; list++) {
331 for (index = 0; index < h->
ref_count[list]; index++) {
354 for (list = 0; list < h->
list_count; list++) {
355 for (i = 0; i < h->
ref_count[list]; i++) {
359 for (j = 0; j < 3; j++)
360 field[0].f.linesize[j] <<= 1;
364 for (j = 0; j < 3; j++)
365 field[1].f.data[j] += frame->
f.
linesize[j];
371 for (j = 0; j < 2; j++) {
437 assert(i >= 0 && i < h->short_ref_count);
491 for (i = 0; i < 16; i++) {
530 for (i = 0; i < 16; i++) {
544 for (i = 0; i < n_mmcos; i++) {
545 if (mmco1[i].opcode != mmco2[i].opcode) {
547 mmco1[i].opcode, mmco2[i].opcode, i);
558 int mmco_index = 0, i = 0;
576 }
else if (!first_slice && mmco_index >= 0 &&
580 "Inconsistent MMCO state between slices [%d, %d]\n",
591 int current_ref_assigned = 0, err = 0;
597 for (i = 0; i < mmco_count; i++) {
618 switch (mmco[i].opcode) {
659 for(j=0; j<16; j++) {
675 current_ref_assigned = 1;
678 assert(mmco[i].long_arg <= 16);
680 for (j = mmco[i].long_arg; j < 16; j++) {
688 for (j = 0; j < 16; j++) {
701 if (!current_ref_assigned) {
713 "assignment for second field "
714 "in complementary field pair "
715 "(first field is long term)\n");
741 "number of reference frames (%d+%d) exceeds max (%d; probably "
742 "corrupt input), discarding one\n",
747 for (i = 0; i < 16; ++i)
761 if (pic->invalid_gap) {
816 "illegal short ref in memory management control "
817 "operation %d\n", mmco);
825 if (long_arg >= 32 ||
830 "illegal long ref in memory management control "
831 "operation %d\n", opcode);
839 "illegal memory management control operation %d\n",
857 if (first_slice && mmco_index != -1) {
858 memcpy(h->
mmco, mmco_temp,
sizeof(h->
mmco));
860 }
else if (!first_slice && mmco_index >= 0 &&
864 "Inconsistent MMCO state between slices [%d, %d]\n",