[FFmpeg-devel] [PATCH 2/3 v1.2] avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding

Hendrik Leppkes h.leppkes at gmail.com
Fri Mar 2 12:22:30 EET 2018


On Fri, Mar 2, 2018 at 2:23 AM, Jun Zhao <mypopydev at gmail.com> wrote:
>
>
> On 2018/3/2 6:43, Mark Thompson wrote:
>> On 01/03/18 08:07, Jerome Borsboom wrote:
>>> v1.1->v1.2: Changed ifdefs around vc1_get_INTCOMPFIELD, vc1_get_LUMSCALE2,
>>> and vc1_get_LUMSHIFT2 to av_unused.
>>>
>>> avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding
>>>
>>> Pass necessary bitstream elements to the VAAPI VC-1 decoder in order
>>> to start doing interlaced decoding in hardware.
>>>
>>> Signed-off-by: Jerome Borsboom <jerome.borsboom at carpalis.nl>
>>> ---
>>>  libavcodec/vaapi_vc1.c | 163 ++++++++++++++++++++++++++++++++++++++++---------
>>>  1 file changed, 134 insertions(+), 29 deletions(-)
>> Wrt hashes, here is fate/vc1/ilaced_twomv.vc1 from a few different decoders:
>>
>> libavcodec software decoder:
>>
>> 0,          0,          0,        1,  3110400, 0x764f8856
>> 0,          2,          2,        1,  3110400, 0x3b615b79
>> 0,          3,          3,        1,  3110400, 0x4fbb6f84
>> 0,          4,          4,        1,  3110400, 0xc1ca8532
>> 0,          5,          5,        1,  3110400, 0xb6e7d363
>> 0,          6,          6,        1,  3110400, 0x1beb5c34
>> 0,          7,          7,        1,  3110400, 0xcb8cb061
>> 0,          8,          8,        1,  3110400, 0x13ddbd61
>> 0,          9,          9,        1,  3110400, 0xde8f052f
>> 0,         10,         10,        1,  3110400, 0x4d4072db
>> 0,         11,         11,        1,  3110400, 0x4e5d29e3
>> 0,         12,         12,        1,  3110400, 0x75300531
>> 0,         13,         13,        1,  3110400, 0x1114285a
>>
>> VAAPI, "Intel i965 driver for Intel(R) Coffee Lake - 2.1.1.pre1 (2.0.0-140-gff23e69)":
>>
>> 0,          0,          0,        1,  3110400, 0xc95e8861
>> 0,          2,          2,        1,  3110400, 0xf58b5cbf
>> 0,          3,          3,        1,  3110400, 0x2f866f33
>> 0,          4,          4,        1,  3110400, 0x05c18415
>> 0,          5,          5,        1,  3110400, 0x94dff199
>> 0,          6,          6,        1,  3110400, 0xf31fda77
>> 0,          7,          7,        1,  3110400, 0x60b1b2da
>> 0,          8,          8,        1,  3110400, 0x748993f5
>> 0,          9,          9,        1,  3110400, 0x750fdf14
>> 0,         10,         10,        1,  3110400, 0x0879792c
>> 0,         11,         11,        1,  3110400, 0x7e0e60fa
>> 0,         12,         12,        1,  3110400, 0xda5bd837
>> 0,         13,         13,        1,  3110400, 0xb6346ccf
>>
>> VAAPI, "Mesa Gallium driver 18.1.0-devel for AMD Radeon (TM) RX 460 Graphics (POLARIS11 / DRM 3.23.0 / 4.15.7, LLVM 4.0.1)":
>>
>> 0,          0,          0,        1,  3110400, 0xc95e8861
>> 0,          2,          2,        1,  3110400, 0xafefc967
>> 0,          3,          3,        1,  3110400, 0x1d736d3b
>> 0,          4,          4,        1,  3110400, 0x4f0fe807
>> 0,          5,          5,        1,  3110400, 0x758c6e9b
>> 0,          6,          6,        1,  3110400, 0x56a5c92a
>> 0,          7,          7,        1,  3110400, 0xa60fcf66
>> 0,          8,          8,        1,  3110400, 0x0c638017
>> 0,          9,          9,        1,  3110400, 0x3fe3310c
>> 0,         10,         10,        1,  3110400, 0x3d2ea8de
>> 0,         11,         11,        1,  3110400, 0xe2f8de62
>> 0,         12,         12,        1,  3110400, 0xa309cd68
>> 0,         13,         13,        1,  3110400, 0x8602abb1
>>
>> Microsoft decoder (thanks to Hendrik for these):
>>
>> 0,          0,          0,        1,  3110400, 0xc95e8861
>> 0,          2,          2,        1,  3110400, 0xf58b5cbf
>> 0,          3,          3,        1,  3110400, 0x2f866f33
>> 0,          4,          4,        1,  3110400, 0x05c18415
>> 0,          5,          5,        1,  3110400, 0x4077ca93
>> 0,          6,          6,        1,  3110400, 0x44d105fc
>> 0,          7,          7,        1,  3110400, 0xa0608374
>> 0,          8,          8,        1,  3110400, 0x407689dc
>> 0,          9,          9,        1,  3110400, 0x4707d00a
>> 0,         10,         10,        1,  3110400, 0x74986831
>> 0,         11,         11,        1,  3110400, 0xa5912619
>> 0,         12,         12,        1,  3110400, 0x44aa5565
>> 0,         13,         13,        1,  3110400, 0xb9752774
>>
>> The VAAPI hardware implementations agree with the Microsoft decoder for the initial four (Intel) or one (AMD) frames, while the software decoder doesn't agree at all.  Unfortunately the AMD output is completely broken after the first frame, but the Intel output does look sensible through the whole sequence.  So, while this could probably be improved in drivers just as it could in the software decoder, the FATE test is not relevant here so this discussion shouldn't block anything.
>>
>> As such, I'm happy to apply all of this as it is now.  Does anyone have any further comments, especially about the VC-1 parts of this change?  If not, I'll apply the whole set this weekend.
>>
>> Thanks,
>>
>> - Mark
> I am OK to merge this part, in fact, I have a similar patches
> (https://github.com/mypopydev/FFmpeg/commit/da0e142cfc6302790bba08704d4cc0b507a78f70),
> but I think Jerome Borsboom did better job than me, so I didn't submit
> the patch.
>
> For VC1 interlaced decoding can't bit match (bit-exact) for Windows
> Decoder/FFmpeg SW Decoder/VA-API HWAccel Decoder, I guess the root cause
> is the DCT/iDCT precision.

For the record, DXVA2/D3D11 on my Intel Haswell GPU also matches the
Intel VAAPI results, so it seems to be up to the hardware/driver.
NVIDIA DXVA2/D3D11 matches the Microsoft software decoder, FWIW.

Is VC-1 even specified strong enough to result in bit-exact output
from every possible decoder?

- Hendrik


More information about the ffmpeg-devel mailing list