diff mbox series

[FFmpeg-devel,v3] avcodec/vp8: Export `vp8_token_update_probs` variable

Message ID DM6PR11MB2681B94AE9364D4AC96CF8F8B1B3A@DM6PR11MB2681.namprd11.prod.outlook.com
State Accepted
Commit 5cb8accd09054f8d9dd63f325a290a1008ce1e7e
Headers show
Series [FFmpeg-devel,v3] avcodec/vp8: Export `vp8_token_update_probs` variable | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Dai, Jianhui J Nov. 13, 2023, 1:44 a.m. UTC
This commit exports the `vp8_token_update_probs` variable to internal
library scope to facilitate its reuse within the library.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
---
 libavcodec/vp8.c     |   2 +-
 libavcodec/vp8data.c | 170 ++++++++++++++++++++++++++++++++++++++++++
 libavcodec/vp8data.h | 171 +------------------------------------------
 3 files changed, 172 insertions(+), 171 deletions(-)

Comments

Dai, Jianhui J Nov. 13, 2023, 1:46 a.m. UTC | #1
> -----Original Message-----
> From: Dai, Jianhui J <jianhui.j.dai@intel.com>
> Sent: Monday, November 13, 2023 9:44 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [PATCH v3] avcodec/vp8: Export `vp8_token_update_probs` variable
> 
> This commit exports the `vp8_token_update_probs` variable to internal library
> scope to facilitate its reuse within the library.
> 
> Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
> ---
>  libavcodec/vp8.c     |   2 +-
>  libavcodec/vp8data.c | 170 ++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/vp8data.h | 171 +------------------------------------------
>  3 files changed, 172 insertions(+), 171 deletions(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index ffc430dd32..83c60adeb0
> 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -458,7 +458,7 @@ static void vp78_update_probability_tables(VP8Context
> *s)
>          for (j = 0; j < 8; j++)
>              for (k = 0; k < 3; k++)
>                  for (l = 0; l < NUM_DCT_TOKENS-1; l++)
> -                    if (vpx_rac_get_prob_branchy(c, vp8_token_update_probs[i][j][k][l]))
> {
> +                    if (vpx_rac_get_prob_branchy(c,
> + ff_vp8_token_update_probs[i][j][k][l])) {
>                          int prob = vp89_rac_get_uint(c, 8);
>                          for (m = 0; vp8_coeff_band_indexes[j][m] >= 0; m++)
>                              s->prob->token[i][vp8_coeff_band_indexes[j][m]][k][l] = prob;
> diff --git a/libavcodec/vp8data.c b/libavcodec/vp8data.c index
> 857406928a..675c2a033d 100644
> --- a/libavcodec/vp8data.c
> +++ b/libavcodec/vp8data.c
> @@ -40,3 +40,173 @@ const uint8_t *const ff_vp8_dct_cat_prob[] = {
>      vp8_dct_cat6_prob,
>  };
> 
> +const uint8_t ff_vp8_token_update_probs[4][8][3][11] = {
> +    {
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
> +            { 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +    },
> +    {
> +        {
> +            { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
> +            { 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +    },
> +    {
> +        {
> +            { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
> +            { 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +    },
> +    {
> +        {
> +            { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
> +            { 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +        {
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> +        },
> +    },
> +};
> diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h index
> 8b8f1ed111..c8e79fdbeb 100644
> --- a/libavcodec/vp8data.h
> +++ b/libavcodec/vp8data.h
> @@ -513,176 +513,7 @@ static const uint8_t
> vp8_token_default_probs[4][8][3][NUM_DCT_TOKENS - 1] = {
>      },
>  };
> 
> -static const uint8_t vp8_token_update_probs[4][8][3][NUM_DCT_TOKENS - 1] =
> {
> -    {
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
> -            { 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -    },
> -    {
> -        {
> -            { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
> -            { 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -    },
> -    {
> -        {
> -            { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
> -            { 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -    },
> -    {
> -        {
> -            { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
> -            { 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -        {
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
> -        },
> -    },
> -};
> +extern const uint8_t ff_vp8_token_update_probs[4][8][3][11];
> 
>  static const uint8_t vp8_dc_qlookup[VP8_MAX_QUANT + 1] = {
>        4,   5,   6,   7,   8,   9,  10,  10,  11,  12,  13,  14,  15,  16,  17,  17,
> --

Fixed the mistake in v2. 
`vp8_token_update_probs` should be exported instead of ` vp8_token_default _probs`.

> 2.25.1
Leo Izen Nov. 13, 2023, 6:53 a.m. UTC | #2
On 11/12/23 20:44, Dai, Jianhui J wrote:
> This commit exports the `vp8_token_update_probs` variable to internal
> library scope to facilitate its reuse within the library.
> 

Where is this symbol actually needed elsewhere? If it is, perhaps an 
explanation in the commit message would be ideal. (I have no issues with 
the commit itself.)

- Leo Izen (Traneptora)
Dai, Jianhui J Nov. 13, 2023, 7:54 a.m. UTC | #3
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Leo
> Izen
> Sent: Monday, November 13, 2023 2:53 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v3] avcodec/vp8: Export
> `vp8_token_update_probs` variable
> 
> On 11/12/23 20:44, Dai, Jianhui J wrote:
> > This commit exports the `vp8_token_update_probs` variable to internal
> > library scope to facilitate its reuse within the library.
> >
> 
> Where is this symbol actually needed elsewhere? If it is, perhaps an
> explanation in the commit message would be ideal. (I have no issues with the
> commit itself.)

Oh, this is the preceding patch of:
`[FFmpeg-devel,v6] avcodec/cbs_vp8: Add support for VP8 codec bitstream`

Probably, I need merge these two together.

> 
> - Leo Izen (Traneptora)
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
Ronald S. Bultje Nov. 13, 2023, 1:43 p.m. UTC | #4
Hi,

On Mon, Nov 13, 2023 at 2:55 AM Dai, Jianhui J <
jianhui.j.dai-at-intel.com@ffmpeg.org> wrote:

> Oh, this is the preceding patch of:
> `[FFmpeg-devel,v6] avcodec/cbs_vp8: Add support for VP8 codec bitstream`
>
> Probably, I need merge these two together.
>

It's ok like this, for me. I'll let this sit for 48 hours for others to
comment. After that, I will merge (both patches) for you later this week if
no other review comments come in.

Ronald
Ronald S. Bultje Nov. 15, 2023, 3:29 p.m. UTC | #5
Hi,

On Mon, Nov 13, 2023 at 8:43 AM Ronald S. Bultje <rsbultje@gmail.com> wrote:

> Hi,
>
> On Mon, Nov 13, 2023 at 2:55 AM Dai, Jianhui J <
> jianhui.j.dai-at-intel.com@ffmpeg.org> wrote:
>
>> Oh, this is the preceding patch of:
>> `[FFmpeg-devel,v6] avcodec/cbs_vp8: Add support for VP8 codec bitstream`
>>
>> Probably, I need merge these two together.
>>
>
> It's ok like this, for me. I'll let this sit for 48 hours for others to
> comment. After that, I will merge (both patches) for you later this week if
> no other review comments come in.
>

Both patches pushed.

Ronald
diff mbox series

Patch

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index ffc430dd32..83c60adeb0 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -458,7 +458,7 @@  static void vp78_update_probability_tables(VP8Context *s)
         for (j = 0; j < 8; j++)
             for (k = 0; k < 3; k++)
                 for (l = 0; l < NUM_DCT_TOKENS-1; l++)
-                    if (vpx_rac_get_prob_branchy(c, vp8_token_update_probs[i][j][k][l])) {
+                    if (vpx_rac_get_prob_branchy(c, ff_vp8_token_update_probs[i][j][k][l])) {
                         int prob = vp89_rac_get_uint(c, 8);
                         for (m = 0; vp8_coeff_band_indexes[j][m] >= 0; m++)
                             s->prob->token[i][vp8_coeff_band_indexes[j][m]][k][l] = prob;
diff --git a/libavcodec/vp8data.c b/libavcodec/vp8data.c
index 857406928a..675c2a033d 100644
--- a/libavcodec/vp8data.c
+++ b/libavcodec/vp8data.c
@@ -40,3 +40,173 @@  const uint8_t *const ff_vp8_dct_cat_prob[] = {
     vp8_dct_cat6_prob,
 };
 
+const uint8_t ff_vp8_token_update_probs[4][8][3][11] = {
+    {
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
+            { 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+    },
+    {
+        {
+            { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
+            { 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+    },
+    {
+        {
+            { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
+            { 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+    },
+    {
+        {
+            { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
+            { 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+        {
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+        },
+    },
+};
diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h
index 8b8f1ed111..c8e79fdbeb 100644
--- a/libavcodec/vp8data.h
+++ b/libavcodec/vp8data.h
@@ -513,176 +513,7 @@  static const uint8_t vp8_token_default_probs[4][8][3][NUM_DCT_TOKENS - 1] = {
     },
 };
 
-static const uint8_t vp8_token_update_probs[4][8][3][NUM_DCT_TOKENS - 1] = {
-    {
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
-            { 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-    },
-    {
-        {
-            { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
-            { 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-    },
-    {
-        {
-            { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
-            { 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-    },
-    {
-        {
-            { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
-            { 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-        {
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-            { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-        },
-    },
-};
+extern const uint8_t ff_vp8_token_update_probs[4][8][3][11];
 
 static const uint8_t vp8_dc_qlookup[VP8_MAX_QUANT + 1] = {
       4,   5,   6,   7,   8,   9,  10,  10,  11,  12,  13,  14,  15,  16,  17,  17,