[mpp_impl]: modify dump frame default size

Default size is frame size.
If want to scale down, setprop mpp_dump_width/height.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I6aa877b9c141501f6921985956f377323c38546b
This commit is contained in:
Yandong Lin
2021-09-26 10:44:51 +08:00
committed by Herman Chen
parent 1c03947d59
commit c2768e1b86

View File

@@ -162,7 +162,9 @@ static void dump_frame(FILE *fp, MppFrame frame, RK_U8 *tmp, RK_U32 w, RK_U32 h)
RK_U8 *psrc = p_buf;
RK_U8 *pdes = tmp;
RK_U32 size = 0;
if (pdes) {
if (hor_stride > w || ver_stride > h) {
RK_U32 step = MPP_MAX((hor_stride + w - 1) / w,
(ver_stride + h - 1) / h);
@@ -204,13 +206,27 @@ static void dump_frame(FILE *fp, MppFrame frame, RK_U8 *tmp, RK_U32 w, RK_U32 h)
pdes += width;
psrc += hor_stride;
}
}
size = width * height * 1.5;
} else {
tmp = p_buf;
width = hor_stride;
height = ver_stride;
switch (fmt) {
case MPP_FMT_YUV420SP :
case MPP_FMT_YUV420P : {
size = hor_stride * ver_stride * 3 / 2;
} break;
case MPP_FMT_YUV422SP : {
size = hor_stride * ver_stride * 2;
} break;
case MPP_FMT_YUV444SP : {
size = hor_stride * ver_stride * 3;
} break;
default : break;
}
mpp_log("dump_yuv: [%d:%d] pts %lld\n", width, height, mpp_frame_get_pts(frame));
fwrite(tmp, 1, width * height * 3 / 2, fp);
}
mpp_log("dump_yuv: w:h [%d:%d] stride [%d:%d] pts %lld\n",
width, height, hor_stride, ver_stride, mpp_frame_get_pts(frame));
fwrite(tmp, 1, size, fp);
fflush(fp);
}
@@ -244,8 +260,8 @@ MPP_RET mpp_dump_init(MppDump *info)
MppDumpImpl *p = mpp_calloc(MppDumpImpl, 1);
mpp_env_get_u32("mpp_dump_width", &p->dump_width, MAX_DUMP_WIDTH);
mpp_env_get_u32("mpp_dump_height", &p->dump_height, MAX_DUMP_HEIGHT);
mpp_env_get_u32("mpp_dump_width", &p->dump_width, 0);
mpp_env_get_u32("mpp_dump_height", &p->dump_height, 0);
p->dump_size = p->dump_width * p->dump_height * 3 / 2;
p->lock = new Mutex();
@@ -295,6 +311,7 @@ MPP_RET mpp_ops_init(MppDump info, MppCtxType type, MppCodingType coding)
if (p->debug & MPP_DBG_DUMP_OUT) {
p->fp_out = try_env_file("mpp_dump_out", dec_frm_path, p->tid);
if (p->dump_size)
p->fp_buf = mpp_malloc(RK_U8, p->dump_size);
}
@@ -303,6 +320,7 @@ MPP_RET mpp_ops_init(MppDump info, MppCtxType type, MppCodingType coding)
} else {
if (p->debug & MPP_DBG_DUMP_IN) {
p->fp_in = try_env_file("mpp_dump_in", enc_frm_path, p->tid);
if (p->dump_size)
p->fp_buf = mpp_malloc(RK_U8, p->dump_size);
}