[FFmpeg-devel] [PATCH] dirac: make initialization of arithmetic coder tables threadsafe.

Michael Niedermayer michael at niedermayer.cc
Mon Mar 27 18:10:11 EEST 2017


On Mon, Mar 27, 2017 at 10:09:05AM -0400, Ronald S. Bultje wrote:
> ---
>  libavcodec/dirac_arith.c | 17 +++++++++++------
>  libavcodec/dirac_arith.h |  1 +
>  libavcodec/diracdec.c    |  9 ++++++++-
>  3 files changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/dirac_arith.c b/libavcodec/dirac_arith.c
> index bf91392..49c0909 100644
> --- a/libavcodec/dirac_arith.c
> +++ b/libavcodec/dirac_arith.c
> @@ -83,9 +83,19 @@ const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT] = {
>  
>  int16_t ff_dirac_prob_branchless[256][2];
>  
> -void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length)
> +av_cold void ff_dirac_init_arith_tables(void)
>  {
>      int i;
> +
> +    for (i = 0; i < 256; i++) {
> +        ff_dirac_prob_branchless[i][0] =  ff_dirac_prob[255-i];
> +        ff_dirac_prob_branchless[i][1] = -ff_dirac_prob[i];
> +    }
> +}
> +
> +void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length)
> +{
> +    int i, ret;

ret seems unused

no other comments from me

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170327/26f7134b/attachment.sig>


More information about the ffmpeg-devel mailing list