RomanArzumanyan / VALI

Video processing in Python
Apache License 2.0
42 stars 4 forks source link

PySurfaceDownloader (minor) issue: too fast! #71

Open Yves33 opened 3 months ago

Yves33 commented 3 months ago

Hi again! On my machine (core i7 12700 / GeForce RTX 3060), I find that running successfully.

PyDecoder.DecodeSingleSurface(nv12_surface)
PySurfaceDownloader.Run(nv12_surface, nv12_cpu_buffer)

may result in altered nv12 buffer ( top of image is cropped - see reconstituted and resized image from buffer below)

PIL_07

the problem

minimal code to reproduce: https://github.com/Yves33/Vali_luma_chroma_shift/blob/main/Vali_nv12_download.py

it seems to me that the download starts before decoded frame is ready.

RomanArzumanyan commented 3 months ago

Hi @Yves33

Thank you for the detailed analysis. I suspect the actual source of problem is here:

https://github.com/RomanArzumanyan/VALI/blob/32368227c0afc89793f3df9fb40de55b25d3d76c/src/TC/src/TaskDecodeFrame.cpp#L518-L534

After I've switched to default CUDA stream and started to push context created by FFMpeg, the reproduction ratio fell but still some decoder unit tests fail to pass from time to time.

I'll continue investigation on this. Maybe if I make FFMpeg use the same CUDA context as VALI, it will be solved. Anyway, as I find something I'll come back to you.

RomanArzumanyan commented 3 months ago

Hi @Yves33

Please check out latest version 3.2.10. Looks like it solves the issue, at least 2 previously unstable hw decoder unit tests are now passing.

Yves33 commented 3 months ago

version 3.2.10 sovles the issue (at least with my test videos...)