]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp8.h
sgi: check maximum supported resolution
[ffmpeg] / libavcodec / vp8.h
index 4a85541f37b748c818e67ef3f1c131edc3e3de67..1eb0512626df69708d90e06d4ab0b59df04f7550 100644 (file)
 #ifndef AVCODEC_VP8_H
 #define AVCODEC_VP8_H
 
+#include "libavutil/buffer.h"
+
+#include "h264pred.h"
+#include "thread.h"
 #include "vp56.h"
-#include "vp56data.h"
 #include "vp8dsp.h"
-#include "h264pred.h"
+
 #if HAVE_PTHREADS
-#include <pthread.h>
+#   include <pthread.h>
 #elif HAVE_W32THREADS
-#include "w32pthreads.h"
+#   include "compat/w32pthreads.h"
 #endif
 
 #define VP8_MAX_QUANT 127
@@ -80,7 +83,7 @@ typedef struct VP8FilterStrength {
 
 typedef struct VP8Macroblock {
     uint8_t skip;
-    // todo: make it possible to check for at least (i4x4 or split_mv)
+    // TODO: make it possible to check for at least (i4x4 or split_mv)
     // in one op. are others needed?
     uint8_t mode;
     uint8_t ref_frame;
@@ -94,8 +97,8 @@ typedef struct VP8Macroblock {
 } VP8Macroblock;
 
 typedef struct VP8ThreadData {
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
-    DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
+    DECLARE_ALIGNED(16, int16_t, block)[6][4][16];
+    DECLARE_ALIGNED(16, int16_t, block_dc)[16];
     /**
      * This is the index plus one of the last non-zero coeff
      * for each of the blocks in the current macroblock.
@@ -114,22 +117,29 @@ typedef struct VP8ThreadData {
     int thread_nr;
 #if HAVE_THREADS
     pthread_mutex_t lock;
-    pthread_cond_t  cond;
+    pthread_cond_t cond;
 #endif
     int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF)
     int wait_mb_pos; // What the current thread is waiting on.
-    uint8_t *edge_emu_buffer;
+
+#define EDGE_EMU_LINESIZE 32
+    DECLARE_ALIGNED(16, uint8_t, edge_emu_buffer)[21 * EDGE_EMU_LINESIZE];
     VP8FilterStrength *filter_strength;
 } VP8ThreadData;
 
+typedef struct VP8Frame {
+    ThreadFrame tf;
+    AVBufferRef *seg_map;
+} VP8Frame;
+
 #define MAX_THREADS 8
 typedef struct VP8Context {
     VP8ThreadData *thread_data;
     AVCodecContext *avctx;
-    AVFrame *framep[4];
-    AVFrame *next_framep[4];
-    AVFrame *curframe;
-    AVFrame *prev_frame;
+    VP8Frame *framep[4];
+    VP8Frame *next_framep[4];
+    VP8Frame *curframe;
+    VP8Frame *prev_frame;
 
     uint16_t mb_width;   /* number of horizontal MB */
     uint16_t mb_height;  /* number of vertical MB */
@@ -194,7 +204,7 @@ typedef struct VP8Context {
          * [7]   - split mv
          *  i16x16 modes never have any adjustment
          */
-        int8_t mode[VP8_MVMODE_SPLIT+1];
+        int8_t mode[VP8_MVMODE_SPLIT + 1];
 
         /**
          * filter strength adjustment for macroblocks that reference:
@@ -206,7 +216,7 @@ typedef struct VP8Context {
         int8_t ref[4];
     } lf_delta;
 
-    uint8_t (*top_border)[16+8+8];
+    uint8_t (*top_border)[16 + 8 + 8];
     uint8_t (*top_nnz)[9];
 
     VP56RangeCoder c;   ///< header context, includes mb modes and motion vectors
@@ -225,7 +235,7 @@ typedef struct VP8Context {
         uint8_t golden;
         uint8_t pred16x16[4];
         uint8_t pred8x8c[3];
-        uint8_t token[4][16][3][NUM_DCT_TOKENS-1];
+        uint8_t token[4][16][3][NUM_DCT_TOKENS - 1];
         uint8_t mvc[2][19];
     } prob[2];
 
@@ -251,17 +261,8 @@ typedef struct VP8Context {
     VP8DSPContext vp8dsp;
     H264PredContext hpc;
     vp8_mc_func put_pixels_tab[3][3][3];
-    AVFrame frames[5];
+    VP8Frame frames[5];
 
-    /**
-     * A list of segmentation_map buffers that are to be free()'ed in
-     * the next decoding iteration. We can't free() them right away
-     * because the map may still be used by subsequent decoding threads.
-     * Unused if frame threading is off.
-     */
-    uint8_t *segmentation_maps[5];
-    int num_maps_to_be_freed;
-    int maps_are_invalid;
     int num_jobs;
     /**
      * This describes the macroblock memory layout.
@@ -271,4 +272,11 @@ typedef struct VP8Context {
     int mb_layout;
 } VP8Context;
 
+int ff_vp8_decode_init(AVCodecContext *avctx);
+
+int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+                        AVPacket *avpkt);
+
+int ff_vp8_decode_free(AVCodecContext *avctx);
+
 #endif /* AVCODEC_VP8_H */