首页 > 代码库 > android KK上,前摄,对于normal、zsd、facebeauty拍照,实现mirror
android KK上,前摄,对于normal、zsd、facebeauty拍照,实现mirror
1、
normal shot.
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\NormalShot\NormalShot.cpp,
bool
NormalShot::
onCmd_capture()
{
...
//加上以下code
if(getOpenId() == 1 && bFlip){
switch(mShotParam.mu4Transform){
case eTransform_ROT_90:
mShotParam.mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mShotParam.mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mShotParam.mu4Transform = eTransform_FLIP_V;
break;
default:
mShotParam.mu4Transform = eTransform_FLIP_H;
break;
}
}
//加上code,end
// shot param
NSCamShot::ShotParam rShotParam(
eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mu4Transform, //picture transform
ePostViewFmt, //postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview transform
mShotParam.mu4ZoomRatio //zoom
);
(2)Face beauty,
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\FBShot\Facebeauty.cpp,
MBOOL
Mhal_facebeauty::
createJpegImg(IImageBuffer const * rSrcImgBufInfo
, NSCamShot::JpegParam const & rJpgParm
, MUINT32 const u4Transform
, IImageBuffer const * rJpgImgBufInfo
, MUINT32 & u4JpegSize)
{
...
将
pISImager->setTransform(u4Transform);
替换为
if(getOpenId() == 1 && bFlip){
MUINT32 mu4Transform = 0;
switch(u4Transform){
case eTransform_ROT_90:
mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mu4Transform = eTransform_FLIP_V;
break;
default:
mu4Transform = eTransform_FLIP_H;
break;
}
pISImager->setTransform(mu4Transform);
}else
pISImager->setTransform(u4Transform);
(3)zsd shot,
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\CapBufShot\CapBufShot.cpp,
bool
CapBufShot::
onCmd_capture()
{
...
//加上以下code
if(getOpenId() == 1 && bFlip){
switch(mShotParam.mu4Transform){
case eTransform_ROT_90:
mShotParam.mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mShotParam.mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mShotParam.mu4Transform = eTransform_FLIP_V;
break;
default:
mShotParam.mu4Transform = eTransform_FLIP_H;
break;
}
}
//加上code,end
// shot param
NSCamShot::ShotParam rShotParam(
eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mu4Transform, //picture transform
ePostViewFmt, //postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview transform
mShotParam.mu4ZoomRatio //zoom
);
2、
alps/mediatek/platform/mt6595/hardware/mtkcam/core/
SingleShot.cpp
BurstShot.cpp
MultiShot.cpp
pass2node.preview.cpp
pass2node.capture.cpp
搜索eTransform_ROT_90,
将
if( XX == eTransform_ROT_90 ||
XX == eTransform_ROT_270 )
替换为
if( XX & eTransform_ROT_90 ||
XX == eTransform_ROT_270)
3、
(1)alps/mediatek/platform/mt6595/hardware/mtkcam/core/iopipe/SImager/ImageTransform/ImageTransform.cpp
MBOOL
ImageTransform::
convertTransform(
MUINT32 const u4Transform,
MUINT32 & u4Rotation,
MUINT32 & u4Flip
)
{
。。。
将
#define TransCase( trans, rot, flip ) \
case trans: \
u4Rotation = (rot); \
u4Flip = (flip); \
break;
TransCase(0 , 0 , 0)
TransCase(eTransform_FLIP_H , 180 , 1)
TransCase(eTransform_FLIP_V , 0 , 1)
TransCase(eTransform_ROT_90 , 90 , 0)
TransCase(eTransform_ROT_180 , 180 , 0)
TransCase(eTransform_ROT_270 , 270 , 0)
default:
MY_LOGE("not supported transform(0x%x)", u4Transform);
u4Rotation = 0;
u4Flip = 0;
return MFALSE;
break;
#undef TransCase
替换为
#define TransCase( trans, rot, flip ) \
case trans: \
u4Rotation = (rot); \
u4Flip = (flip); \
break;
TransCase(0 , 0 , 0)
TransCase(eTransform_FLIP_H , 0 , 1)
TransCase(eTransform_FLIP_V , 180 , 1)
TransCase(eTransform_ROT_90 , 90 , 0)
TransCase(eTransform_ROT_180 , 180 , 0)
TransCase(eTransform_FLIP_H|eTransform_ROT_90 , 270 , 1)
TransCase(eTransform_FLIP_V|eTransform_ROT_90 , 90 , 1)
TransCase(eTransform_ROT_270 , 270 , 0)
default:
MY_LOGE("not supported transform(0x%x)", u4Transform);
u4Rotation = 0;
u4Flip = 0;
return MFALSE;
break;
#undef TransCase
(2)alps\mediatek\platform\mt6595\hardware\mtkcam\core\iopipe\PostProc\HalPipeWrapper.cpp,
将
TransformMapping mTransformMapping[TRANSFORM_MAX]=
{
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_180,NSImageio::NSIspio::eImgRot_180,NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_OFF},
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_270,NSImageio::NSIspio::eImgRot_270,NSImageio::NSIspio::eImgFlip_OFF}
};
替换为
TransformMapping mTransformMapping[TRANSFORM_MAX]=
{
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V, NSImageio::NSIspio::eImgRot_180, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_180,NSImageio::NSIspio::eImgRot_180,NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H|eTransform_ROT_90, NSImageio::NSIspio::eImgRot_270, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V|eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_270,NSImageio::NSIspio::eImgRot_270,NSImageio::NSIspio::eImgFlip_OFF}
};
normal shot.
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\NormalShot\NormalShot.cpp,
bool
NormalShot::
onCmd_capture()
{
...
//加上以下code
if(getOpenId() == 1 && bFlip){
switch(mShotParam.mu4Transform){
case eTransform_ROT_90:
mShotParam.mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mShotParam.mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mShotParam.mu4Transform = eTransform_FLIP_V;
break;
default:
mShotParam.mu4Transform = eTransform_FLIP_H;
break;
}
}
//加上code,end
// shot param
NSCamShot::ShotParam rShotParam(
eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mu4Transform, //picture transform
ePostViewFmt, //postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview transform
mShotParam.mu4ZoomRatio //zoom
);
(2)Face beauty,
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\FBShot\Facebeauty.cpp,
MBOOL
Mhal_facebeauty::
createJpegImg(IImageBuffer const * rSrcImgBufInfo
, NSCamShot::JpegParam const & rJpgParm
, MUINT32 const u4Transform
, IImageBuffer const * rJpgImgBufInfo
, MUINT32 & u4JpegSize)
{
...
将
pISImager->setTransform(u4Transform);
替换为
if(getOpenId() == 1 && bFlip){
MUINT32 mu4Transform = 0;
switch(u4Transform){
case eTransform_ROT_90:
mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mu4Transform = eTransform_FLIP_V;
break;
default:
mu4Transform = eTransform_FLIP_H;
break;
}
pISImager->setTransform(mu4Transform);
}else
pISImager->setTransform(u4Transform);
(3)zsd shot,
alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\CapBufShot\CapBufShot.cpp,
bool
CapBufShot::
onCmd_capture()
{
...
//加上以下code
if(getOpenId() == 1 && bFlip){
switch(mShotParam.mu4Transform){
case eTransform_ROT_90:
mShotParam.mu4Transform = eTransform_FLIP_V | eTransform_ROT_90;
break;
case eTransform_ROT_270:
mShotParam.mu4Transform = eTransform_FLIP_H | eTransform_ROT_90;
break;
case eTransform_ROT_180:
mShotParam.mu4Transform = eTransform_FLIP_V;
break;
default:
mShotParam.mu4Transform = eTransform_FLIP_H;
break;
}
}
//加上code,end
// shot param
NSCamShot::ShotParam rShotParam(
eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mu4Transform, //picture transform
ePostViewFmt, //postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview transform
mShotParam.mu4ZoomRatio //zoom
);
2、
alps/mediatek/platform/mt6595/hardware/mtkcam/core/
SingleShot.cpp
BurstShot.cpp
MultiShot.cpp
pass2node.preview.cpp
pass2node.capture.cpp
搜索eTransform_ROT_90,
将
if( XX == eTransform_ROT_90 ||
XX == eTransform_ROT_270 )
替换为
if( XX & eTransform_ROT_90 ||
XX == eTransform_ROT_270)
3、
(1)alps/mediatek/platform/mt6595/hardware/mtkcam/core/iopipe/SImager/ImageTransform/ImageTransform.cpp
MBOOL
ImageTransform::
convertTransform(
MUINT32 const u4Transform,
MUINT32 & u4Rotation,
MUINT32 & u4Flip
)
{
。。。
将
#define TransCase( trans, rot, flip ) \
case trans: \
u4Rotation = (rot); \
u4Flip = (flip); \
break;
TransCase(0 , 0 , 0)
TransCase(eTransform_FLIP_H , 180 , 1)
TransCase(eTransform_FLIP_V , 0 , 1)
TransCase(eTransform_ROT_90 , 90 , 0)
TransCase(eTransform_ROT_180 , 180 , 0)
TransCase(eTransform_ROT_270 , 270 , 0)
default:
MY_LOGE("not supported transform(0x%x)", u4Transform);
u4Rotation = 0;
u4Flip = 0;
return MFALSE;
break;
#undef TransCase
替换为
#define TransCase( trans, rot, flip ) \
case trans: \
u4Rotation = (rot); \
u4Flip = (flip); \
break;
TransCase(0 , 0 , 0)
TransCase(eTransform_FLIP_H , 0 , 1)
TransCase(eTransform_FLIP_V , 180 , 1)
TransCase(eTransform_ROT_90 , 90 , 0)
TransCase(eTransform_ROT_180 , 180 , 0)
TransCase(eTransform_FLIP_H|eTransform_ROT_90 , 270 , 1)
TransCase(eTransform_FLIP_V|eTransform_ROT_90 , 90 , 1)
TransCase(eTransform_ROT_270 , 270 , 0)
default:
MY_LOGE("not supported transform(0x%x)", u4Transform);
u4Rotation = 0;
u4Flip = 0;
return MFALSE;
break;
#undef TransCase
(2)alps\mediatek\platform\mt6595\hardware\mtkcam\core\iopipe\PostProc\HalPipeWrapper.cpp,
将
TransformMapping mTransformMapping[TRANSFORM_MAX]=
{
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_180,NSImageio::NSIspio::eImgRot_180,NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_OFF},
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_270,NSImageio::NSIspio::eImgRot_270,NSImageio::NSIspio::eImgFlip_OFF}
};
替换为
TransformMapping mTransformMapping[TRANSFORM_MAX]=
{
{0, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H, NSImageio::NSIspio::eImgRot_0, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V, NSImageio::NSIspio::eImgRot_180, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_180,NSImageio::NSIspio::eImgRot_180,NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_OFF},
{eTransform_FLIP_H|eTransform_ROT_90, NSImageio::NSIspio::eImgRot_270, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_FLIP_V|eTransform_ROT_90, NSImageio::NSIspio::eImgRot_90, NSImageio::NSIspio::eImgFlip_ON},
{eTransform_ROT_270,NSImageio::NSIspio::eImgRot_270,NSImageio::NSIspio::eImgFlip_OFF}
};
android KK上,前摄,对于normal、zsd、facebeauty拍照,实现mirror
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。