diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-05-03 10:24:27 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-05-03 10:24:33 +0100 |
commit | 8bba752ae95f385f2658c43ca5b512e5f9b31a51 (patch) | |
tree | 267cd52bec7a65b966c35717e8b422efce17726d | |
parent | 014fb816d104fef876f7044c0f6876e890c93c0a (diff) | |
parent | ea6ab02a174bcc11f3eaa1b840c9a4c895968690 (diff) | |
download | ffmpeg-8bba752ae95f385f2658c43ca5b512e5f9b31a51.tar.gz |
Merge commit 'ea6ab02a174bcc11f3eaa1b840c9a4c895968690'
* commit 'ea6ab02a174bcc11f3eaa1b840c9a4c895968690':
svq3: move the frame num variables to the SVQ3Context
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavcodec/svq3.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index fd43e84ab2..2223d10b67 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -96,6 +96,10 @@ typedef struct SVQ3Context { int slice_num; int qscale; int cbp; + int frame_num; + int frame_num_offset; + int prev_frame_num_offset; + int prev_frame_num; enum AVPictureType pict_type; @@ -510,15 +514,15 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode, my = s->next_pic->motion_val[0][b_xy][1] << 1; if (dir == 0) { - mx = mx * h->frame_num_offset / - h->prev_frame_num_offset + 1 >> 1; - my = my * h->frame_num_offset / - h->prev_frame_num_offset + 1 >> 1; + mx = mx * s->frame_num_offset / + s->prev_frame_num_offset + 1 >> 1; + my = my * s->frame_num_offset / + s->prev_frame_num_offset + 1 >> 1; } else { - mx = mx * (h->frame_num_offset - h->prev_frame_num_offset) / - h->prev_frame_num_offset + 1 >> 1; - my = my * (h->frame_num_offset - h->prev_frame_num_offset) / - h->prev_frame_num_offset + 1 >> 1; + mx = mx * (s->frame_num_offset - s->prev_frame_num_offset) / + s->prev_frame_num_offset + 1 >> 1; + my = my * (s->frame_num_offset - s->prev_frame_num_offset) / + s->prev_frame_num_offset + 1 >> 1; } } @@ -1514,22 +1518,22 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data, } if (s->pict_type == AV_PICTURE_TYPE_B) { - h->frame_num_offset = s->slice_num - h->prev_frame_num; + s->frame_num_offset = s->slice_num - s->prev_frame_num; - if (h->frame_num_offset < 0) - h->frame_num_offset += 256; - if (h->frame_num_offset == 0 || - h->frame_num_offset >= h->prev_frame_num_offset) { + if (s->frame_num_offset < 0) + s->frame_num_offset += 256; + if (s->frame_num_offset == 0 || + s->frame_num_offset >= s->prev_frame_num_offset) { av_log(h->avctx, AV_LOG_ERROR, "error in B-frame picture id\n"); return -1; } } else { - h->prev_frame_num = h->frame_num; - h->frame_num = s->slice_num; - h->prev_frame_num_offset = h->frame_num - h->prev_frame_num; + s->prev_frame_num = s->frame_num; + s->frame_num = s->slice_num; + s->prev_frame_num_offset = s->frame_num - s->prev_frame_num; - if (h->prev_frame_num_offset < 0) - h->prev_frame_num_offset += 256; + if (s->prev_frame_num_offset < 0) + s->prev_frame_num_offset += 256; } for (m = 0; m < 2; m++) { |