[Mplayer-cvslog] CVS: main/liba52 test.c,1.3,1.4
Arpi of Ize
arpi at mplayer.dev.hu
Mon Dec 17 18:21:53 CET 2001
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_gl2.c,1.8,1.9
- Next message: [Mplayer-cvslog] CVS: main imgfmt.c,NONE,1.1 imgfmt.h,NONE,1.1 afmt.c,NONE,1.1 afmt.h,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/liba52
In directory mplayer:/var/tmp.root/cvs-serv29515
Modified Files:
test.c
Log Message:
use resample.c functions
Index: test.c
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- test.c 16 Dec 2001 02:47:03 -0000 1.3
+++ test.c 17 Dec 2001 17:21:50 -0000 1.4
@@ -38,111 +38,6 @@
#endif
-static inline int16_t convert (int32_t i)
-{
- if (i > 0x43c07fff)
- return 32767;
- else if (i < 0x43bf8000)
- return -32768;
- else
- return i - 0x43c00000;
-}
-
-static inline void float_to_int (float * _f, int16_t * s16, int flags)
-{
- int i;
- int32_t * f = (int32_t *) _f;
-
- switch (flags) {
- case A52_MONO:
- for (i = 0; i < 256; i++) {
- s16[5*i] = s16[5*i+1] = s16[5*i+2] = s16[5*i+3] = 0;
- s16[5*i+4] = convert (f[i]);
- }
- break;
- case A52_CHANNEL:
- case A52_STEREO:
- case A52_DOLBY:
- for (i = 0; i < 256; i++) {
- s16[2*i] = convert (f[i]);
- s16[2*i+1] = convert (f[i+256]);
- }
- break;
- case A52_3F:
- for (i = 0; i < 256; i++) {
- s16[5*i] = convert (f[i]);
- s16[5*i+1] = convert (f[i+512]);
- s16[5*i+2] = s16[5*i+3] = 0;
- s16[5*i+4] = convert (f[i+256]);
- }
- break;
- case A52_2F2R:
- for (i = 0; i < 256; i++) {
- s16[4*i] = convert (f[i]);
- s16[4*i+1] = convert (f[i+256]);
- s16[4*i+2] = convert (f[i+512]);
- s16[4*i+3] = convert (f[i+768]);
- }
- break;
- case A52_3F2R:
- for (i = 0; i < 256; i++) {
- s16[5*i] = convert (f[i]);
- s16[5*i+1] = convert (f[i+512]);
- s16[5*i+2] = convert (f[i+768]);
- s16[5*i+3] = convert (f[i+1024]);
- s16[5*i+4] = convert (f[i+256]);
- }
- break;
- case A52_MONO | A52_LFE:
- for (i = 0; i < 256; i++) {
- s16[6*i] = s16[6*i+1] = s16[6*i+2] = s16[6*i+3] = 0;
- s16[6*i+4] = convert (f[i+256]);
- s16[6*i+5] = convert (f[i]);
- }
- break;
- case A52_CHANNEL | A52_LFE:
- case A52_STEREO | A52_LFE:
- case A52_DOLBY | A52_LFE:
- for (i = 0; i < 256; i++) {
- s16[6*i] = convert (f[i+256]);
- s16[6*i+1] = convert (f[i+512]);
- s16[6*i+2] = s16[6*i+3] = s16[6*i+4] = 0;
- s16[6*i+5] = convert (f[i]);
- }
- break;
- case A52_3F | A52_LFE:
- for (i = 0; i < 256; i++) {
- s16[6*i] = convert (f[i+256]);
- s16[6*i+1] = convert (f[i+768]);
- s16[6*i+2] = s16[6*i+3] = 0;
- s16[6*i+4] = convert (f[i+512]);
- s16[6*i+5] = convert (f[i]);
- }
- break;
- case A52_2F2R | A52_LFE:
- for (i = 0; i < 256; i++) {
- s16[6*i] = convert (f[i+256]);
- s16[6*i+1] = convert (f[i+512]);
- s16[6*i+2] = convert (f[i+768]);
- s16[6*i+3] = convert (f[i+1024]);
- s16[6*i+4] = 0;
- s16[6*i+5] = convert (f[i]);
- }
- break;
- case A52_3F2R | A52_LFE:
- for (i = 0; i < 256; i++) {
- s16[6*i] = convert (f[i+256]);
- s16[6*i+1] = convert (f[i+768]);
- s16[6*i+2] = convert (f[i+1024]);
- s16[6*i+3] = convert (f[i+1280]);
- s16[6*i+4] = convert (f[i+512]);
- s16[6*i+5] = convert (f[i]);
- }
- break;
- }
-}
-
-
int main(){
int accel=0;
int sample_rate=0;
@@ -162,6 +57,7 @@
int16_t *s16;
sample_t level=1, bias=384;
int flags=0;
+ int channels=0;
while(buf_size<7){
int c=getchar();
@@ -186,6 +82,8 @@
// decode:
flags=A52_STEREO; // A52_DOLBY // A52_2F2R // A52_3F2R | A52_LFE
+ channels=2;
+
flags |= A52_ADJUST_LEVEL;
STARTTIMING
if (a52_frame (&state, buf, &flags, &level, bias))
@@ -194,20 +92,15 @@
// a52_dynrng (&state, NULL, NULL); // disable dynamic range compensation
+ a52_resample_init(flags,channels);
s16 = out_buf;
for (i = 0; i < 6; i++) {
- int32_t * f = (int32_t *) samples;
- int i;
STARTTIMING
if (a52_block (&state, samples))
{ fprintf(stderr,"error at sampling\n"); break; }
ENDTIMING
- // resample to STEREO/DOLBY:
- for (i = 0; i < 256; i++) {
- s16[2*i] = convert (f[i]);
- s16[2*i+1] = convert (f[i+256]);
- }
- s16+=2*i;
+ // float->int + channels interleaving:
+ s16+=a52_resample(samples,s16);
}
#ifdef TIMING
if(sum<min) min=sum;
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_gl2.c,1.8,1.9
- Next message: [Mplayer-cvslog] CVS: main imgfmt.c,NONE,1.1 imgfmt.h,NONE,1.1 afmt.c,NONE,1.1 afmt.h,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list