haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
523 stars 63 forks source link

utils/libav: Only adjust bit_shift for DRM P010 frames #239

Closed nowrep closed 5 months ago

nowrep commented 5 months ago

Not sure about this one, but it fixes rendering P010 on radv (would be full green otherwise).

haasn commented 5 months ago

Hi, can you share the command line you used to reproduce / test this? I want to make sure I understand fully what's going on, first.

nowrep commented 5 months ago

can you share the command line

I don't have any, if you can send me some example I can try to reproduce.

My case is just simple code, very similar to what you can see in #237 . Looking more into it, bits->sample_depth being 0 doesn't seem to cause issues in my code, but the additional bit_shift will make it render incorrectly.

streamingdv commented 5 months ago

@nowrep I tested your fix and as you mentioned, this line in libav_internal.h is producing the green frames

case AV_PIX_FMT_P010: bits->bit_shift = 6; break;

I created a patch in my project which removes the "switch case" and can confirm that I no longer receive green frames for AV_PIX_FMT_P010 and everything works as intended.

nowrep commented 5 months ago

Thanks for testing. The bit shift is still needed for DRM P010 frames, so I updated the patch accordingly.