From aa9adac08904c8980fb96c0f1fb090492c28139c Mon Sep 17 00:00:00 2001 From: HuangTingjin Date: Fri, 12 Aug 2016 01:46:31 +0000 Subject: [PATCH] [jpegd]: remove codes of slice mode. git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1193 6e48237b-75ef-9749-8fc9-41990f28c85a --- mpp/codec/dec/jpeg/jpegd_parser.c | 83 +------------------------------ mpp/codec/dec/jpeg/jpegd_parser.h | 1 - mpp/hal/vpu/jpegd/hal_jpegd_reg.c | 15 +----- 3 files changed, 2 insertions(+), 97 deletions(-) diff --git a/mpp/codec/dec/jpeg/jpegd_parser.c b/mpp/codec/dec/jpeg/jpegd_parser.c index 71bc35e7..6020f8f7 100644 --- a/mpp/codec/dec/jpeg/jpegd_parser.c +++ b/mpp/codec/dec/jpeg/jpegd_parser.c @@ -234,12 +234,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) pSyntax->info.yCbCrMode = JPEGDEC_YUV420; pSyntax->info.X = pSyntax->frame.hwX; pSyntax->info.Y = pSyntax->frame.hwY; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = (pSyntax->info.X * (pSyntax->info.sliceMbSetValue * 16)); - pSyntax->image.sizeChroma = pSyntax->image.sizeLuma / 2; - } } else if (pSyntax->frame.component[0].H == 2 && pSyntax->frame.component[0].V == 1 && pSyntax->frame.component[1].H == 1 && pSyntax->frame.component[1].V == 1 && pSyntax->frame.component[2].H == 1 && pSyntax->frame.component[2].V == 1) { @@ -254,12 +248,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) /* check if fill needed */ if ((pSyntax->frame.Y & 0xF) && (pSyntax->frame.Y & 0xF) <= 8) pSyntax->info.fillBottom = 1; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = (pSyntax->info.X * (pSyntax->info.sliceMbSetValue * 16)); - pSyntax->image.sizeChroma = pSyntax->image.sizeLuma; - } } else if (pSyntax->frame.component[0].H == 1 && pSyntax->frame.component[0].V == 2 && pSyntax->frame.component[1].H == 1 && @@ -274,12 +262,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) /* check if fill needed */ if ((pSyntax->frame.X & 0xF) && (pSyntax->frame.X & 0xF) <= 8) pSyntax->info.fillRight = 1; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = (pSyntax->info.X * (pSyntax->info.sliceMbSetValue * 16)); - pSyntax->image.sizeChroma = pSyntax->image.sizeLuma; - } } /* JPEG_YCBCR444 : NOT SUPPORTED */ else if (pSyntax->frame.component[0].H == 1 && @@ -299,12 +281,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) if ((pSyntax->frame.Y & 0xF) && (pSyntax->frame.Y & 0xF) <= 8) pSyntax->info.fillBottom = 1; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = (pSyntax->info.X * (pSyntax->info.sliceMbSetValue * 16)); - pSyntax->image.sizeChroma = pSyntax->image.sizeLuma * 2; - } } else if (pSyntax->frame.component[0].H == 4 && pSyntax->frame.component[0].V == 1 && pSyntax->frame.component[1].H == 1 && @@ -319,12 +295,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) /* check if fill needed */ if ((pSyntax->frame.Y & 0xF) && (pSyntax->frame.Y & 0xF) <= 8) pSyntax->info.fillBottom = 1; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = (pSyntax->info.X * (pSyntax->info.sliceMbSetValue * 16)); - pSyntax->image.sizeChroma = pSyntax->image.sizeLuma / 2; - } } else { JPEGD_ERROR_LOG("Unsupported YCbCr Format: (%d*%d:%d*%d:%d*%d)", pSyntax->frame.component[0].H, pSyntax->frame.component[0].V, pSyntax->frame.component[1].H, pSyntax->frame.component[1].V, @@ -345,14 +315,6 @@ JpegDecRet jpegd_set_yuv_mode(JpegSyntaxParam *pSyntax) if ((pSyntax->frame.Y & 0xF) && (pSyntax->frame.Y & 0xF) <= 8) pSyntax->info.fillBottom = 1; - - /* calculate new output size if slice mode used */ - if (pSyntax->info.sliceMbSetValue) { - pSyntax->image.sizeLuma = - ((((pSyntax->info.X + 15) / 16) * 16) * (pSyntax->info.sliceMbSetValue * 16)); - - pSyntax->image.sizeChroma = 0; - } } else { JPEGD_ERROR_LOG("unsupported format"); return (JPEGDEC_UNSUPPORTED); @@ -2465,7 +2427,6 @@ MPP_RET jpegd_decode_frame(JpegParserContext *ctx) } JpegSyntaxParam *pSyntax = pCtx->pSyntax; - RK_U32 mcuSizeDivider = 0; /* Store the stream parameters */ if (pSyntax->info.progressiveScanReady == 0 && @@ -2480,58 +2441,17 @@ MPP_RET jpegd_decode_frame(JpegParserContext *ctx) pSyntax->image.headerReady = 0; } - /* set mcu/slice value */ - pSyntax->info.sliceMbSetValue = pCtx->sliceMbSet; - if (pSyntax->info.operationType == JPEGDEC_PROGRESSIVE) { JPEGD_ERROR_LOG ("Operation type not supported"); return (JPEGDEC_UNSUPPORTED); } - /* check slice config */ - if ((pCtx->sliceMbSet && pCtx->decImageType == JPEGDEC_IMAGE && - pSyntax->info.operationType != JPEGDEC_BASELINE) || - (pCtx->sliceMbSet && pCtx->decImageType == JPEGDEC_THUMBNAIL && - pSyntax->info.operationTypeThumb != JPEGDEC_BASELINE)) { - JPEGD_ERROR_LOG("Slice mode not supported for this operation type"); - return (JPEGDEC_SLICE_MODE_UNSUPPORTED); - } - /* check if frame size over 16M */ - if ((!pCtx->sliceMbSet) && - ((pSyntax->frame.hwX * pSyntax->frame.hwY) > JPEGDEC_MAX_PIXEL_AMOUNT)) { + if ((pSyntax->frame.hwX * pSyntax->frame.hwY) > JPEGDEC_MAX_PIXEL_AMOUNT) { JPEGD_ERROR_LOG ("Resolution > 16M ==> use slice mode!"); return (JPEGDEC_PARAM_ERROR); } - if (pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr400 || - pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr440 || - pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr444_SEMIPLANAR) - mcuSizeDivider = 2; - else - mcuSizeDivider = 1; - - /* check slice config */ - if ((pCtx->sliceMbSet * (pSyntax->frame.numMcuInRow / mcuSizeDivider)) > pCtx->maxSupportedSliceSize) { - JPEGD_ERROR_LOG("sliceMbSet > JPEGDEC_MAX_SLICE_SIZE"); - return (JPEGDEC_PARAM_ERROR); - } - - /* check slice size */ - if (pCtx->sliceMbSet && !pSyntax->info.SliceReadyForPause && !pSyntax->info.inputBufferEmpty) { - if (pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr400 || - pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr440 || - pSyntax->info.getInfoYCbCrMode == JPEGDEC_YCbCr444_SEMIPLANAR) - mcuSizeDivider = 2; - else - mcuSizeDivider = 1; - - if ((pCtx->sliceMbSet * (pSyntax->frame.numMcuInRow / mcuSizeDivider)) > pSyntax->frame.numMcuInFrame) { - JPEGD_ERROR_LOG("(sliceMbSet * Number of MCU's in row) > Number of MCU's in frame"); - return (JPEGDEC_PARAM_ERROR); - } - } - /* check if input streaming used */ if (!pSyntax->info.SliceReadyForPause && !pSyntax->info.inputBufferEmpty && pCtx->bufferSize) { @@ -2725,7 +2645,6 @@ MPP_RET jpegd_init(void *ctx, ParserCfg *parser_cfg) JpegParserCtx->pSyntax->ppInstance = (void *)0; /* will be changed when need pp */ JpegParserCtx->decImageType = JPEGDEC_IMAGE; /* FULL MODEs */ - JpegParserCtx->sliceMbSet = 0; /* will be changed when over 16MB*/ JpegParserCtx->output_fmt = MPP_FMT_YUV420SP; /* max */ diff --git a/mpp/codec/dec/jpeg/jpegd_parser.h b/mpp/codec/dec/jpeg/jpegd_parser.h index bf475064..fba331b3 100644 --- a/mpp/codec/dec/jpeg/jpegd_parser.h +++ b/mpp/codec/dec/jpeg/jpegd_parser.h @@ -169,7 +169,6 @@ typedef struct JpegParserContext { RK_U32 streamLength; /* input stream length or buffer size */ RK_U32 bufferSize; /* input stream buffer size */ RK_U32 decImageType; /* Full image or Thumbnail to be decoded */ - RK_U32 sliceMbSet; /* slice mode: mcu rows to decode */ MppFrameFormat output_fmt; MppPacket input_packet; diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_reg.c b/mpp/hal/vpu/jpegd/hal_jpegd_reg.c index 2e31a596..4b8d6292 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_reg.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_reg.c @@ -42,13 +42,6 @@ static const RK_U8 zzOrder[64] = { 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 }; -void jpegd_calculate_slice_size(JpegSyntaxParam *pSyntax) -{ - FUN_TEST("Enter"); - (void)pSyntax; - FUN_TEST("Exit"); -} - void jpegd_input_buff_load_init(JpegSyntaxParam *pSyntax) { FUN_TEST("Enter"); @@ -1841,12 +1834,6 @@ MPP_RET jpegd_gen_regs(JpegHalContext *ctx, JpegSyntaxParam *syntax) /* check if we had to load input buffer or not */ if (!pSyntax->info.inputBufferEmpty) { - /* if slice mode ==> set slice height */ - if (pSyntax->info.sliceMbSetValue && pSyntax->ppControl.usePipeline == 0) { - jpegd_calculate_slice_size(pSyntax); - JPEGD_INFO_LOG("sliceHeight is %d, sliceMbSetValue is %d", pSyntax->info.sliceHeight, pSyntax->info.sliceMbSetValue); - } - /* Start HW or continue after pause */ if (!pSyntax->info.SliceReadyForPause) { if (!pSyntax->info.progressiveScanReady || pSyntax->info.nonInterleavedScanReady) { @@ -2120,7 +2107,7 @@ MPP_RET hal_jpegd_wait(void *hal, HalTaskInfo *task) mpp_buf_slot_get_prop(JpegHalCtx->frame_slots, task->dec.output, SLOT_BUFFER, &outputBuf); pOutYUV = mpp_buffer_get_ptr(outputBuf); - snprintf(name, sizeof(name), "/data/output%02d.yuv", JpegHalCtx->output_yuv_count); + snprintf(name, sizeof(name), "/tmp/output%02d.yuv", JpegHalCtx->output_yuv_count); jpg_file = fopen(name, "wb+"); if (jpg_file) { JpegSyntaxParam *pTmpSyn = (JpegSyntaxParam *)task->dec.syntax.data;