[FFmpeg-soc] [soc]: r1192 - in qcelp: qcelp_parser.c qcelpdata.h qcelpdec.c

reynaldo subversion at mplayerhq.hu
Sun Aug 26 07:55:15 CEST 2007


Author: reynaldo
Date: Sun Aug 26 07:55:15 2007
New Revision: 1192

Log:
TRIVIAL & COSMETIC: Some code reordering and some commentary work

Modified:
   qcelp/qcelp_parser.c
   qcelp/qcelpdata.h
   qcelp/qcelpdec.c

Modified: qcelp/qcelp_parser.c
==============================================================================
--- qcelp/qcelp_parser.c	(original)
+++ qcelp/qcelp_parser.c	Sun Aug 26 07:55:15 2007
@@ -30,29 +30,45 @@
 
 
 /**
- * finds the end of the current frame in the bitstream.
+ * Finds the end of the current frame in the bitstream.
+ *
  * @return the position of the first byte of the next frame, or -1
  */
 
 static int qcelp_find_frame_end(ParseContext *pc, const uint8_t *buf,
        int buf_size)
 {
-    if(buf_size < 3)
-        return END_NOT_FOUND;
+
+    av_log(pc, AV_LOG_ERROR, "buf_size:%d buf[0]:%d\n", buf_size, buf[0]);
+
+    /**
+     * Lest try and see if this packet holds exactly one frame
+     */
 
     switch(buf_size)
     {
-        case 35:
-        case 34:
-        case 17:
-        case 16:
-        case  8:
-        case  7:
-        case  4:
-        case  3:
+        case 35:             // RATE_FULL in 'codec frame' fmt
+        case 34:             // RATE_FULL
+        case 17:             // RATE_HALF in 'codec frame' fmt
+        case 16:             // RATE_HALF
+        case  8:             // RATE_QUARTER in 'codec frame' fmt
+        case  7:             // RATE_QUARTER
+        case  4:             // RATE_OCTAVE in 'codec frame' fmt
+        case  3:             // RATE_OCTAVE
             return buf_size;
     }
 
+    /**
+     * If we reach this point it means the packet holds a multiset of
+     * frames, each one of them in codec frame format, all of the same
+     * rate, as described in:
+     *
+     * http://tools.ietf.org/html/draft-mckay-qcelp-02
+     */
+
+    if(buf_size < 3)
+        return END_NOT_FOUND;
+
     switch(buf[0])
     {
         case 4:
@@ -81,9 +97,9 @@ static int qcelp_parse(AVCodecParserCont
     start_found=1;
 
     if(s->flags & PARSER_FLAG_COMPLETE_FRAMES)
-    {
         next=buf_size;
-    }else{
+    else
+    {
         next=qcelp_find_frame_end(pc, buf, buf_size);
 
         if (ff_combine_frame(pc, next, &buf, &buf_size) < 0)

Modified: qcelp/qcelpdata.h
==============================================================================
--- qcelp/qcelpdata.h	(original)
+++ qcelp/qcelpdata.h	Sun Aug 26 07:55:15 2007
@@ -22,6 +22,7 @@
 /**
  * @file qcelpdata.h
  * QCELP decoder
+ * @author Reynaldo H. Verdejo Pinochet
  */
 
 #define QCELP_FXQ(v)  (roundf(16384.0*v)/16384.0)

Modified: qcelp/qcelpdec.c
==============================================================================
--- qcelp/qcelpdec.c	(original)
+++ qcelp/qcelpdec.c	Sun Aug 26 07:55:15 2007
@@ -22,6 +22,7 @@
 /**
  * @file qcelpdec.c
  * QCELP decoder
+ * @author Reynaldo H. Verdejo Pinochet
  */
 
 #include <math.h>



More information about the FFmpeg-soc mailing list