[jpegd]: Add YUV400 support

Change-Id: I110f0f2a16977f985d32204704ca4c2effcd8b90
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2019-06-12 10:33:00 +08:00
parent a711528671
commit d2459e4fac
4 changed files with 16 additions and 3 deletions

View File

@@ -165,7 +165,7 @@ typedef enum {
MPP_FMT_YUV422SP_VU, /* YYYY... VUVUVU... (NV42) */ MPP_FMT_YUV422SP_VU, /* YYYY... VUVUVU... (NV42) */
MPP_FMT_YUV422_YUYV, /* YUYVYUYV... (YUY2) */ MPP_FMT_YUV422_YUYV, /* YUYVYUYV... (YUY2) */
MPP_FMT_YUV422_UYVY, /* UYVYUYVY... (UYVY) */ MPP_FMT_YUV422_UYVY, /* UYVYUYVY... (UYVY) */
MPP_FMT_YUV400SP, /* YYYY... */ MPP_FMT_YUV400, /* YYYY... */
MPP_FMT_YUV440SP, /* YYYY... UVUV... */ MPP_FMT_YUV440SP, /* YYYY... UVUV... */
MPP_FMT_YUV411SP, /* YYYY... UV... */ MPP_FMT_YUV411SP, /* YYYY... UV... */
MPP_FMT_YUV444SP, /* YYYY... UVUVUVUV... */ MPP_FMT_YUV444SP, /* YYYY... UVUVUVUV... */

View File

@@ -144,7 +144,7 @@ static MPP_RET jpeg_judge_yuv_mode(JpegdCtx *ctx)
} else if (s->nb_components == 1) { } else if (s->nb_components == 1) {
if ((s->h_count[0] == 1) || (s->v_count[0] == 1)) { if ((s->h_count[0] == 1) || (s->v_count[0] == 1)) {
s->yuv_mode = JPEGDEC_YUV400; s->yuv_mode = JPEGDEC_YUV400;
s->output_fmt = MPP_FMT_YUV400SP; s->output_fmt = MPP_FMT_YUV400;
/* check if fill needed */ /* check if fill needed */
if ((s->width & 0xf) && ((s->width & 0xf) <= 8)) { if ((s->width & 0xf) && ((s->width & 0xf) <= 8)) {
@@ -1145,6 +1145,9 @@ static MPP_RET jpegd_allocate_frame(JpegdCtx *ctx)
case JPEGDEC_YUV444: { case JPEGDEC_YUV444: {
fmt = MPP_FMT_YUV444SP; fmt = MPP_FMT_YUV444SP;
} break; } break;
case JPEGDEC_YUV400: {
fmt = MPP_FMT_YUV400;
} break;
default : { default : {
fmt = MPP_FMT_YUV420SP; fmt = MPP_FMT_YUV420SP;
} break; } break;

View File

@@ -247,7 +247,7 @@ void jpegd_setup_output_fmt(JpegdHalCtx *ctx, JpegdSyntax *s, RK_S32 output)
if (ctx->set_output_fmt_flag && (ctx->output_fmt != s->output_fmt)) { if (ctx->set_output_fmt_flag && (ctx->output_fmt != s->output_fmt)) {
/* Using pp to convert all format to yuv420sp */ /* Using pp to convert all format to yuv420sp */
switch (s->output_fmt) { switch (s->output_fmt) {
case MPP_FMT_YUV400SP: case MPP_FMT_YUV400:
pp_in_fmt = PP_IN_FORMAT_YUV400; pp_in_fmt = PP_IN_FORMAT_YUV400;
break; break;
case MPP_FMT_YUV420SP: case MPP_FMT_YUV420SP:

View File

@@ -132,6 +132,16 @@ void dump_mpp_frame_to_file(MppFrame frame, FILE *fp)
fwrite(tmp, 1, width * height * 2, fp); fwrite(tmp, 1, width * height * 2, fp);
mpp_free(tmp); mpp_free(tmp);
} break; } break;
case MPP_FMT_YUV400: {
RK_U32 i;
RK_U8 *base_y = base;
RK_U8 *tmp = mpp_malloc(RK_U8, h_stride * height);
for (i = 0; i < height; i++, base_y += h_stride)
fwrite(base_y, 1, width, fp);
mpp_free(tmp);
} break;
default : { default : {
mpp_err("not supported format %d\n", fmt); mpp_err("not supported format %d\n", fmt);
} break; } break;