]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp56.h
Add approved chunks to AAC encoder
[ffmpeg] / libavcodec / vp56.h
index adae42b35f5139c4869725939b605f0ed4933ec0..8167957ed5d2bb0e75a938368cabfd814f268dbc 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef VP56_H
-#define VP56_H
+#ifndef FFMPEG_VP56_H
+#define FFMPEG_VP56_H
 
 #include "vp56data.h"
 #include "dsputil.h"
-#include "mpegvideo.h"
+#include "bitstream.h"
 #include "bytestream.h"
 
 
@@ -43,13 +43,13 @@ typedef void (*vp56_parse_coeff_t)(vp56_context_t *s);
 typedef void (*vp56_default_models_init_t)(vp56_context_t *s);
 typedef void (*vp56_parse_vector_models_t)(vp56_context_t *s);
 typedef void (*vp56_parse_coeff_models_t)(vp56_context_t *s);
-typedef int (*vp56_parse_header_t)(vp56_context_t *s, uint8_t *buf,
+typedef int (*vp56_parse_header_t)(vp56_context_t *s, const uint8_t *buf,
                                    int buf_size, int *golden_frame);
 
 typedef struct {
     int high;
     int bits;
-    uint8_t *buffer;
+    const uint8_t *buffer;
     unsigned long code_word;
 } vp56_range_coder_t;
 
@@ -90,8 +90,8 @@ struct vp56_context {
     AVCodecContext *avctx;
     DSPContext dsp;
     ScanTable scantable;
-    AVFrame frames[3];
-    AVFrame *framep[4];
+    AVFrame frames[4];
+    AVFrame *framep[6];
     uint8_t *edge_emu_buffer_alloc;
     uint8_t *edge_emu_buffer;
     vp56_range_coder_t c;
@@ -100,8 +100,8 @@ struct vp56_context {
     int sub_version;
 
     /* frame info */
-    int plane_width[3];
-    int plane_height[3];
+    int plane_width[4];
+    int plane_height[4];
     int mb_width;   /* number of horizontal MB */
     int mb_height;  /* number of vertical MB */
     int block_offset[6];
@@ -137,11 +137,13 @@ struct vp56_context {
     uint8_t coeff_ctx[4][64];              /* used in vp5 only */
     uint8_t coeff_ctx_last[4];             /* used in vp5 only */
 
+    int has_alpha;
+
     /* upside-down flipping hints */
     int flip;  /* are we flipping ? */
     int frbi;  /* first row block index in MB */
     int srbi;  /* second row block index in MB */
-    int stride[3];  /* stride for each plan */
+    int stride[4];  /* stride for each plan */
 
     const uint8_t *vp56_coord_div;
     vp56_parse_vector_adjustment_t parse_vector_adjustment;
@@ -154,15 +156,23 @@ struct vp56_context {
     vp56_parse_header_t parse_header;
 
     vp56_model_t *modelp;
-    vp56_model_t models;
+    vp56_model_t models[2];
+
+    /* huffman decoding */
+    int use_huffman;
+    GetBitContext gb;
+    VLC dccv_vlc[2];
+    VLC runv_vlc[2];
+    VLC ract_vlc[2][3][6];
+    unsigned int nb_null[2][2];       /* number of consecutive NULL DC/AC */
 };
 
 
-void vp56_init(AVCodecContext *avctx, int flip);
+void vp56_init(AVCodecContext *avctx, int flip, int has_alpha);
 int vp56_free(AVCodecContext *avctx);
 void vp56_init_dequant(vp56_context_t *s, int quantizer);
 int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                      uint8_t *buf, int buf_size);
+                      const uint8_t *buf, int buf_size);
 
 
 /**
@@ -170,7 +180,7 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
  */
 
 static inline void vp56_init_range_decoder(vp56_range_coder_t *c,
-                                           uint8_t *buf, int buf_size)
+                                           const uint8_t *buf, int buf_size)
 {
     c->high = 255;
     c->bits = 8;
@@ -255,4 +265,4 @@ static inline int vp56_rac_get_tree(vp56_range_coder_t *c,
     return -tree->val;
 }
 
-#endif /* VP56_H */
+#endif /* FFMPEG_VP56_H */