35 #define COPY_PICTURE(dst, src) \
38 (dst)->f.extended_data = (dst)->f.data;\
39 (dst)->tf.f = &(dst)->f;\
45 for (i = 0; i < 4; ++i) {
76 while ((i[0] < len || i[1] < len) && index < def_len) {
77 while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))
79 while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
81 if (i[0] < len && index < def_len) {
85 if (i[1] < len && index < def_len) {
100 best_poc = dir ? INT_MIN : INT_MAX;
102 for (i = 0; i <
len; i++) {
103 const int poc = src[i]->
poc;
104 if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) {
106 sorted[out_i] = src[i];
109 if (best_poc == (dir ? INT_MIN : INT_MAX))
111 limit = sorted[out_i++]->
poc - dir;
130 for (list = 0; list < 2; list++) {
141 if (len < h->ref_count[list])
146 if (lens[0] == lens[1] && lens[1] > 1) {
147 for (i = 0; i < lens[0] &&
164 if (len < h->ref_count[0])
214 int list,
index, pic_structure, i;
219 for (list = 0; list < h->
list_count; list++) {
226 for (index = 0; ; index++) {
232 if (reordering_of_pic_nums_idc == 3)
240 switch (reordering_of_pic_nums_idc) {
248 "abs_diff_pic_num overflow\n");
252 if (reordering_of_pic_nums_idc == 0)
253 pred -= abs_diff_pic_num;
255 pred += abs_diff_pic_num;
280 "long_term_pic_idx overflow\n");
285 if (ref && (ref->
reference & pic_structure)) {
296 "illegal reordering_of_pic_nums_idc\n");
302 "reference picture missing during reorder\n");
305 for (i = index; i + 1 < h->
ref_count[list]; i++) {
310 for (; i >
index; i--) {
321 for (list = 0; list < h->
list_count; list++) {
322 for (index = 0; index < h->
ref_count[list]; index++) {
339 for (list = 0; list < 2; list++) {
340 for (i = 0; i < h->
ref_count[list]; i++) {
344 for (j = 0; j < 3; j++)
345 field[0].f.linesize[j] <<= 1;
349 for (j = 0; j < 3; j++)
350 field[1].f.data[j] += frame->
f.
linesize[j];
356 for (j = 0; j < 2; j++) {
422 assert(i >= 0 && i < h->short_ref_count);
476 for (i = 0; i < 16; i++) {
512 for (i = 0; i < 16; i++) {
526 for (i = 0; i < n_mmcos; i++) {
527 if (mmco1[i].opcode != mmco2[i].opcode)
537 int mmco_index = 0, i;
557 }
else if (!first_slice && mmco_index >= 0 &&
561 "Inconsistent MMCO state between slices [%d, %d, %d]\n",
571 int current_ref_assigned = 0, err = 0;
577 for (i = 0; i < mmco_count; i++) {
598 switch (mmco[i].opcode) {
644 current_ref_assigned = 1;
647 assert(mmco[i].long_arg <= 16);
649 for (j = mmco[i].long_arg; j < 16; j++) {
657 for (j = 0; j < 16; j++) {
668 if (!current_ref_assigned) {
680 "assignment for second field "
681 "in complementary field pair "
682 "(first field is long term)\n");
709 "number of reference frames (%d+%d) exceeds max (%d; probably "
710 "corrupt input), discarding one\n",
715 for (i = 0; i < 16; ++i)
760 "illegal short ref in memory management control "
761 "operation %d\n", mmco);
769 if (long_arg >= 32 ||
774 "illegal long ref in memory management control "
775 "operation %d\n", opcode);
783 "illegal memory management control operation %d\n",
801 if (first_slice && mmco_index != -1) {
803 }
else if (!first_slice && mmco_index >= 0 &&
807 "Inconsistent MMCO state between slices [%d, %d]\n",