【转载】添加hdr feature

一.概述
以HDR Feature为例,在CamX中添加一个新的Feature

从上游stream(upstream) feature获取格式P010的多帧数据作为input
pipeline(SWMFMergeYuv)运行算法
生成同样格式的单帧数据作为输出,发送给下游stream(down stream) feature
二.添加
2.1 从Feature基类派生Feature
2.1.1 重要的文件:
/chi-cdk/oem/qcom/feature2/chifeature2hdr/chifeature2hdr.cpp
/chi-cdk/oem/qcom/feature2/chifeature2hdr/chifeature2hdr.h
/chi-cdk /oem/qcom/feature2/chifeature2hdr/common/build/android/Android.mk


2.1.2 重要的函数
DoQueryCaps(){ }
CreateFeature(){ }
OnSelectFlowToExecuteRequest (){ }
DoPrepareRequest(){ }
DoStreamNegotiation(){ }
2.2 添加Feature Descriptor (Feature描述符)
2.2.1 CHI Feature descriptor包括如下细节组件:
ChiFeature input/output target buffer descriptor.
ChiFeature input/output port descriptor.
ChiFeature pipelines descriptor.
ChiFeature session info descriptor.
ChiFeature input dependency and config descriptor.
ChiFeature stage info descriptor
Session, Pipeline, 和 port numbers 从 0 开始递增 1

如果1个session里面有2个pipeline,pipeline Id就是 0 和 1

2.2.2 重要定义:
vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h

确保所有的input/output target都在chifeature2utils.h的TargetStreamMap有列出

vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h

ChiFeature2Type 中添加一个新的 feature type

2.2.3 chifeature2HDRdescriptor.cpp放在正确的目录
将Feature Descriptor文件chifeature2HDRdescriptor.cpp放在正确的文件目录下

2.2.4 添加ChiFeature2TargetDescriptor
ChiFeature2TargetDescriptor结构体描述 Feature 的 Input/output Targets

ChiFeature2TargetDescriptor的target buffer名字要和feature使用的pipeline(SWMFMergeYuv)的target buffer名字保持一致

2.2.5 添加ChiFeature2PortDescriptor
ChiFeature2PortDescriptor 结构体描述了Feature的ports, 包括session的info、pipeline、port index、port direction、port type 和 Feature port 到 Target 的映射

2.2.6 添加ChiFeature2PipelineDescriptor
ChiFeature2PipelineDescriptor结构体描述Feature里pipeline的信息

2.2.7 添加ChiFeature2SessionDescriptor
ChiFeature2SessionDescriptor结构体描述Feature中的Session信息

2.2.8 添加ChiFeature2StageDescriptor
ChiFeature2StageDescriptor 结构体描述Stage Id,Stage Name, pointer to the input dependency descriptor tale

2.2.9 添加ChiFeature2Descriptor 
ChiFeature2Descriptor 结构体描述Feature Id、Feature name、Feature里stages的个数,并且指向session descriptor table。

pFeatureName("HDRDemo") 必须和DoQueryCaps()中的ppCapabilities("HDRDemo ")一样

三.Feature2中使用Feature描述符(Descriptor)
3.1 在Android.mk中包含Feature descriptor和Feature class files
/chi-cdk/oem/qcom/feature2/chifeature2hdr/common/build/android/Android.mk

# Block this if use generated
LOCAL_SRC_FILES := \
    chifeature2hdrdemo/chifeature2hdr.cpp \
    chifeature2graphselector/descriptors/nongenerated/chifeature2hdrdescriptor.cpp
LOCAL_INC_FILES := \
    chifeature2hdr/chifeature2hdr.h
# Binary name
LOCAL_MODULE := com.qti.feature2.hdr
...
include $(BUILD_SHARED_LIBRARY)
3.2 oem/Android.mk中 Include HDR Feature mk
/chi-cdk/oem/Android.mk

include $(CAMX_CHICDK_OEM_PATH)/qcom/feature2/chifeature2hdrdemo/common/build/android/Android.mk
include $(CAMX_CHICDK_OEM_PATH)/qcom/feature2/chifeature2realtimeserializer/common/build/android/Android.mk
3.3 项目配置mk文件中的PRODUCT_PACKAGES Include "HDR Feature class lib"
com.qti.feature2.hdrdemo.so由HDR feature的.cpp和.h编译生成

/chi-cdk/configs/product.mk

PRODUCT_PACKAGES = com.qti.feature2.rawhdr
PRODUCT_PACKAGES = com.qti.feature2.hdrdemo
PRODUCT_PACKAGES = com.qti.feature2.rt
3.4 LOCAL_SHARED_LIBRARIES中 Include "HDR Feature class lib"
当在graphselector里使用HDRDemo feature时,需要添加com.qti.feature2.hdrdemo到LOCAL_SHARED_LIBRARIES

/chi-cdk/oem/qcom/feature2/chifeature2graphselector/sm8350/build/android/Android.mk

LOCAL_SHARED_LIBRARIES = \
    com.qti.feature2.rawhdr \
    com.qti.feature2.hdrdemo \
    com.qti.feature2.swmf \
四.结束

原文链接:https://blog.csdn.net/geyichongchujianghu/article/details/131034146

添加HDR环境到three.js场景中,需要使用THREE.RGBELoader和THREE.HDRILoader加载器。 首先,你需要下载所需的HDR环境贴图,并将其放置在你的项目中。然后,在Three.js中使用RGBELoader加载器加载贴图文件: ```javascript const envMap = new THREE.RGBELoader() .setDataType(THREE.UnsignedByteType) .load('path/to/hdr/file.hdr', function (texture) { // 环境贴图加载完成后执行的回调函数 texture.encoding = THREE.RGBEEncoding; texture.minFilter = THREE.NearestFilter; texture.magFilter = THREE.NearestFilter; texture.format = THREE.RGBAFormat; texture.generateMipmaps = false; scene.background = envMap; scene.environment = envMap; }); ``` 在加载完成后,设置环境贴图的编码方式、滤波器、格式等。然后,将环境贴图分配给场景的背景和环境属性。 接下来,你需要使用HDRILoader加载器加载HDR环境贴图文件: ```javascript new THREE.HDRLoader() .setDataType(THREE.UnsignedByteType) .load('path/to/hdr/file.hdr', function (texture) { // HDR环境贴图加载完成后执行的回调函数 texture.encoding = THREE.RGBEEncoding; texture.minFilter = THREE.NearestFilter; texture.magFilter = THREE.NearestFilter; texture.format = THREE.RGBAFormat; texture.generateMipmaps = false; const pmremGenerator = new THREE.PMREMGenerator(renderer); pmremGenerator.compileEquirectangularShader(); const envMap = pmremGenerator.fromEquirectangular(texture).texture; scene.background = envMap; scene.environment = envMap; texture.dispose(); pmremGenerator.dispose(); }); ``` 在加载完成后,设置HDR环境贴图的编码方式、滤波器、格式等。然后,使用PMREMGenerator生成预计算的辐照度贴图,并将其分配给场景的背景和环境属性。最后,释放贴图和PMREMGenerator的资源。 这样,你就可以在three.js场景中添加HDR环境了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值