Commit 4e2f6212 authored by Anton Khirnov's avatar Anton Khirnov

svq3: stop using H264Picture

The SVQ3 decoder has been decoupled from the H.264 decoder, so it can
now use its own data type.
parent 251cbb44
...@@ -65,6 +65,20 @@ ...@@ -65,6 +65,20 @@
* svq3 decoder. * svq3 decoder.
*/ */
typedef struct SVQ3Frame {
AVFrame *f;
AVBufferRef *motion_val_buf[2];
int16_t (*motion_val[2])[2];
AVBufferRef *mb_type_buf;
uint32_t *mb_type;
AVBufferRef *ref_index_buf[2];
int8_t *ref_index[2];
} SVQ3Frame;
typedef struct SVQ3Context { typedef struct SVQ3Context {
AVCodecContext *avctx; AVCodecContext *avctx;
...@@ -74,9 +88,9 @@ typedef struct SVQ3Context { ...@@ -74,9 +88,9 @@ typedef struct SVQ3Context {
TpelDSPContext tdsp; TpelDSPContext tdsp;
VideoDSPContext vdsp; VideoDSPContext vdsp;
H264Picture *cur_pic; SVQ3Frame *cur_pic;
H264Picture *next_pic; SVQ3Frame *next_pic;
H264Picture *last_pic; SVQ3Frame *last_pic;
GetBitContext gb; GetBitContext gb;
GetBitContext gb_slice; GetBitContext gb_slice;
uint8_t *slice_buf; uint8_t *slice_buf;
...@@ -410,7 +424,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, ...@@ -410,7 +424,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
int mx, int my, int dxy, int mx, int my, int dxy,
int thirdpel, int dir, int avg) int thirdpel, int dir, int avg)
{ {
const H264Picture *pic = (dir == 0) ? s->last_pic : s->next_pic; const SVQ3Frame *pic = (dir == 0) ? s->last_pic : s->next_pic;
uint8_t *src, *dest; uint8_t *src, *dest;
int i, emu = 0; int i, emu = 0;
int blocksize = 2 - (width >> 3); // 16->0, 8->1, 4->2 int blocksize = 2 - (width >> 3); // 16->0, 8->1, 4->2
...@@ -1298,7 +1312,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) ...@@ -1298,7 +1312,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
static void free_picture(AVCodecContext *avctx, H264Picture *pic) static void free_picture(AVCodecContext *avctx, SVQ3Frame *pic)
{ {
int i; int i;
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
...@@ -1310,7 +1324,7 @@ static void free_picture(AVCodecContext *avctx, H264Picture *pic) ...@@ -1310,7 +1324,7 @@ static void free_picture(AVCodecContext *avctx, H264Picture *pic)
av_frame_unref(pic->f); av_frame_unref(pic->f);
} }
static int get_buffer(AVCodecContext *avctx, H264Picture *pic) static int get_buffer(AVCodecContext *avctx, SVQ3Frame *pic)
{ {
SVQ3Context *s = avctx->priv_data; SVQ3Context *s = avctx->priv_data;
const int big_mb_num = s->mb_stride * (s->mb_height + 1) + 1; const int big_mb_num = s->mb_stride * (s->mb_height + 1) + 1;
...@@ -1339,10 +1353,10 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic) ...@@ -1339,10 +1353,10 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
pic->ref_index[i] = pic->ref_index_buf[i]->data; pic->ref_index[i] = pic->ref_index_buf[i]->data;
} }
} }
pic->reference = !(s->pict_type == AV_PICTURE_TYPE_B);
ret = ff_get_buffer(avctx, pic->f, ret = ff_get_buffer(avctx, pic->f,
pic->reference ? AV_GET_BUFFER_FLAG_REF : 0); (s->pict_type != AV_PICTURE_TYPE_B) ?
AV_GET_BUFFER_FLAG_REF : 0);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
...@@ -1388,7 +1402,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data, ...@@ -1388,7 +1402,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
return -1; return -1;
if (s->pict_type != AV_PICTURE_TYPE_B) if (s->pict_type != AV_PICTURE_TYPE_B)
FFSWAP(H264Picture*, s->next_pic, s->last_pic); FFSWAP(SVQ3Frame*, s->next_pic, s->last_pic);
av_frame_unref(s->cur_pic->f); av_frame_unref(s->cur_pic->f);
...@@ -1539,7 +1553,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data, ...@@ -1539,7 +1553,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
*got_frame = 1; *got_frame = 1;
if (s->pict_type != AV_PICTURE_TYPE_B) { if (s->pict_type != AV_PICTURE_TYPE_B) {
FFSWAP(H264Picture*, s->cur_pic, s->next_pic); FFSWAP(SVQ3Frame*, s->cur_pic, s->next_pic);
} else { } else {
av_frame_unref(s->cur_pic->f); av_frame_unref(s->cur_pic->f);
} }
......
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