Unverified Commit 6e7cecd3 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

[FBcode->GH] torchvision decoder. fix artifacts, blury images for frame...


[FBcode->GH] torchvision decoder. fix artifacts, blury images for frame dimensions not multiple of 8 (#7523) (#7552)
Co-authored-by: default avatarVadim Zubov <vadikrobot@meta.com>
parent 5a9e2103
...@@ -181,6 +181,23 @@ bool VideoSampler::init(const SamplerParameters& params) { ...@@ -181,6 +181,23 @@ bool VideoSampler::init(const SamplerParameters& params) {
// set output format // set output format
params_ = params; params_ = params;
if (params.in.video.format == AV_PIX_FMT_YUV420P) {
/* When the video width and height are not multiples of 8,
* and there is no size change in the conversion,
* a blurry screen will appear on the right side
* This problem was discovered in 2012 and
* continues to exist in version 4.1.3 in 2019
* This problem can be avoided by increasing SWS_ACCURATE_RND
* details https://trac.ffmpeg.org/ticket/1582
*/
if ((params.in.video.width & 0x7) || (params.in.video.height & 0x7)) {
VLOG(1) << "The width " << params.in.video.width << " and height "
<< params.in.video.height << " the image is not a multiple of 8, "
<< "the decoding speed may be reduced";
swsFlags_ |= SWS_ACCURATE_RND;
}
}
scaleContext_ = sws_getContext( scaleContext_ = sws_getContext(
params.in.video.width, params.in.video.width,
params.in.video.height, params.in.video.height,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment