[FFmpeg-devel] [PATCH] h264: don't touch H264Context->ref_count[] during MB decoding.

Clément Bœsch ubitux at gmail.com
Fri Oct 5 07:38:10 CEST 2012


On Thu, Oct 04, 2012 at 04:15:58PM +0200, Clément Bœsch wrote:
> On Thu, Oct 04, 2012 at 04:13:24PM +0200, Clément Bœsch wrote:
> [...]
> > > >      if(MB_MBAFF){
> > > > -        h->ref_count[0] <<= 1;
> > > > -        h->ref_count[1] <<= 1;
> > > > +        local_ref_count[0] <<= 1;
> > > > +        local_ref_count[1] <<= 1;
> > > >      }
> > > 
> > > maybe
> > > local_ref_count[0] = h->ref_count[0] << MB_MBAFF
> > > is faster but otherwise whatever is fast & clean is fine with me
> > > 
> > 
> > Ah right, I'll push the attached version tomorrow unless there is an
> > objection then.
> > 
> 
> Derp, sent a bad draft version. Fixed.
> 
> -- 
> Clément B.

> From 9079f71858e80bef4b40cb721c1b25befa632b7d Mon Sep 17 00:00:00 2001
> From: "Ronald S. Bultje" <rsbultje at gmail.com>
> Date: Thu, 4 Oct 2012 09:01:45 +0200
> Subject: [PATCH] lavc/h264: don't touch H264Context->ref_count[] during MB
>  decoding.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The variable is copied to subsequent threads at the same time, so this
> may cause wrong ref_count[] values to be copied to subsequent threads.
> 
> This bug was found using TSAN and Helgrind.
> 
> Original patch by Ronald, adapted with a local_ref_count by Clément,
> following the suggestion of Michael Niedermayer.
> 
> Signed-off-by: Clément Bœsch <clement.boesch at smartjog.com>
> ---
>  libavcodec/h264_cabac.c |   36 +++++++++++++++---------------------
>  libavcodec/h264_cavlc.c |   32 +++++++++++++-------------------
>  2 files changed, 28 insertions(+), 40 deletions(-)
> 

Applied. Thanks Ronald & Michael :)

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121005/24682fa6/attachment.asc>


More information about the ffmpeg-devel mailing list