Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -46,7 +46,7 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, · 45 unmodified lines | ||
| 46 | 46 | if (get_rac(c, state + 0)) |
| 47 | 47 | return 0; |
| 48 | 48 | else { |
| 49 | − int i, e; | |
| 49 | + int e; | |
| 50 | 50 | unsigned a; |
| 51 | 51 | e = 0; |
| 52 | 52 | while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10 |
| @@ -56,7 +56,7 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, · 3 unmodified lines | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | a = 1; |
| 59 | − for (i = e - 1; i >= 0; i--) | |
| 59 | + for (int i = e - 1; i >= 0; i--) | |
| 60 | 60 | a += a + get_rac(c, state + 22 + FFMIN(i, 9)); // 22..31 |
| 61 | 61 | |
| 62 | 62 | e = -(is_signed && get_rac(c, state + 11 + FFMIN(e, 10))); // 11..21 |
| @@ -167,7 +167,7 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs) · 104 unmodified lines | ||
| 167 | 167 | { |
| 168 | 168 | RangeCoder *c = &fs->c; |
| 169 | 169 | uint8_t state[CONTEXT_SIZE]; |
| 170 | − unsigned ps, i, context_count; | |
| 170 | + unsigned ps, context_count; | |
| 171 | 171 | int sx, sy, sw, sh; |
| 172 | 172 | |
| 173 | 173 | memset(state, 128, sizeof(state)); |
| @@ -197,7 +197,7 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs) · 23 unmodified lines | ||
| 197 | 197 | if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23)) |
| 198 | 198 | return AVERROR_INVALIDDATA; |
| 199 | 199 | |
| 200 | − for (i = 0; i < f->plane_count; i++) { | |
| 200 | + for (unsigned i = 0; i < f->plane_count; i++) { | |
| 201 | 201 | PlaneContext * const p = &fs->plane[i]; |
| 202 | 202 | int idx = get_symbol(c, state, 0); |
| 203 | 203 | if (idx >= (unsigned)f->quant_table_count) { |
| @@ -259,7 +259,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 55 unmodified lines | ||
| 259 | 259 | int width, height, x, y, ret; |
| 260 | 260 | const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step; |
| 261 | 261 | AVFrame * const p = f->cur; |
| 262 | − int i, si; | |
| 262 | + int si; | |
| 263 | 263 | |
| 264 | 264 | for( si=0; fs != f->slice_context[si]; si ++) |
| 265 | 265 | ; |
| @@ -276,7 +276,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 10 unmodified lines | ||
| 276 | 276 | if (!(p->flags & AV_FRAME_FLAG_KEY)) |
| 277 | 277 | fsdst->slice_damaged |= fssrc->slice_damaged; |
| 278 | 278 | |
| 279 | − for (i = 0; i < f->plane_count; i++) { | |
| 279 | + for (int i = 0; i < f->plane_count; i++) { | |
| 280 | 280 | PlaneContext *psrc = &fssrc->plane[i]; |
| 281 | 281 | PlaneContext *pdst = &fsdst->plane[i]; |
| 282 | 282 | |
| @@ -424,7 +424,7 @@ static int read_extra_header(FFV1Context *f) · 141 unmodified lines | ||
| 424 | 424 | { |
| 425 | 425 | RangeCoder *const c = &f->c; |
| 426 | 426 | uint8_t state[CONTEXT_SIZE]; |
| 427 | − int i, j, k, ret; | |
| 427 | + int ret; | |
| 428 | 428 | uint8_t state2[32][CONTEXT_SIZE]; |
| 429 | 429 | unsigned crc = 0; |
| 430 | 430 | |
| @@ -453,7 +453,7 @@ static int read_extra_header(FFV1Context *f) · 22 unmodified lines | ||
| 453 | 453 | f->ac = get_symbol(c, state, 0); |
| 454 | 454 | |
| 455 | 455 | if (f->ac == AC_RANGE_CUSTOM_TAB) { |
| 456 | − for (i = 1; i < 256; i++) | |
| 456 | + for (int i = 1; i < 256; i++) | |
| 457 | 457 | f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i]; |
| 458 | 458 | } |
| 459 | 459 | |
| @@ -492,7 +492,7 @@ static int read_extra_header(FFV1Context *f) · 32 unmodified lines | ||
| 492 | 492 | return AVERROR_INVALIDDATA; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | − for (i = 0; i < f->quant_table_count; i++) { | |
| 495 | + for (int i = 0; i < f->quant_table_count; i++) { | |
| 496 | 496 | f->context_count[i] = read_quant_tables(c, f->quant_tables[i]); |
| 497 | 497 | if (f->context_count[i] < 0) { |
| 498 | 498 | av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n"); |
| @@ -502,10 +502,10 @@ static int read_extra_header(FFV1Context *f) · 3 unmodified lines | ||
| 502 | 502 | if ((ret = ff_ffv1_allocate_initial_states(f)) < 0) |
| 503 | 503 | return ret; |
| 504 | 504 | |
| 505 | − for (i = 0; i < f->quant_table_count; i++) | |
| 505 | + for (int i = 0; i < f->quant_table_count; i++) | |
| 506 | 506 | if (get_rac(c, state)) { |
| 507 | − for (j = 0; j < f->context_count[i]; j++) | |
| 508 | − for (k = 0; k < CONTEXT_SIZE; k++) { | |
| 507 | + for (int j = 0; j < f->context_count[i]; j++) | |
| 508 | + for (int k = 0; k < CONTEXT_SIZE; k++) { | |
| 509 | 509 | int pred = j ? f->initial_states[i][j - 1][k] : 128; |
| 510 | 510 | f->initial_states[i][j][k] = |
| 511 | 511 | (pred + get_symbol(c, state2[k], 1)) & 0xFF; |
| @@ -550,7 +550,7 @@ static int read_extra_header(FFV1Context *f) · 38 unmodified lines | ||
| 550 | 550 | static int read_header(FFV1Context *f) |
| 551 | 551 | { |
| 552 | 552 | uint8_t state[CONTEXT_SIZE]; |
| 553 | − int i, j, context_count = -1; //-1 to avoid warning | |
| 553 | + int context_count = -1; //-1 to avoid warning | |
| 554 | 554 | RangeCoder *const c = &f->slice_context[0]->c; |
| 555 | 555 | |
| 556 | 556 | memset(state, 128, sizeof(state)); |
| @@ -566,7 +566,7 @@ static int read_header(FFV1Context *f) · 9 unmodified lines | ||
| 566 | 566 | f->ac = get_symbol(c, state, 0); |
| 567 | 567 | |
| 568 | 568 | if (f->ac == AC_RANGE_CUSTOM_TAB) { |
| 569 | − for (i = 1; i < 256; i++) { | |
| 569 | + for (int i = 1; i < 256; i++) { | |
| 570 | 570 | int st = get_symbol(c, state, 1) + c->one_state[i]; |
| 571 | 571 | if (st < 1 || st > 255) { |
| 572 | 572 | av_log(f->avctx, AV_LOG_ERROR, "invalid state transition %d\n", st); |
| @@ -790,7 +790,7 @@ static int read_header(FFV1Context *f) · 217 unmodified lines | ||
| 790 | 790 | return AVERROR_INVALIDDATA; |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | − for (j = 0; j < f->slice_count; j++) { | |
| 793 | + for (int j = 0; j < f->slice_count; j++) { | |
| 794 | 794 | FFV1Context *fs = f->slice_context[j]; |
| 795 | 795 | fs->ac = f->ac; |
| 796 | 796 | fs->packed_at_lsb = f->packed_at_lsb; |
| @@ -819,7 +819,7 @@ static int read_header(FFV1Context *f) · 22 unmodified lines | ||
| 819 | 819 | && (unsigned)fs->slice_y + (uint64_t)fs->slice_height <= f->height); |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | − for (i = 0; i < f->plane_count; i++) { | |
| 822 | + for (int i = 0; i < f->plane_count; i++) { | |
| 823 | 823 | PlaneContext *const p = &fs->plane[i]; |
| 824 | 824 | |
| 825 | 825 | if (f->version == 2) { |
| @@ -874,7 +874,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 48 unmodified lines | ||
| 874 | 874 | int buf_size = avpkt->size; |
| 875 | 875 | FFV1Context *f = avctx->priv_data; |
| 876 | 876 | RangeCoder *const c = &f->slice_context[0]->c; |
| 877 | − int i, ret, key_frame; | |
| 877 | + int ret, key_frame; | |
| 878 | 878 | uint8_t keystate = 128; |
| 879 | 879 | uint8_t *buf_p; |
| 880 | 880 | AVFrame *p; |
| @@ -908,6 +908,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 27 unmodified lines | ||
| 908 | 908 | } else { |
| 909 | 909 | int w = avctx->width; |
| 910 | 910 | int s = 1 + w / (1<<23); |
| 911 | + int i; | |
| 911 | 912 | |
| 912 | 913 | w /= s; |
| 913 | 914 | |
| @@ -941,7 +942,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 27 unmodified lines | ||
| 941 | 942 | ff_thread_finish_setup(avctx); |
| 942 | 943 | |
| 943 | 944 | buf_p = buf + buf_size; |
| 944 | − for (i = f->slice_count - 1; i >= 0; i--) { | |
| 945 | + for (int i = f->slice_count - 1; i >= 0; i--) { | |
| 945 | 946 | FFV1Context *fs = f->slice_context[i]; |
| 946 | 947 | int trailer = 3 + 5*!!f->ec; |
| 947 | 948 | int v; |
| @@ -991,15 +992,14 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 43 unmodified lines | ||
| 991 | 992 | f->slice_count, |
| 992 | 993 | sizeof(void*)); |
| 993 | 994 | |
| 994 | − for (i = f->slice_count - 1; i >= 0; i--) { | |
| 995 | + for (int i = f->slice_count - 1; i >= 0; i--) { | |
| 995 | 996 | FFV1Context *fs = f->slice_context[i]; |
| 996 | − int j; | |
| 997 | 997 | if (fs->slice_damaged && f->last_picture.f) { |
| 998 | 998 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); |
| 999 | 999 | const uint8_t *src[4]; |
| 1000 | 1000 | uint8_t *dst[4]; |
| 1001 | 1001 | ff_progress_frame_await(&f->last_picture, INT_MAX); |
| 1002 | − for (j = 0; j < desc->nb_components; j++) { | |
| 1002 | + for (int j = 0; j < desc->nb_components; j++) { | |
| 1003 | 1003 | int pixshift = desc->comp[j].depth > 8; |
| 1004 | 1004 | int sh = (j == 1 || j == 2) ? f->chroma_h_shift : 0; |
| 1005 | 1005 | int sv = (j == 1 || j == 2) ? f->chroma_v_shift : 0; |
| @@ -1064,7 +1064,6 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) · 58 unmodified lines | ||
| 1064 | 1064 | { |
| 1065 | 1065 | FFV1Context *fsrc = src->priv_data; |
| 1066 | 1066 | FFV1Context *fdst = dst->priv_data; |
| 1067 | − int i; | |
| 1068 | 1067 | |
| 1069 | 1068 | if (dst == src) |
| 1070 | 1069 | return 0; |
| @@ -1075,7 +1074,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) · 4 unmodified lines | ||
| 1075 | 1074 | sizeof(fdst->state_transition)); |
| 1076 | 1075 | memcpy(fdst->quant_table, fsrc->quant_table, sizeof(fsrc->quant_table)); |
| 1077 | 1076 | |
| 1078 | − for (i = 0; i < fdst->num_h_slices * fdst->num_v_slices; i++) { | |
| 1077 | + for (int i = 0; i < fdst->num_h_slices * fdst->num_v_slices; i++) { | |
| 1079 | 1078 | FFV1Context *fssrc = fsrc->slice_context[i]; |
| 1080 | 1079 | FFV1Context *fsdst = fdst->slice_context[i]; |
| 1081 | 1080 | copy_fields(fsdst, fssrc, fsrc); |