Possible since 9b11fefb88c770b9c1d4d4583c61c6abde6c033c. Also remove a now always-zero parameter.
Unified · Split
| @@ -30,16 +30,27 @@ · 29 unmodified lines | |||
| 30 | #include "aacenc_is.h" | 30 | #include "aacenc_is.h" |
| 31 | #include "aacenc_quantization.h" | 31 | #include "aacenc_quantization.h" |
| 32 | 32 | ||
| 33 | struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, | 33 | /** Frequency in Hz for lower limit of intensity stereo **/ |
| 34 | int start, int w, int g, float ener0, | 34 | #define INT_STEREO_LOW_LIMIT 6100 |
| 35 | float ener1, float ener01, | 35 | |
| 36 | int use_pcoeffs, int phase) | 36 | struct AACISError { |
| 37 | int pass; /* 1 if dist2 <= dist1 */ | ||
| 38 | int phase; /* -1 or +1 */ | ||
| 39 | float error; /* fabs(dist1 - dist2) */ | ||
| 40 | float dist1; /* From original coeffs */ | ||
| 41 | float dist2; /* From IS'd coeffs */ | ||
| 42 | float ener01; | ||
| 43 | }; | ||
| 44 | |||
| 45 | static struct AACISError aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, | ||
| 46 | int start, int w, int g, float ener0, | ||
| 47 | float ener1, float ener01, int phase) | ||
| 37 | { | 48 | { |
| 38 | int i, w2; | 49 | int i, w2; |
| 39 | SingleChannelElement *sce0 = &cpe->ch[0]; | 50 | SingleChannelElement *sce0 = &cpe->ch[0]; |
| 40 | SingleChannelElement *sce1 = &cpe->ch[1]; | 51 | SingleChannelElement *sce1 = &cpe->ch[1]; |
| 41 | float *L = use_pcoeffs ? sce0->pcoeffs : sce0->coeffs; | 52 | float *L = sce0->coeffs; |
| 42 | float *R = use_pcoeffs ? sce1->pcoeffs : sce1->coeffs; | 53 | float *R = sce1->coeffs; |
| 43 | float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1]; | 54 | float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1]; |
| 44 | float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3]; | 55 | float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3]; |
| 45 | float dist1 = 0.0f, dist2 = 0.0f; | 56 | float dist1 = 0.0f, dist2 = 0.0f; |
| @@ -128,10 +139,10 @@ void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen · 82 unmodified lines | |||
| 128 | ener01p += (coef0 - coef1)*(coef0 - coef1); | 139 | ener01p += (coef0 - coef1)*(coef0 - coef1); |
| 129 | } | 140 | } |
| 130 | } | 141 | } |
| 131 | ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g, | 142 | ph_err1 = aac_is_encoding_err(s, cpe, start, w, g, |
| 132 | ener0, ener1, ener01p, 0, -1); | 143 | ener0, ener1, ener01p, -1); |
| 133 | ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g, | 144 | ph_err2 = aac_is_encoding_err(s, cpe, start, w, g, |
| 134 | ener0, ener1, ener01, 0, +1); | 145 | ener0, ener1, ener01, +1); |
| 135 | best = (ph_err1.pass && ph_err1.error < ph_err2.error) ? &ph_err1 : &ph_err2; | 146 | best = (ph_err1.pass && ph_err1.error < ph_err2.error) ? &ph_err1 : &ph_err2; |
| 136 | if (best->pass) { | 147 | if (best->pass) { |
| 137 | cpe->is_mask[w*16+g] = 1; | 148 | cpe->is_mask[w*16+g] = 1; |
| @@ -30,22 +30,6 @@ · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | #include "aacenc.h" | 31 | #include "aacenc.h" |
| 32 | 32 | ||
| 33 | /** Frequency in Hz for lower limit of intensity stereo **/ | ||
| 34 | #define INT_STEREO_LOW_LIMIT 6100 | ||
| 35 | |||
| 36 | struct AACISError { | ||
| 37 | int pass; /* 1 if dist2 <= dist1 */ | ||
| 38 | int phase; /* -1 or +1 */ | ||
| 39 | float error; /* fabs(dist1 - dist2) */ | ||
| 40 | float dist1; /* From original coeffs */ | ||
| 41 | float dist2; /* From IS'd coeffs */ | ||
| 42 | float ener01; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, | ||
| 46 | int start, int w, int g, float ener0, | ||
| 47 | float ener1, float ener01, | ||
| 48 | int use_pcoeffs, int phase); | ||
| 49 | void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe); | 33 | void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe); |
| 50 | 34 | ||
| 51 | #endif /* AVCODEC_AACENC_IS_H */ | 35 | #endif /* AVCODEC_AACENC_IS_H */ |