In particular, declare iterators with loop scope. Also remove av_uninit while at it, because they are now unnecessary due to the changes of the preceding commit.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -38,8 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | static void pic_as_field(H264Ref *pic, const int parity) |
| 40 | 40 | { |
| 41 | − int i; | |
| 42 | − for (i = 0; i < FF_ARRAY_ELEMS(pic->data); ++i) { | |
| 41 | + for (int i = 0; i < FF_ARRAY_ELEMS(pic->data); ++i) { | |
| 43 | 42 | if (parity == PICT_BOTTOM_FIELD) |
| 44 | 43 | pic->data[i] += pic->linesize[i]; |
| 45 | 44 | pic->reference = parity; |
| @@ -104,13 +103,12 @@ static int build_def_list(H264Ref *def, int def_len, · 58 unmodified lines | ||
| 104 | 103 | static int add_sorted(H264Picture **sorted, H264Picture * const *src, |
| 105 | 104 | int len, int limit, int dir) |
| 106 | 105 | { |
| 107 | − int i, best_poc; | |
| 108 | 106 | int out_i = 0; |
| 109 | 107 | |
| 110 | 108 | for (;;) { |
| 111 | − best_poc = dir ? INT_MIN : INT_MAX; | |
| 109 | + int best_poc = dir ? INT_MIN : INT_MAX; | |
| 112 | 110 | |
| 113 | − for (i = 0; i < len; i++) { | |
| 111 | + for (int i = 0; i < len; i++) { | |
| 114 | 112 | const int poc = src[i]->poc; |
| 115 | 113 | if (((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)) { |
| 116 | 114 | best_poc = poc; |
| @@ -134,12 +132,11 @@ static int mismatches_ref(const H264Context *h, const H264Picture *pic) · 17 unmodified lines | ||
| 134 | 132 | |
| 135 | 133 | static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) |
| 136 | 134 | { |
| 137 | − int i, len; | |
| 138 | − int j; | |
| 135 | + int len; | |
| 139 | 136 | |
| 140 | 137 | if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { |
| 141 | 138 | H264Picture *sorted[32]; |
| 142 | − int cur_poc, list; | |
| 139 | + int cur_poc; | |
| 143 | 140 | int lens[2]; |
| 144 | 141 | |
| 145 | 142 | if (FIELD_PICTURE(h)) |
| @@ -147,7 +144,7 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 1 unmodified line | ||
| 147 | 144 | else |
| 148 | 145 | cur_poc = h->cur_pic_ptr->poc; |
| 149 | 146 | |
| 150 | − for (list = 0; list < 2; list++) { | |
| 147 | + for (int list = 0; list < 2; list++) { | |
| 151 | 148 | len = add_sorted(sorted, h->short_ref, h->short_ref_count, cur_poc, 1 ^ list); |
| 152 | 149 | len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list); |
| 153 | 150 | av_assert0(len <= 32); |
| @@ -165,6 +162,7 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 11 unmodified lines | ||
| 165 | 162 | } |
| 166 | 163 | |
| 167 | 164 | if (lens[0] == lens[1] && lens[1] > 1) { |
| 165 | + int i; | |
| 168 | 166 | for (i = 0; i < lens[0] && |
| 169 | 167 | sl->ref_list[0][i].parent->f->buf[0]->buffer == |
| 170 | 168 | sl->ref_list[1][i].parent->f->buf[0]->buffer; i++); |
| @@ -184,14 +182,14 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 13 unmodified lines | ||
| 184 | 182 | memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len)); |
| 185 | 183 | } |
| 186 | 184 | #ifdef TRACE |
| 187 | − for (i = 0; i < sl->ref_count[0]; i++) { | |
| 185 | + for (int i = 0; i < sl->ref_count[0]; i++) { | |
| 188 | 186 | ff_tlog(h->avctx, "List0: %s fn:%d 0x%p\n", |
| 189 | 187 | (sl->ref_list[0][i].parent ? (sl->ref_list[0][i].parent->long_ref ? "LT" : "ST") : "??"), |
| 190 | 188 | sl->ref_list[0][i].pic_id, |
| 191 | 189 | sl->ref_list[0][i].data[0]); |
| 192 | 190 | } |
| 193 | 191 | if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { |
| 194 | − for (i = 0; i < sl->ref_count[1]; i++) { | |
| 192 | + for (int i = 0; i < sl->ref_count[1]; i++) { | |
| 195 | 193 | ff_tlog(h->avctx, "List1: %s fn:%d 0x%p\n", |
| 196 | 194 | (sl->ref_list[1][i].parent ? (sl->ref_list[1][i].parent->long_ref ? "LT" : "ST") : "??"), |
| 197 | 195 | sl->ref_list[1][i].pic_id, |
| @@ -200,8 +198,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 2 unmodified lines | ||
| 200 | 198 | } |
| 201 | 199 | #endif |
| 202 | 200 | |
| 203 | − for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) { | |
| 204 | − for (i = 0; i < sl->ref_count[j]; i++) { | |
| 201 | + for (int j = 0; j < 1 + (sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) { | |
| 202 | + for (int i = 0; i < sl->ref_count[j]; i++) { | |
| 205 | 203 | if (sl->ref_list[j][i].parent) { |
| 206 | 204 | if (mismatches_ref(h, sl->ref_list[j][i].parent)) { |
| 207 | 205 | av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching reference\n"); |
| @@ -210,7 +208,7 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 2 unmodified lines | ||
| 210 | 208 | } |
| 211 | 209 | } |
| 212 | 210 | } |
| 213 | − for (i = 0; i < sl->list_count; i++) | |
| 211 | + for (int i = 0; i < sl->list_count; i++) | |
| 214 | 212 | h->default_ref[i] = sl->ref_list[i][0]; |
| 215 | 213 | } |
| 216 | 214 | |
| @@ -219,10 +217,9 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) · 2 unmodified lines | ||
| 219 | 217 | */ |
| 220 | 218 | static void print_short_term(const H264Context *h) |
| 221 | 219 | { |
| 222 | − uint32_t i; | |
| 223 | 220 | if (h->avctx->debug & FF_DEBUG_MMCO) { |
| 224 | 221 | av_log(h->avctx, AV_LOG_DEBUG, "short term list:\n"); |
| 225 | − for (i = 0; i < h->short_ref_count; i++) { | |
| 222 | + for (uint32_t i = 0; i < h->short_ref_count; i++) { | |
| 226 | 223 | H264Picture *pic = h->short_ref[i]; |
| 227 | 224 | av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n", |
| 228 | 225 | i, pic->frame_num, pic->poc, pic->f->data[0]); |
| @@ -235,10 +232,9 @@ static void print_short_term(const H264Context *h) · 6 unmodified lines | ||
| 235 | 232 | */ |
| 236 | 233 | static void print_long_term(const H264Context *h) |
| 237 | 234 | { |
| 238 | − uint32_t i; | |
| 239 | 235 | if (h->avctx->debug & FF_DEBUG_MMCO) { |
| 240 | 236 | av_log(h->avctx, AV_LOG_DEBUG, "long term list:\n"); |
| 241 | − for (i = 0; i < 16; i++) { | |
| 237 | + for (uint32_t i = 0; i < 16; i++) { | |
| 242 | 238 | H264Picture *pic = h->long_ref[i]; |
| 243 | 239 | if (pic) { |
| 244 | 240 | av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n", |
| @@ -273,22 +269,21 @@ static int pic_num_extract(const H264Context *h, int pic_num, int *structure) · 28 unmodified lines | ||
| 273 | 269 | |
| 274 | 270 | static void h264_fill_mbaff_ref_list(H264SliceContext *sl) |
| 275 | 271 | { |
| 276 | − int list, i, j; | |
| 277 | − for (list = 0; list < sl->list_count; list++) { | |
| 278 | − for (i = 0; i < sl->ref_count[list]; i++) { | |
| 272 | + for (int list = 0; list < sl->list_count; list++) { | |
| 273 | + for (int i = 0; i < sl->ref_count[list]; i++) { | |
| 279 | 274 | const H264Ref *frame = &sl->ref_list[list][i]; |
| 280 | 275 | H264Ref *field = &sl->ref_list[list][16 + 2 * i]; |
| 281 | 276 | |
| 282 | 277 | field[0] = *frame; |
| 283 | 278 | |
| 284 | − for (j = 0; j < 3; j++) | |
| 279 | + for (int j = 0; j < 3; j++) | |
| 285 | 280 | field[0].linesize[j] <<= 1; |
| 286 | 281 | field[0].reference = PICT_TOP_FIELD; |
| 287 | 282 | field[0].poc = field[0].parent->field_poc[0]; |
| 288 | 283 | |
| 289 | 284 | field[1] = field[0]; |
| 290 | 285 | |
| 291 | − for (j = 0; j < 3; j++) | |
| 286 | + for (int j = 0; j < 3; j++) | |
| 292 | 287 | field[1].data[j] += frame->parent->f->linesize[j]; |
| 293 | 288 | field[1].reference = PICT_BOTTOM_FIELD; |
| 294 | 289 | field[1].poc = field[1].parent->field_poc[1]; |
| @@ -298,21 +293,19 @@ static void h264_fill_mbaff_ref_list(H264SliceContext *sl) · 3 unmodified lines | ||
| 298 | 293 | |
| 299 | 294 | int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl) |
| 300 | 295 | { |
| 301 | − int list, index, pic_structure; | |
| 302 | − | |
| 303 | 296 | print_short_term(h); |
| 304 | 297 | print_long_term(h); |
| 305 | 298 | |
| 306 | 299 | h264_initialise_ref_list(h, sl); |
| 307 | 300 | |
| 308 | − for (list = 0; list < sl->list_count; list++) { | |
| 301 | + for (int list = 0; list < sl->list_count; list++) { | |
| 309 | 302 | int pred = sl->curr_pic_num; |
| 310 | 303 | |
| 311 | − for (index = 0; index < sl->nb_ref_modifications[list]; index++) { | |
| 304 | + for (int index = 0; index < sl->nb_ref_modifications[list]; index++) { | |
| 312 | 305 | unsigned int modification_of_pic_nums_idc = sl->ref_modifications[list][index].op; |
| 313 | 306 | unsigned int val = sl->ref_modifications[list][index].val; |
| 314 | 307 | unsigned int pic_id; |
| 315 | − int i; | |
| 308 | + int i, pic_structure; | |
| 316 | 309 | H264Picture *ref = NULL; |
| 317 | 310 | |
| 318 | 311 | switch (modification_of_pic_nums_idc) { |
| @@ -396,13 +389,13 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl) · 77 unmodified lines | ||
| 396 | 389 | } |
| 397 | 390 | } |
| 398 | 391 | } |
| 399 | − for (list = 0; list < sl->list_count; list++) { | |
| 400 | − for (index = 0; index < sl->ref_count[list]; index++) { | |
| 392 | + for (int list = 0; list < sl->list_count; list++) { | |
| 393 | + for (int index = 0; index < sl->ref_count[list]; index++) { | |
| 401 | 394 | if ( !sl->ref_list[list][index].parent |
| 402 | 395 | || (!FIELD_PICTURE(h) && (sl->ref_list[list][index].reference&3) != 3)) { |
| 403 | − int i; | |
| 404 | 396 | av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref[list].poc); |
| 405 | − for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) | |
| 397 | + | |
| 398 | + for (int i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) | |
| 406 | 399 | h->last_pocs[i] = INT_MIN; |
| 407 | 400 | if (h->default_ref[list].parent |
| 408 | 401 | && !(!FIELD_PICTURE(h) && (h->default_ref[list].reference&3) != 3)) |
| @@ -433,16 +426,14 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl) · 24 unmodified lines | ||
| 433 | 426 | |
| 434 | 427 | int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx) |
| 435 | 428 | { |
| 436 | − int list, index; | |
| 437 | − | |
| 438 | 429 | sl->nb_ref_modifications[0] = 0; |
| 439 | 430 | sl->nb_ref_modifications[1] = 0; |
| 440 | 431 | |
| 441 | − for (list = 0; list < sl->list_count; list++) { | |
| 432 | + for (int list = 0; list < sl->list_count; list++) { | |
| 442 | 433 | if (!get_bits1(&sl->gb)) // ref_pic_list_modification_flag_l[01] |
| 443 | 434 | continue; |
| 444 | 435 | |
| 445 | − for (index = 0; ; index++) { | |
| 436 | + for (int index = 0; ; index++) { | |
| 446 | 437 | unsigned int op = get_ue_golomb_31(&sl->gb); |
| 447 | 438 | |
| 448 | 439 | if (op == 3) |
| @@ -479,11 +470,10 @@ int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx) · 30 unmodified lines | ||
| 479 | 470 | */ |
| 480 | 471 | static inline int unreference_pic(H264Context *h, H264Picture *pic, int refmask) |
| 481 | 472 | { |
| 482 | − int i; | |
| 483 | 473 | if (pic->reference &= refmask) { |
| 484 | 474 | return 0; |
| 485 | 475 | } else { |
| 486 | − for(i = 0; h->delayed_pic[i]; i++) | |
| 476 | + for (int i = 0; h->delayed_pic[i]; i++) | |
| 487 | 477 | if(pic == h->delayed_pic[i]){ |
| 488 | 478 | pic->reference = DELAYED_PIC_REF; |
| 489 | 479 | break; |
| @@ -502,9 +492,7 @@ static inline int unreference_pic(H264Context *h, H264Picture *pic, int refmask) · 12 unmodified lines | ||
| 502 | 492 | */ |
| 503 | 493 | static H264Picture *find_short(H264Context *h, int frame_num, int *idx) |
| 504 | 494 | { |
| 505 | − int i; | |
| 506 | − | |
| 507 | − for (i = 0; i < h->short_ref_count; i++) { | |
| 495 | + for (int i = 0; i < h->short_ref_count; i++) { | |
| 508 | 496 | H264Picture *pic = h->short_ref[i]; |
| 509 | 497 | if (h->avctx->debug & FF_DEBUG_MMCO) |
| 510 | 498 | av_log(h->avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic); |
| @@ -575,11 +563,8 @@ static H264Picture *remove_long(H264Context *h, int i, int ref_mask) · 64 unmodified lines | ||
| 575 | 563 | |
| 576 | 564 | void ff_h264_remove_all_refs(H264Context *h) |
| 577 | 565 | { |
| 578 | − int i; | |
| 579 | − | |
| 580 | − for (i = 0; i < 16; i++) { | |
| 566 | + for (int i = 0; i < 16; i++) | |
| 581 | 567 | remove_long(h, i, 0); |
| 582 | − } | |
| 583 | 568 | assert(h->long_ref_count == 0); |
| 584 | 569 | |
| 585 | 570 | if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) { |
| @@ -587,7 +572,7 @@ void ff_h264_remove_all_refs(H264Context *h) · 1 unmodified line | ||
| 587 | 572 | ff_h264_ref_picture(&h->last_pic_for_ec, h->short_ref[0]); |
| 588 | 573 | } |
| 589 | 574 | |
| 590 | − for (i = 0; i < h->short_ref_count; i++) { | |
| 575 | + for (int i = 0; i < h->short_ref_count; i++) { | |
| 591 | 576 | unreference_pic(h, h->short_ref[i], 0); |
| 592 | 577 | h->short_ref[i] = NULL; |
| 593 | 578 | } |
| @@ -622,10 +607,8 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 28 unmodified lines | ||
| 622 | 607 | { |
| 623 | 608 | MMCO *mmco = h->mmco; |
| 624 | 609 | int mmco_count; |
| 625 | − int i, av_uninit(j); | |
| 626 | 610 | int pps_ref_count[2] = {0}; |
| 627 | 611 | int current_ref_assigned = 0, err = 0; |
| 628 | − H264Picture *av_uninit(pic); | |
| 629 | 612 | |
| 630 | 613 | if (!h->ps.sps) { |
| 631 | 614 | av_log(h->avctx, AV_LOG_ERROR, "SPS is unset\n"); |
| @@ -640,17 +623,18 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 8 unmodified lines | ||
| 640 | 623 | if ((h->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0) |
| 641 | 624 | av_log(h->avctx, AV_LOG_DEBUG, "no mmco here\n"); |
| 642 | 625 | |
| 643 | − for (i = 0; i < mmco_count; i++) { | |
| 644 | − int av_uninit(structure), av_uninit(frame_num); | |
| 626 | + for (int i = 0; i < mmco_count; i++) { | |
| 645 | 627 | if (h->avctx->debug & FF_DEBUG_MMCO) |
| 646 | 628 | av_log(h->avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, |
| 647 | 629 | h->mmco[i].short_pic_num, h->mmco[i].long_arg); |
| 648 | 630 | |
| 649 | 631 | switch (mmco[i].opcode) { |
| 650 | 632 | case MMCO_SHORT2UNUSED: |
| 651 | − case MMCO_SHORT2LONG: | |
| 652 | − frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure); | |
| 653 | − pic = find_short(h, frame_num, &j); | |
| 633 | + case MMCO_SHORT2LONG: { | |
| 634 | + int structure, j; | |
| 635 | + int frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure); | |
| 636 | + H264Picture *pic = find_short(h, frame_num, &j); | |
| 637 | + | |
| 654 | 638 | if (!pic) { |
| 655 | 639 | if (mmco[i].opcode != MMCO_SHORT2LONG || |
| 656 | 640 | !h->long_ref[mmco[i].long_arg] || |
| @@ -677,14 +661,16 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 20 unmodified lines | ||
| 677 | 661 | } |
| 678 | 662 | } |
| 679 | 663 | break; |
| 680 | − case MMCO_LONG2UNUSED: | |
| 681 | − j = pic_num_extract(h, mmco[i].long_arg, &structure); | |
| 682 | − pic = h->long_ref[j]; | |
| 664 | + } | |
| 665 | + case MMCO_LONG2UNUSED: { | |
| 666 | + int structure, j = pic_num_extract(h, mmco[i].long_arg, &structure); | |
| 667 | + H264Picture *pic = h->long_ref[j]; | |
| 683 | 668 | if (pic) { |
| 684 | 669 | remove_long(h, j, structure ^ PICT_FRAME); |
| 685 | 670 | } else if (h->avctx->debug & FF_DEBUG_MMCO) |
| 686 | 671 | av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref long failure\n"); |
| 687 | 672 | break; |
| 673 | + } | |
| 688 | 674 | case MMCO_LONG: |
| 689 | 675 | // Comment below left from previous code as it is an interesting note. |
| 690 | 676 | /* First field in pair is in short term list or |
| @@ -700,7 +686,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 9 unmodified lines | ||
| 700 | 686 | |
| 701 | 687 | /* make sure the current picture is not already assigned as a long ref */ |
| 702 | 688 | if (h->cur_pic_ptr->long_ref) { |
| 703 | − for (j = 0; j < FF_ARRAY_ELEMS(h->long_ref); j++) { | |
| 689 | + for (int j = 0; j < FF_ARRAY_ELEMS(h->long_ref); j++) { | |
| 704 | 690 | if (h->long_ref[j] == h->cur_pic_ptr) { |
| 705 | 691 | if (j != mmco[i].long_arg) |
| 706 | 692 | av_log(h->avctx, AV_LOG_ERROR, "mmco: cannot assign current picture to 2 long term references\n"); |
| @@ -724,21 +710,19 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 17 unmodified lines | ||
| 724 | 710 | case MMCO_SET_MAX_LONG: |
| 725 | 711 | assert(mmco[i].long_arg <= 16); |
| 726 | 712 | // just remove the long term which index is greater than new max |
| 727 | − for (j = mmco[i].long_arg; j < 16; j++) { | |
| 713 | + for (int j = mmco[i].long_arg; j < 16; j++) | |
| 728 | 714 | remove_long(h, j, 0); |
| 729 | − } | |
| 730 | 715 | break; |
| 731 | 716 | case MMCO_RESET: |
| 732 | 717 | while (h->short_ref_count) { |
| 733 | 718 | remove_short(h, h->short_ref[0]->frame_num, 0); |
| 734 | 719 | } |
| 735 | − for (j = 0; j < 16; j++) { | |
| 720 | + for (int j = 0; j < 16; j++) | |
| 736 | 721 | remove_long(h, j, 0); |
| 737 | − } | |
| 738 | 722 | h->poc.frame_num = h->cur_pic_ptr->frame_num = 0; |
| 739 | 723 | h->mmco_reset = 1; |
| 740 | 724 | h->cur_pic_ptr->mmco_reset = 1; |
| 741 | − for (j = 0; j < FF_ARRAY_ELEMS(h->last_pocs); j++) | |
| 725 | + for (int j = 0; j < FF_ARRAY_ELEMS(h->last_pocs); j++) | |
| 742 | 726 | h->last_pocs[j] = INT_MIN; |
| 743 | 727 | break; |
| 744 | 728 | default: av_assert0(0); |
| @@ -762,7 +746,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 17 unmodified lines | ||
| 762 | 746 | "(first field is long term)\n"); |
| 763 | 747 | err = AVERROR_INVALIDDATA; |
| 764 | 748 | } else { |
| 765 | − pic = remove_short(h, h->cur_pic_ptr->frame_num, 0); | |
| 749 | + H264Picture *pic = remove_short(h, h->cur_pic_ptr->frame_num, 0); | |
| 766 | 750 | if (pic) { |
| 767 | 751 | av_log(h->avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n"); |
| 768 | 752 | err = AVERROR_INVALIDDATA; |
| @@ -791,6 +775,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 22 unmodified lines | ||
| 791 | 775 | err = AVERROR_INVALIDDATA; |
| 792 | 776 | |
| 793 | 777 | if (h->long_ref_count && !h->short_ref_count) { |
| 778 | + int i; | |
| 794 | 779 | for (i = 0; i < 16; ++i) |
| 795 | 780 | if (h->long_ref[i]) |
| 796 | 781 | break; |
| @@ -798,13 +783,13 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 1 unmodified line | ||
| 798 | 783 | assert(i < 16); |
| 799 | 784 | remove_long(h, i, 0); |
| 800 | 785 | } else { |
| 801 | − pic = h->short_ref[h->short_ref_count - 1]; | |
| 786 | + H264Picture *pic = h->short_ref[h->short_ref_count - 1]; | |
| 802 | 787 | remove_short(h, pic->frame_num, 0); |
| 803 | 788 | } |
| 804 | 789 | } |
| 805 | 790 | |
| 806 | − for (i = 0; i<h->short_ref_count; i++) { | |
| 807 | − pic = h->short_ref[i]; | |
| 791 | + for (int i = 0; i < h->short_ref_count; i++) { | |
| 792 | + H264Picture *pic = h->short_ref[i]; | |
| 808 | 793 | if (pic->invalid_gap) { |
| 809 | 794 | int d = av_mod_uintp2(h->cur_pic_ptr->frame_num - pic->frame_num, h->ps.sps->log2_max_frame_num); |
| 810 | 795 | if (d > h->ps.sps->ref_frame_count) |
| @@ -815,7 +800,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) · 4 unmodified lines | ||
| 815 | 800 | print_short_term(h); |
| 816 | 801 | print_long_term(h); |
| 817 | 802 | |
| 818 | − for (i = 0; i < FF_ARRAY_ELEMS(h->ps.pps_list); i++) { | |
| 803 | + for (int i = 0; i < FF_ARRAY_ELEMS(h->ps.pps_list); i++) { | |
| 819 | 804 | if (h->ps.pps_list[i]) { |
| 820 | 805 | const PPS *pps = h->ps.pps_list[i]; |
| 821 | 806 | pps_ref_count[0] = FFMAX(pps_ref_count[0], pps->ref_count[0]); |
| @@ -843,7 +828,6 @@ out: · 21 unmodified lines | ||
| 843 | 828 | int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb, |
| 844 | 829 | const H2645NAL *nal, void *logctx) |
| 845 | 830 | { |
| 846 | − int i; | |
| 847 | 831 | MMCO *mmco = sl->mmco; |
| 848 | 832 | int nb_mmco = 0; |
| 849 | 833 | |
| @@ -858,6 +842,7 @@ int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb, · 8 unmodified lines | ||
| 858 | 842 | } else { |
| 859 | 843 | sl->explicit_ref_marking = get_bits1(gb); |
| 860 | 844 | if (sl->explicit_ref_marking) { |
| 845 | + int i; | |
| 861 | 846 | for (i = 0; i < FF_ARRAY_ELEMS(sl->mmco); i++) { |
| 862 | 847 | MMCOOpcode opcode = get_ue_golomb_31(gb); |
| 863 | 848 | |