mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[utils]: Add YUV444 frame writing support
VDPU hardware only support semi-planar format for YUV444 which is hard to display on other software. So utils will change it to YUV444P and write to file. Change-Id: Ie81149d7638c2e1d36fc3bc06fe1353ca95c6c01 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "mpp_mem.h"
|
||||||
#include "mpp_log.h"
|
#include "mpp_log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@@ -80,6 +81,30 @@ void dump_mpp_frame_to_file(MppFrame frame, FILE *fp)
|
|||||||
fwrite(base_c, 1, width, fp);
|
fwrite(base_c, 1, width, fp);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case MPP_FMT_YUV444SP : {
|
||||||
|
/* YUV444SP -> YUV444P for better display */
|
||||||
|
RK_U32 i, j;
|
||||||
|
RK_U8 *base_y = base;
|
||||||
|
RK_U8 *base_c = base + h_stride * v_stride;
|
||||||
|
RK_U8 *tmp = mpp_malloc(RK_U8, h_stride * height * 2);
|
||||||
|
RK_U8 *tmp_u = tmp;
|
||||||
|
RK_U8 *tmp_v = tmp + width * height;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++, base_y += h_stride)
|
||||||
|
fwrite(base_y, 1, width, fp);
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++, base_c += h_stride * 2) {
|
||||||
|
for (j = 0; j < width; j++) {
|
||||||
|
tmp_u[j] = base_c[2 * j + 0];
|
||||||
|
tmp_v[j] = base_c[2 * j + 1];
|
||||||
|
}
|
||||||
|
tmp_u += width;
|
||||||
|
tmp_v += width;
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite(tmp, 1, width * height * 2, 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;
|
||||||
|
Reference in New Issue
Block a user