diff options
author | Marc Hoffman <mmhoffm@gmail.com> | 2007-07-16 11:25:56 +0000 |
---|---|---|
committer | Marc Hoffman <mmhoffm@gmail.com> | 2007-07-16 11:25:56 +0000 |
commit | dc0c20f99bbe070c8cedc7acc595919d6cf08099 (patch) | |
tree | ffa57b786fcc19ea247aa92cb74ae04a5ba3fc49 /libavcodec | |
parent | e2e2e7dd70db2b1643041853ce7472257814524e (diff) | |
download | ffmpeg-dc0c20f99bbe070c8cedc7acc595919d6cf08099.tar.gz |
separate the actual math for recovering stereo from a signal channel, this is to allow fixpoint implementation
Originally committed as revision 9698 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cook.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 0f3e97cf07..571d6899c1 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -741,6 +741,30 @@ static void decouple_info(COOKContext *q, int* decouple_tab){ return; } +/* + * function decouples a pair of signals from a single signal via multiplication. + * + * @param q pointer to the COOKContext + * @param subband index of the current subband + * @param f1 multiplier for channel 1 extraction + * @param f2 multiplier for channel 2 extraction + * @param decode_buffer input buffer + * @param mlt_buffer1 pointer to left channel mlt coefficients + * @param mlt_buffer2 pointer to right channel mlt coefficients + */ +static void decouple_float (COOKContext *q, + int subband, + float f1, float f2, + float *decode_buffer, + float *mlt_buffer1, float *mlt_buffer2) +{ + int j, tmp_idx; + for (j=0 ; j<SUBBAND_SIZE ; j++) { + tmp_idx = ((q->js_subband_start + subband)*SUBBAND_SIZE)+j; + mlt_buffer1[SUBBAND_SIZE*subband + j] = f1 * decode_buffer[tmp_idx]; + mlt_buffer2[SUBBAND_SIZE*subband + j] = f2 * decode_buffer[tmp_idx]; + } +} /** * function for decoding joint stereo data @@ -785,11 +809,7 @@ static void joint_decode(COOKContext *q, float* mlt_buffer1, cplscale = (float*)cplscales[q->js_vlc_bits-2]; //choose decoupler table f1 = cplscale[decouple_tab[cpl_tmp]]; f2 = cplscale[idx-1]; - for (j=0 ; j<SUBBAND_SIZE ; j++) { - tmp_idx = ((q->js_subband_start + i)*20)+j; - mlt_buffer1[20*i + j] = f1 * decode_buffer[tmp_idx]; - mlt_buffer2[20*i + j] = f2 * decode_buffer[tmp_idx]; - } + decouple_float (q, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); idx = (1 << q->js_vlc_bits) - 1; } } |