[vpu_api]: support nv21 format encode

Change-Id: I82af5c70702b759afbce8665ff536c517d164831
Signed-off-by: Hery Xu <hery.xu@rock-chips.com>
This commit is contained in:
Hery Xu
2024-04-15 16:45:00 +08:00
committed by Herman Chen
parent a37666b014
commit 2ea1a7ecd3
2 changed files with 9 additions and 2 deletions

View File

@@ -72,7 +72,8 @@ typedef enum {
ENC_INPUT_RGB888 = 10, /**< 24-bit RGB */
ENC_INPUT_BGR888 = 11, /**< 24-bit RGB */
ENC_INPUT_RGB101010 = 12, /**< 30-bit RGB */
ENC_INPUT_BGR101010 = 13 /**< 30-bit RGB */
ENC_INPUT_BGR101010 = 13, /**< 30-bit RGB */
ENC_INPUT_YUV420_SEMIPLANAR_VU = 0X100 /**< YYYY... VUVUVUVU... */
} EncInputPictureType;
typedef enum VPU_API_CMD {

View File

@@ -44,6 +44,9 @@ static MppFrameFormat vpu_pic_type_remap_to_mpp(EncInputPictureType type)
case ENC_INPUT_YUV420_SEMIPLANAR : {
ret = MPP_FMT_YUV420SP;
} break;
case ENC_INPUT_YUV420_SEMIPLANAR_VU : {
ret = MPP_FMT_YUV420SP_VU;
} break;
case ENC_INPUT_YUV422_INTERLEAVED_YUYV : {
ret = MPP_FMT_YUV422_YUYV;
} break;
@@ -231,7 +234,8 @@ static int copy_align_raw_buffer_to_dest(RK_U8 *dst, RK_U8 *src, RK_U32 width,
RK_U8 *dst_v = dst_u + hor_stride * ver_stride / 4;
switch (fmt) {
case MPP_FMT_YUV420SP : {
case MPP_FMT_YUV420SP :
case MPP_FMT_YUV420SP_VU : {
for (row = 0; row < height; row++) {
memcpy(dst_buf + row * hor_stride, src_buf + index, width);
index += width;
@@ -1409,6 +1413,8 @@ RK_S32 VpuApiLegacy::encoder_sendframe(VpuCodecContext *ctx, EncInputStream_t *a
}
if (format >= MPP_FMT_YUV420SP && format < MPP_FMT_YUV_BUTT) {
align_size = hor_stride * MPP_ALIGN(ver_stride, 16) * 3 / 2;
} else if (format >= MPP_FMT_YUV420SP_VU && format < MPP_FMT_YUV_BUTT) {
align_size = hor_stride * MPP_ALIGN(ver_stride, 16) * 3 / 2;
} else if (format >= MPP_FMT_RGB565 && format < MPP_FMT_BGR888) {
align_size = hor_stride * MPP_ALIGN(ver_stride, 16) * 3;
} else if (format >= MPP_FMT_RGB101010 && format < MPP_FMT_RGB_BUTT) {