diff mbox

[FFmpeg-devel] avcodec/vc1: fix B predictor validity for 4-MV MBs

Message ID 57d4f6b9-0468-0814-0e99-b0727939bac3@carpalis.nl
State Accepted
Commit fc6e53b0b662c60560dff75cc93248f72d0faf8a
Headers show

Commit Message

Jerome Borsboom Jan. 14, 2019, 8:05 a.m. UTC
The B predictor for 4-MV MBs in interlace field pictures is not used
for blocks 0 and 2 when the picture is 1 MB wide.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
---
My 'shuffle calculation of MV predictor candidates' patch overlooked the
corner case of 1 MB wide field interlace pictures. According to VC-1 spec
and the reference decoder, the B predictor is not used for for block 0 and
block 2 when the picture is 1 MB wide. This patch corrects this.

 libavcodec/vc1_pred.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Carl Eugen Hoyos Jan. 14, 2019, 11:30 a.m. UTC | #1
2019-01-14 9:05 GMT+01:00, Jerome Borsboom <jerome.borsboom@carpalis.nl>:
> The B predictor for 4-MV MBs in interlace field pictures is not used
> for blocks 0 and 2 when the picture is 1 MB wide.
>
> Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
> ---
> My 'shuffle calculation of MV predictor candidates' patch overlooked the
> corner case of 1 MB wide field interlace pictures. According to VC-1 spec
> and the reference decoder, the B predictor is not used for for block 0 and
> block 2 when the picture is 1 MB wide. This patch corrects this.
>
>  libavcodec/vc1_pred.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
> index e1758a3817..77dda86cd0 100644
> --- a/libavcodec/vc1_pred.c
> +++ b/libavcodec/vc1_pred.c
> @@ -289,6 +289,8 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int
> dmv_y,
>          case 3:
>              off = -1;
>          }
> +        if (v->field_mode && s->mb_width == 1)
> +            b_valid = b_valid && c_valid;

I will push this if you don't request commit rights
but shouldn't this be "b_valid &= c_valid;"?

Carl Eugen
Jerome Borsboom Jan. 14, 2019, 12:05 p.m. UTC | #2
> 2019-01-14 9:05 GMT+01:00, Jerome Borsboom <jerome.borsboom at carpalis.nl>:
>> The B predictor for 4-MV MBs in interlace field pictures is not used
>> for blocks 0 and 2 when the picture is 1 MB wide.
>>
>> Signed-off-by: Jerome Borsboom <jerome.borsboom at carpalis.nl>
>> ---
>> My 'shuffle calculation of MV predictor candidates' patch overlooked the
>> corner case of 1 MB wide field interlace pictures. According to VC-1 spec
>> and the reference decoder, the B predictor is not used for for block 0 and
>> block 2 when the picture is 1 MB wide. This patch corrects this.
>>
>>  libavcodec/vc1_pred.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
>> index e1758a3817..77dda86cd0 100644
>> --- a/libavcodec/vc1_pred.c
>> +++ b/libavcodec/vc1_pred.c
>> @@ -289,6 +289,8 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int
>> dmv_y,
>>          case 3:
>>              off = -1;
>>          }
>> +        if (v->field_mode && s->mb_width == 1)
>> +            b_valid = b_valid && c_valid;
> 
> I will push this if you don't request commit rights
> but shouldn't this be "b_valid &= c_valid;"?
> 
> Carl Eugen

Please push. As b_valid and c_valid both expressions would give the same
result. I really meant logical comparison, so 'b_valid = b_valid &&
c_valid' is correct and will short-circuit where &= would not.

Regards,
Jerome
Carl Eugen Hoyos Jan. 14, 2019, 12:41 p.m. UTC | #3
2019-01-14 13:05 GMT+01:00, Jerome Borsboom <jerome.borsboom@carpalis.nl>:
>> 2019-01-14 9:05 GMT+01:00, Jerome Borsboom <jerome.borsboom at
>> carpalis.nl>:
>>> The B predictor for 4-MV MBs in interlace field pictures is not used
>>> for blocks 0 and 2 when the picture is 1 MB wide.
>>>
>>> Signed-off-by: Jerome Borsboom <jerome.borsboom at carpalis.nl>
>>> ---
>>> My 'shuffle calculation of MV predictor candidates' patch overlooked the
>>> corner case of 1 MB wide field interlace pictures. According to VC-1 spec
>>> and the reference decoder, the B predictor is not used for for block 0
>>> and
>>> block 2 when the picture is 1 MB wide. This patch corrects this.
>>>
>>>  libavcodec/vc1_pred.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
>>> index e1758a3817..77dda86cd0 100644
>>> --- a/libavcodec/vc1_pred.c
>>> +++ b/libavcodec/vc1_pred.c
>>> @@ -289,6 +289,8 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x,
>>> int
>>> dmv_y,
>>>          case 3:
>>>              off = -1;
>>>          }
>>> +        if (v->field_mode && s->mb_width == 1)
>>> +            b_valid = b_valid && c_valid;
>>
>> I will push this if you don't request commit rights
>> but shouldn't this be "b_valid &= c_valid;"?
>
> Please push.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index e1758a3817..77dda86cd0 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -289,6 +289,8 @@  void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
         case 3:
             off = -1;
         }
+        if (v->field_mode && s->mb_width == 1)
+            b_valid = b_valid && c_valid;
     }
 
     if (v->field_mode) {