You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know how much this really matters, since maybe everyone just avoids this case already for now by just not calling with height values that obviously don't work, but for posterity:
When the height of the video is an odd number, we get some lines of chroma error at the top, and a single line of it at the bottom.
Also for some odd heights but not others it seems like the bottom line is truncated in the pre-scaling video (this is easier to see at lower resolutions with something like this caption with a gap underneath at the bottom):
I suspect playing back videos where the resolution is not a multiple of the subsampling is probably a bad time generally because of all the instances in the code of stuff like: height >> p[i].ss.y
and ((width * height) >> (p[i].ss.x + p[i].ss.y))
i.e. right shifting by the subsampling bits, in other words dividing by the subsampling multiple rounding down, when you need to round up -- the actual plane obviously has to have another line to cover the last less-than-a-full-subsample's-worth lines of the overall image.
But just fixing instances of those that I could find isn't enough on its own. There's something that needs the extra full subsample worth of lines in the output image, I guess. The hack of just doing e.g.:
height = ROUND_UP(height, 2);
at the top of nvCreateSurface2() and
picture_height = ROUND_UP(picture_height, 2);
at the top of nvCreateContext() does make all the problems go away, at least testing from mpv.
The text was updated successfully, but these errors were encountered:
The issue is in CUVIDDECODECREATEINFO where ulTargetWidth and ulTargetHeight should be multiple of 2. In ffmpegulTargetWidth and ulTargetHeight are rounded up to 2.
cuviddec.c:167 FFmpeg n7.1
// target width/height need to be multiples of twocuinfo.ulTargetWidth=avctx->width= (avctx->width+1) & ~1;
cuinfo.ulTargetHeight=avctx->height= (avctx->height+1) & ~1;
I don't know how much this really matters, since maybe everyone just avoids this case already for now by just not calling with height values that obviously don't work, but for posterity:
When the height of the video is an odd number, we get some lines of chroma error at the top, and a single line of it at the bottom.
Also for some odd heights but not others it seems like the bottom line is truncated in the pre-scaling video (this is easier to see at lower resolutions with something like this caption with a gap underneath at the bottom):
I suspect playing back videos where the resolution is not a multiple of the subsampling is probably a bad time generally because of all the instances in the code of stuff like:
height >> p[i].ss.y
and
((width * height) >> (p[i].ss.x + p[i].ss.y))
i.e. right shifting by the subsampling bits, in other words dividing by the subsampling multiple rounding down, when you need to round up -- the actual plane obviously has to have another line to cover the last less-than-a-full-subsample's-worth lines of the overall image.
But just fixing instances of those that I could find isn't enough on its own. There's something that needs the extra full subsample worth of lines in the output image, I guess. The hack of just doing e.g.:
at the top of
nvCreateSurface2()
andat the top of
nvCreateContext()
does make all the problems go away, at least testing frommpv
.The text was updated successfully, but these errors were encountered: