[FFmpeg-devel] avcodec/proresenc_aw : improve speed by replacing PutBitContext for codeword encoding

Michael Niedermayer michael at niedermayer.cc
Mon Mar 4 23:30:47 EET 2019


On Tue, Feb 26, 2019 at 04:54:38PM +0100, Martin Vignali wrote:
> Hello,
> 
> Patch in attach, change codeword bits writing
> by replacing PutBitContext, and use instead uint64_t bit_buf
> Also remove byte buffer length check
> 
> encode_codeword func have two version now
> - one for dc coeff and run coeff (same as previous encode_codeword func)
> - one for level coeff who also integrate the "IS_NEGATIVE(val)" bit writing
> 
> encode_codeword func code is reorganize
> in the first part, calculate codeword value and number of bits for this
> value
> at the end, write the codeword in bit_buf, and if bit_buf is full, write it
> in dst buf.
> 
> Pass fate test for me (X86_64 os X)
> also tested, on real samples. Md5 hash of the target file doesn't change
> for me
> 
> Speed improvment on X86_64 :
> test file 1 : 140 -> 154 fps
> test file 2 : 55 -> 62 fps
> 
> Not tested on big endian and X86_32.
> 
> Fate test cmd :
> make fate-vsynth3-prores;make fate-vsynth2-prores;make
> fate-vsynth1-prores;make fate-vsynth_lena-prores SAMPLES=fate-suite/
> 
> Comments welcome
> 
> Martin

>  proresenc_anatoliy.c |  133 +++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 108 insertions(+), 25 deletions(-)
> a5390e02202e780e4ae88d931af3959f338d447d  0001-avcodec-proresenc_aw-replace-putbitsContext-by-uint6.patch
> From ce7709c6145920a9eeea8618810894d3a7fe99ba Mon Sep 17 00:00:00 2001
> From: Martin Vignali <martin.vignali at gmail.com>
> Date: Tue, 26 Feb 2019 16:33:39 +0100
> Subject: [PATCH] avcodec/proresenc_aw : replace putbitsContext by uint64
>  bit_buf
> 

> also remove the target buffer length check

do i understand correctly that there is no check that prevents out of array
writing ?
not even an assert
If thats the case, then i think this is unwise.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190304/9485a4d1/attachment.sig>


More information about the ffmpeg-devel mailing list