Message ID | 6d53a008-2bbe-0006-1412-4d9037e298ee@carpalis.nl |
---|---|
State | Accepted |
Headers | show |
2019-01-11 15:36 GMT+01:00, Jerome Borsboom <jerome.borsboom@carpalis.nl>: > The position of the B MV predicitor candidate is slightly different > for the old WMV3 format that is indicated by RES_RTM_FLAG. This patch > fixes the decoding artifacts in the niceday.wmv sample. Cool! Please mention / test ticket #6641, there are still (less) artefacts. > Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl> > --- > libavcodec/vc1.c | 5 ----- > libavcodec/vc1_pred.c | 7 ++++++- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c > index 3581d87b57..e102b931d8 100644 > --- a/libavcodec/vc1.c > +++ b/libavcodec/vc1.c > @@ -379,11 +379,6 @@ int ff_vc1_decode_sequence_header(AVCodecContext > *avctx, VC1Context *v, GetBitCo > } else { > v->res_rtm_flag = get_bits1(gb); //reserved > } > - if (!v->res_rtm_flag) { > - av_log(avctx, AV_LOG_ERROR, > - "Old WMV3 version detected, some frames may be decoded > incorrectly\n"); > - //return -1; > - } > //TODO: figure out what they mean (always 0x402F) > if (!v->res_fasttx) > skip_bits(gb, 16); > diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c > index 0b22d9916c..1ae1e33fbe 100644 > --- a/libavcodec/vc1_pred.c > +++ b/libavcodec/vc1_pred.c > @@ -275,7 +275,12 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, > int dmv_y, > //in 4-MV mode different blocks have different B predictor position > switch (n) { > case 0: > - off = (s->mb_x > 0) ? -1 : 1; > + if (v->res_rtm_flag) > + off = s->mb_x ? -1 : 1; > + else { Please add more (free) braces. Thank you, Carl Eugen
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 3581d87b57..e102b931d8 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -379,11 +379,6 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo } else { v->res_rtm_flag = get_bits1(gb); //reserved } - if (!v->res_rtm_flag) { - av_log(avctx, AV_LOG_ERROR, - "Old WMV3 version detected, some frames may be decoded incorrectly\n"); - //return -1; - } //TODO: figure out what they mean (always 0x402F) if (!v->res_fasttx) skip_bits(gb, 16); diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index 0b22d9916c..1ae1e33fbe 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -275,7 +275,12 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, //in 4-MV mode different blocks have different B predictor position switch (n) { case 0: - off = (s->mb_x > 0) ? -1 : 1; + if (v->res_rtm_flag) + off = s->mb_x ? -1 : 1; + else { + off = s->mb_x ? -1 : 2 * s->mb_width - wrap - 1; + b_valid = b_valid && (s->mb_x || s->mb_y > 1); + } break; case 1: off = (s->mb_x == (s->mb_width - 1)) ? -1 : 1;
The position of the B MV predicitor candidate is slightly different for the old WMV3 format that is indicated by RES_RTM_FLAG. This patch fixes the decoding artifacts in the niceday.wmv sample. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl> --- libavcodec/vc1.c | 5 ----- libavcodec/vc1_pred.c | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-)