sizeof(PredictorState) is different for the floating-point and the fixed-point AAC decoders; this is an obstacle for deduplicating code between these decoders. So don't include this array in SingleChannelElement, instead add a union of pointers to the fixed-point PredictorState and the floating-point PredictorState. The actual arrays are part of the extended ChannelElement to be allocated by ff_aac_sbr_ctx_alloc_init(); it also sets the pointers.
Showing the changes to libavcodec/aac.h (1 of 6 files). Show all
Unified · Split
| @@ -30,9 +30,6 @@ · 29 unmodified lines | |||
| 30 | #ifndef AVCODEC_AAC_H | 30 | #ifndef AVCODEC_AAC_H |
| 31 | #define AVCODEC_AAC_H | 31 | #define AVCODEC_AAC_H |
| 32 | 32 | ||
| 33 | |||
| 34 | #include "aac_defines.h" | ||
| 35 | |||
| 36 | #define MAX_CHANNELS 64 | 33 | #define MAX_CHANNELS 64 |
| 37 | #define MAX_ELEM_ID 16 | 34 | #define MAX_ELEM_ID 16 |
| 38 | 35 | ||
| @@ -85,20 +82,6 @@ enum ChannelPosition { · 46 unmodified lines | |||
| 85 | AAC_CHANNEL_CC = 5, | 82 | AAC_CHANNEL_CC = 5, |
| 86 | }; | 83 | }; |
| 87 | 84 | ||
| 88 | /** | ||
| 89 | * Predictor State | ||
| 90 | */ | ||
| 91 | typedef struct PredictorState { | ||
| 92 | AAC_FLOAT cor0; | ||
| 93 | AAC_FLOAT cor1; | ||
| 94 | AAC_FLOAT var0; | ||
| 95 | AAC_FLOAT var1; | ||
| 96 | AAC_FLOAT r0; | ||
| 97 | AAC_FLOAT r1; | ||
| 98 | AAC_FLOAT k1; | ||
| 99 | AAC_FLOAT x_est; | ||
| 100 | } PredictorState; | ||
| 101 | |||
| 102 | #define MAX_PREDICTORS 672 | 85 | #define MAX_PREDICTORS 672 |
| 103 | 86 | ||
| 104 | #define SCALE_DIV_512 36 ///< scalefactor difference that corresponds to scale difference in 512 times | 87 | #define SCALE_DIV_512 36 ///< scalefactor difference that corresponds to scale difference in 512 times |