]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/amrnbdec.c
build: Fix Ogg demuxer dependencies
[ffmpeg] / libavcodec / amrnbdec.c
index a7d0b4e33748375d1a2ed916490b5cb5fa8e810b..ab721ea239e404ed26ac361279e994731f0a7fb4 100644 (file)
@@ -44,7 +44,6 @@
 #include <math.h>
 
 #include "avcodec.h"
-#include "get_bits.h"
 #include "libavutil/common.h"
 #include "celp_math.h"
 #include "celp_filters.h"
@@ -189,16 +188,11 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
 static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
                                   int buf_size)
 {
-    GetBitContext gb;
     enum Mode mode;
 
-    init_get_bits(&gb, buf, buf_size * 8);
-
     // Decode the first octet.
-    skip_bits(&gb, 1);                        // padding bit
-    mode = get_bits(&gb, 4);                  // frame type
-    p->bad_frame_indicator = !get_bits1(&gb); // quality bit
-    skip_bits(&gb, 2);                        // two padding bits
+    mode = buf[0] >> 3 & 0x0F;                      // frame type
+    p->bad_frame_indicator = (buf[0] & 0x4) != 0x4; // quality bit
 
     if (mode >= N_MODES || buf_size < frame_sizes_nb[mode] + 1) {
         return NO_DATA;
@@ -1069,5 +1063,6 @@ AVCodec ff_amrnb_decoder = {
     .decode         = amrnb_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
-    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
+    .sample_fmts    = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
+                                                     AV_SAMPLE_FMT_NONE },
 };