[vlc-commits] Fixed DV audio using 12 bits quantization.

Laurent Aimar git at videolan.org
Fri Jun 1 21:26:37 CEST 2012


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed May 30 01:01:21 2012 +0200| [47b27a1e4a05571f280e7e04e026857311be67cd] | committer: Laurent Aimar

Fixed DV audio using 12 bits quantization.

It close #4828 and #3685.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47b27a1e4a05571f280e7e04e026857311be67cd
---

 modules/demux/rawdv.h |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/modules/demux/rawdv.h b/modules/demux/rawdv.h
index fc878a5..ca0b24e 100644
--- a/modules/demux/rawdv.h
+++ b/modules/demux/rawdv.h
@@ -105,7 +105,6 @@ static block_t *dv_extract_audio( block_t *p_frame_block )
     int i_audio_quant, i_samples, i_size, i_half_ch;
     const uint16_t (*audio_shuffle)[9];
     int i, j, d, of;
-    uint16_t lc;
 
     if( p_frame_block->i_buffer < 4 )
         return NULL;
@@ -173,17 +172,24 @@ static block_t *dv_extract_audio( block_t *p_frame_block )
                 else
                 {
                     /* 12bit quantization */
-                    lc = ((uint16_t)p_frame[d] << 4) |
-                         ((uint16_t)p_frame[d+2] >> 4);
-                    lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
+                    uint16_t lc = (p_frame[d+0] << 4) | (p_frame[d+2] >> 4);
+                    uint16_t rc = (p_frame[d+1] << 4) | (p_frame[d+2] & 0x0f);
 
-                    of = audio_shuffle[i][j] + (d - 8) / 3 *
-                         (i_dsf ? 108 : 90);
-                    if( of*2 >= i_size ) continue;
+                    lc = lc == 0x800 ? 0 : dv_audio_12to16(lc);
+                    rc = rc == 0x800 ? 0 : dv_audio_12to16(rc);
 
-                    /* big endian */
-                    p_block->p_buffer[of*2] = lc & 0xff;
+                    of = audio_shuffle[i][j] + (d - 8) / 3 * (i_dsf ? 108 : 90);
+                    if( of*2 >= i_size )
+                        continue;
+                    p_block->p_buffer[of*2+0] = lc & 0xff;
                     p_block->p_buffer[of*2+1] = lc >> 8;
+
+                    of = audio_shuffle[i + i_half_ch][j] + (d - 8) / 3 * (i_dsf ? 108 : 90);
+                    if( of*2 >= i_size )
+                        continue;
+                    p_block->p_buffer[of*2+0] = rc & 0xff;
+                    p_block->p_buffer[of*2+1] = rc >> 8;
+
                     ++d;
                 }
             }



More information about the vlc-commits mailing list