[FFmpeg-devel] [PATCH 6/7] proresdec2: remove a useless DC codebook entry
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Sep 8 12:08:56 EEST 2023
Christophe Gisquet:
> ---
> libavcodec/proresdec2.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
> index 02e1d82d00..b20021c622 100644
> --- a/libavcodec/proresdec2.c
> +++ b/libavcodec/proresdec2.c
> @@ -534,9 +534,9 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
>
> #define FIRST_DC_CB 0xB8
>
> -static const char dc_codebook[7][4] = {
> +static const char dc_codebook[6][4] = {
You would not need this change if you omitted the length.
> { 0, 0, 1, -1 }, { 0, 1, 2, -2 }, { 0, 1, 2, -2 },
> - { 1, 2, 2, 0 }, { 1, 2, 2, 0 }, { 0, 3, 4, -8 }, { 0, 3, 4, -8 }
> + { 1, 2, 2, 0 }, { 1, 2, 2, 0 }, { 0, 3, 4, -8 }
> };
>
> static av_always_inline int decode_dc_coeffs(GetBitContext *gb, int16_t *out,
> @@ -553,7 +553,7 @@ static av_always_inline int decode_dc_coeffs(GetBitContext *gb, int16_t *out,
> code = 5;
> sign = 0;
> for (i = 1; i < blocks_per_slice; i++, out += 64) {
> - unsigned int dccb = FFMIN(code, 6U);
> + unsigned int dccb = FFMIN(code, 5U);
You wouldn't need this change if you used FF_ARRAY_ELEMS(dc_codebook) -
1 here.
Btw: Why is this codebook entry useless? Can code never be 6?
> DECODE_CODEWORD2(code, dc_codebook[dccb][0], dc_codebook[dccb][1],
> dc_codebook[dccb][2], dc_codebook[dccb][3]);
> if(code) sign ^= -(code & 1);
More information about the ffmpeg-devel
mailing list