Mercurial > libavcodec.hg
comparison cook.c @ 5344:b0d49997bd92 libavcodec
separate the actual math for recovering stereo from a signal channel, this is to allow fixpoint implementation
author | mhoffman |
---|---|
date | Mon, 16 Jul 2007 11:25:56 +0000 |
parents | 1aa26b974dc3 |
children | af1c85da8982 |
comparison
equal
deleted
inserted
replaced
5343:1aa26b974dc3 | 5344:b0d49997bd92 |
---|---|
739 decouple_tab[cplband[q->js_subband_start] + i] = get_bits(&q->gb, q->js_vlc_bits); | 739 decouple_tab[cplband[q->js_subband_start] + i] = get_bits(&q->gb, q->js_vlc_bits); |
740 } | 740 } |
741 return; | 741 return; |
742 } | 742 } |
743 | 743 |
744 /* | |
745 * function decouples a pair of signals from a single signal via multiplication. | |
746 * | |
747 * @param q pointer to the COOKContext | |
748 * @param subband index of the current subband | |
749 * @param f1 multiplier for channel 1 extraction | |
750 * @param f2 multiplier for channel 2 extraction | |
751 * @param decode_buffer input buffer | |
752 * @param mlt_buffer1 pointer to left channel mlt coefficients | |
753 * @param mlt_buffer2 pointer to right channel mlt coefficients | |
754 */ | |
755 static void decouple_float (COOKContext *q, | |
756 int subband, | |
757 float f1, float f2, | |
758 float *decode_buffer, | |
759 float *mlt_buffer1, float *mlt_buffer2) | |
760 { | |
761 int j, tmp_idx; | |
762 for (j=0 ; j<SUBBAND_SIZE ; j++) { | |
763 tmp_idx = ((q->js_subband_start + subband)*SUBBAND_SIZE)+j; | |
764 mlt_buffer1[SUBBAND_SIZE*subband + j] = f1 * decode_buffer[tmp_idx]; | |
765 mlt_buffer2[SUBBAND_SIZE*subband + j] = f2 * decode_buffer[tmp_idx]; | |
766 } | |
767 } | |
744 | 768 |
745 /** | 769 /** |
746 * function for decoding joint stereo data | 770 * function for decoding joint stereo data |
747 * | 771 * |
748 * @param q pointer to the COOKContext | 772 * @param q pointer to the COOKContext |
783 cpl_tmp = cplband[i]; | 807 cpl_tmp = cplband[i]; |
784 idx -=decouple_tab[cpl_tmp]; | 808 idx -=decouple_tab[cpl_tmp]; |
785 cplscale = (float*)cplscales[q->js_vlc_bits-2]; //choose decoupler table | 809 cplscale = (float*)cplscales[q->js_vlc_bits-2]; //choose decoupler table |
786 f1 = cplscale[decouple_tab[cpl_tmp]]; | 810 f1 = cplscale[decouple_tab[cpl_tmp]]; |
787 f2 = cplscale[idx-1]; | 811 f2 = cplscale[idx-1]; |
788 for (j=0 ; j<SUBBAND_SIZE ; j++) { | 812 decouple_float (q, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); |
789 tmp_idx = ((q->js_subband_start + i)*20)+j; | |
790 mlt_buffer1[20*i + j] = f1 * decode_buffer[tmp_idx]; | |
791 mlt_buffer2[20*i + j] = f2 * decode_buffer[tmp_idx]; | |
792 } | |
793 idx = (1 << q->js_vlc_bits) - 1; | 813 idx = (1 << q->js_vlc_bits) - 1; |
794 } | 814 } |
795 } | 815 } |
796 | 816 |
797 /** | 817 /** |