aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliubolun <bolun.liu@intel.com>2013-11-22 14:03:23 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:02:56 -0700
commita0f95d79fa654a816532eea0ee8868e56049847c (patch)
treed0f40d1c83bace7d570a41753b9708eb3fc2bd8f
parent2bab681173a098b357b98ce4e7f0837b9a430c07 (diff)
downloadandroid_hardware_intel_common_omx-components-a0f95d79fa654a816532eea0ee8868e56049847c.tar.gz
android_hardware_intel_common_omx-components-a0f95d79fa654a816532eea0ee8868e56049847c.tar.bz2
android_hardware_intel_common_omx-components-a0f95d79fa654a816532eea0ee8868e56049847c.zip
[PORT FROM MAIN JB-MR2] Eble dynamic setting bitrate/framerate/K frame for VP8 encode.
BZ: 153768 Add a pair of get/set config function for seting k frame; Add codecs judgement for bitrate/frame rate setting in VCM mode. Change-Id: Ic86ceee7aadb7b296917ee340a732c79141b551c Orig-Change-Id: I6ffdad79cbe19ec8cdb753837ac48f87069b6f5d Signed-off-by: liubolun <bolun.liu@intel.com>
-rwxr-xr-xvideocodec/OMXVideoEncoderBase.cpp17
-rw-r--r--videocodec/OMXVideoEncoderVP8.cpp30
-rw-r--r--videocodec/OMXVideoEncoderVP8.h2
3 files changed, 42 insertions, 7 deletions
diff --git a/videocodec/OMXVideoEncoderBase.cpp b/videocodec/OMXVideoEncoderBase.cpp
index 628da22..0960e0c 100755
--- a/videocodec/OMXVideoEncoderBase.cpp
+++ b/videocodec/OMXVideoEncoderBase.cpp
@@ -418,7 +418,6 @@ OMX_ERRORTYPE OMXVideoEncoderBase::BuildHandlerList(void) {
AddHandler((OMX_INDEXTYPE)OMX_IndexStoreMetaDataInBuffers, GetStoreMetaDataInBuffers, SetStoreMetaDataInBuffers);
AddHandler((OMX_INDEXTYPE)OMX_IndexExtSyncEncoding, GetSyncEncoding, SetSyncEncoding);
AddHandler((OMX_INDEXTYPE)OMX_IndexExtPrependSPSPPS, GetPrependSPSPPS, SetPrependSPSPPS);
-
return OMX_ErrorNone;
}
@@ -568,7 +567,8 @@ OMX_ERRORTYPE OMXVideoEncoderBase::GetConfigIntelBitrate(OMX_PTR pStructure) {
OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigIntelBitrate(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
Encode_Status retStatus = ENCODE_SUCCESS;
- if (mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax) {
+ if ((mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax)&&
+ (mEncoderParams->profile != VAProfileVP8Version0_3)) {
LOGE("SetConfigIntelBitrate failed. Feature is disabled.");
return OMX_ErrorUnsupportedIndex;
}
@@ -583,8 +583,9 @@ OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigIntelBitrate(OMX_PTR pStructure) {
// TODO: return OMX_ErrorIncorrectStateOperation?
CHECK_SET_CONFIG_STATE();
- if (mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode) {
- LOGE("SetConfigIntelBitrate failed. Feature is supported only in VCM.");
+ if ((mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode)&&
+ (mEncoderParams->profile != VAProfileVP8Version0_3)){
+ LOGE("SetConfigIntelBitrate failed. Feature is supported only in VCM for AVC/H264/MPEG4.");
return OMX_ErrorUnsupportedSetting;
}
VideoConfigBitRate configBitRate;
@@ -723,7 +724,8 @@ OMX_ERRORTYPE OMXVideoEncoderBase::GetConfigVideoFramerate(OMX_PTR pStructure) {
OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigVideoFramerate(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
Encode_Status retStatus = ENCODE_SUCCESS;
- if (mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax) {
+ if ((mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax)&&
+ (mEncoderParams->profile != VAProfileVP8Version0_3)){
LOGE("SetConfigVideoFramerate failed. Feature is disabled.");
return OMX_ErrorUnsupportedIndex;
}
@@ -738,8 +740,9 @@ OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigVideoFramerate(OMX_PTR pStructure) {
// TODO, return OMX_ErrorIncorrectStateOperation?
CHECK_SET_CONFIG_STATE();
- if (mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode) {
- LOGE("SetConfigIntelAIR failed. Feature is supported only in VCM.");
+ if ((mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode)&&
+ (mEncoderParams->profile != VAProfileVP8Version0_3)){
+ LOGE("SetConfigIntelAIR failed. Feature is supported only in VCM for AVC/H264/MPEG4.");
return OMX_ErrorUnsupportedSetting;
}
VideoConfigFrameRate framerate;
diff --git a/videocodec/OMXVideoEncoderVP8.cpp b/videocodec/OMXVideoEncoderVP8.cpp
index 8df2b3d..c5630f9 100644
--- a/videocodec/OMXVideoEncoderVP8.cpp
+++ b/videocodec/OMXVideoEncoderVP8.cpp
@@ -194,6 +194,7 @@ OMX_ERRORTYPE OMXVideoEncoderVP8::BuildHandlerList(void) {
OMXVideoEncoderBase::BuildHandlerList();
AddHandler((OMX_INDEXTYPE)OMX_IndexParamVideoVp8, GetParamVideoVp8, SetParamVideoVp8);
AddHandler((OMX_INDEXTYPE)OMX_IndexConfigVideoVp8ReferenceFrame, GetConfigVideoVp8ReferenceFrame, SetConfigVideoVp8ReferenceFrame);
+ AddHandler((OMX_INDEXTYPE)OMX_IndexExtVP8ForceKFrame, GetConfigVp8ForceKFrame, SetConfigVp8ForceKFrame);
return OMX_ErrorNone;
}
@@ -253,4 +254,33 @@ OMX_ERRORTYPE OMXVideoEncoderVP8::SetConfigVideoVp8ReferenceFrame(OMX_PTR pStruc
return OMX_ErrorNone;
}
+OMX_ERRORTYPE OMXVideoEncoderVP8::GetConfigVp8ForceKFrame(OMX_PTR pStructure) {
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE OMXVideoEncoderVP8::SetConfigVp8ForceKFrame(OMX_PTR pStructure) {
+ OMX_ERRORTYPE ret;
+ Encode_Status retStatus = ENCODE_SUCCESS;
+ OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME *p = (OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME*) pStructure;
+ CHECK_TYPE_HEADER(p);
+ CHECK_PORT_INDEX(p, OUTPORT_INDEX);
+
+ CHECK_SET_CONFIG_STATE();
+
+ VideoConfigVP8 configVP8;
+ configVP8.force_kf = p->bForceKFrame;
+ configVP8.refresh_entropy_probs = 0;
+ configVP8.value = 0;
+ configVP8.sharpness_level = 2;
+
+ retStatus = mVideoEncoder->setConfig(&configVP8);
+ if(retStatus != ENCODE_SUCCESS) {
+ LOGW("Failed to set refresh config");
+ }
+ return OMX_ErrorNone;
+}
+
+
+
DECLARE_OMX_COMPONENT("OMX.Intel.VideoEncoder.VP8", "video_encoder.vpx", OMXVideoEncoderVP8);
diff --git a/videocodec/OMXVideoEncoderVP8.h b/videocodec/OMXVideoEncoderVP8.h
index 54aae79..fb578c8 100644
--- a/videocodec/OMXVideoEncoderVP8.h
+++ b/videocodec/OMXVideoEncoderVP8.h
@@ -17,6 +17,7 @@ class OMXVideoEncoderVP8 : public OMXVideoEncoderBase {
virtual OMX_ERRORTYPE SetVideoEncoderParam();
DECLARE_HANDLER(OMXVideoEncoderVP8, ParamVideoVp8);
DECLARE_HANDLER(OMXVideoEncoderVP8, ConfigVideoVp8ReferenceFrame);
+ DECLARE_HANDLER(OMXVideoEncoderVP8, ConfigVp8ForceKFrame);
private:
enum {
OUTPORT_MIN_BUFFER_COUNT = 1,
@@ -26,6 +27,7 @@ class OMXVideoEncoderVP8 : public OMXVideoEncoderBase {
OMX_VIDEO_PARAM_VP8TYPE mParamVp8;
OMX_VIDEO_VP8REFERENCEFRAMETYPE mConfigVideoVp8ReferenceFrame;
+ OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME mVideoConfigVP8ForceKFrame;
};
#endif /* OMX_VIDEO_ENCODER_VP8_H */