[Mplayer-cvslog] CVS: main/libmpcodecs ad_libvorbis.c,1.11,1.12
Richard Felker CVS
rfelker at mplayerhq.hu
Mon Jan 13 20:39:16 CET 2003
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv2728/libmpcodecs
Modified Files:
ad_libvorbis.c
Log Message:
don't waste time on rg_scale nonsense if not necessary.
Index: ad_libvorbis.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_libvorbis.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ad_libvorbis.c 13 Jan 2003 19:18:26 -0000 1.11
+++ ad_libvorbis.c 13 Jan 2003 19:38:52 -0000 1.12
@@ -187,6 +187,7 @@
int len = 0;
int samples;
float **pcm;
+ float scale;
ogg_packet op;
struct ov_struct_st *ov = sh->context;
op.b_o_s = op.e_o_s = 0;
@@ -206,6 +207,33 @@
/* convert floats to 16 bit signed ints (host order) and
interleave */
+#ifdef TREMOR
+ if (ov->rg_scale_int == 64) {
+ for(i=0;i<ov->vi.channels;i++){
+ ogg_int16_t *convbuffer=(ogg_int16_t *)(&buf[len]);
+ ogg_int16_t *ptr=convbuffer+i;
+ ogg_int32_t *mono=pcm[i];
+ for(j=0;j<bout;j++){
+ int val=mono[j]>>9;
+ /* might as well guard against clipping */
+ if(val>32767){
+ val=32767;
+ clipflag=1;
+ }
+ if(val<-32768){
+ val=-32768;
+ clipflag=1;
+ }
+ *ptr=val;
+ ptr+=ov->vi.channels;
+ }
+ }
+ } else
+#endif /* TREMOR */
+ {
+#ifndef TREMOR
+ scale = 32767.f * ov->rg_scale;
+#endif
for(i=0;i<ov->vi.channels;i++){
ogg_int16_t *convbuffer=(ogg_int16_t *)(&buf[len]);
ogg_int16_t *ptr=convbuffer+i;
@@ -216,8 +244,7 @@
#else
float *mono=pcm[i];
for(j=0;j<bout;j++){
- int val=mono[j]*32767.f*ov->rg_scale;
-#endif /* TREMOR */
+ int val=mono[j]*scale;
/* might as well guard against clipping */
if(val>32767){
val=32767;
@@ -227,10 +254,12 @@
val=-32768;
clipflag=1;
}
+#endif /* TREMOR */
*ptr=val;
ptr+=ov->vi.channels;
}
}
+ }
if(clipflag)
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(ov->vd.sequence));
More information about the MPlayer-cvslog
mailing list