History

avcodec/aacenc_is: Make ff_aac_is_encoding_err() static

Possible since 9b11fefb88c770b9c1d4d4583c61c6abde6c033c. Also remove a now always-zero parameter.

Andreas Rheinhardt committed 1 year ago

Commit a2136d51 parent d78cb532 files · +21 −26Browse files

Unified · Split

2 files
  1. libavcodec/aacenc_is.c +21 −10
  2. libavcodec/aacenc_is.h +0 −16
libavcodec/aacenc_is.c+21−10
@@ -30,16 +30,27 @@ · 29 unmodified lines
3030 #include "aacenc_is.h"
3131 #include "aacenc_quantization.h"
3232
33−struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe,
34− int start, int w, int g, float ener0,
35− float ener1, float ener01,
36− int use_pcoeffs, int phase)
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+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)
3748 {
3849 int i, w2;
3950 SingleChannelElement *sce0 = &cpe->ch[0];
4051 SingleChannelElement *sce1 = &cpe->ch[1];
41− float *L = use_pcoeffs ? sce0->pcoeffs : sce0->coeffs;
42− float *R = use_pcoeffs ? sce1->pcoeffs : sce1->coeffs;
52+ float *L = sce0->coeffs;
53+ float *R = sce1->coeffs;
4354 float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1];
4455 float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3];
4556 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
128139 ener01p += (coef0 - coef1)*(coef0 - coef1);
129140 }
130141 }
131− ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g,
132− ener0, ener1, ener01p, 0, -1);
133− ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g,
134− ener0, ener1, ener01, 0, +1);
142+ ph_err1 = aac_is_encoding_err(s, cpe, start, w, g,
143+ ener0, ener1, ener01p, -1);
144+ ph_err2 = aac_is_encoding_err(s, cpe, start, w, g,
145+ ener0, ener1, ener01, +1);
135146 best = (ph_err1.pass && ph_err1.error < ph_err2.error) ? &ph_err1 : &ph_err2;
136147 if (best->pass) {
137148 cpe->is_mask[w*16+g] = 1;
libavcodec/aacenc_is.h+0−16
@@ -30,22 +30,6 @@ · 29 unmodified lines
3030
3131 #include "aacenc.h"
3232
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);
4933 void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe);
5034
5135 #endif /* AVCODEC_AACENC_IS_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t