[FFmpeg-devel] [PATCH v3] avcodec: fix atomics usage for h264/mpeg error_count

Michael Niedermayer michael at niedermayer.cc
Thu Mar 15 00:38:59 EET 2018


On Wed, Mar 14, 2018 at 08:11:35AM +0100, wm4 wrote:
> On Tue, 13 Mar 2018 19:07:33 +0100
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > On Tue, Mar 13, 2018 at 04:02:57PM +0000, Aman Gupta wrote:
> > > On Tue, Mar 13, 2018 at 4:39 AM Michael Niedermayer <michael at niedermayer.cc>
> > > wrote:
> > >   
> > > > On Mon, Mar 12, 2018 at 06:49:19PM -0700, Aman Gupta wrote:  
> > > > > From: Aman Gupta <aman at tmm1.net>
> > > > >
> > > > > ---
> > > > >  libavcodec/h264_slice.c    |  5 +++--
> > > > >  libavcodec/mpeg12dec.c     | 12 +++++++-----
> > > > >  libavcodec/mpegvideo_enc.c |  3 ++-
> > > > >  3 files changed, 12 insertions(+), 8 deletions(-)  
> > > >
> > > > Iam a little bit confused, you write about "fixing" but not what this is
> > > > fixing and it appears there are several distinct types of changes  
> > > 
> > > 
> > > The type of error_count is already atomic_int. I don't know when that was
> > > changed.
> > > 
> > > The fix here is that these files do not compile on FreeBSD because of
> > > errors such as:
> > > 
> > > [2018-03-11 18:26:55.078686] [freebsd-x86_64] libavcodec/mpegvideo_enc.c:
> > > In function 'merge_context_after_encode':
> > > 
> > > [2018-03-11 18:26:55.081607] [freebsd-x86_64]
> > > libavcodec/mpegvideo_enc.c:3578:33: error: invalid operands to binary +
> > > (have 'atomic_int' and 'atomic_int')
> > > 
> > > 
> > > [2018-03-11 16:43:23.543072] [freebsd-x86_64] CC    libavcodec/mpeg12dec.o
> > > 
> > > [2018-03-11 16:43:23.768864] [freebsd-x86_64] libavcodec/mpeg12dec.c: In
> > > function 'slice_decode_thread':
> > >   
> > 
> > > [2018-03-11 16:43:23.769713] [freebsd-x86_64]
> > > libavcodec/mpeg12dec.c:1996:23: error: incompatible types when assigning to
> > > type 'atomic_int' from type 'int'  
> > 
> > what compiler is this ?
> >     6.5.16.1 Simple assignment
> >     Constraints
> >     One of the following shall hold: 114)
> >     — the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
> >     arithmetic type;
> > 
> > Please someone correct me here if iam wrong but
> > To me this sounds like doing normal arithmetic operations between atomic and
> > non atomic arithmetic types is allowed.
> 
> It's true that C11 atomics allow direct access, but we also have
> some atomic wrappers that won't work correctly then. I haven't checked
> why this one fails, but the gcc compat wrappers use non-atomic types for
> the emulation, so this patch is justified and necessary.

The wrappers should be fixed if they do not work.
If they cannot be fixed and cannot implement the C11 spec correctly they 
should not use the standard C11 types but choose differnt function and type
names. And document these limitations and differences in that new API


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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.
-------------- 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/20180314/c870a877/attachment.sig>


More information about the ffmpeg-devel mailing list