aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dsp.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-03-15 22:29:04 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-03-17 16:46:48 -0400
commit0f999cfddb0746602288eabddf38679fd25a2ff7 (patch)
tree055b877b24d0d1df4ff4feca6d0922174c51938f /libavcodec/ac3dsp.c
parent487fef2dcc24d7b4051b4402acf5c619fb082351 (diff)
downloadffmpeg-0f999cfddb0746602288eabddf38679fd25a2ff7.tar.gz
ac3enc: add float_to_fixed24() with x86-optimized versions to AC3DSPContext
and use in scale_coefficients() for the floating-point AC-3 encoder.
Diffstat (limited to 'libavcodec/ac3dsp.c')
-rw-r--r--libavcodec/ac3dsp.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 4d9db9be50..9bfa7300e3 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -85,13 +85,30 @@ static void ac3_rshift_int32_c(int32_t *src, unsigned int len,
} while (len > 0);
}
-av_cold void ff_ac3dsp_init(AC3DSPContext *c)
+static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int len)
+{
+ const float scale = 1 << 24;
+ do {
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ *dst++ = lrintf(*src++ * scale);
+ len -= 8;
+ } while (len > 0);
+}
+
+av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
{
c->ac3_exponent_min = ac3_exponent_min_c;
c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c;
c->ac3_lshift_int16 = ac3_lshift_int16_c;
c->ac3_rshift_int32 = ac3_rshift_int32_c;
+ c->float_to_fixed24 = float_to_fixed24_c;
if (HAVE_MMX)
- ff_ac3dsp_init_x86(c);
+ ff_ac3dsp_init_x86(c, bit_exact);
}