android YV12 地址偏移 与 line_stride 对齐

1.buffer地址偏移
以分辨率 1280*720 格式为YV12 为例,Y起始地址为0x100000000 ,且是连续

y_addr   = 0x100000000;
cb_addr =  y_addr  + 1280×720;
cr_addr =  cb_addr + 1280*720/4;

2.line stride计算
需要考虑到不同硬件使用相同的地址,如camera 写buffer display去显示。而两个硬件的line stride 要求不同,则需要计算一个line stride 来满足他们。下面是android 官网给的计算方式.
PS: line stride 可以理解为硬件写实际一行后,下一行起始地址的累加长度,
如 1028 ×720 对齐后 1280×720 .则硬件每次写一行数据为1280,一共写720行,这样就把对应的Y数据写完

Android YUV format.

This format is exposed to software decoders and applications.

YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed by (W/2) x (H/2) Cr and Cb planes.

This format assumes

an even width
an even height
a horizontal stride multiple of 16 pixels
a vertical stride equal to the height
 y_size = stride * height
 c_stride = ALIGN(stride/2, 16)
 c_size = c_stride * height/2
 size = y_size + c_size * 2
 cr_offset = y_size
 cb_offset = y_size + c_size

NV21 的line stride

cb_stride = y_stride;
cr_stride = 0;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值