android前置拍照镜像代码,如何通过libyuv::I420Scale为Android前置摄像头实现镜像?...

Mirror - Horizontal Flip

Mirror functions for horizontally flipping an image, which can be useful for 'self view' of a webcam.

int I420Mirror(const uint8* src_y, int src_stride_y,

const uint8* src_u, int src_stride_u,

const uint8* src_v, int src_stride_v,

uint8* dst_y, int dst_stride_y,

uint8* dst_u, int dst_stride_u,

uint8* dst_v, int dst_stride_v,

int width, int height);Mirror functionality can also be achieved with the I420Scale and ARGBScale functions by passing negative width and/or height.

但是,我看到了像这样的I420Scale的实现:

LIBYUV_API

int I420Scale(const uint8* src_y, int src_stride_y,

const uint8* src_u, int src_stride_u,

const uint8* src_v, int src_stride_v,

int src_width, int src_height,

uint8* dst_y, int dst_stride_y,

uint8* dst_u, int dst_stride_u,

uint8* dst_v, int dst_stride_v,

int dst_width, int dst_height,

enum FilterMode filtering) {

int src_halfwidth = SUBSAMPLE(src_width, 1, 1);

int src_halfheight = SUBSAMPLE(src_height, 1, 1);

int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);

int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);

if (!src_y || !src_u || !src_v || src_width == 0 || src_height == 0 ||

src_width > 32768 || src_height > 32768 ||

!dst_y || !dst_u || !dst_v || dst_width <= 0 || dst_height <= 0) {

return -1;

}

ScalePlane(src_y, src_stride_y, src_width, src_height,

dst_y, dst_stride_y, dst_width, dst_height,

filtering);

ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight,

dst_u, dst_stride_u, dst_halfwidth, dst_halfheight,

filtering);

ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight,

dst_v, dst_stride_v, dst_halfwidth, dst_halfheight,

filtering);

return 0;

}如果dst_width <= 0 || dst_height <= 0,则return -1;

这是关于Mirror functionality can also be achieved with the I420Scale by passing negative width and/or height的笑话吗?

如何通过I420Scale实现镜像功能?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值