Quote:
Originally Posted by Asmodian
An aside: For the same reasons you should not be using super sampling and point resize at the same time. Using point resize undoes the super sampling. I think your example would just add 106 to the top and 98 to the bottom.
|
Not exactly.
The purpose of the supersampling is to end up adding borders with an odd number of pixels (here 105 and 99, matching the earlier Crop). This works for the luma, thus restoring the uncropped luma pixels to their original positions. However (and this is probably what you meant), it adds 53 chroma pixels to the top and 49 to the bottom, so chroma is shifted down by 1 luma pixel (2*53 - 105).
In addition, the earlier odd-numbered Crop has introduced a shift of its own, amounting to 1 luma pixel, so the final result has a shift of 2 luma pixels.
However, as this is an even number (and we have a YV12 clip), it can be easily corrected by adding a final
MergeChroma(PointResize(width, height, 0, 2))
Thus the following sequence is completely lossless (except of course for the pixels cropped off).
Code:
ConvertToYV24(chromaresample="point")
MergeChroma(PointResize(width, height, 0, 1))
#ConvertToRGB32() removed to make completely lossless
Crop(10,105,10,-99)
ConvertToYV12(chromaresample="point")
ss=2
PointResize(width*ss, height*ss)
AddBorders(10*ss, 105*ss, 10*ss, 99*ss)
PointResize(width/ss, height/ss)
MergeChroma(PointResize(width, height, 0, 2))