头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

Re: 【test】4:2:2 comparison

fch1993 写了:
06_taro 写了:[syntax lang="avisynth" lines="f"]# Adjust these settings according to your source clip
matrix = "709"
tv_range = true
chroma_p = "MPEG2"
#
Dither_convert_yuv_to_rgb(matrix=matrix,
\ tv_range=tv_range,
\ cplace=chroma_p,
\ chromak="bicubic",
\ output="rgb48y")
r = SelectEvery(3, 0)
g = SelectEvery(3, 1)
b = SelectEvery(3, 2)
Dither_convert_rgb_to_yuv(r, g, b,
\ matrix=matrix,
\ tv_range=tv_range,
\ cplace=chroma_p,
\ chromak="bicubic",
\ lsb=true, output="YV16")
[/syntax]
这个输出YV24的话该如何修改。查维基的转换没查出来。
這裡不是給出例子了麼…前面那個走RGB48Y的我個人更不推薦,盡量別用RGB中轉,一定要用的話無非就是把最後一行裡output="YV16"改成output="YV24"而已…

還是那句話,如果你不知道原始片子製作階段的chroma subsampling採樣過程是如何進行的,那就別拿4:2:0的源來壓4:2:2或者4:4:4。上面這個些腳本都是在默認原片製作沒有任何問題,完全符合MPEG-2的choma subsampling的position標準,中途沒有任何chroma上的問題才可以這樣做。要是原盤有一點問題,誰都沒法推測出應該該怎麼辦,絕大多數處理都是錯誤的,我相信大部分人胡亂處理出來的結果都不如madVR直接在播放階段靠高精度下GPU shader做的chroma upsampling的質量。尤其是如果您連上面這個RGB48Y中轉的方法都不知道如何改的話,我個人更加懷疑您能否做出符合標準的upsampling。

另外還有,x264的內部在編碼4:4:4的情況下,chroma-qp-offset默認是會在4:2:0/4:2:2的設定基礎上+6的,也就是說人為降低了4:4:4裡chroma的編碼質量。當然您可以手動設定這個參數,但是最終編碼結果會有什麼影響請自己看著辦。
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
fch1993
帖子: 213
注册时间: 2012-06-12 11:56

Re: 【test】4:2:2 comparison

f3kdb(range=9,Y=48,Cb=40,Cr=40,keep_tv_range=true,dither_algo=3,input_mode=0,output_mode=2,output_depth=16)或者LumaDBL(dither="f3kdb(range=9,Y=48,Cb=40,Cr=40,keep_tv_range=true,dither_algo=3,input_mode=0,output_mode=2,output_depth=16)", d_lsb=true, d_lsb_in=false)

之后再用
c16 = U16
U = c16.UtoY.Dither_resize16(width, height, 0.25, U=1, V=1)
V = c16.VtoY.Dither_resize16(width, height, 0.25, U=1, V=1)
YtoUV(U, V, c16.ConvertToYV24)
或者
c16 = U16
U = c16.UtoY.Dither_resize16(width/2, height, 0.25, U=1, V=1)
V = c16.VtoY.Dither_resize16(width/2, height, 0.25, U=1, V=1)
YtoUV(U, V, c16.ConvertToYV16)AVS就会跪。
求解。

还有原生422的MPEG2是不是直接转。(chroma错误除外)
例如

ID : 1 (0x1)
完整名称 : J:\Beijing.2008.Opening.Ceremony.MPEG2.422.1080i.55.Mbps.AC3.5.1-aB.ts
文件格式 : MPEG-TS
文件大小 : 28.4 GiB
长度 : 1小时 11分
平均混合码率 : 56.7 Mbps

视频
ID : 17 (0x11)
菜单ID : 1 (0x1)
文件格式 : MPEG Video
格式版本 : Version 2
格式简介 : 4:2:2@High
格式设置, BVOP : 是
格式设置, Matrix : 自定义
格式设置, GOP : M=3, N=12
编码设置ID : 2
长度 : 1小时 11分
码率 : 53.4 Mbps
最大码率 : 55.0 Mbps
画面宽度 : 1 920像素
画面高度 : 1 080像素
画面比例 : 16:9
帧率 : 25.000 fps
色彩空间 : YUV
色度抽样 : 4:2:2
位深度 : 8位
扫描方式 : 隔行扫描
扫描顺序 : 奇数场(前场TFF)优先
压缩模式 : 有损压缩
bits/(pixel*frame)(数据密度) : 1.031
大小 : 26.8 GiB (94%)

音频
ID : 20 (0x14)
菜单ID : 1 (0x1)
文件格式 : AC-3
文件格式/信息 : Audio Coding 3
扩展模式 : CM (complete main)
编码设置ID : 129
长度 : 1小时 11分
码率模式 : CBR
码率 : 448 Kbps
声道 : 6声道
声道位置 : Front: L C R, Side: L R, LFE
采样率 : 48.0 KHz
位深度 : 16位
压缩模式 : 有损压缩
视频延迟 : 920ms
大小 : 230 MiB (1%)
语言 : English
头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

Re: 【test】4:2:2 comparison

output_mode=2
x264裡lavf的demuxer可以直接吃4:2:2,並直接輸出4:2:2
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
头像
mawen1250
核心会员
核心会员
帖子: 670
注册时间: 2011-07-24 20:33

Re: 【test】4:2:2 comparison

LumaDBL里的f3kdb只能用output_mode=1,16bit下的处理只能在stack的16bit上用,interleave的16bit只用于输出给x264。
c16 = U16这条是把8bit的输入升到16bit,你已经输入16bit(而且还是interleave格式)再U16那不出问题才奇怪了。

一定要升444那就这么用,chroma、luma分别进行resize后成为YV24,在444下做有edgemask保护的deband。

代码: 全选

source_width = last.width()
source_height = last.height()
#设定目标分辨率,默认为源分辨率
target_width = source_width
target_height = source_height

c8  = last
c16 = c8.U16()
Y   = ( source_width==target_width && source_height==target_height ) ? 
      \c16.Dither_resize16(target_width, target_height, kernel="spline36", U=1, V=1) : c16
U   = c16.UtoY.Dither_resize16(target_width, target_height, 0.25, kernel="bicubic", U=1, V=1)
V   = c16.VtoY.Dither_resize16(target_width, target_height, 0.25, kernel="bicubic", U=1, V=1)
P16 = YtoUV(U, V, Y.ConvertToYV24())

deband = P16.f3kdb(range=9,Y=48,Cb=40,Cr=40,keep_tv_range=true,dither_algo=3,input_mode=1,output_mode=1,output_depth=16)
emask  = c8.TEdgeMask(link=2, preblur=true, valon=-1, U=1, V=1 ).mt_lut( "x 255 *", U=1, V=1).ConvertToYV24()
Dither_merge16_8( deband, P16, emask, luma=true )

Down10(stack=false)

回到 “理论讨论 / Theoratical discussion”