View Single Post
Old 17th February 2013, 14:57   #32  |  Link
06_taro
soy sauce buyer
 
Join Date: Mar 2010
Location: United Kingdom
Posts: 164
Quote:
(my image source is a handmade png 16 bit image under photoshop CS3)
What is the final pixel format of your AviSynth script? avs4x264mod currently only supports outputting YV12/YV16/YV24 without forcing to convert them to YV12. If the final pixel format of your script is Y8/YV411/YUY2/RGB, then ConvertToYV12() is automatically invoked.

Quote:
Or I can convert it with ConvertToYV24 but I think YV24 is 8bit, am I wrong ?
Exactly. However, thanks to Cretindesalpes for his dither package, we can use up to 16-bit YUV420/422/444 formats in AviSynth. There are two formats of such high bit depth colour space: stacked and interleaved. The former contains MSB and LSB stacked vertically, so it is easy for viewing and general filtering; while the latter actually put MSB data and LSB data in the same structure that native Planar YUV formats use, so it can be used for encoding: if you tell the receiver of this format (e.g. x264) that the raw YUV is yuv420p16, then x264 will treat this fake interleaved MSB/LSB as 16-bit yuv420. You can use yuv444p10 in the similar way by:
PHP Code:
ImageSource("input.png")

# convert RGB to stacked yuv444p16
Dither_Convert_RGB_TO_YUV(output="YV24"lsb=True)

# convert stacked yuv444p16 to interleaved yuv444p16 for encoding, you can also use Dither_out()
f3kdb(Y=0Cb=0Cr=0grainY=0grainC=0input_depth=16input_mode=1output_depth=16output_mode=2
Then feed the script to avs4x264mod with "--input-depth=16", then such raw yuv444p16 will be passed directly to x264 without unnecessary conversion.

If your raw yuv data is neither 8-bit nor 16-bit, then vanilla x264 will firstly shift it to 16-bit then dither it back to encoding bit depth using Sierra-2-4A error diffusion dithering. If you are using x264 built with the patch Skip bit depth filter when possible, then you can even pass 10bit avs script to x264, and neither avs4x264mod nor patched x264 will do any conversion on the raw yuv:
PHP Code:
ImageSource("input.png")

# convert RGB to stacked yuv444p16
Dither_Convert_RGB_TO_YUV(output="YV24"lsb=True)

# convert stacked yuv444p16 to interleaved yuv444p10 for encoding
f3kdb(Y=0Cb=0Cr=0grainY=0grainC=0input_depth=16input_mode=1output_depth=10output_mode=2
Then feed the script to avs4x264mod with "--input-depth=10".

Last edited by 06_taro; 17th February 2013 at 15:07.
06_taro is offline   Reply With Quote