[FFmpeg-devel] [PATCH 1/9] avcodec/dvdata: Order code table by codes

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 6 04:33:52 EEST 2022


Andreas Rheinhardt:
> Right now, it is nearly ordered by "left codes in the tree first";
> the only exception is the escape value which has been put at the
> end. This commit moves it to the place it should have according
> to the above order. This is in preparation for further commits.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/dv_tablegen.h |  2 +-
>  libavcodec/dvdata.c      | 12 ++++--------
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/dv_tablegen.h b/libavcodec/dv_tablegen.h
> index 941b5572be..0dcfffc140 100644
> --- a/libavcodec/dv_tablegen.h
> +++ b/libavcodec/dv_tablegen.h
> @@ -51,7 +51,7 @@ static struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
>  static av_cold void dv_vlc_map_tableinit(void)
>  {
>      int i, j;
> -    for (i = 0; i < NB_DV_VLC - 1; i++) {
> +    for (int i = 0; i < NB_DV_VLC; i++) {
>          if (ff_dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
>              continue;
>  #if CONFIG_SMALL
> diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
> index 231569a328..1e48db591d 100644
> --- a/libavcodec/dvdata.c
> +++ b/libavcodec/dvdata.c
> @@ -75,7 +75,7 @@ const uint8_t ff_dv_quant_offset[4] = { 6, 3, 0, 1 };
>   * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82.
>   */
>  const uint16_t ff_dv_vlc_bits[NB_DV_VLC] = {
> -    0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
> +    0x0000, 0x0002, 0x0006, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
>      0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a,
>      0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00e0, 0x00e1, 0x00e2,
>      0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea,
> @@ -126,11 +126,10 @@ const uint16_t ff_dv_vlc_bits[NB_DV_VLC] = {
>      0x7fe8, 0x7fe9, 0x7fea, 0x7feb, 0x7fec, 0x7fed, 0x7fee, 0x7fef,
>      0x7ff0, 0x7ff1, 0x7ff2, 0x7ff3, 0x7ff4, 0x7ff5, 0x7ff6, 0x7ff7,
>      0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff,
> -    0x0006,
>  };
>  
>  const uint8_t ff_dv_vlc_len[NB_DV_VLC] = {
> -     2,  3,  4,  4,  4,  5,  5,  5,
> +     2,  3,  4,  4,  4,  4,  5,  5,  5,
>       5,  6,  6,  6,  6,  7,  7,  7,
>       7,  7,  7,  7,  7,  8,  8,  8,
>       8,  8,  8,  8,  8,  8,  8,  8,
> @@ -181,11 +180,10 @@ const uint8_t ff_dv_vlc_len[NB_DV_VLC] = {
>      15, 15, 15, 15, 15, 15, 15, 15,
>      15, 15, 15, 15, 15, 15, 15, 15,
>      15, 15, 15, 15, 15, 15, 15, 15,
> -     4,
>  };
>  
>  const uint8_t ff_dv_vlc_run[NB_DV_VLC] = {
> -     0,  0,  1,  0,  0,  2,  1,  0,
> +     0,  0, 127, 1,  0,  0,  2,  1,  0,
>       0,  3,  4,  0,  0,  5,  6,  2,
>       1,  1,  0,  0,  0,  7,  8,  9,
>      10,  3,  4,  2,  1,  1,  1,  0,
> @@ -236,11 +234,10 @@ const uint8_t ff_dv_vlc_run[NB_DV_VLC] = {
>       0,  0,  0,  0,  0,  0,  0,  0,
>       0,  0,  0,  0,  0,  0,  0,  0,
>       0,  0,  0,  0,  0,  0,  0,  0,
> -   127,
>  };
>  
>  const uint8_t ff_dv_vlc_level[NB_DV_VLC] = {
> -     1,   2,   1,   3,   4,   1,   2,   5,
> +     1,   2,   0,   1,   3,   4,   1,   2,   5,
>       6,   1,   1,   7,   8,   1,   1,   2,
>       3,   4,   9,  10,  11,   1,   1,   1,
>       1,   2,   2,   3,   5,   6,   7,  12,
> @@ -291,5 +288,4 @@ const uint8_t ff_dv_vlc_level[NB_DV_VLC] = {
>     232, 233, 234, 235, 236, 237, 238, 239,
>     240, 241, 242, 243, 244, 245, 246, 247,
>     248, 249, 250, 251, 252, 253, 254, 255,
> -     0,
>  };

Will apply this tomorrow unless there are objections.

- Andreas


More information about the ffmpeg-devel mailing list