]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/imc.c
Fix nv12/nv21 handling. linesize for plane 1 should account for both chroma
[ffmpeg] / libavcodec / imc.c
index 436a5c95528055b8716a2b8add44a91973acab30..93093ebd533fedf886b824355239f01854e9453b 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 /**
- *  @file imc.c IMC - Intel Music Coder
+ *  @file libavcodec/imc.c IMC - Intel Music Coder
  *  A mdct based codec using a 256 points large transform
  *  divied into 32 bands with some mix of scale factors.
  *  Only mono is supported.
@@ -36,7 +36,7 @@
 
 #define ALT_BITSTREAM_READER
 #include "avcodec.h"
-#include "bitstream.h"
+#include "get_bits.h"
 #include "dsputil.h"
 
 #include "imcdata.h"
@@ -143,7 +143,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
     /* initialize the VLC tables */
     for(i = 0; i < 4 ; i++) {
         for(j = 0; j < 4; j++) {
-            huffman_vlc[i][j].table = vlc_tables[vlc_offsets[i * 4 + j]];
+            huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]];
             huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j];
             init_vlc(&huffman_vlc[i][j], 9, imc_huffman_sizes[i],
                      imc_huffman_lens[i][j], 1, 1,
@@ -155,6 +155,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
     ff_fft_init(&q->fft, 7, 1);
     dsputil_init(&q->dsp, avctx);
     avctx->sample_fmt = SAMPLE_FMT_S16;
+    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
     return 0;
 }
 
@@ -638,8 +639,10 @@ static int imc_get_coeffs (IMCContext* q) {
 
 static int imc_decode_frame(AVCodecContext * avctx,
                             void *data, int *data_size,
-                            const uint8_t * buf, int buf_size)
+                            AVPacket *avpkt)
 {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
 
     IMCContext *q = avctx->priv_data;