[FFmpeg-devel] [PATCH v3] avcodec/vp8: Export `vp8_token_update_probs` variable
Dai, Jianhui J
jianhui.j.dai at intel.com
Mon Nov 13 03:46:11 EET 2023
> -----Original Message-----
> From: Dai, Jianhui J <jianhui.j.dai at intel.com>
> Sent: Monday, November 13, 2023 9:44 AM
> To: ffmpeg-devel at 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 at 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
More information about the ffmpeg-devel
mailing list