diff mbox

[FFmpeg-devel] avcodec/vaapi: do not parse MVMODE for VC-1 interlaced frame pictures

Message ID f8be1b9e-6d66-dc00-9d73-81c51b3c15d5@carpalis.nl
State Accepted
Commit 8132d362facd6bde7dd158733bf2b4723295ec5b
Headers show

Commit Message

Jerome Borsboom March 29, 2018, 11:43 a.m. UTC
Interlaced frame pictures do not contain the MVMODE or MVMODE2 bitstream
element. Trying to parse this element and passing a nonzero value to the
hardware decoder results in small inaccuracies in the decoded picture.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
---
With this patch the Intel hardware decoded fate test for ilaced_twomv.vc1
perfectly matches the output from the Microsoft software decoder.

 libavcodec/vaapi_vc1.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Jerome Borsboom April 23, 2018, 6:58 p.m. UTC | #1
On 29-3-2018 13:43, Jerome Borsboom wrote:
> Interlaced frame pictures do not contain the MVMODE or MVMODE2 bitstream
> element. Trying to parse this element and passing a nonzero value to the
> hardware decoder results in small inaccuracies in the decoded picture.
> 
> Signed-off-by: Jerome Borsboom <jerome.borsboom at carpalis.nl>
> ---
> With this patch the Intel hardware decoded fate test for ilaced_twomv.vc1
> perfectly matches the output from the Microsoft software decoder.
> 
>  libavcodec/vaapi_vc1.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
> index 74ba783141..bdb5e24cc5 100644
> --- a/libavcodec/vaapi_vc1.c
> +++ b/libavcodec/vaapi_vc1.c
> @@ -138,8 +138,9 @@ static int vc1_get_FPTYPE(const VC1Context *v)
>  /** Reconstruct bitstream MVMODE (7.1.1.32) */
>  static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
>  {
> -    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
> -        (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))
> +    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
> +        ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
> +         (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)))
>          return get_VAMvModeVC1(v->mv_mode);
>      return 0;
>  }
> @@ -147,7 +148,8 @@ static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
>  /** Reconstruct bitstream MVMODE2 (7.1.1.33) */
>  static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
>  {
> -    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
> +    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
> +        (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
>          v->mv_mode == MV_PMODE_INTENSITY_COMP)
>          return get_VAMvModeVC1(v->mv_mode2);
>      return 0;
> -- 
> 2.13.6

Could someone please have a look at this patch?
Mark Thompson April 23, 2018, 10:19 p.m. UTC | #2
On 23/04/18 19:58, Jerome Borsboom wrote:
> On 29-3-2018 13:43, Jerome Borsboom wrote:
>> Interlaced frame pictures do not contain the MVMODE or MVMODE2 bitstream
>> element. Trying to parse this element and passing a nonzero value to the
>> hardware decoder results in small inaccuracies in the decoded picture.
>>
>> Signed-off-by: Jerome Borsboom <jerome.borsboom at carpalis.nl>
>> ---
>> With this patch the Intel hardware decoded fate test for ilaced_twomv.vc1
>> perfectly matches the output from the Microsoft software decoder.
>>
>>  libavcodec/vaapi_vc1.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
>> index 74ba783141..bdb5e24cc5 100644
>> --- a/libavcodec/vaapi_vc1.c
>> +++ b/libavcodec/vaapi_vc1.c
>> @@ -138,8 +138,9 @@ static int vc1_get_FPTYPE(const VC1Context *v)
>>  /** Reconstruct bitstream MVMODE (7.1.1.32) */
>>  static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
>>  {
>> -    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
>> -        (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))
>> +    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
>> +        ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
>> +         (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)))
>>          return get_VAMvModeVC1(v->mv_mode);
>>      return 0;
>>  }
>> @@ -147,7 +148,8 @@ static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
>>  /** Reconstruct bitstream MVMODE2 (7.1.1.33) */
>>  static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
>>  {
>> -    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
>> +    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
>> +        (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
>>          v->mv_mode == MV_PMODE_INTENSITY_COMP)
>>          return get_VAMvModeVC1(v->mv_mode2);
>>      return 0;
>> -- 
>> 2.13.6
> 
> Could someone please have a look at this patch?

Tested, looks good and matches the reference output for me as well, applied.

Thanks!

- Mark
diff mbox

Patch

diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 74ba783141..bdb5e24cc5 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -138,8 +138,9 @@  static int vc1_get_FPTYPE(const VC1Context *v)
 /** Reconstruct bitstream MVMODE (7.1.1.32) */
 static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
 {
-    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
-        (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))
+    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
+        ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) ||
+         (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)))
         return get_VAMvModeVC1(v->mv_mode);
     return 0;
 }
@@ -147,7 +148,8 @@  static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
 /** Reconstruct bitstream MVMODE2 (7.1.1.33) */
 static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
 {
-    if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
+    if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
+        (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
         v->mv_mode == MV_PMODE_INTENSITY_COMP)
         return get_VAMvModeVC1(v->mv_mode2);
     return 0;