On 24/04/2024 14:45, Xiang, Haihao wrote: > On Ma, 2024-04-22 at 22:23 +0100, Mark Thompson wrote: >> Rather than turning the constraint flags into a single profile and then >> searching for that profile (and failing if it doesn't match any profile >> exactly), instead search all supported profiles and use the first one >> which supports the given set of constraint flags. >> --- >> This fixes decode of rext 8-bit 4:2:0; it will correctly pick Main 12 or Main >> 4:2:2 10 or Main 4:4:4 (first one available) to use as the decoding profile >> after this patch. > > sw decoding and vaapi decoding might have different bits (There is the same > issue if applying Fei's patchset). > > For example: > $ ffmpeg -hwaccel vaapi -f lavfi -i testsrc -vf 'format=nv12,hwupload' -c:v > hevc_vaapi -profile:v rext -vframes 30 -y out.mp4 > > 8bit ouput if using sw decoding: > $ ffmpeg -i out.mp4 -f null - > [...] > Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, progressive), 320x240 > [SAR > 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn (default) > > 12bit output if using vaapi decoding: > $ ffmpeg -hwaccel vaapi -i out.mp4 -f null - > [...] > Stream #0:0(und): Video: wrapped_avframe, p012le(tv, progressive), 320x240 > [SAR > 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
That comes from what the driver reports support for, though? E.g. with the Intel iHD driver, I have { "profile": 23, "name": "HEVCMain12", ... "surface_formats": [ { "rt_format": "YUV420", "max_width": 16384, "max_height": 16384, "memory_types": [ "VA", "DRM_PRIME_2", ], "pixel_formats": [ "P012", "P016", ], }, So to decode a 4:2:0 8-bit input it is asking for a P012 or P016 surface. If the driver reported that a Main 12 profile 4:2:0 8-bit input could be decoded to an NV12 surface then it would be picked by the logic in vaapi_decode_find_best_format(), since it would be a better match than the higher-depth formats. Thanks, - Mark _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".