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) {
76 while (i[0] < len || i[1] < 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))))
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++) {
138 if (len < h->ref_count[list])
143 if (lens[0] == lens[1] && lens[1] > 1) {
156 if (len < h->ref_count[0])
206 int list,
index, pic_structure, i;
211 for (list = 0; list < h->
list_count; list++) {
218 for (index = 0; ; index++) {
224 if (reordering_of_pic_nums_idc == 3)
232 if (reordering_of_pic_nums_idc < 3) {
233 if (reordering_of_pic_nums_idc < 2) {
242 if (reordering_of_pic_nums_idc == 0)
243 pred -= abs_diff_pic_num;
245 pred += abs_diff_pic_num;
272 if (ref && (ref->
reference & pic_structure)) {
285 for (i = index; i + 1 < h->
ref_count[list]; i++) {
290 for (; i >
index; i--) {
305 for (list = 0; list < h->
list_count; list++) {
306 for (index = 0; index < h->
ref_count[list]; index++) {
329 for (list = 0; list < h->
list_count; list++) {
330 for (i = 0; i < h->
ref_count[list]; i++) {
334 for (j = 0; j < 3; j++)
335 field[0].f.linesize[j] <<= 1;
339 for (j = 0; j < 3; j++)
340 field[1].f.data[j] += frame->
f.
linesize[j];
346 for (j = 0; j < 2; j++) {
412 assert(i >= 0 && i < h->short_ref_count);
466 for (i = 0; i < 16; i++) {
505 for (i = 0; i < 16; i++) {
519 for (i = 0; i < n_mmcos; i++) {
520 if (mmco1[i].opcode != mmco2[i].opcode) {
522 mmco1[i].opcode, mmco2[i].opcode, i);
533 int mmco_index = 0, i;
551 }
else if (!first_slice && mmco_index >= 0 &&
555 "Inconsistent MMCO state between slices [%d, %d]\n",
566 int current_ref_assigned = 0, err = 0;
572 for (i = 0; i < mmco_count; i++) {
593 switch (mmco[i].opcode) {
630 for(j=0; j<16; j++) {
649 current_ref_assigned = 1;
652 assert(mmco[i].long_arg <= 16);
654 for (j = mmco[i].long_arg; j < 16; j++) {
662 for (j = 0; j < 16; j++) {
675 if (!current_ref_assigned) {
687 "assignment for second field "
688 "in complementary field pair "
689 "(first field is long term)\n");
715 "number of reference frames (%d+%d) exceeds max (%d; probably "
716 "corrupt input), discarding one\n",
721 for (i = 0; i < 16; ++i)
781 "illegal short ref in memory management control "
782 "operation %d\n", mmco);
790 if (long_arg >= 32 ||
795 "illegal long ref in memory management control "
796 "operation %d\n", opcode);
804 "illegal memory management control operation %d\n",
822 if (first_slice && mmco_index != -1) {
823 memcpy(h->
mmco, mmco_temp,
sizeof(h->
mmco));
825 }
else if (!first_slice && mmco_index >= 0 &&
829 "Inconsistent MMCO state between slices [%d, %d]\n",