Skip to content

Commit

Permalink
Merge "mm-video-v4l2: Support YUV420PackedSemiPlanar32m o/p format fo…
Browse files Browse the repository at this point in the history
…r interlaced clips"
  • Loading branch information
Linux Build Service Account authored and Gerrit - the friendly Code Review server committed Oct 8, 2018
2 parents 3033455 + cf08131 commit e81e397
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
8 changes: 8 additions & 0 deletions mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,10 +1250,18 @@ class omx_vdec: public qc_omx_component
OMX_U32 bytes);
OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
bool is_color_conversion_enabled() {return enabled;}
bool is_client_buffers_disabled() {return client_buffers_disabled;}
void set_client_buffers_disabled(bool val) {client_buffers_disabled = val;}
// Returns a specific C2D state, if true current buffers should undergo C2D conversion
// otherwise C2D is in quasi enabled state where in C2D src and dst formats are set but
// color conversion doesnt take place. This state is needed to handle color conversion
// of interlaced clips during port reconfig.
bool client_buffers_invalid() {return (!enabled || client_buffers_disabled);}
private:
#define MAX_COUNT MAX_NUM_INPUT_OUTPUT_BUFFERS
omx_vdec *omx;
bool enabled;
bool client_buffers_disabled;
OMX_COLOR_FORMATTYPE ColorFormat;
void init_members();
bool color_convert_mode;
Expand Down
50 changes: 40 additions & 10 deletions mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ int omx_vdec::log_input_buffers(const char *buffer_addr, int buffer_len, uint64_
}

