[h265d]:support 10bit info change

[mpp_frame]:support pixel_fmt seting

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@474 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenSiyong
2015-11-19 21:56:51 +00:00
parent 363686f0a8
commit 22c93e4a1b
8 changed files with 48 additions and 3 deletions

View File

@@ -129,6 +129,17 @@ typedef enum {
MPP_CHROMA_LOC_NB, ///< Not part of ABI MPP_CHROMA_LOC_NB, ///< Not part of ABI
} MppFrameChromaLocation; } MppFrameChromaLocation;
/*
*mpp color format define
*/
typedef enum {
MPP_FMT_YUV420SP = 0,
MPP_FMT_YUV420SP_10BIT = 1,
MPP_FMT_YUV422SP = 2,
MPP_FMT_YUV422SP_10BIT = 3, ///< Not part of ABI
} MppFrameFormat;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@@ -189,6 +200,9 @@ MppFrameColorSpace mpp_frame_get_colorspace(const MppFrame frame);
void mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace); void mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace);
MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame); MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame);
void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location); void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location);
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
/* /*
* HDR parameter * HDR parameter

View File

@@ -137,6 +137,7 @@ typedef struct H265dContext {
**/ **/
RK_U32 pix_fmt; RK_U32 pix_fmt;
RK_U32 nBitDepth;
RK_U32 err_recognition; RK_U32 err_recognition;
/** /**

View File

@@ -473,6 +473,7 @@ static RK_S32 set_sps(HEVCContext *s, const HEVCSPS *sps)
s->h265dctx->width = sps->output_width; s->h265dctx->width = sps->output_width;
s->h265dctx->height = sps->output_height; s->h265dctx->height = sps->output_height;
s->h265dctx->pix_fmt = sps->pix_fmt; s->h265dctx->pix_fmt = sps->pix_fmt;
s->h265dctx->nBitDepth = sps->bit_depth;
s->h265dctx->sample_aspect_ratio = sps->vui.sar; s->h265dctx->sample_aspect_ratio = sps->vui.sar;
mpp_buf_slot_setup(s->slots, 25); mpp_buf_slot_setup(s->slots, 25);

View File

@@ -1492,8 +1492,8 @@ RK_S32 mpp_hevc_decode_nal_sps(HEVCContext *s)
if (sps->chroma_format_idc == 1) { if (sps->chroma_format_idc == 1) {
switch (sps->bit_depth) { switch (sps->bit_depth) {
case 8: sps->pix_fmt = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR | VPU_OUTPUT_FORMAT_BIT_8; break; case 8: sps->pix_fmt = MPP_FMT_YUV420SP; break;
case 10: sps->pix_fmt = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR | VPU_OUTPUT_FORMAT_BIT_10; break; case 10: sps->pix_fmt = MPP_FMT_YUV420SP_10BIT; break;
default: default:
mpp_err( "Unsupported bit depth: %d\n", mpp_err( "Unsupported bit depth: %d\n",
sps->bit_depth); sps->bit_depth);

View File

@@ -92,10 +92,13 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
mpp_frame_set_width(frame->frame, s->h265dctx->width); mpp_frame_set_width(frame->frame, s->h265dctx->width);
mpp_frame_set_height(frame->frame, s->h265dctx->height); mpp_frame_set_height(frame->frame, s->h265dctx->height);
mpp_frame_set_hor_stride(frame->frame, s->h265dctx->coded_width); mpp_frame_set_hor_stride(frame->frame, (s->h265dctx->coded_width * s->h265dctx->nBitDepth) >> 3);
mpp_frame_set_ver_stride(frame->frame, s->h265dctx->coded_height); mpp_frame_set_ver_stride(frame->frame, s->h265dctx->coded_height);
mpp_frame_set_fmt(frame->frame, s->h265dctx->pix_fmt);
h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height); h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height);
// frame->frame->color_type = s->h265dctx->pix_fmt; // frame->frame->color_type = s->h265dctx->pix_fmt;
// if (!frame->frame->sample_aspect_ratio.num) // if (!frame->frame->sample_aspect_ratio.num)
// frame->frame->sample_aspect_ratio = s->h265dctx->sample_aspect_ratio; // frame->frame->sample_aspect_ratio = s->h265dctx->sample_aspect_ratio;

View File

@@ -140,6 +140,30 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32); vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32);
vframe->ShowTime.TimeLow = (RK_U32)pts; vframe->ShowTime.TimeLow = (RK_U32)pts;
buf = mpp_frame_get_buffer(mframe); buf = mpp_frame_get_buffer(mframe);
switch (mpp_frame_get_fmt(mframe)) {
case MPP_FMT_YUV420SP: {
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR;
vframe->OutputWidth = 0x20;
break;
}
case MPP_FMT_YUV420SP_10BIT: {
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR;
vframe->ColorType |= VPU_OUTPUT_FORMAT_BIT_10;
vframe->OutputWidth = 0x22;
break;
}
case MPP_FMT_YUV422SP: {
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV422;
break;
}
case MPP_FMT_YUV422SP_10BIT: {
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV422;
vframe->ColorType |= VPU_OUTPUT_FORMAT_BIT_10;
break;
}
default:
break;
}
if (buf) { if (buf) {
ptr = mpp_buffer_get_ptr(buf); ptr = mpp_buffer_get_ptr(buf);
fd = mpp_buffer_get_fd(buf); fd = mpp_buffer_get_fd(buf);

View File

@@ -167,6 +167,7 @@ MPP_FRAME_ACCESSORS(MppFrameColorPrimaries, color_primaries)
MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc) MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc)
MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace) MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location) MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
MPP_FRAME_ACCESSORS(MppFrameFormat, fmt)
MPP_FRAME_ACCESSORS(MppBuffer, buffer) MPP_FRAME_ACCESSORS(MppBuffer, buffer)
MPP_FRAME_ACCESSORS(size_t, buf_size) MPP_FRAME_ACCESSORS(size_t, buf_size)

View File

@@ -83,6 +83,7 @@ struct MppFrameImpl_t {
MppFrameColorSpace colorspace; MppFrameColorSpace colorspace;
MppFrameChromaLocation chroma_location; MppFrameChromaLocation chroma_location;
MppFrameFormat fmt;
/* /*
* buffer information * buffer information
* NOTE: buf_size only access internally * NOTE: buf_size only access internally