The chroma pointers ac_val[1] and ac_val[2] are no longer used anywhere.
Unified · Split
| @@ -451,7 +451,7 @@ static void h263_pred_acdc(MpegEncContext * s, int16_t *block, int n) · 450 unmodified lines | |||
| 451 | int wrap, a, c, pred_dc, scale; | 451 | int wrap, a, c, pred_dc, scale; |
| 452 | const int xy = s->block_index[n]; | 452 | const int xy = s->block_index[n]; |
| 453 | int16_t *const dc_val = s->dc_val[0] + xy; | 453 | int16_t *const dc_val = s->dc_val[0] + xy; |
| 454 | int16_t *const ac_val = (s->ac_val[0] + xy)[0]; | 454 | int16_t *const ac_val = (s->ac_val + xy)[0]; |
| 455 | 455 | ||
| 456 | /* find prediction */ | 456 | /* find prediction */ |
| 457 | if (n < 4) { | 457 | if (n < 4) { |
| @@ -50,11 +50,13 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s) · 49 unmodified lines | |||
| 50 | l_xy = (2 * s->mb_y - 1) * l_wrap + s->mb_x * 2 - 1; | 50 | l_xy = (2 * s->mb_y - 1) * l_wrap + s->mb_x * 2 - 1; |
| 51 | c_wrap = s->mb_stride; | 51 | c_wrap = s->mb_stride; |
| 52 | int u_xy = 2 * mb_height * l_wrap + s->mb_y * c_wrap + s->mb_x - 1; | 52 | int u_xy = 2 * mb_height * l_wrap + s->mb_y * c_wrap + s->mb_x - 1; |
| 53 | int v_xy = u_xy + c_wrap * (mb_height + 1); | ||
| 54 | int16_t (*ac_val)[16] = s->ac_val; | ||
| 53 | 55 | ||
| 54 | /* clean AC */ | 56 | /* clean AC */ |
| 55 | memset(s->ac_val[0] + l_xy, 0, (l_wrap * 2 + 1) * 16 * sizeof(int16_t)); | 57 | memset(ac_val + l_xy, 0, (l_wrap * 2 + 1) * sizeof(*ac_val)); |
| 56 | memset(s->ac_val[0] + u_xy, 0, (c_wrap + 1) * 16 * sizeof(int16_t)); | 58 | memset(ac_val + u_xy, 0, (c_wrap + 1) * sizeof(*ac_val)); |
| 57 | memset(s->ac_val[0] + u_xy + c_wrap * (mb_height + 1), 0, (c_wrap + 1) * 16 * sizeof(int16_t)); | 59 | memset(ac_val + v_xy, 0, (c_wrap + 1) * sizeof(*ac_val)); |
| 58 | 60 | ||
| 59 | /* clean MV */ | 61 | /* clean MV */ |
| 60 | // we can't clear the MVs as they might be needed by a B-frame | 62 | // we can't clear the MVs as they might be needed by a B-frame |
| @@ -326,7 +326,7 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir) · 325 unmodified lines | |||
| 326 | int8_t *const qscale_table = s->cur_pic.qscale_table; | 326 | int8_t *const qscale_table = s->cur_pic.qscale_table; |
| 327 | 327 | ||
| 328 | /* find prediction */ | 328 | /* find prediction */ |
| 329 | ac_val = &s->ac_val[0][0][0] + s->block_index[n] * 16; | 329 | ac_val = &s->ac_val[0][0] + s->block_index[n] * 16; |
| 330 | ac_val1 = ac_val; | 330 | ac_val1 = ac_val; |
| 331 | if (s->ac_pred) { | 331 | if (s->ac_pred) { |
| 332 | if (dir == 0) { | 332 | if (dir == 0) { |
| @@ -3785,9 +3785,7 @@ static av_cold void clear_context(MpegEncContext *s) · 3452 unmodified lines | |||
| 3785 | s->block = NULL; | 3785 | s->block = NULL; |
| 3786 | s->blocks = NULL; | 3786 | s->blocks = NULL; |
| 3787 | s->ac_val_base = NULL; | 3787 | s->ac_val_base = NULL; |
| 3788 | s->ac_val[0] = | 3788 | s->ac_val = NULL; |
| 3789 | s->ac_val[1] = | ||
| 3790 | s->ac_val[2] =NULL; | ||
| 3791 | memset(&s->sc, 0, sizeof(s->sc)); | 3789 | memset(&s->sc, 0, sizeof(s->sc)); |
| 3792 | 3790 | ||
| 3793 | s->p_field_mv_table_base = NULL; | 3791 | s->p_field_mv_table_base = NULL; |
| @@ -130,7 +130,7 @@ static inline void restore_ac_coeffs(MPVEncContext *const s, int16_t block[6][64 · 129 unmodified lines | |||
| 130 | memcpy(s->c.block_last_index, zigzag_last_index, sizeof(int) * 6); | 130 | memcpy(s->c.block_last_index, zigzag_last_index, sizeof(int) * 6); |
| 131 | 131 | ||
| 132 | for (n = 0; n < 6; n++) { | 132 | for (n = 0; n < 6; n++) { |
| 133 | int16_t *ac_val = &s->c.ac_val[0][0][0] + s->c.block_index[n] * 16; | 133 | int16_t *ac_val = &s->c.ac_val[0][0] + s->c.block_index[n] * 16; |
| 134 | 134 | ||
| 135 | st[n] = s->c.intra_scantable.permutated; | 135 | st[n] = s->c.intra_scantable.permutated; |
| 136 | if (dir[n]) { | 136 | if (dir[n]) { |
| @@ -169,7 +169,7 @@ static inline int decide_ac_pred(MPVEncContext *const s, int16_t block[6][64], · 32 unmodified lines | |||
| 169 | score -= get_block_rate(s, block[n], s->c.block_last_index[n], | 169 | score -= get_block_rate(s, block[n], s->c.block_last_index[n], |
| 170 | s->c.intra_scantable.permutated); | 170 | s->c.intra_scantable.permutated); |
| 171 | 171 | ||
| 172 | ac_val = &s->c.ac_val[0][0][0] + s->c.block_index[n] * 16; | 172 | ac_val = &s->c.ac_val[0][0] + s->c.block_index[n] * 16; |
| 173 | ac_val1 = ac_val; | 173 | ac_val1 = ac_val; |
| 174 | if (dir[n]) { | 174 | if (dir[n]) { |
| 175 | const int xy = s->c.mb_x + s->c.mb_y * s->c.mb_stride - s->c.mb_stride; | 175 | const int xy = s->c.mb_x + s->c.mb_y * s->c.mb_stride - s->c.mb_stride; |
| @@ -129,9 +129,7 @@ static av_cold int init_duplicate_context(MpegEncContext *s) · 128 unmodified lines | |||
| 129 | /* ac values */ | 129 | /* ac values */ |
| 130 | if (!FF_ALLOCZ_TYPED_ARRAY(s->ac_val_base, yc_size)) | 130 | if (!FF_ALLOCZ_TYPED_ARRAY(s->ac_val_base, yc_size)) |
| 131 | return AVERROR(ENOMEM); | 131 | return AVERROR(ENOMEM); |
| 132 | s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; | 132 | s->ac_val = s->ac_val_base + s->b8_stride + 1; |
| 133 | s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; | ||
| 134 | s->ac_val[2] = s->ac_val[1] + c_size; | ||
| 135 | } | 133 | } |
| 136 | 134 | ||
| 137 | return 0; | 135 | return 0; |
| @@ -195,9 +193,7 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src) · 57 unmodified lines | |||
| 195 | COPY(start_mb_y); | 193 | COPY(start_mb_y); |
| 196 | COPY(end_mb_y); | 194 | COPY(end_mb_y); |
| 197 | COPY(ac_val_base); | 195 | COPY(ac_val_base); |
| 198 | COPY(ac_val[0]); | 196 | COPY(ac_val); |
| 199 | COPY(ac_val[1]); | ||
| 200 | COPY(ac_val[2]); | ||
| 201 | #undef COPY | 197 | #undef COPY |
| 202 | } | 198 | } |
| 203 | 199 | ||
| @@ -502,7 +498,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 298 unmodified lines | |||
| 502 | dc_val[uxy] = | 498 | dc_val[uxy] = |
| 503 | dc_val[vxy] = 1024; | 499 | dc_val[vxy] = 1024; |
| 504 | /* ac pred */ | 500 | /* ac pred */ |
| 505 | int16_t (*ac_val)[16] = s->ac_val[0]; | 501 | int16_t (*ac_val)[16] = s->ac_val; |
| 506 | av_assume(!((uintptr_t)ac_val & 0xF)); | 502 | av_assume(!((uintptr_t)ac_val & 0xF)); |
| 507 | // Don't reset the upper-left luma block, as it will only ever be | 503 | // Don't reset the upper-left luma block, as it will only ever be |
| 508 | // referenced by blocks from the same macroblock. | 504 | // referenced by blocks from the same macroblock. |
| @@ -148,7 +148,7 @@ typedef struct MpegEncContext { · 147 unmodified lines | |||
| 148 | uint8_t *coded_block_base; | 148 | uint8_t *coded_block_base; |
| 149 | uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) | 149 | uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) |
| 150 | int16_t (*ac_val_base)[16]; | 150 | int16_t (*ac_val_base)[16]; |
| 151 | int16_t (*ac_val[3])[16]; ///< used for MPEG-4 AC prediction, all 3 arrays must be continuous | 151 | int16_t (*ac_val)[16]; ///< used for H.263 AIC, MPEG-4 AC prediction |
| 152 | int mb_skipped; ///< MUST BE SET only during DECODING | 152 | int mb_skipped; ///< MUST BE SET only during DECODING |
| 153 | uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example) | 153 | uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example) |
| 154 | and used for B-frame encoding & decoding (contains skip table of next P-frame) */ | 154 | and used for B-frame encoding & decoding (contains skip table of next P-frame) */ |
| @@ -3327,7 +3327,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3326 unmodified lines | |||
| 3327 | if(storecoefs){ | 3327 | if(storecoefs){ |
| 3328 | for(i=0; i<6; i++){ | 3328 | for(i=0; i<6; i++){ |
| 3329 | dc[i] = s->c.dc_val[0][s->c.block_index[i]]; | 3329 | dc[i] = s->c.dc_val[0][s->c.block_index[i]]; |
| 3330 | memcpy(ac[i], s->c.ac_val[0][s->c.block_index[i]], sizeof(int16_t)*16); | 3330 | memcpy(ac[i], s->c.ac_val[s->c.block_index[i]], sizeof(*s->c.ac_val)); |
| 3331 | } | 3331 | } |
| 3332 | } | 3332 | } |
| 3333 | 3333 | ||
| @@ -3337,7 +3337,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3 unmodified lines | |||
| 3337 | if(storecoefs){ | 3337 | if(storecoefs){ |
| 3338 | for(i=0; i<6; i++){ | 3338 | for(i=0; i<6; i++){ |
| 3339 | s->c.dc_val[0][s->c.block_index[i]] = dc[i]; | 3339 | s->c.dc_val[0][s->c.block_index[i]] = dc[i]; |
| 3340 | memcpy(s->c.ac_val[0][s->c.block_index[i]], ac[i], sizeof(int16_t)*16); | 3340 | memcpy(s->c.ac_val[s->c.block_index[i]], ac[i], sizeof(*s->c.ac_val)); |
| 3341 | } | 3341 | } |
| 3342 | } | 3342 | } |
| 3343 | } | 3343 | } |
| @@ -611,7 +611,7 @@ static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, · 610 unmodified lines | |||
| 611 | /* Store the quantized DC coeff, used for prediction */ | 611 | /* Store the quantized DC coeff, used for prediction */ |
| 612 | block[0] = dcdiff * s->y_dc_scale; | 612 | block[0] = dcdiff * s->y_dc_scale; |
| 613 | 613 | ||
| 614 | ac_val = s->ac_val[0][s->block_index[n]]; | 614 | ac_val = s->ac_val[s->block_index[n]]; |
| 615 | ac_val2 = ac_val; | 615 | ac_val2 = ac_val; |
| 616 | if (dc_pred_dir) // left | 616 | if (dc_pred_dir) // left |
| 617 | ac_val -= 16; | 617 | ac_val -= 16; |
| @@ -750,7 +750,7 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, · 132 unmodified lines | |||
| 750 | 750 | ||
| 751 | scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); | 751 | scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); |
| 752 | 752 | ||
| 753 | ac_val = s->ac_val[0][s->block_index[n]]; | 753 | ac_val = s->ac_val[s->block_index[n]]; |
| 754 | ac_val2 = ac_val; | 754 | ac_val2 = ac_val; |
| 755 | if (dc_pred_dir) // left | 755 | if (dc_pred_dir) // left |
| 756 | ac_val -= 16; | 756 | ac_val -= 16; |
| @@ -938,7 +938,7 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, · 181 unmodified lines | |||
| 938 | if (!a_avail) dc_pred_dir = 1; | 938 | if (!a_avail) dc_pred_dir = 1; |
| 939 | if (!c_avail) dc_pred_dir = 0; | 939 | if (!c_avail) dc_pred_dir = 0; |
| 940 | if (!a_avail && !c_avail) use_pred = 0; | 940 | if (!a_avail && !c_avail) use_pred = 0; |
| 941 | ac_val = s->ac_val[0][s->block_index[n]]; | 941 | ac_val = s->ac_val[s->block_index[n]]; |
| 942 | ac_val2 = ac_val; | 942 | ac_val2 = ac_val; |
| 943 | 943 | ||
| 944 | scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); | 944 | scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); |