Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Thu, Oct 29, 2015 at 7:55 AM, Ganesh Ajjanagaddewrote: > On Thu, Oct 29, 2015 at 12:29 AM, Michael Niedermayer > wrote: > > On Wed, Oct 28, 2015 at 07:02:42PM -0400, Ganesh Ajjanagadde wrote: > >> On Wed, Oct 28, 2015 at 3:05 PM, Ronald S. Bultje > wrote: > >> > Hi, > >> > > >> > On Wed, Oct 28, 2015 at 2:46 PM, Ganesh Ajjanagadde < > gajjanaga...@gmail.com> > >> > wrote: > >> >> > >> >> On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultje < > rsbul...@gmail.com> > >> >> wrote: > >> >> > Hi, > >> >> > > >> >> > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde > >> >> > > >> >> > wrote: > >> >> >> > >> >> >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje < > rsbul...@gmail.com> > >> >> >> wrote: > >> >> >> > Hi, > >> >> >> > > >> >> >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje > >> >> >> >> > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje > >> >> >> >> >> > >> >> >> >> >> wrote: > >> >> >> >> >> > Hi, > >> >> >> >> >> > > >> >> >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > >> >> >> >> >> > > >> >> >> >> >> > wrote: > >> >> >> >> >> >> > >> >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje > >> >> >> >> >> >> > >> >> >> >> >> >> wrote: > >> >> >> >> >> >> > Hi, > >> >> >> >> >> >> > > >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > >> >> >> >> >> >> > wrote: > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> wrote: > >> >> >> >> >> >> >> > Hi, > >> >> >> >> >> >> >> > > >> >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > >> >> >> >> >> >> >> > > >> >> >> >> >> >> >> > wrote: > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of > int. > >> >> >> >> >> >> >> >> Thus > >> >> >> >> >> >> >> >> (for > >> >> >> >> >> >> >> >> instance) > >> >> >> >> >> >> >> >> 0x8000 > >> >> >> >> >> >> >> >> unfortunately does not work, and throws a warning > with > >> >> >> >> >> >> >> >> -Wpedantic > >> >> >> >> >> >> >> >> on > >> >> >> >> >> >> >> >> clang 3.7. > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> This fixes it by using alternative expressions that > >> >> >> >> >> >> >> >> result > >> >> >> >> >> >> >> >> in > >> >> >> >> >> >> >> >> identical > >> >> >> >> >> >> >> >> values but do not have this issue. > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> Tested with FATE. > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> --- > >> >> >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 > >> >> >> >> >> >> >> >> -- > >> >> >> >> >> >> >> >> libavformat/cinedec.c | 2 +- > >> >> >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- > >> >> >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> >> b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> >> index 3466b6b..6981cb8 100644 > >> >> >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> >> @@ -19,19 +19,17 @@ > >> >> >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> -enum DCASyncwords { > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> >> >> >> >> >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Thu, Oct 29, 2015 at 12:29 AM, Michael Niedermayerwrote: > On Wed, Oct 28, 2015 at 07:02:42PM -0400, Ganesh Ajjanagadde wrote: >> On Wed, Oct 28, 2015 at 3:05 PM, Ronald S. Bultje wrote: >> > Hi, >> > >> > On Wed, Oct 28, 2015 at 2:46 PM, Ganesh Ajjanagadde >> > >> > wrote: >> >> >> >> On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultje >> >> wrote: >> >> > Hi, >> >> > >> >> > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde >> >> > >> >> > wrote: >> >> >> >> >> >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde >> >> >> > wrote: >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> wrote: >> >> >> >> > Hi, >> >> >> >> > >> >> >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> > Hi, >> >> >> >> >> > >> >> >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde >> >> >> >> >> > >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> >> > Hi, >> >> >> >> >> >> > >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> >> >> > Hi, >> >> >> >> >> >> >> > >> >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> >> >> >> >> >> > >> >> >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. >> >> >> >> >> >> >> >> Thus >> >> >> >> >> >> >> >> (for >> >> >> >> >> >> >> >> instance) >> >> >> >> >> >> >> >> 0x8000 >> >> >> >> >> >> >> >> unfortunately does not work, and throws a warning with >> >> >> >> >> >> >> >> -Wpedantic >> >> >> >> >> >> >> >> on >> >> >> >> >> >> >> >> clang 3.7. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> This fixes it by using alternative expressions that >> >> >> >> >> >> >> >> result >> >> >> >> >> >> >> >> in >> >> >> >> >> >> >> >> identical >> >> >> >> >> >> >> >> values but do not have this issue. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> --- >> >> >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 >> >> >> >> >> >> >> >> -- >> >> >> >> >> >> >> >> libavformat/cinedec.c | 2 +- >> >> >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> >> b/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> >> index 3466b6b..6981cb8 100644 >> >> >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> >> @@ -19,19 +19,17 @@ >> >> >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -enum DCASyncwords { >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> >> >> >> >> >> -}; >> >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE >> >> >> >> >> >> >> >> 0x7FFE8001U >> >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE >> >> >> >> >> >> >> >> 0xFE7F0180U >> >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE >> >> >> >> >> >> >> >> 0x1FFFE800U >> >> >> >> >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagaddewrote: > On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje > wrote: > > Hi, > > > > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde < > gajjanaga...@gmail.com> > > wrote: > >> > >> ISO C restricts enumerator values to the range of int. Thus (for > instance) > >> 0x8000 > >> unfortunately does not work, and throws a warning with -Wpedantic on > >> clang 3.7. > >> > >> This fixes it by using alternative expressions that result in identical > >> values but do not have this issue. > >> > >> Tested with FATE. > >> > >> Signed-off-by: Ganesh Ajjanagadde > >> --- > >> libavcodec/dca_syncwords.h | 26 -- > >> libavformat/cinedec.c | 2 +- > >> libavformat/mov_chan.c | 2 +- > >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> > >> diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h > >> index 3466b6b..6981cb8 100644 > >> --- a/libavcodec/dca_syncwords.h > >> +++ b/libavcodec/dca_syncwords.h > >> @@ -19,19 +19,17 @@ > >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> #define AVCODEC_DCA_SYNCWORDS_H > >> > >> -enum DCASyncwords { > >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> -}; > >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U > >> +#defineDCA_SYNCWORD_X96 0x1D95F262U > >> +#defineDCA_SYNCWORD_XBR 0x655E315EU > >> +#defineDCA_SYNCWORD_LBR 0x0A801921U > >> +#defineDCA_SYNCWORD_XLL 0x41A29547U > >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > > > > > > This one is fine. > > > >> > >> --- a/libavformat/cinedec.c > >> +++ b/libavformat/cinedec.c > >> @@ -50,7 +50,7 @@ enum { > >> CFA_BAYER = 3, /**< GB/RG */ > >> CFA_BAYERFLIP = 4, /**< RG/GB */ > >> > >> -CFA_TLGRAY= 0x8000, > >> +CFA_TLGRAY= INT32_MIN, > >> CFA_TRGRAY= 0x4000, > >> CFA_BLGRAY= 0x2000, > >> CFA_BRGRAY= 0x1000 > >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c > >> index a2fa8d6..f6181e2 100644 > >> --- a/libavformat/mov_chan.c > >> +++ b/libavformat/mov_chan.c > >> @@ -45,7 +45,7 @@ > >> *do not specify a particular ordering of those channels." > >> */ > >> enum MovChannelLayoutTag { > >> -MOV_CH_LAYOUT_UNKNOWN = 0x, > >> +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), > >> MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, > >> MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, > >> MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, > >> -- > >> 2.6.2 > > > > > > I personally don't really like these... I think both obfuscate the > meaning > > of the flag values, particularly the first one. > > There is no real solution (recall apedec and the INT32_MIN final > solution), barring adding a comment signifying our intent (ie the > desired hex mask). I can do this if you think it helps. The solution is to not care about ISO C if it doesn't fix real issues. :) Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultjewrote: > Hi, > > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > wrote: >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> > >> > wrote: >> >> >> >> ISO C restricts enumerator values to the range of int. Thus (for >> >> instance) >> >> 0x8000 >> >> unfortunately does not work, and throws a warning with -Wpedantic on >> >> clang 3.7. >> >> >> >> This fixes it by using alternative expressions that result in identical >> >> values but do not have this issue. >> >> >> >> Tested with FATE. >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> --- >> >> libavcodec/dca_syncwords.h | 26 -- >> >> libavformat/cinedec.c | 2 +- >> >> libavformat/mov_chan.c | 2 +- >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h >> >> index 3466b6b..6981cb8 100644 >> >> --- a/libavcodec/dca_syncwords.h >> >> +++ b/libavcodec/dca_syncwords.h >> >> @@ -19,19 +19,17 @@ >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> -enum DCASyncwords { >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> -}; >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U >> > >> > >> > This one is fine. >> > >> >> >> >> --- a/libavformat/cinedec.c >> >> +++ b/libavformat/cinedec.c >> >> @@ -50,7 +50,7 @@ enum { >> >> CFA_BAYER = 3, /**< GB/RG */ >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> >> >> -CFA_TLGRAY= 0x8000, >> >> +CFA_TLGRAY= INT32_MIN, >> >> CFA_TRGRAY= 0x4000, >> >> CFA_BLGRAY= 0x2000, >> >> CFA_BRGRAY= 0x1000 >> >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c >> >> index a2fa8d6..f6181e2 100644 >> >> --- a/libavformat/mov_chan.c >> >> +++ b/libavformat/mov_chan.c >> >> @@ -45,7 +45,7 @@ >> >> *do not specify a particular ordering of those channels." >> >> */ >> >> enum MovChannelLayoutTag { >> >> -MOV_CH_LAYOUT_UNKNOWN = 0x, >> >> +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), >> >> MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, >> >> MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, >> >> MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, >> >> -- >> >> 2.6.2 >> > >> > >> > I personally don't really like these... I think both obfuscate the >> > meaning >> > of the flag values, particularly the first one. >> >> There is no real solution (recall apedec and the INT32_MIN final >> solution), barring adding a comment signifying our intent (ie the >> desired hex mask). I can do this if you think it helps. > > > The solution is to not care about ISO C if it doesn't fix real issues. :) This is where we will just have to agree to disagree, I consider this issue "real enough" - it is a violation of the standard, and POSIX says nothing contrariwise unlike the function pointer/data pointer thing. > > Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultjewrote: > Hi, > > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > wrote: >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> > wrote: >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> wrote: >> >> > Hi, >> >> > >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> > >> >> > wrote: >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. Thus (for >> >> >> instance) >> >> >> 0x8000 >> >> >> unfortunately does not work, and throws a warning with -Wpedantic on >> >> >> clang 3.7. >> >> >> >> >> >> This fixes it by using alternative expressions that result in >> >> >> identical >> >> >> values but do not have this issue. >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> --- >> >> >> libavcodec/dca_syncwords.h | 26 -- >> >> >> libavformat/cinedec.c | 2 +- >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h >> >> >> index 3466b6b..6981cb8 100644 >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> @@ -19,19 +19,17 @@ >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> -enum DCASyncwords { >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> -}; >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U >> >> > >> >> > >> >> > This one is fine. >> >> > >> >> >> >> >> >> --- a/libavformat/cinedec.c >> >> >> +++ b/libavformat/cinedec.c >> >> >> @@ -50,7 +50,7 @@ enum { >> >> >> CFA_BAYER = 3, /**< GB/RG */ >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> >> >> >> >> -CFA_TLGRAY= 0x8000, >> >> >> +CFA_TLGRAY= INT32_MIN, >> >> >> CFA_TRGRAY= 0x4000, >> >> >> CFA_BLGRAY= 0x2000, >> >> >> CFA_BRGRAY= 0x1000 >> >> >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c >> >> >> index a2fa8d6..f6181e2 100644 >> >> >> --- a/libavformat/mov_chan.c >> >> >> +++ b/libavformat/mov_chan.c >> >> >> @@ -45,7 +45,7 @@ >> >> >> *do not specify a particular ordering of those >> >> >> channels." >> >> >> */ >> >> >> enum MovChannelLayoutTag { >> >> >> -MOV_CH_LAYOUT_UNKNOWN = 0x, >> >> >> +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), >> >> >> MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, >> >> >> MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, >> >> >> MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, >> >> >> -- >> >> >> 2.6.2 >> >> > >> >> > >> >> > I personally don't really like these... I think both obfuscate the >> >> > meaning >> >> > of the flag values, particularly the first one. >> >> >> >> There is no real solution (recall apedec and the INT32_MIN final >> >> solution), barring adding a comment signifying our intent (ie the >> >> desired hex mask). I can do this if you think it helps. >> > >> > >> > The solution is to not care about ISO C if it doesn't fix real issues. >> > :) >> >> This is where we will just have to agree to disagree, I consider this >> issue "real enough" - it is a violation of the standard, and POSIX >> says nothing
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagaddewrote: > On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje > wrote: > > Hi, > > > > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde < > gajjanaga...@gmail.com> > > wrote: > >> > >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje > >> wrote: > >> > Hi, > >> > > >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > >> > wrote: > >> >> > >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje < > rsbul...@gmail.com> > >> >> wrote: > >> >> > Hi, > >> >> > > >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > >> >> > > >> >> > wrote: > >> >> >> > >> >> >> ISO C restricts enumerator values to the range of int. Thus (for > >> >> >> instance) > >> >> >> 0x8000 > >> >> >> unfortunately does not work, and throws a warning with -Wpedantic > on > >> >> >> clang 3.7. > >> >> >> > >> >> >> This fixes it by using alternative expressions that result in > >> >> >> identical > >> >> >> values but do not have this issue. > >> >> >> > >> >> >> Tested with FATE. > >> >> >> > >> >> >> Signed-off-by: Ganesh Ajjanagadde > >> >> >> --- > >> >> >> libavcodec/dca_syncwords.h | 26 -- > >> >> >> libavformat/cinedec.c | 2 +- > >> >> >> libavformat/mov_chan.c | 2 +- > >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> >> >> > >> >> >> diff --git a/libavcodec/dca_syncwords.h > b/libavcodec/dca_syncwords.h > >> >> >> index 3466b6b..6981cb8 100644 > >> >> >> --- a/libavcodec/dca_syncwords.h > >> >> >> +++ b/libavcodec/dca_syncwords.h > >> >> >> @@ -19,19 +19,17 @@ > >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> >> >> #define AVCODEC_DCA_SYNCWORDS_H > >> >> >> > >> >> >> -enum DCASyncwords { > >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> >> >> -}; > >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U > >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U > >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU > >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U > >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U > >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > >> >> > > >> >> > > >> >> > This one is fine. > >> >> > > >> >> >> > >> >> >> --- a/libavformat/cinedec.c > >> >> >> +++ b/libavformat/cinedec.c > >> >> >> @@ -50,7 +50,7 @@ enum { > >> >> >> CFA_BAYER = 3, /**< GB/RG */ > >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ > >> >> >> > >> >> >> -CFA_TLGRAY= 0x8000, > >> >> >> +CFA_TLGRAY= INT32_MIN, > >> >> >> CFA_TRGRAY= 0x4000, > >> >> >> CFA_BLGRAY= 0x2000, > >> >> >> CFA_BRGRAY= 0x1000 > >> >> >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c > >> >> >> index a2fa8d6..f6181e2 100644 > >> >> >> --- a/libavformat/mov_chan.c > >> >> >> +++ b/libavformat/mov_chan.c > >> >> >> @@ -45,7 +45,7 @@ > >> >> >> *do not specify a particular ordering of those > >> >> >> channels." > >> >> >> */ > >> >> >> enum MovChannelLayoutTag { > >> >> >> -MOV_CH_LAYOUT_UNKNOWN = 0x, > >> >> >> +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), > >> >> >> MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, > >> >> >> MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, > >> >> >> MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, > >> >> >> -- > >> >> >> 2.6.2 > >> >> > > >> >> > > >> >> > I personally don't really like these... I think both obfuscate the > >> >> > meaning > >> >> > of the flag values, particularly the first one. > >> >> > >> >> There is no real solution (recall apedec and the INT32_MIN final > >> >> solution), barring adding a comment signifying our
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 10:34:37AM -0400, Ronald S. Bultje wrote: [...] > You could do the same for the last 4 values of the cinething changes, they > are clearly not enums, but flags. Flags are always unsigned, so if enums > are unsigned and that causes an issue (as it does here), it makes sense to > fix that at its root, i.e. by making the value unsigned and it thus also > being a macro instead of an enum. Again, only the last 4 elements, the > first 5 appear to be genuine enums. I support this (or just remove the entries altogether since unused). -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultjewrote: > Hi, > > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde > wrote: >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde >> > wrote: >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje >> >> wrote: >> >> > Hi, >> >> > >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde >> >> > >> >> > wrote: >> >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> >> >> >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> >> >> > wrote: >> >> >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> >> >> >> >> >> >> wrote: >> >> >> >> > Hi, >> >> >> >> > >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> >> >> > >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. Thus >> >> >> >> >> (for >> >> >> >> >> instance) >> >> >> >> >> 0x8000 >> >> >> >> >> unfortunately does not work, and throws a warning with >> >> >> >> >> -Wpedantic >> >> >> >> >> on >> >> >> >> >> clang 3.7. >> >> >> >> >> >> >> >> >> >> This fixes it by using alternative expressions that result in >> >> >> >> >> identical >> >> >> >> >> values but do not have this issue. >> >> >> >> >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> >> >> --- >> >> >> >> >> libavcodec/dca_syncwords.h | 26 -- >> >> >> >> >> libavformat/cinedec.c | 2 +- >> >> >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h >> >> >> >> >> b/libavcodec/dca_syncwords.h >> >> >> >> >> index 3466b6b..6981cb8 100644 >> >> >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> >> >> @@ -19,19 +19,17 @@ >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> >> >> >> -enum DCASyncwords { >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> >> >> -}; >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> >> >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> >> >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> >> >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> >> >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> >> >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> >> >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U >> >> >> >> > >> >> >> >> > >> >> >> >> > This one is fine. >> >> >> >> > >> >> >> >> >> >> >> >> >> >> --- a/libavformat/cinedec.c >> >> >> >> >> +++ b/libavformat/cinedec.c >> >> >> >> >> @@ -50,7 +50,7 @@ enum { >> >> >> >> >> CFA_BAYER = 3, /**< GB/RG */ >> >> >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> >> >> >> >> >> >> >> >> -CFA_TLGRAY= 0x8000, >> >> >> >> >> +CFA_TLGRAY= INT32_MIN, >> >> >> >> >> CFA_TRGRAY= 0x4000, >> >> >> >> >> CFA_BLGRAY= 0x2000, >> >> >> >> >> CFA_BRGRAY= 0x1000 >> >> >> >> >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c >> >> >> >> >> index a2fa8d6..f6181e2 100644 >> >> >> >> >> --- a/libavformat/mov_chan.c >> >> >> >> >> +++ b/libavformat/mov_chan.c >> >> >> >> >> @@ -45,7 +45,7 @@ >> >> >> >> >> *do not specify a particular ordering of those >> >> >> >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 11:33 AM, Hendrik Leppkeswrote: > On Wed, Oct 28, 2015 at 4:00 PM, Ganesh Ajjanagadde > wrote: >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje >> wrote: >>> Hi, >>> >>> On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde >>> wrote: On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje wrote: > Hi, > > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > > wrote: >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> > wrote: >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> >> >> wrote: >> >> > Hi, >> >> > >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> > >> >> > wrote: >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. Thus (for >> >> >> instance) >> >> >> 0x8000 >> >> >> unfortunately does not work, and throws a warning with -Wpedantic >> >> >> on >> >> >> clang 3.7. >> >> >> >> >> >> This fixes it by using alternative expressions that result in >> >> >> identical >> >> >> values but do not have this issue. >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> --- >> >> >> libavcodec/dca_syncwords.h | 26 -- >> >> >> libavformat/cinedec.c | 2 +- >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h >> >> >> b/libavcodec/dca_syncwords.h >> >> >> index 3466b6b..6981cb8 100644 >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> @@ -19,19 +19,17 @@ >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> -enum DCASyncwords { >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> -}; >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U >> >> > >> >> > >> >> > This one is fine. >> >> > >> >> >> >> >> >> --- a/libavformat/cinedec.c >> >> >> +++ b/libavformat/cinedec.c >> >> >> @@ -50,7 +50,7 @@ enum { >> >> >> CFA_BAYER = 3, /**< GB/RG */ >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> >> >> >> >> -CFA_TLGRAY= 0x8000, >> >> >> +CFA_TLGRAY= INT32_MIN, >> >> >> CFA_TRGRAY= 0x4000, >> >> >> CFA_BLGRAY= 0x2000, >> >> >> CFA_BRGRAY= 0x1000 >> >> >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c >> >> >> index a2fa8d6..f6181e2 100644 >> >> >> --- a/libavformat/mov_chan.c >> >> >> +++ b/libavformat/mov_chan.c >> >> >> @@ -45,7 +45,7 @@ >> >> >> *do not specify a particular ordering of those >> >> >> channels." >> >> >> */ >> >> >> enum MovChannelLayoutTag { >> >> >> -MOV_CH_LAYOUT_UNKNOWN = 0x, >> >> >> +
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 11:44 AM, Clément Bœschwrote: > On Wed, Oct 28, 2015 at 10:34:37AM -0400, Ronald S. Bultje wrote: > [...] >> You could do the same for the last 4 values of the cinething changes, they >> are clearly not enums, but flags. Flags are always unsigned, so if enums >> are unsigned and that causes an issue (as it does here), it makes sense to >> fix that at its root, i.e. by making the value unsigned and it thus also >> being a macro instead of an enum. Again, only the last 4 elements, the >> first 5 appear to be genuine enums. > > I support this (or just remove the entries altogether since unused). I will change this, only issue of contention is the mov_chan one for which I still feel my solution is better than proposed alternatives. > > -- > Clément B. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagaddewrote: > On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje > wrote: > > Hi, > > > > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde > > wrote: > >> > >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje > >> wrote: > >> > Hi, > >> > > >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde > >> > wrote: > >> >> > >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje < > rsbul...@gmail.com> > >> >> wrote: > >> >> > Hi, > >> >> > > >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > >> >> > > >> >> > wrote: > >> >> >> > >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje > >> >> >> > >> >> >> wrote: > >> >> >> > Hi, > >> >> >> > > >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje > >> >> >> >> > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > >> >> >> >> > > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> ISO C restricts enumerator values to the range of int. Thus > >> >> >> >> >> (for > >> >> >> >> >> instance) > >> >> >> >> >> 0x8000 > >> >> >> >> >> unfortunately does not work, and throws a warning with > >> >> >> >> >> -Wpedantic > >> >> >> >> >> on > >> >> >> >> >> clang 3.7. > >> >> >> >> >> > >> >> >> >> >> This fixes it by using alternative expressions that result > in > >> >> >> >> >> identical > >> >> >> >> >> values but do not have this issue. > >> >> >> >> >> > >> >> >> >> >> Tested with FATE. > >> >> >> >> >> > >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde > >> >> >> >> >> --- > >> >> >> >> >> libavcodec/dca_syncwords.h | 26 -- > >> >> >> >> >> libavformat/cinedec.c | 2 +- > >> >> >> >> >> libavformat/mov_chan.c | 2 +- > >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> >> >> >> >> > >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h > >> >> >> >> >> b/libavcodec/dca_syncwords.h > >> >> >> >> >> index 3466b6b..6981cb8 100644 > >> >> >> >> >> --- a/libavcodec/dca_syncwords.h > >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h > >> >> >> >> >> @@ -19,19 +19,17 @@ > >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> > >> >> >> >> >> -enum DCASyncwords { > >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> >> >> >> >> -}; > >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > >> >> >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > >> >> >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U > >> >> >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U > >> >> >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU > >> >> >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U > >> >> >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U > >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > This one is fine. > >> >> >> >> > > >> >> >> >> >> > >> >> >> >> >> --- a/libavformat/cinedec.c > >> >> >> >> >> +++ b/libavformat/cinedec.c > >> >> >> >> >> @@ -50,7 +50,7 @@ enum { > >> >> >> >> >> CFA_BAYER = 3, /**< GB/RG */ > >> >> >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ > >> >> >> >> >> > >> >> >> >> >> -CFA_TLGRAY= 0x8000, > >> >> >> >> >> +CFA_TLGRAY= INT32_MIN, > >> >> >> >> >> CFA_TRGRAY= 0x4000, > >> >> >> >> >> CFA_BLGRAY= 0x2000, > >> >> >> >> >> CFA_BRGRAY= 0x1000 > >> >> >> >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultjewrote: > Hi, > > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde > wrote: >> >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde >> > wrote: >> >> >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje >> >> wrote: >> >> > Hi, >> >> > >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde >> >> > wrote: >> >> >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje >> >> >> >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> wrote: >> >> >> >> > Hi, >> >> >> >> > >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> > Hi, >> >> >> >> >> > >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> >> >> >> > >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. Thus >> >> >> >> >> >> (for >> >> >> >> >> >> instance) >> >> >> >> >> >> 0x8000 >> >> >> >> >> >> unfortunately does not work, and throws a warning with >> >> >> >> >> >> -Wpedantic >> >> >> >> >> >> on >> >> >> >> >> >> clang 3.7. >> >> >> >> >> >> >> >> >> >> >> >> This fixes it by using alternative expressions that result >> >> >> >> >> >> in >> >> >> >> >> >> identical >> >> >> >> >> >> values but do not have this issue. >> >> >> >> >> >> >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> >> >> >> --- >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 -- >> >> >> >> >> >> libavformat/cinedec.c | 2 +- >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h >> >> >> >> >> >> b/libavcodec/dca_syncwords.h >> >> >> >> >> >> index 3466b6b..6981cb8 100644 >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> >> >> >> @@ -19,19 +19,17 @@ >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> >> >> >> >> >> -enum DCASyncwords { >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> >> >> >> -}; >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> >> >> >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> >> >> >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> >> >> >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> >> >> >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> >> >> >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> >> >> >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > This one is fine. >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> --- a/libavformat/cinedec.c >> >> >> >> >> >> +++ b/libavformat/cinedec.c >> >> >> >> >> >> @@ -50,7 +50,7 @@ enum { >> >> >> >> >> >> CFA_BAYER = 3, /**< GB/RG */ >> >> >> >> >> >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> >> >> >> >> >> >> >> >> >> >> -CFA_TLGRAY=
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Wed, Oct 28, 2015 at 2:46 PM, Ganesh Ajjanagaddewrote: > On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultje > wrote: > > Hi, > > > > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde < > gajjanaga...@gmail.com> > > wrote: > >> > >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje > >> wrote: > >> > Hi, > >> > > >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde > >> > wrote: > >> >> > >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje < > rsbul...@gmail.com> > >> >> wrote: > >> >> > Hi, > >> >> > > >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde > >> >> > wrote: > >> >> >> > >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje > >> >> >> > >> >> >> wrote: > >> >> >> > Hi, > >> >> >> > > >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > >> >> >> > > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje > >> >> >> >> > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje > >> >> >> >> >> > >> >> >> >> >> wrote: > >> >> >> >> >> > Hi, > >> >> >> >> >> > > >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > >> >> >> >> >> > > >> >> >> >> >> > wrote: > >> >> >> >> >> >> > >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. > Thus > >> >> >> >> >> >> (for > >> >> >> >> >> >> instance) > >> >> >> >> >> >> 0x8000 > >> >> >> >> >> >> unfortunately does not work, and throws a warning with > >> >> >> >> >> >> -Wpedantic > >> >> >> >> >> >> on > >> >> >> >> >> >> clang 3.7. > >> >> >> >> >> >> > >> >> >> >> >> >> This fixes it by using alternative expressions that > result > >> >> >> >> >> >> in > >> >> >> >> >> >> identical > >> >> >> >> >> >> values but do not have this issue. > >> >> >> >> >> >> > >> >> >> >> >> >> Tested with FATE. > >> >> >> >> >> >> > >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde < > gajjanaga...@gmail.com> > >> >> >> >> >> >> --- > >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 > -- > >> >> >> >> >> >> libavformat/cinedec.c | 2 +- > >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- > >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> >> >> >> >> >> > >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> index 3466b6b..6981cb8 100644 > >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> @@ -19,19 +19,17 @@ > >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> > >> >> >> >> >> >> -enum DCASyncwords { > >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> >> >> >> >> >> -}; > >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > >> >> >> >> >> >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_X96 0x1D95F262U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_XBR 0x655E315EU > >> >> >> >> >> >> +#defineDCA_SYNCWORD_LBR 0x0A801921U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_XLL 0x41A29547U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > >> >> >> >> >> >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > >> >> >> >> >> > > >> >> >> >> >> > > >> >> >> >> >> > This one is fine. > >> >> >> >> >> > > >> >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 07:02:42PM -0400, Ganesh Ajjanagadde wrote: > On Wed, Oct 28, 2015 at 3:05 PM, Ronald S. Bultjewrote: > > Hi, > > > > On Wed, Oct 28, 2015 at 2:46 PM, Ganesh Ajjanagadde > > wrote: > >> > >> On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultje > >> wrote: > >> > Hi, > >> > > >> > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde > >> > > >> > wrote: > >> >> > >> >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje > >> >> wrote: > >> >> > Hi, > >> >> > > >> >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde > >> >> > wrote: > >> >> >> > >> >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje > >> >> >> > >> >> >> wrote: > >> >> >> > Hi, > >> >> >> > > >> >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje > >> >> >> >> > >> >> >> >> wrote: > >> >> >> >> > Hi, > >> >> >> >> > > >> >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde > >> >> >> >> > > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje > >> >> >> >> >> > >> >> >> >> >> wrote: > >> >> >> >> >> > Hi, > >> >> >> >> >> > > >> >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde > >> >> >> >> >> > wrote: > >> >> >> >> >> >> > >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje > >> >> >> >> >> >> > >> >> >> >> >> >> wrote: > >> >> >> >> >> >> > Hi, > >> >> >> >> >> >> > > >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > >> >> >> >> >> >> > > >> >> >> >> >> >> > wrote: > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. > >> >> >> >> >> >> >> Thus > >> >> >> >> >> >> >> (for > >> >> >> >> >> >> >> instance) > >> >> >> >> >> >> >> 0x8000 > >> >> >> >> >> >> >> unfortunately does not work, and throws a warning with > >> >> >> >> >> >> >> -Wpedantic > >> >> >> >> >> >> >> on > >> >> >> >> >> >> >> clang 3.7. > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> This fixes it by using alternative expressions that > >> >> >> >> >> >> >> result > >> >> >> >> >> >> >> in > >> >> >> >> >> >> >> identical > >> >> >> >> >> >> >> values but do not have this issue. > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> Tested with FATE. > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> --- > >> >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 > >> >> >> >> >> >> >> -- > >> >> >> >> >> >> >> libavformat/cinedec.c | 2 +- > >> >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- > >> >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> index 3466b6b..6981cb8 100644 > >> >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h > >> >> >> >> >> >> >> @@ -19,19 +19,17 @@ > >> >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H > >> >> >> >> >> >> >> > >> >> >> >> >> >> >> -enum DCASyncwords { > >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > >> >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, > >> >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > >> >> >> >> >> >> >> -}; > >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE > >> >> >> >> >> >> >> 0x7FFE8001U > >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE > >> >> >> >> >> >> >> 0xFE7F0180U > >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE > >> >> >> >> >> >> >> 0x1FFFE800U > >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE > >> >> >> >> >> >> >> 0xFF1F00E8U > >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_XCH > >> >> >> >> >> >> >> 0x5A5A5A5AU > >> >> >> >> >> >> >> +#define
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Wed, Oct 28, 2015 at 3:05 PM, Ronald S. Bultjewrote: > Hi, > > On Wed, Oct 28, 2015 at 2:46 PM, Ganesh Ajjanagadde > wrote: >> >> On Wed, Oct 28, 2015 at 2:39 PM, Ronald S. Bultje >> wrote: >> > Hi, >> > >> > On Wed, Oct 28, 2015 at 2:31 PM, Ganesh Ajjanagadde >> > >> > wrote: >> >> >> >> On Wed, Oct 28, 2015 at 11:38 AM, Ronald S. Bultje >> >> wrote: >> >> > Hi, >> >> > >> >> > On Wed, Oct 28, 2015 at 11:00 AM, Ganesh Ajjanagadde >> >> > wrote: >> >> >> >> >> >> On Wed, Oct 28, 2015 at 10:53 AM, Ronald S. Bultje >> >> >> >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > On Wed, Oct 28, 2015 at 10:48 AM, Ganesh Ajjanagadde >> >> >> > wrote: >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 10:34 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> wrote: >> >> >> >> > Hi, >> >> >> >> > >> >> >> >> > On Wed, Oct 28, 2015 at 8:20 AM, Ganesh Ajjanagadde >> >> >> >> > >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> On Wed, Oct 28, 2015 at 7:00 AM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> > Hi, >> >> >> >> >> > >> >> >> >> >> > On Tue, Oct 27, 2015 at 10:58 PM, Ganesh Ajjanagadde >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultje >> >> >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >> >> > Hi, >> >> >> >> >> >> > >> >> >> >> >> >> > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde >> >> >> >> >> >> > >> >> >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> >> ISO C restricts enumerator values to the range of int. >> >> >> >> >> >> >> Thus >> >> >> >> >> >> >> (for >> >> >> >> >> >> >> instance) >> >> >> >> >> >> >> 0x8000 >> >> >> >> >> >> >> unfortunately does not work, and throws a warning with >> >> >> >> >> >> >> -Wpedantic >> >> >> >> >> >> >> on >> >> >> >> >> >> >> clang 3.7. >> >> >> >> >> >> >> >> >> >> >> >> >> >> This fixes it by using alternative expressions that >> >> >> >> >> >> >> result >> >> >> >> >> >> >> in >> >> >> >> >> >> >> identical >> >> >> >> >> >> >> values but do not have this issue. >> >> >> >> >> >> >> >> >> >> >> >> >> >> Tested with FATE. >> >> >> >> >> >> >> >> >> >> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde >> >> >> >> >> >> >> >> >> >> >> >> >> >> --- >> >> >> >> >> >> >> libavcodec/dca_syncwords.h | 26 >> >> >> >> >> >> >> -- >> >> >> >> >> >> >> libavformat/cinedec.c | 2 +- >> >> >> >> >> >> >> libavformat/mov_chan.c | 2 +- >> >> >> >> >> >> >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> >> >> >> >> >> >> >> >> >> >> >> >> diff --git a/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> b/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> index 3466b6b..6981cb8 100644 >> >> >> >> >> >> >> --- a/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> +++ b/libavcodec/dca_syncwords.h >> >> >> >> >> >> >> @@ -19,19 +19,17 @@ >> >> >> >> >> >> >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> #define AVCODEC_DCA_SYNCWORDS_H >> >> >> >> >> >> >> >> >> >> >> >> >> >> -enum DCASyncwords { >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> >> >> >> >> >> >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> >> >> >> >> >> >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> >> >> >> >> >> >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> >> >> >> >> >> >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> >> >> >> >> >> >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> >> >> >> >> >> >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> >> >> >> >> >> >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> >> >> >> >> >> >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> >> >> >> >> >> >> -}; >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_BE >> >> >> >> >> >> >> 0x7FFE8001U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_LE >> >> >> >> >> >> >> 0xFE7F0180U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_BE >> >> >> >> >> >> >> 0x1FFFE800U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_CORE_14B_LE >> >> >> >> >> >> >> 0xFF1F00E8U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_XCH >> >> >> >> >> >> >> 0x5A5A5A5AU >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_XXCH >> >> >> >> >> >> >> 0x47004A03U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_X96 >> >> >> >> >> >> >> 0x1D95F262U >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_XBR >> >> >> >> >> >> >> 0x655E315EU >> >> >> >> >> >> >> +#defineDCA_SYNCWORD_LBR >> >> >> >> >> >> >> 0x0A801921U >> >>
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Tue, 27 Oct 2015 20:53:39 -0400 Ganesh Ajjanagaddewrote: > ISO C restricts enumerator values to the range of int. Thus (for instance) > 0x8000 > unfortunately does not work, and throws a warning with -Wpedantic on > clang 3.7. > > This fixes it by using alternative expressions that result in identical > values but do not have this issue. > > Tested with FATE. > > Signed-off-by: Ganesh Ajjanagadde > --- > libavcodec/dca_syncwords.h | 26 -- > libavformat/cinedec.c | 2 +- > libavformat/mov_chan.c | 2 +- > 3 files changed, 14 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h > index 3466b6b..6981cb8 100644 > --- a/libavcodec/dca_syncwords.h > +++ b/libavcodec/dca_syncwords.h > @@ -19,19 +19,17 @@ > #ifndef AVCODEC_DCA_SYNCWORDS_H > #define AVCODEC_DCA_SYNCWORDS_H > > -enum DCASyncwords { > -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > -DCA_SYNCWORD_XXCH = 0x47004A03U, > -DCA_SYNCWORD_X96= 0x1D95F262U, > -DCA_SYNCWORD_XBR= 0x655E315EU, > -DCA_SYNCWORD_LBR= 0x0A801921U, > -DCA_SYNCWORD_XLL= 0x41A29547U, > -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > -}; > +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > +#defineDCA_SYNCWORD_XXCH 0x47004A03U > +#defineDCA_SYNCWORD_X96 0x1D95F262U > +#defineDCA_SYNCWORD_XBR 0x655E315EU > +#defineDCA_SYNCWORD_LBR 0x0A801921U > +#defineDCA_SYNCWORD_XLL 0x41A29547U > +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > > #endif /* AVCODEC_DCA_SYNCWORDS_H */ > diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c > index 632f46c..d030907 100644 > --- a/libavformat/cinedec.c > +++ b/libavformat/cinedec.c > @@ -50,7 +50,7 @@ enum { > CFA_BAYER = 3, /**< GB/RG */ > CFA_BAYERFLIP = 4, /**< RG/GB */ > > -CFA_TLGRAY= 0x8000, > +CFA_TLGRAY= INT32_MIN, > CFA_TRGRAY= 0x4000, > CFA_BLGRAY= 0x2000, > CFA_BRGRAY= 0x1000 > diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c > index a2fa8d6..f6181e2 100644 > --- a/libavformat/mov_chan.c > +++ b/libavformat/mov_chan.c > @@ -45,7 +45,7 @@ > *do not specify a particular ordering of those channels." > */ > enum MovChannelLayoutTag { > -MOV_CH_LAYOUT_UNKNOWN = 0x, > +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), > MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, > MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, > MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, Looks all kinds of backwards. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
ISO C restricts enumerator values to the range of int. Thus (for instance) 0x8000 unfortunately does not work, and throws a warning with -Wpedantic on clang 3.7. This fixes it by using alternative expressions that result in identical values but do not have this issue. Tested with FATE. Signed-off-by: Ganesh Ajjanagadde--- libavcodec/dca_syncwords.h | 26 -- libavformat/cinedec.c | 2 +- libavformat/mov_chan.c | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h index 3466b6b..6981cb8 100644 --- a/libavcodec/dca_syncwords.h +++ b/libavcodec/dca_syncwords.h @@ -19,19 +19,17 @@ #ifndef AVCODEC_DCA_SYNCWORDS_H #define AVCODEC_DCA_SYNCWORDS_H -enum DCASyncwords { -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, -DCA_SYNCWORD_XXCH = 0x47004A03U, -DCA_SYNCWORD_X96= 0x1D95F262U, -DCA_SYNCWORD_XBR= 0x655E315EU, -DCA_SYNCWORD_LBR= 0x0A801921U, -DCA_SYNCWORD_XLL= 0x41A29547U, -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, -}; +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU +#defineDCA_SYNCWORD_XXCH 0x47004A03U +#defineDCA_SYNCWORD_X96 0x1D95F262U +#defineDCA_SYNCWORD_XBR 0x655E315EU +#defineDCA_SYNCWORD_LBR 0x0A801921U +#defineDCA_SYNCWORD_XLL 0x41A29547U +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U #endif /* AVCODEC_DCA_SYNCWORDS_H */ diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c index 632f46c..d030907 100644 --- a/libavformat/cinedec.c +++ b/libavformat/cinedec.c @@ -50,7 +50,7 @@ enum { CFA_BAYER = 3, /**< GB/RG */ CFA_BAYERFLIP = 4, /**< RG/GB */ -CFA_TLGRAY= 0x8000, +CFA_TLGRAY= INT32_MIN, CFA_TRGRAY= 0x4000, CFA_BLGRAY= 0x2000, CFA_BRGRAY= 0x1000 diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index a2fa8d6..f6181e2 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -45,7 +45,7 @@ *do not specify a particular ordering of those channels." */ enum MovChannelLayoutTag { -MOV_CH_LAYOUT_UNKNOWN = 0x, +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Tue, Oct 27, 2015 at 08:53:39PM -0400, Ganesh Ajjanagadde wrote: > ISO C restricts enumerator values to the range of int. Thus (for instance) > 0x8000 > unfortunately does not work, and throws a warning with -Wpedantic on > clang 3.7. > > This fixes it by using alternative expressions that result in identical > values but do not have this issue. > > Tested with FATE. > > Signed-off-by: Ganesh Ajjanagadde> --- > libavcodec/dca_syncwords.h | 26 -- > libavformat/cinedec.c | 2 +- > libavformat/mov_chan.c | 2 +- > 3 files changed, 14 insertions(+), 16 deletions(-) LGTM (good in the sense of fixing the issue not neccessrily good as in pretty) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
Hi, On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagaddewrote: > ISO C restricts enumerator values to the range of int. Thus (for instance) > 0x8000 > unfortunately does not work, and throws a warning with -Wpedantic on > clang 3.7. > > This fixes it by using alternative expressions that result in identical > values but do not have this issue. > > Tested with FATE. > > Signed-off-by: Ganesh Ajjanagadde > --- > libavcodec/dca_syncwords.h | 26 -- > libavformat/cinedec.c | 2 +- > libavformat/mov_chan.c | 2 +- > 3 files changed, 14 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h > index 3466b6b..6981cb8 100644 > --- a/libavcodec/dca_syncwords.h > +++ b/libavcodec/dca_syncwords.h > @@ -19,19 +19,17 @@ > #ifndef AVCODEC_DCA_SYNCWORDS_H > #define AVCODEC_DCA_SYNCWORDS_H > > -enum DCASyncwords { > -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, > -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, > -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, > -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, > -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, > -DCA_SYNCWORD_XXCH = 0x47004A03U, > -DCA_SYNCWORD_X96= 0x1D95F262U, > -DCA_SYNCWORD_XBR= 0x655E315EU, > -DCA_SYNCWORD_LBR= 0x0A801921U, > -DCA_SYNCWORD_XLL= 0x41A29547U, > -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, > -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, > -}; > +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U > +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U > +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U > +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U > +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU > +#defineDCA_SYNCWORD_XXCH 0x47004A03U > +#defineDCA_SYNCWORD_X96 0x1D95F262U > +#defineDCA_SYNCWORD_XBR 0x655E315EU > +#defineDCA_SYNCWORD_LBR 0x0A801921U > +#defineDCA_SYNCWORD_XLL 0x41A29547U > +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U > +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > This one is fine. > --- a/libavformat/cinedec.c > +++ b/libavformat/cinedec.c > @@ -50,7 +50,7 @@ enum { > CFA_BAYER = 3, /**< GB/RG */ > CFA_BAYERFLIP = 4, /**< RG/GB */ > > -CFA_TLGRAY= 0x8000, > +CFA_TLGRAY= INT32_MIN, > CFA_TRGRAY= 0x4000, > CFA_BLGRAY= 0x2000, > CFA_BRGRAY= 0x1000 > diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c > index a2fa8d6..f6181e2 100644 > --- a/libavformat/mov_chan.c > +++ b/libavformat/mov_chan.c > @@ -45,7 +45,7 @@ > *do not specify a particular ordering of those channels." > */ > enum MovChannelLayoutTag { > -MOV_CH_LAYOUT_UNKNOWN = 0x, > +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), > MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, > MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, > MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, > -- > 2.6.2 I personally don't really like these... I think both obfuscate the meaning of the flag values, particularly the first one. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] all: fix enum definition for large values
On Tue, Oct 27, 2015 at 10:41 PM, Ronald S. Bultjewrote: > Hi, > > On Tue, Oct 27, 2015 at 8:53 PM, Ganesh Ajjanagadde > wrote: >> >> ISO C restricts enumerator values to the range of int. Thus (for instance) >> 0x8000 >> unfortunately does not work, and throws a warning with -Wpedantic on >> clang 3.7. >> >> This fixes it by using alternative expressions that result in identical >> values but do not have this issue. >> >> Tested with FATE. >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavcodec/dca_syncwords.h | 26 -- >> libavformat/cinedec.c | 2 +- >> libavformat/mov_chan.c | 2 +- >> 3 files changed, 14 insertions(+), 16 deletions(-) >> >> diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h >> index 3466b6b..6981cb8 100644 >> --- a/libavcodec/dca_syncwords.h >> +++ b/libavcodec/dca_syncwords.h >> @@ -19,19 +19,17 @@ >> #ifndef AVCODEC_DCA_SYNCWORDS_H >> #define AVCODEC_DCA_SYNCWORDS_H >> >> -enum DCASyncwords { >> -DCA_SYNCWORD_CORE_BE= 0x7FFE8001U, >> -DCA_SYNCWORD_CORE_LE= 0xFE7F0180U, >> -DCA_SYNCWORD_CORE_14B_BE= 0x1FFFE800U, >> -DCA_SYNCWORD_CORE_14B_LE= 0xFF1F00E8U, >> -DCA_SYNCWORD_XCH= 0x5A5A5A5AU, >> -DCA_SYNCWORD_XXCH = 0x47004A03U, >> -DCA_SYNCWORD_X96= 0x1D95F262U, >> -DCA_SYNCWORD_XBR= 0x655E315EU, >> -DCA_SYNCWORD_LBR= 0x0A801921U, >> -DCA_SYNCWORD_XLL= 0x41A29547U, >> -DCA_SYNCWORD_SUBSTREAM = 0x64582025U, >> -DCA_SYNCWORD_SUBSTREAM_CORE = 0x02B09261U, >> -}; >> +#defineDCA_SYNCWORD_CORE_BE 0x7FFE8001U >> +#defineDCA_SYNCWORD_CORE_LE 0xFE7F0180U >> +#defineDCA_SYNCWORD_CORE_14B_BE 0x1FFFE800U >> +#defineDCA_SYNCWORD_CORE_14B_LE 0xFF1F00E8U >> +#defineDCA_SYNCWORD_XCH 0x5A5A5A5AU >> +#defineDCA_SYNCWORD_XXCH 0x47004A03U >> +#defineDCA_SYNCWORD_X96 0x1D95F262U >> +#defineDCA_SYNCWORD_XBR 0x655E315EU >> +#defineDCA_SYNCWORD_LBR 0x0A801921U >> +#defineDCA_SYNCWORD_XLL 0x41A29547U >> +#defineDCA_SYNCWORD_SUBSTREAM0x64582025U >> +#defineDCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > > > This one is fine. > >> >> --- a/libavformat/cinedec.c >> +++ b/libavformat/cinedec.c >> @@ -50,7 +50,7 @@ enum { >> CFA_BAYER = 3, /**< GB/RG */ >> CFA_BAYERFLIP = 4, /**< RG/GB */ >> >> -CFA_TLGRAY= 0x8000, >> +CFA_TLGRAY= INT32_MIN, >> CFA_TRGRAY= 0x4000, >> CFA_BLGRAY= 0x2000, >> CFA_BRGRAY= 0x1000 >> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c >> index a2fa8d6..f6181e2 100644 >> --- a/libavformat/mov_chan.c >> +++ b/libavformat/mov_chan.c >> @@ -45,7 +45,7 @@ >> *do not specify a particular ordering of those channels." >> */ >> enum MovChannelLayoutTag { >> -MOV_CH_LAYOUT_UNKNOWN = 0x, >> +MOV_CH_LAYOUT_UNKNOWN = -( 1 << 16), >> MOV_CH_LAYOUT_USE_DESCRIPTIONS = ( 0 << 16) | 0, >> MOV_CH_LAYOUT_USE_BITMAP= ( 1 << 16) | 0, >> MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0, >> -- >> 2.6.2 > > > I personally don't really like these... I think both obfuscate the meaning > of the flag values, particularly the first one. There is no real solution (recall apedec and the INT32_MIN final solution), barring adding a comment signifying our intent (ie the desired hex mask). I can do this if you think it helps. > > Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel