-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve GPU frames accuracy #413
Conversation
EDIT: out of date, just refer to updated see main comment above |
Wow! Great catch! Thanks @fmassa, @pjs102793 and @NicolasHug! |
@@ -225,7 +225,7 @@ void convertAVFrameToDecodedOutputOnCuda( | |||
auto start = std::chrono::high_resolution_clock::now(); | |||
NppStatus status; | |||
if (src->colorspace == AVColorSpace::AVCOL_SPC_BT709) { | |||
status = nppiNV12ToRGB_709HDTV_8u_P2C3R( | |||
status = nppiNV12ToRGB_709CSC_8u_P2C3R( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by: this should probably be gated by AVFrame::color_range.
https://ffmpeg.org/doxygen/trunk/pixfmt_8h.html#a3da0bf691418bc22c4bcbe6583ad589a
MPEG has limited color-range while JPEG has full color range.
We were using full for all frames before -- now we are using limited for all. Colorspace and color-range are orthogonal so probably need nested ifs here.
We now call
nppiNV12ToRGB_709CSC_8u_P2C3R
for GPU frame color conversion, instead ofnppiNV12ToRGB_709HDTV_8u_P2C3R
, as suggested in #412This dramatically improves accuracy of decoded frames, as they are now much closer to the expected CPU ones, within
atol=2
(this is even stricter than our frame comparison for MacOS!).Closes #412
Thank you @fmassa for the original hint in #372 (comment) and @pjs102793 for chasing this up!