[FFmpeg-devel] [PATCH 5/6] opus_celt: rename structures to better names and reorganize them

Michael Niedermayer michaelni at gmx.at
Thu Feb 2 04:47:36 EET 2017


On Wed, Feb 01, 2017 at 01:03:23PM +0000, Rostislav Pehlivanov wrote:
> On 1 February 2017 at 11:51, Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > On Wed, Feb 01, 2017 at 03:13:08AM +0000, Rostislav Pehlivanov wrote:
> > > This is meant to be applied on top of my previous patch which
> > > split PVQ into celt_pvq.c and made opus_celt.h
> > >
> > > Essentially nothing has been changed other than renaming CeltFrame
> > > to CeltBlock (CeltFrame had absolutely nothing at all to do with
> > > a frame) and CeltContext to CeltFrame.
> > > 3 variables have been put in CeltFrame as they make more sense
> > > there rather than being passed around as arguments.
> > > The coefficients have been moved to the CeltBlock structure
> > > (why the hell were they in CeltContext and not in CeltFrame??).
> > >
> > > Now the encoder would be able to use the exact context the decoder
> > > uses (plus a couple of extra fields in there).
> > >
> > > FATE passes, no slowdowns, etc.
> >
> > This doesnt build on arm-linux-gnueabi-gcc-4.5
> > (i think arm is unrelated here)
> >
> > In file included from src/libavcodec/opus_celt.c:28:0:
> > src/libavcodec/opus_celt.h:134:3: error: redefinition of typedef
> > ‘CeltFrame’
> > src/libavcodec/opus.h:82:26: note: previous declaration of ‘CeltFrame’ was
> > here
> > make: *** [libavcodec/opus_celt.o] Error 1
> >
> >
> > [...]
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > No great genius has ever existed without some touch of madness. --
> > Aristotle
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> Seems older GCC versions are unhappy.
> Removed the typedef from the struct definition in opus_celt.h and attached
> new patch


this fixes it:


diff --git a/libavcodec/opus_celt.h b/libavcodec/opus_celt.h
index 9d144f2f52..681b028d9c 100644
--- a/libavcodec/opus_celt.h
+++ b/libavcodec/opus_celt.h
@@ -59,7 +59,7 @@ enum CeltBlockSize {
     CELT_BLOCK_NB
 };

-struct CeltBlock {
+typedef struct CeltBlock {
     float energy[CELT_MAX_BANDS];
     float lin_energy[CELT_MAX_BANDS];
     float error_energy[CELT_MAX_BANDS];
@@ -87,9 +87,9 @@ struct CeltBlock {
     float pf_gains_old[3];

     float emph_coeff;
-};
+} CeltBlock;

-typedef struct CeltFrame {
+struct CeltFrame {
     // constant values that do not change during context lifetime
     AVCodecContext      *avctx;
     MDCT15Context       *imdct[4];
@@ -131,7 +131,7 @@ typedef struct CeltFrame {
     int tf_change    [CELT_MAX_BANDS];

     DECLARE_ALIGNED(32, float, scratch)[22 * 8]; // MAX(ff_celt_freq_range) * 1<<CELT_MAX_LOG_BLOCKS
-} CeltFrame;
+} ;

 /* LCG for noise generation */
 static av_always_inline uint32_t celt_rng(CeltFrame *f)

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170202/a62a2da5/attachment.sig>


More information about the ffmpeg-devel mailing list