[FFmpeg-soc] [soc]: r3981 - in wmapro: wma3.h wma3dec.c

faust3 subversion at mplayerhq.hu
Sat Jan 17 18:39:51 CET 2009


Author: faust3
Date: Sat Jan 17 18:39:51 2009
New Revision: 3981

Log:
renamed bitreservoir buffer and size so that it is clear that it contains packet data

Modified:
   wmapro/wma3.h
   wmapro/wma3dec.c

Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h	Sat Jan 17 18:32:06 2009	(r3980)
+++ wmapro/wma3.h	Sat Jan 17 18:39:51 2009	(r3981)
@@ -119,8 +119,8 @@ typedef struct WMA3DecodeContext {
 
     /** packet decode state */
     uint8_t          packet_sequence_number;   //< current packet number
-    int              prev_frame_bit_size;      //< saved number of bits
-    uint8_t*         prev_frame;               //< prev frame data
+    int              prev_packet_bit_size;     //< saved number of bits
+    uint8_t*         prev_packet_data;         //< prev frame data
     uint8_t          bit5;                     //< padding bit? (CBR files)
     uint8_t          bit6;
     uint8_t          packet_loss;              //< set in case of bitstream error

Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c	Sat Jan 17 18:32:06 2009	(r3980)
+++ wmapro/wma3dec.c	Sat Jan 17 18:39:51 2009	(r3981)
@@ -96,7 +96,7 @@ static av_cold int wma3_decode_end(AVCod
     WMA3DecodeContext *s = avctx->priv_data;
     int i;
 
-    av_free(s->prev_frame);
+    av_free(s->prev_packet_data);
     av_free(s->num_sfb);
     av_free(s->sfb_offsets);
     av_free(s->subwoofer_cutoffs);
@@ -1475,16 +1475,16 @@ static int remaining_bits(WMA3DecodeCont
  */
 static void save_bits(WMA3DecodeContext *s,int len)
 {
-    int buflen = (s->prev_frame_bit_size + len + 8) / 8;
-    int bit_offset = s->prev_frame_bit_size % 8;
-    int pos = (s->prev_frame_bit_size - bit_offset) / 8;
-    s->prev_frame_bit_size += len;
+    int buflen = (s->prev_packet_bit_size + len + 8) / 8;
+    int bit_offset = s->prev_packet_bit_size % 8;
+    int pos = (s->prev_packet_bit_size - bit_offset) / 8;
+    s->prev_packet_bit_size += len;
 
     if(len <= 0)
          return;
 
     /** increase length if needed */
-    s->prev_frame = av_realloc(s->prev_frame,buflen +
+    s->prev_packet_data = av_realloc(s->prev_packet_data,buflen +
                                FF_INPUT_BUFFER_PADDING_SIZE);
 
     /** byte align prev_frame buffer */
@@ -1492,20 +1492,20 @@ static void save_bits(WMA3DecodeContext 
         int missing = 8 - bit_offset;
         if(len < missing)
             missing = len;
-        s->prev_frame[pos++] |=
+        s->prev_packet_data[pos++] |=
             get_bits(&s->gb, missing) << (8 - bit_offset - missing);
         len -= missing;
     }
 
     /** copy full bytes */
     while(len > 7){
-        s->prev_frame[pos++] = get_bits(&s->gb,8);
+        s->prev_packet_data[pos++] = get_bits(&s->gb,8);
         len -= 8;
     }
 
     /** copy remaining bits */
     if(len > 0)
-        s->prev_frame[pos++] = get_bits(&s->gb,len) << (8 - len);
+        s->prev_packet_data[pos++] = get_bits(&s->gb,len) << (8 - len);
 }
 
 /**
@@ -1559,21 +1559,22 @@ static int wma3_decode_packet(AVCodecCon
             previous packet to create a full frame */
         save_bits(s,num_bits_prev_frame);
         av_log(avctx, AV_LOG_DEBUG, "accumulated %x bits of frame data\n",
-                      s->prev_frame_bit_size);
+                      s->prev_packet_bit_size);
 
         /** decode the cross packet frame if it is valid */
         if(!s->packet_loss){
             GetBitContext gb_prev;
-            init_get_bits(&gb_prev, s->prev_frame, s->prev_frame_bit_size);
+            init_get_bits(&gb_prev, s->prev_packet_data,
+                              s->prev_packet_bit_size);
             wma_decode_frame(s,&gb_prev);
         }
-    }else if(s->prev_frame_bit_size){
+    }else if(s->prev_packet_bit_size){
         av_log(avctx, AV_LOG_ERROR, "ignoring %x previously saved bits\n",
-                      s->prev_frame_bit_size);
+                      s->prev_packet_bit_size);
     }
 
     /** reset prev frame buffer */
-    s->prev_frame_bit_size = 0;
+    s->prev_packet_bit_size = 0;
     s->packet_loss = 0;
     /** decode the rest of the packet */
     while(more_frames && remaining_bits(s) > s->log2_frame_size){



More information about the FFmpeg-soc mailing list