[FFmpeg-devel] [PATCH 3/6] lavc/vp56: Move golden_frame into VP56Context
Ben Jackson
ben at ben.com
Fri Sep 14 06:43:04 CEST 2012
Makes golden_frame more like other frame data, paves way for threading
alpha channel decode.
Signed-off-by: Ben Jackson <ben at ben.com>
---
libavcodec/vp5.c | 3 +--
libavcodec/vp56.c | 6 +++---
libavcodec/vp56.h | 3 ++-
libavcodec/vp6.c | 5 ++---
4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c
index 9f74784..3ae7c25 100644
--- a/libavcodec/vp5.c
+++ b/libavcodec/vp5.c
@@ -35,8 +35,7 @@
#include "vp5data.h"
-static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
- int *golden_frame)
+static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
{
VP56RangeCoder *c = &s->c;
int rows, cols;
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index b8e183c..47f92f1 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -507,12 +507,11 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
int mb_row, mb_col, mb_row_flip, mb_offset = 0;
int block, y, uv, stride_y, stride_uv;
- int golden_frame = 0;
int res;
s->modelp = &s->models[is_alpha];
- res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
+ res = s->parse_header(s, buf, remaining_buf_size);
if (!res)
return -1;
@@ -620,7 +619,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
next:
- if (p->key_frame || golden_frame) {
+ if (p->key_frame || s->golden_frame) {
if (s->framep[VP56_FRAME_GOLDEN]->data[0] && s->framep[VP56_FRAME_GOLDEN] != p &&
s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
@@ -690,6 +689,7 @@ av_cold void ff_vp56_init_context(AVCodecContext *avctx, VP56Context *s,
s->macroblocks = NULL;
s->quantizer = -1;
s->deblock_filtering = 1;
+ s->golden_frame = 0;
s->filter = NULL;
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index 8256bee..7a32342 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -50,7 +50,7 @@ typedef void (*VP56DefaultModelsInit)(VP56Context *s);
typedef void (*VP56ParseVectorModels)(VP56Context *s);
typedef int (*VP56ParseCoeffModels)(VP56Context *s);
typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf,
- int buf_size, int *golden_frame);
+ int buf_size);
typedef struct {
int high;
@@ -105,6 +105,7 @@ struct vp56_context {
int sub_version;
/* frame info */
+ int golden_frame;
int plane_width[4];
int plane_height[4];
int mb_width; /* number of horizontal MB */
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index a895386..c6d1dea 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -43,8 +43,7 @@
static void vp6_parse_coeff(VP56Context *s);
static void vp6_parse_coeff_huffman(VP56Context *s);
-static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
- int *golden_frame)
+static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
{
VP56RangeCoder *c = &s->c;
int parse_filter_info = 0;
@@ -111,7 +110,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
}
ff_vp56_init_range_decoder(c, buf+1, buf_size-1);
- *golden_frame = vp56_rac_get(c);
+ s->golden_frame = vp56_rac_get(c);
if (s->filter_header) {
s->deblock_filtering = vp56_rac_get(c);
if (s->deblock_filtering)
--
1.6.3.GIT
More information about the ffmpeg-devel
mailing list