Commit 8bba752a authored by Derek Buitenhuis's avatar Derek Buitenhuis

Merge commit 'ea6ab02a'

* commit 'ea6ab02a':
  svq3: move the frame num variables to the SVQ3Context
Merged-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parents 014fb816 ea6ab02a
......@@ -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++) {
......
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