passed h264,hevc decoder fate test.

On Sun, Mar 21, 2021 at 1:06 PM Nuo Mi <nuomi2...@gmail.com> wrote:

> Magic number 124 and ^= are not listed on the spec.
> Strictly following the spec will make a reader's life much easier. See
> (9-6) for details
> ---
>  libavcodec/hevc_cabac.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
> index 9b8c8e342d..7ac340f471 100644
> --- a/libavcodec/hevc_cabac.c
> +++ b/libavcodec/hevc_cabac.c
> @@ -496,12 +496,10 @@ static void cabac_init_state(HEVCContext *s)
>          int init_value = init_values[init_type][i];
>          int m = (init_value >> 4) * 5 - 45;
>          int n = ((init_value & 15) << 3) - 16;
> -        int pre = 2 * (((m * av_clip(s->sh.slice_qp, 0, 51)) >> 4) + n) -
> 127;
> -
> -        pre ^= pre >> 31;
> -        if (pre > 124)
> -            pre = 124 + (pre & 1);
> -        s->HEVClc->cabac_state[i] = pre;
> +        int pre = av_clip(((m * av_clip(s->sh.slice_qp, 0, 51)) >> 4) +
> n, 1, 126);
> +        int val_mps = (pre <= 63 ) ? 0 : 1;
> +        int state = val_mps ? (pre - 64) : (63 - pre);
> +        s->HEVClc->cabac_state[i] = (state << 1) + val_mps;
>      }
>
>      for (i = 0; i < 4; i++)
> --
> 2.25.1
>
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to