Commit 9f00fa53 authored by Mark Thompson's avatar Mark Thompson

vp8: Add hwaccel hooks

Also adds some extra fields to the main context structure that may
be needed by a hwaccel decoder.

The current behaviour of the WebP decoder is maintained by adding an
additional field to the VP8 decoder private context to indicate that
it is actually being used as WebP (no hwaccel is supported for that
case).
parent efd0612f
This diff is collapsed.
...@@ -138,12 +138,18 @@ typedef struct VP8ThreadData { ...@@ -138,12 +138,18 @@ typedef struct VP8ThreadData {
typedef struct VP8Frame { typedef struct VP8Frame {
ThreadFrame tf; ThreadFrame tf;
AVBufferRef *seg_map; AVBufferRef *seg_map;
AVBufferRef *hwaccel_priv_buf;
void *hwaccel_picture_private;
} VP8Frame; } VP8Frame;
#define MAX_THREADS 8 #define MAX_THREADS 8
typedef struct VP8Context { typedef struct VP8Context {
VP8ThreadData *thread_data; VP8ThreadData *thread_data;
AVCodecContext *avctx; AVCodecContext *avctx;
enum AVPixelFormat pix_fmt;
int actually_webp;
VP8Frame *framep[4]; VP8Frame *framep[4];
VP8Frame *next_framep[4]; VP8Frame *next_framep[4];
VP8Frame *curframe; VP8Frame *curframe;
...@@ -172,6 +178,7 @@ typedef struct VP8Context { ...@@ -172,6 +178,7 @@ typedef struct VP8Context {
uint8_t enabled; uint8_t enabled;
uint8_t absolute_vals; uint8_t absolute_vals;
uint8_t update_map; uint8_t update_map;
uint8_t update_feature_data;
int8_t base_quant[4]; int8_t base_quant[4];
int8_t filter_level[4]; ///< base loop filter level int8_t filter_level[4]; ///< base loop filter level
} segmentation; } segmentation;
...@@ -199,8 +206,19 @@ typedef struct VP8Context { ...@@ -199,8 +206,19 @@ typedef struct VP8Context {
int16_t chroma_qmul[2]; int16_t chroma_qmul[2];
} qmat[4]; } qmat[4];
// Raw quantisation values, which may be needed by hwaccel decode.
struct {
int yac_qi;
int ydc_delta;
int y2dc_delta;
int y2ac_delta;
int uvdc_delta;
int uvac_delta;
} quant;
struct { struct {
uint8_t enabled; ///< whether each mb can have a different strength based on mode/ref uint8_t enabled; ///< whether each mb can have a different strength based on mode/ref
uint8_t update;
/** /**
* filter strength adjustment for the following macroblock modes: * filter strength adjustment for the following macroblock modes:
...@@ -228,6 +246,20 @@ typedef struct VP8Context { ...@@ -228,6 +246,20 @@ typedef struct VP8Context {
VP56RangeCoder c; ///< header context, includes mb modes and motion vectors VP56RangeCoder c; ///< header context, includes mb modes and motion vectors
/* This contains the entropy coder state at the end of the header
* block, in the form specified by the standard. For use by
* hwaccels, so that a hardware decoder has the information to
* start decoding at the macroblock layer.
*/
struct {
const uint8_t *input;
uint32_t range;
uint32_t value;
int bit_count;
} coder_state_at_header_end;
int header_partition_size;
/** /**
* These are all of the updatable probabilities for binary decisions. * These are all of the updatable probabilities for binary decisions.
* They are only implicitly reset on keyframes, making it quite likely * They are only implicitly reset on keyframes, making it quite likely
...@@ -265,6 +297,7 @@ typedef struct VP8Context { ...@@ -265,6 +297,7 @@ typedef struct VP8Context {
*/ */
int num_coeff_partitions; int num_coeff_partitions;
VP56RangeCoder coeff_partition[8]; VP56RangeCoder coeff_partition[8];
int coeff_partition_size[8];
VideoDSPContext vdsp; VideoDSPContext vdsp;
VP8DSPContext vp8dsp; VP8DSPContext vp8dsp;
H264PredContext hpc; H264PredContext hpc;
......
...@@ -1335,6 +1335,7 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p, ...@@ -1335,6 +1335,7 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (!s->initialized) { if (!s->initialized) {
ff_vp8_decode_init(avctx); ff_vp8_decode_init(avctx);
s->initialized = 1; s->initialized = 1;
s->v.actually_webp = 1;
} }
avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
s->lossless = 0; s->lossless = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment