mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-08 02:20:06 +08:00
[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:
@@ -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()
|
||||||
|
23
mpp/codec/dec/common/CMakeLists.txt
Normal file
23
mpp/codec/dec/common/CMakeLists.txt
Normal 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")
|
||||||
|
|
57
mpp/codec/dec/common/h2645d_sei.c
Normal file
57
mpp/codec/dec/common/h2645d_sei.c
Normal 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;
|
||||||
|
}
|
24
mpp/codec/dec/common/h2645d_sei.h
Normal file
24
mpp/codec/dec/common/h2645d_sei.h
Normal 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_ */
|
Reference in New Issue
Block a user