int omx_vdec::log_cc_output_buffers(OMX_BUFFERHEADERTYPE *buffer) {
if (!client_buffers.is_color_conversion_enabled() ||
if (client_buffers.client_buffers_invalid() ||
!m_debug.out_cc_buffer_log || !buffer || !buffer->nFilledLen)
return 0;

Expand Down Expand Up @@ -3689,10 +3689,26 @@ OMX_ERRORTYPE omx_vdec::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
OMX_PARAM_PORTDEFINITIONTYPE *portDefn =
(OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPortDefinition");

OMX_COLOR_FORMATTYPE drv_color_format;
bool status = false;

if (in_reconfig && !client_buffers.is_color_conversion_enabled()) {
status = client_buffers.get_color_format(drv_color_format);
}

if (decide_dpb_buffer_mode(is_down_scalar_enabled)) {
DEBUG_PRINT_ERROR("%s:decide_dpb_buffer_mode failed", __func__);
return OMX_ErrorBadParameter;
}

if (in_reconfig && status) {
if (!client_buffers.is_color_conversion_enabled()) {
client_buffers.set_client_buffers_disabled(true);
client_buffers.set_color_format(drv_color_format);
}
}

eRet = update_portdef(portDefn);
if (eRet == OMX_ErrorNone)
m_port_def = *portDefn;
Expand Down Expand Up @@ -12112,6 +12128,7 @@ OMX_ERRORTYPE omx_vdec::handle_demux_data(OMX_BUFFERHEADERTYPE *p_buf_hdr)
omx_vdec::allocate_color_convert_buf::allocate_color_convert_buf()
{
enabled = false;
client_buffers_disabled = false;
omx = NULL;
init_members();
ColorFormat = OMX_COLOR_FormatMax;
Expand Down Expand Up @@ -12212,7 +12229,8 @@ bool omx_vdec::allocate_color_convert_buf::update_buffer_req()
if (status != false) {
if (omx->drv_ctx.output_format != VDEC_YUV_FORMAT_NV12 &&
(ColorFormat != OMX_COLOR_FormatYUV420Planar &&
ColorFormat != OMX_COLOR_FormatYUV420SemiPlanar)) {
ColorFormat != OMX_COLOR_FormatYUV420SemiPlanar &&
ColorFormat != (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m)) {
DEBUG_PRINT_ERROR("update_buffer_req: Unsupported color conversion");
status = false;
} else {
Expand Down Expand Up @@ -12293,9 +12311,17 @@ bool omx_vdec::allocate_color_convert_buf::set_color_format(
if (status && drv_colorformat_c2d_enable && dest_color_format_c2d_enable) {
DEBUG_PRINT_LOW("Enabling C2D");
if (dest_color_format == OMX_COLOR_FormatYUV420Planar ||
dest_color_format == OMX_COLOR_FormatYUV420SemiPlanar ) {
dest_color_format == OMX_COLOR_FormatYUV420SemiPlanar ||
(omx->m_progressive != MSM_VIDC_PIC_STRUCT_PROGRESSIVE &&
dest_color_format == (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m)) {
ColorFormat = dest_color_format;
dest_format = dest_color_format == OMX_COLOR_FormatYUV420Planar? YCbCr420P: YCbCr420SP;
if (dest_color_format == OMX_COLOR_FormatYUV420Planar) {
dest_format = YCbCr420P;
} else if( dest_color_format == OMX_COLOR_FormatYUV420SemiPlanar) {
dest_format = YCbCr420SP;
} else {
dest_format = NV12_128m;
}
enabled = true;
} else {
DEBUG_PRINT_ERROR("Unsupported output color format for c2d (%d)",
Expand All @@ -12316,7 +12342,7 @@ OMX_BUFFERHEADERTYPE* omx_vdec::allocate_color_convert_buf::get_il_buf_hdr()
DEBUG_PRINT_ERROR("Invalid param get_buf_hdr");
return NULL;
}
if (!enabled)
if (client_buffers_invalid())
return omx->m_out_mem_ptr;
return m_out_mem_ptr_client;
}
Expand All @@ -12328,7 +12354,7 @@ OMX_BUFFERHEADERTYPE* omx_vdec::allocate_color_convert_buf::get_il_buf_hdr()
DEBUG_PRINT_ERROR("Invalid param get_buf_hdr");
return NULL;
}
if (!enabled)
if (client_buffers_invalid())
return bufadd;

unsigned index = 0;
Expand Down Expand Up @@ -12374,7 +12400,7 @@ OMX_BUFFERHEADERTYPE* omx_vdec::allocate_color_convert_buf::get_il_buf_hdr()
DEBUG_PRINT_ERROR("Invalid param get_buf_hdr");
return NULL;
}
if (!enabled)
if (client_buffers_invalid())
return bufadd;
unsigned index = 0;
index = bufadd - m_out_mem_ptr_client;
Expand Down Expand Up @@ -12440,7 +12466,7 @@ OMX_ERRORTYPE omx_vdec::allocate_color_convert_buf::free_output_buffer(
{
unsigned int index = 0;

if (!enabled)
if (client_buffers_invalid())
return omx->free_output_buffer(bufhdr);
if (enabled && omx->is_component_secure())
return OMX_ErrorNone;
Expand Down Expand Up @@ -12498,6 +12524,8 @@ OMX_ERRORTYPE omx_vdec::allocate_color_convert_buf::allocate_buffers_color_conve
DEBUG_PRINT_ERROR("Actual count err in allocate_buffers_color_convert");
return OMX_ErrorInsufficientResources;
}

client_buffers_disabled = false;
OMX_BUFFERHEADERTYPE *temp_bufferHdr = NULL;
eRet = omx->allocate_output_buffer(hComp,&temp_bufferHdr,
port,appData,omx->drv_ctx.op_buf.buffer_size);
Expand Down Expand Up @@ -12583,10 +12611,12 @@ bool omx_vdec::allocate_color_convert_buf::get_color_format(OMX_COLOR_FORMATTYPE
}
} else {
if (ColorFormat == OMX_COLOR_FormatYUV420Planar ||
ColorFormat == OMX_COLOR_FormatYUV420SemiPlanar) {
ColorFormat == OMX_COLOR_FormatYUV420SemiPlanar ||
ColorFormat == (OMX_COLOR_FORMATTYPE) QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m) {
dest_color_format = ColorFormat;
} else
} else {
status = false;
}
}
return status;
}
Expand Down

0 comments on commit e81e397

Please sign in to comment.