[dec]: Add common code for AVC and HEVC

Change-Id: I48f0bddbbb6762a653dca0eec3dc8b6acba03673
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2023-04-21 18:55:54 +08:00
parent 66e2f65ff2
commit 1a8161c845
4 changed files with 106 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
add_subdirectory(dummy) add_subdirectory(dummy)
add_subdirectory(common)
if( HAVE_AVSD ) if( HAVE_AVSD )
add_subdirectory(avs) add_subdirectory(avs)
endif() endif()

View File

@@ -0,0 +1,23 @@
# vim: syntax=cmake
include_directories(.)
set(DEC_COMMON_HDR
h2645d_sei.h
)
# h264 decoder sourse
set(DEC_COMMON_SRC
h2645d_sei.c
)
set(DEC_COMMON dec_common)
add_library(${DEC_COMMON} STATIC
${DEC_COMMON_HDR}
${DEC_COMMON_SRC}
)
target_link_libraries(${DEC_COMMON} mpp_base)
set_target_properties(${DEC_COMMON} PROPERTIES FOLDER "mpp/codec/dec/common")

View File

@@ -0,0 +1,57 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (c) 2023 Rockchip Electronics Co., Ltd.
*/
#define MODULE_TAG "h2645d_sei"
#include <stdint.h>
#include <string.h>
#include "mpp_mem.h"
#include "h2645d_sei.h"
static RK_U8 const deny_uuid[2][16] = {{
0xfa, 0x5e, 0xfe, 0x40, 0xa6, 0xaf, 0x11, 0xdd,
0xa6, 0x59, 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b
},
{
0x68, 0x55, 0x98, 0x4e, 0x49, 0x9c, 0x45, 0xc5,
0x8e, 0x5b, 0xf2, 0x7b, 0xd1, 0xd4, 0xac, 0xe6
}
};
static RK_U8 const deny_identity[3][4] = {
{0x44, 0x69, 0x76, 0x58},
{0x50, 0x6C, 0x75, 0x73},
{0x48, 0x45, 0x56, 0x43}
};
MPP_RET check_encoder_sei_info(BitReadCtx_t *gb, RK_S32 payload_size, RK_U32 *is_match)
{
RK_S32 i = 0;
RK_U8 *payload = NULL;
if (payload_size < 25 || payload_size >= INT32_MAX - 1)
return MPP_ERR_STREAM;
payload = mpp_calloc(RK_U8, payload_size);
for (i = 0; i < payload_size; i++)
READ_BITS(gb, 8, &payload[i]);
if ((!memcmp(payload, deny_uuid[0], 16) ||
!memcmp(payload, deny_uuid[1], 16)) &&
(!memcmp(payload + 16, deny_identity[0], 4)) &&
(!memcmp(payload + 21, deny_identity[1], 4) ||
!memcmp(payload + 21, deny_identity[2], 4))) {
*is_match = 1;
}
mpp_free(payload);
return MPP_OK;;
__BITREAD_ERR:
mpp_free(payload);
return gb->ret;
}

View File

@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (c) 2023 Rockchip Electronics Co., Ltd.
*/
#ifndef _H2645D_SEI_H_
#define _H2645D_SEI_H_
#include "rk_type.h"
#include "mpp_err.h"
#include "mpp_bitread.h"
#ifdef __cplusplus
extern "C" {
#endif
MPP_RET check_encoder_sei_info(BitReadCtx_t *gb, RK_S32 payload_size, RK_U32 *is_match);
#ifdef __cplusplus
}
#endif
//========================================
#endif /* end of _H2645D_SEI_H_ */