[FFmpeg-devel] [PATCH] huffyuvdec: use unsafe bitstream reader
Michael Niedermayer
michaelni at gmx.at
Mon Jun 16 01:32:35 CEST 2014
On Sun, Jun 15, 2014 at 08:39:07PM +0200, Christophe Gisquet wrote:
> Hi,
>
> 2014-06-15 16:20 GMT+02:00 Michael Niedermayer <michaelni at gmx.at>:
> > decode_422_bitstream() also needs an additional check because it
> > seems to be able ro read 4 samples which might be upto 16 byte but
> > the bitreader itself can overread 3 bytes so it might be slightly
> > beyond the required padding of 16 bytes
>
> Hum OK. So I think adding that extra check is adding back some extra
> complexity in that loop. Therefore I chose to perform some unrolling
> here in my patch. Maybe we could even get rid of the last code block
> now.
>
> There's also an additional check in the BGR case, but it would get
> ugly to unroll it.
>
> btw, that 422 bitstream parsing sets the missing values to 128. Is
> that what the format wants? Or should that be 0, because we're dealing
> with residuals?
iam pretty sure the format does not require 128
fixed
>
> --
> Christophe
> huffyuvdec.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
> c569e06b39bf5df2cce62ab7f29962478dfbc5f9 0004-huffyuvdec-use-unsafe-bitstream-reader.patch
> From b59ab09386f08e23f71b2554d54ea65e3c3fd958 Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet <christophe.gisquet at gmail.com>
> Date: Sun, 15 Jun 2014 12:04:36 +0200
> Subject: [PATCH 4/4] huffyuvdec: use unsafe bitstream reader
>
> The reader reads in chunks of 11 bits at most, and at most 3 times. The unsafe
> reader therefore may read 6 chunks instead of 1 in worst case, ie 8 bytes,
> which is within the padding tolerance.
>
> The reader ends up being ~10% faster. Cumulative effect of unsafe reading and
> code block swapping on 3 sequences is for 1 thread, decoding time goes from
> 23.3s to 19.0s.
applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140616/7f312a0c/attachment.asc>
More information about the ffmpeg-devel
mailing list