mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[mpi] add avs marco
[vpu_api] add avs marco [avsd] add avs interface [test] comment [h264d] move h264d_rw to codec git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@599 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -53,6 +53,7 @@ typedef enum {
|
|||||||
MPP_VIDEO_CodingDIVX3, /**< DIVX3 */
|
MPP_VIDEO_CodingDIVX3, /**< DIVX3 */
|
||||||
MPP_VIDEO_CodingVP6,
|
MPP_VIDEO_CodingVP6,
|
||||||
MPP_VIDEO_CodingHEVC, /**< H.265/HEVC */
|
MPP_VIDEO_CodingHEVC, /**< H.265/HEVC */
|
||||||
|
MPP_VIDEO_CodingAVS, /**< AVS+ */
|
||||||
MPP_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
MPP_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||||
MPP_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
MPP_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||||
MPP_VIDEO_CodingMax = 0x7FFFFFFF
|
MPP_VIDEO_CodingMax = 0x7FFFFFFF
|
||||||
|
@@ -184,6 +184,7 @@ typedef enum OMX_RK_VIDEO_CODINGTYPE {
|
|||||||
OMX_RK_VIDEO_CodingDIVX3, /**< DIVX3 */
|
OMX_RK_VIDEO_CodingDIVX3, /**< DIVX3 */
|
||||||
OMX_RK_VIDEO_CodingVP6,
|
OMX_RK_VIDEO_CodingVP6,
|
||||||
OMX_RK_VIDEO_CodingHEVC, /**< H.265/HEVC */
|
OMX_RK_VIDEO_CodingHEVC, /**< H.265/HEVC */
|
||||||
|
OMX_RK_VIDEO_CodingAVS, /**< AVS+ */
|
||||||
OMX_RK_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
OMX_RK_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||||
OMX_RK_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
OMX_RK_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||||
OMX_RK_VIDEO_CodingMax = 0x7FFFFFFF
|
OMX_RK_VIDEO_CodingMax = 0x7FFFFFFF
|
||||||
|
@@ -19,6 +19,7 @@ target_link_libraries(mpp_codec
|
|||||||
codec_h264d
|
codec_h264d
|
||||||
codec_vp9d
|
codec_vp9d
|
||||||
codec_h265d
|
codec_h265d
|
||||||
|
codec_avsd
|
||||||
codec_dummy_enc
|
codec_dummy_enc
|
||||||
codec_dummy_dec
|
codec_dummy_dec
|
||||||
mpp)
|
mpp)
|
||||||
|
@@ -7,3 +7,12 @@ add_subdirectory(h264)
|
|||||||
add_subdirectory(h265)
|
add_subdirectory(h265)
|
||||||
|
|
||||||
add_subdirectory(vp9)
|
add_subdirectory(vp9)
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/avs_impl/")
|
||||||
|
add_subdirectory(avs_impl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(avs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
35
mpp/codec/dec/avs/CMakeLists.txt
Normal file
35
mpp/codec/dec/avs/CMakeLists.txt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# vim: syntax=cmake
|
||||||
|
include_directories(.)
|
||||||
|
|
||||||
|
# avs decoder api
|
||||||
|
set(AVSD_API
|
||||||
|
|
||||||
|
)
|
||||||
|
set(AVSD_COMMON
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# avs decoder header
|
||||||
|
set(AVSD_HDR
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# avs decoder sourse
|
||||||
|
set(AVSD_SRC
|
||||||
|
avsd_api.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(codec_avsd STATIC
|
||||||
|
${AVSD_API}
|
||||||
|
${AVSD_COMMON}
|
||||||
|
${AVSD_HDR}
|
||||||
|
${AVSD_SRC}
|
||||||
|
)
|
||||||
|
if(EXISTS codec_avsd_impl)
|
||||||
|
target_link_libraries(codec_avsd codec_avsd codec_avsd_impl)
|
||||||
|
else()
|
||||||
|
target_link_libraries(codec_avsd mpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(codec_avsd PROPERTIES FOLDER "mpp/codec")
|
||||||
|
|
197
mpp/codec/dec/avs/avsd_api.c
Normal file
197
mpp/codec/dec/avs/avsd_api.c
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MODULE_TAG "avsd_api"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "mpp_packet.h"
|
||||||
|
#include "mpp_packet_impl.h"
|
||||||
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_log.h"
|
||||||
|
#include "mpp_env.h"
|
||||||
|
|
||||||
|
#include "avsd_api.h"
|
||||||
|
|
||||||
|
|
||||||
|
RK_U32 avsd_parse_debug = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* alloc all buffer
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
MPP_RET avsd_init(void *ctx, ParserCfg *init)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
mpp_env_get_u32("avsd_debug", &avsd_parse_debug, 0);
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
(void)init;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* free all buffer
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_deinit(void *ctx)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* reset
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_reset(void *ctx)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* flush
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_flush(void *ctx)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* control/perform
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_control(void *ctx, RK_S32 cmd_type, void *param)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
(void)cmd_type;
|
||||||
|
(void)param;
|
||||||
|
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* prepare
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_prepare(void *ctx, MppPacket pkt, HalDecTask *task)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
(void)ctx;
|
||||||
|
(void)pkt;
|
||||||
|
(void)task;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* parser
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_parse(void *ctx, HalDecTask *in_task)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
(void)in_task;
|
||||||
|
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* callback
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
MPP_RET avsd_callback(void *decoder, void *info)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_PARSE_TRACE("In.");
|
||||||
|
|
||||||
|
(void)decoder;
|
||||||
|
(void)info;
|
||||||
|
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* api struct interface
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
const ParserApi api_avsd_parser = {
|
||||||
|
"avsd_parse",
|
||||||
|
MPP_VIDEO_CodingAVS,
|
||||||
|
200,//sizeof(AvsCodecContext),
|
||||||
|
0,
|
||||||
|
avsd_init,
|
||||||
|
avsd_deinit,
|
||||||
|
avsd_prepare,
|
||||||
|
avsd_parse,
|
||||||
|
avsd_reset,
|
||||||
|
avsd_flush,
|
||||||
|
avsd_control,
|
||||||
|
avsd_callback,
|
||||||
|
};
|
||||||
|
|
@@ -22,7 +22,7 @@ set(H264D_HDR
|
|||||||
h264d_dpb.h
|
h264d_dpb.h
|
||||||
h264d_init.h
|
h264d_init.h
|
||||||
h264d_fill.h
|
h264d_fill.h
|
||||||
|
h264d_rwfile.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ set(H264D_SRC
|
|||||||
h264d_dpb.c
|
h264d_dpb.c
|
||||||
h264d_init.c
|
h264d_init.c
|
||||||
h264d_fill.c
|
h264d_fill.c
|
||||||
|
h264d_rwfile.c
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
56
mpp/codec/inc/avsd_api.h
Normal file
56
mpp/codec/inc/avsd_api.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __AVSD_API_H__
|
||||||
|
#define __AVSD_API_H__
|
||||||
|
|
||||||
|
#include "parser_api.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define AVSD_DBG_TRACE (0x00000001)
|
||||||
|
|
||||||
|
|
||||||
|
extern RK_U32 avsd_parse_debug;
|
||||||
|
|
||||||
|
#define AVSD_PARSE_TRACE(fmt, ...)\
|
||||||
|
do {\
|
||||||
|
if (AVSD_DBG_TRACE & avsd_parse_debug)\
|
||||||
|
{ mpp_log_f(fmt, ## __VA_ARGS__); }\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const ParserApi api_avsd_parser;
|
||||||
|
|
||||||
|
MPP_RET avsd_init (void *decoder, ParserCfg *cfg);
|
||||||
|
MPP_RET avsd_deinit (void *decoder);
|
||||||
|
MPP_RET avsd_reset (void *decoder);
|
||||||
|
MPP_RET avsd_flush (void *decoder);
|
||||||
|
MPP_RET avsd_control(void *decoder, RK_S32 cmd_type, void *param);
|
||||||
|
MPP_RET avsd_prepare(void *decoder, MppPacket pkt, HalDecTask *task);
|
||||||
|
MPP_RET avsd_parse (void *decoder, HalDecTask *task);
|
||||||
|
MPP_RET avsd_callback(void *decoder, void *err_info);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*__AVSD_API_H__*/
|
@@ -27,6 +27,8 @@
|
|||||||
#include "h264d_api.h"
|
#include "h264d_api.h"
|
||||||
#include "h265d_api.h"
|
#include "h265d_api.h"
|
||||||
#include "vp9d_api.h"
|
#include "vp9d_api.h"
|
||||||
|
#include "avsd_api.h"
|
||||||
|
|
||||||
// for test and demo
|
// for test and demo
|
||||||
#include "dummy_dec_api.h"
|
#include "dummy_dec_api.h"
|
||||||
|
|
||||||
@@ -37,6 +39,7 @@ static const ParserApi *parsers[] = {
|
|||||||
&api_h264d_parser,
|
&api_h264d_parser,
|
||||||
&api_vp9d_parser,
|
&api_vp9d_parser,
|
||||||
&api_h265d_parser,
|
&api_h265d_parser,
|
||||||
|
&api_avsd_parser,
|
||||||
&dummy_dec_parser,
|
&dummy_dec_parser,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,10 +20,12 @@ add_subdirectory(rkdec/h265d)
|
|||||||
|
|
||||||
add_subdirectory(rkdec/vp9d)
|
add_subdirectory(rkdec/vp9d)
|
||||||
|
|
||||||
|
add_subdirectory(rkdec/avsd)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# add hardware worker implement
|
# add hardware worker implement
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
add_subdirectory(worker/libvpu)
|
add_subdirectory(worker/libvpu)
|
||||||
add_subdirectory(worker/libv4l2)
|
add_subdirectory(worker/libv4l2)
|
||||||
|
|
||||||
target_link_libraries(mpp_hal hal_h264d hal_vp9d hal_h265d hal_dummy)
|
target_link_libraries(mpp_hal hal_h264d hal_vp9d hal_h265d hal_avsd hal_dummy)
|
60
mpp/hal/inc/hal_avsd_api.h
Normal file
60
mpp/hal/inc/hal_avsd_api.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __HAL_AVSD_API_H__
|
||||||
|
#define __HAL_AVSD_API_H__
|
||||||
|
|
||||||
|
#include "rk_type.h"
|
||||||
|
#include "mpp_err.h"
|
||||||
|
#include "mpp_hal.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define AVSD_HAL_DBG_TRACE (0x00000001)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern RK_U32 avsd_hal_debug;
|
||||||
|
|
||||||
|
#define AVSD_HAL_TRACE(fmt, ...)\
|
||||||
|
do {\
|
||||||
|
if (AVSD_HAL_DBG_TRACE & avsd_hal_debug)\
|
||||||
|
{ mpp_log_f(fmt, ## __VA_ARGS__); }\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const MppHalApi hal_api_avsd;
|
||||||
|
|
||||||
|
MPP_RET hal_avsd_init (void *hal, MppHalCfg *cfg);
|
||||||
|
MPP_RET hal_avsd_deinit (void *hal);
|
||||||
|
MPP_RET hal_avsd_gen_regs(void *hal, HalTaskInfo *task);
|
||||||
|
MPP_RET hal_avsd_start (void *hal, HalTaskInfo *task);
|
||||||
|
MPP_RET hal_avsd_wait (void *hal, HalTaskInfo *task);
|
||||||
|
MPP_RET hal_avsd_reset (void *hal);
|
||||||
|
MPP_RET hal_avsd_flush (void *hal);
|
||||||
|
MPP_RET hal_avsd_control (void *hal, RK_S32 cmd_type, void *param);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*__HAL_AVSD_API_H__*/
|
@@ -28,6 +28,8 @@
|
|||||||
#include "hal_h264d_api.h"
|
#include "hal_h264d_api.h"
|
||||||
#include "hal_h265d_api.h"
|
#include "hal_h265d_api.h"
|
||||||
#include "hal_vp9d_api.h"
|
#include "hal_vp9d_api.h"
|
||||||
|
#include "hal_avsd_api.h"
|
||||||
|
|
||||||
// for test and demo
|
// for test and demo
|
||||||
#include "hal_dummy_dec_api.h"
|
#include "hal_dummy_dec_api.h"
|
||||||
#include "hal_dummy_enc_api.h"
|
#include "hal_dummy_enc_api.h"
|
||||||
@@ -39,6 +41,7 @@ static const MppHalApi *hw_apis[] = {
|
|||||||
&hal_api_h264d,
|
&hal_api_h264d,
|
||||||
&hal_api_h265d,
|
&hal_api_h265d,
|
||||||
&hal_api_vp9d,
|
&hal_api_vp9d,
|
||||||
|
&hal_api_avsd,
|
||||||
&hal_api_dummy_dec,
|
&hal_api_dummy_dec,
|
||||||
&hal_api_dummy_enc,
|
&hal_api_dummy_enc,
|
||||||
};
|
};
|
||||||
|
31
mpp/hal/rkdec/avsd/CMakeLists.txt
Normal file
31
mpp/hal/rkdec/avsd/CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# vim: syntax=cmake
|
||||||
|
|
||||||
|
# hal avs decoder api
|
||||||
|
set(HAL_AVSD_API
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# hal avs header
|
||||||
|
set(HAL_AVSD_HDR
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# hal avs decoder sourse
|
||||||
|
set(HAL_AVSD_SRC
|
||||||
|
|
||||||
|
hal_avsd_api.c
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(hal_avsd STATIC
|
||||||
|
${HAL_AVSD_API}
|
||||||
|
${HAL_AVSD_HDR}
|
||||||
|
${HAL_AVSD_SRC}
|
||||||
|
)
|
||||||
|
target_link_libraries(hal_avsd
|
||||||
|
mpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(hal_avsd PROPERTIES FOLDER "mpp/hal")
|
||||||
|
|
191
mpp/hal/rkdec/avsd/hal_avsd_api.c
Normal file
191
mpp/hal/rkdec/avsd/hal_avsd_api.c
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define MODULE_TAG "hal_avsd_api"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "rk_type.h"
|
||||||
|
#include "vpu.h"
|
||||||
|
#include "mpp_log.h"
|
||||||
|
#include "mpp_err.h"
|
||||||
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_env.h"
|
||||||
|
|
||||||
|
#include "hal_avsd_api.h"
|
||||||
|
|
||||||
|
|
||||||
|
RK_U32 avsd_hal_debug = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* init
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_init(void *hal, MppHalCfg *cfg)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
mpp_env_get_u32("avsd_debug", &avsd_hal_debug, 0);
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
(void)cfg;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* deinit
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_deinit(void *hal)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* generate register
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_gen_regs(void *hal, HalTaskInfo *task)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
(void)hal;
|
||||||
|
(void)task;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief h
|
||||||
|
* start hard
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_start(void *hal, HalTaskInfo *task)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
(void)task;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* wait hard
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_wait(void *hal, HalTaskInfo *task)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
(void)task;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* reset
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_reset(void *hal)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* flush
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_flush(void *hal)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
***********************************************************************
|
||||||
|
* \brief
|
||||||
|
* control
|
||||||
|
***********************************************************************
|
||||||
|
*/
|
||||||
|
//extern "C"
|
||||||
|
MPP_RET hal_avsd_control(void *hal, RK_S32 cmd_type, void *param)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
|
AVSD_HAL_TRACE("In.");
|
||||||
|
|
||||||
|
(void)hal;
|
||||||
|
(void)cmd_type;
|
||||||
|
(void)param;
|
||||||
|
|
||||||
|
return ret = MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const MppHalApi hal_api_avsd = {
|
||||||
|
"avsd_rkdec",
|
||||||
|
MPP_CTX_DEC,
|
||||||
|
MPP_VIDEO_CodingAVS,
|
||||||
|
200,//sizeof(AvsdHalCtx_t),
|
||||||
|
0,
|
||||||
|
hal_avsd_init,
|
||||||
|
hal_avsd_deinit,
|
||||||
|
hal_avsd_gen_regs,
|
||||||
|
hal_avsd_start,
|
||||||
|
hal_avsd_wait,
|
||||||
|
hal_avsd_reset,
|
||||||
|
hal_avsd_flush,
|
||||||
|
hal_avsd_control,
|
||||||
|
};
|
||||||
|
|
@@ -269,6 +269,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
|||||||
mpp_log("s->videoCoding=%d, s->width=%d, s->height=%d \n", s->videoCoding, s->width, s->height);
|
mpp_log("s->videoCoding=%d, s->width=%d, s->height=%d \n", s->videoCoding, s->width, s->height);
|
||||||
if (s->videoCoding == OMX_RK_VIDEO_CodingHEVC
|
if (s->videoCoding == OMX_RK_VIDEO_CodingHEVC
|
||||||
|| s->videoCoding == OMX_RK_VIDEO_CodingVP9
|
|| s->videoCoding == OMX_RK_VIDEO_CodingVP9
|
||||||
|
|| s->videoCoding == OMX_RK_VIDEO_CodingAVS
|
||||||
|| (s->videoCoding == OMX_RK_VIDEO_CodingAVC &&
|
|| (s->videoCoding == OMX_RK_VIDEO_CodingAVC &&
|
||||||
s->codecType == CODEC_DECODER && ((s->width > 1920) || (s->height > 1088) || use_mpp_mode))) {
|
s->codecType == CODEC_DECODER && ((s->width > 1920) || (s->height > 1088) || use_mpp_mode))) {
|
||||||
free(s);
|
free(s);
|
||||||
|
@@ -16,6 +16,7 @@ macro(add_mpp_test module)
|
|||||||
target_link_libraries(${test_name} mpp_shared)
|
target_link_libraries(${test_name} mpp_shared)
|
||||||
set_target_properties(${test_name} PROPERTIES FOLDER "mpp/test")
|
set_target_properties(${test_name} PROPERTIES FOLDER "mpp/test")
|
||||||
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
||||||
|
#add_test(NAME ${test_name} COMMAND ${test_name})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@@ -23,21 +24,13 @@ endmacro()
|
|||||||
add_mpp_test(mpp_info)
|
add_mpp_test(mpp_info)
|
||||||
|
|
||||||
# h264 decoder test
|
# h264 decoder test
|
||||||
option(H264D_TEST "Build mpp h264 decoder unit test" ON)
|
include_directories(../codec/dec/h264)
|
||||||
if(H264D_TEST)
|
add_mpp_test(h264d)
|
||||||
set(test_name h264d_test)
|
|
||||||
add_executable(${test_name} ${test_name}.c h264d_rwfile.h h264d_rwfile.c)
|
|
||||||
target_link_libraries(${test_name} mpp_shared)
|
|
||||||
set_target_properties(${test_name} PROPERTIES FOLDER "mpp/test")
|
|
||||||
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# vp9 decoder test
|
# vp9 decoder test
|
||||||
option(VP9D_TEST "Build mpp vp9 decoder unit test" ON)
|
include_directories(../codec/dec/vp9)
|
||||||
if(VP9D_TEST)
|
add_mpp_test(vp9d)
|
||||||
set(test_name vp9d_test)
|
|
||||||
add_executable(${test_name} ${test_name}.c)
|
# avs decoder test
|
||||||
target_link_libraries(${test_name} mpp_shared)
|
include_directories(../codec/dec/avs)
|
||||||
set_target_properties(${test_name} PROPERTIES FOLDER "mpp/test")
|
add_mpp_test(avsd)
|
||||||
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
|
||||||
endif()
|
|
||||||
|
148
mpp/test/avsd_test.c
Normal file
148
mpp/test/avsd_test.c
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MODULE_TAG "avsd_test"
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include "vld.h"
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
#include "mpp_log.h"
|
||||||
|
#include "mpp_env.h"
|
||||||
|
#include "mpp_dec.h"
|
||||||
|
#include "mpp_hal.h"
|
||||||
|
#include "mpp_mem.h"
|
||||||
|
#include "mpp_packet.h"
|
||||||
|
#include "mpp_packet_impl.h"
|
||||||
|
#include "mpp_hal.h"
|
||||||
|
|
||||||
|
#include "avsd_api.h"
|
||||||
|
#include "hal_avsd_api.h"
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
//!< memory malloc check
|
||||||
|
#define MEM_CHECK(ret, val, ...)\
|
||||||
|
do{\
|
||||||
|
if (!(val)) { \
|
||||||
|
ret = MPP_ERR_MALLOC; \
|
||||||
|
mpp_log("Function:%s:%d, ERROR: malloc buffer.\n", __FUNCTION__, __LINE__); \
|
||||||
|
mpp_assert(0); goto __FAILED; \
|
||||||
|
}} while (0)
|
||||||
|
//!< function return check
|
||||||
|
#define FUN_CHECK(val)\
|
||||||
|
do{\
|
||||||
|
if ((val) < 0) { \
|
||||||
|
goto __FAILED; \
|
||||||
|
}} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
static MPP_RET avs_decoder_deinit(MppDec *pApi)
|
||||||
|
{
|
||||||
|
if (pApi->frame_slots) {
|
||||||
|
mpp_buf_slot_deinit(pApi->frame_slots);
|
||||||
|
pApi->frame_slots = NULL;
|
||||||
|
}
|
||||||
|
if (pApi->parser) {
|
||||||
|
parser_deinit(pApi->parser);
|
||||||
|
pApi->parser = NULL;
|
||||||
|
}
|
||||||
|
if (pApi->hal) {
|
||||||
|
mpp_hal_deinit(pApi->hal);
|
||||||
|
pApi->hal = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static MPP_RET avs_decoder_init(MppDec *pApi)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
ParserCfg parser_cfg;
|
||||||
|
MppHalCfg hal_cfg;
|
||||||
|
|
||||||
|
pApi->coding = MPP_VIDEO_CodingAVS;
|
||||||
|
// malloc slot
|
||||||
|
FUN_CHECK(ret = mpp_buf_slot_init(&pApi->frame_slots));
|
||||||
|
MEM_CHECK(ret, pApi->frame_slots);
|
||||||
|
// init parser part
|
||||||
|
memset(&parser_cfg, 0, sizeof(parser_cfg));
|
||||||
|
parser_cfg.coding = pApi->coding;
|
||||||
|
parser_cfg.frame_slots = pApi->frame_slots;
|
||||||
|
parser_cfg.packet_slots = pApi->packet_slots;
|
||||||
|
FUN_CHECK(ret = parser_init(&pApi->parser, &parser_cfg));
|
||||||
|
|
||||||
|
// init hal part
|
||||||
|
memset(&hal_cfg, 0, sizeof(hal_cfg));
|
||||||
|
hal_cfg.type = MPP_CTX_DEC;
|
||||||
|
hal_cfg.coding = pApi->coding;
|
||||||
|
hal_cfg.work_mode = HAL_MODE_LIBVPU;
|
||||||
|
hal_cfg.device_id = HAL_RKVDEC;
|
||||||
|
hal_cfg.frame_slots = pApi->frame_slots;
|
||||||
|
hal_cfg.packet_slots = pApi->packet_slots;
|
||||||
|
hal_cfg.task_count = parser_cfg.task_count;
|
||||||
|
FUN_CHECK(ret = mpp_hal_init(&pApi->hal, &hal_cfg));
|
||||||
|
pApi->tasks = hal_cfg.tasks;
|
||||||
|
|
||||||
|
return MPP_OK;
|
||||||
|
__FAILED:
|
||||||
|
avs_decoder_deinit(pApi);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
MppPacket pkt = NULL;
|
||||||
|
MppDec *pApi = mpp_calloc(MppDec, 1);
|
||||||
|
HalTaskInfo *task = mpp_calloc_size(HalTaskInfo, sizeof(HalTaskInfo));
|
||||||
|
mpp_log("+++++++ all test begin +++++++ \n");
|
||||||
|
//!< init decoder
|
||||||
|
FUN_CHECK(ret = avs_decoder_init(pApi));
|
||||||
|
//!< initial packet
|
||||||
|
mpp_packet_init(&pkt, NULL, 0);
|
||||||
|
//!< initial task
|
||||||
|
memset(task, 0, sizeof(HalTaskInfo));
|
||||||
|
memset(task->dec.refer, -1, sizeof(task->dec.refer));
|
||||||
|
//!< prepare
|
||||||
|
FUN_CHECK(ret = parser_prepare(pApi->parser, pkt, &task->dec));
|
||||||
|
//!< free packet
|
||||||
|
mpp_packet_deinit(&pkt);
|
||||||
|
//!< parse
|
||||||
|
FUN_CHECK(ret = parser_parse(pApi->parser, &task->dec));
|
||||||
|
//!< hal module
|
||||||
|
FUN_CHECK(ret = mpp_hal_reg_gen(pApi->hal, task));
|
||||||
|
FUN_CHECK(ret = mpp_hal_hw_start(pApi->hal, task));
|
||||||
|
FUN_CHECK(ret = mpp_hal_hw_wait(pApi->hal, task));
|
||||||
|
|
||||||
|
(void)argv;
|
||||||
|
(void)argc;
|
||||||
|
|
||||||
|
mpp_log("+++++++ all test end +++++++ \n");
|
||||||
|
ret = MPP_OK;
|
||||||
|
__FAILED:
|
||||||
|
avs_decoder_deinit(pApi);
|
||||||
|
MPP_FREE(pApi);
|
||||||
|
MPP_FREE(task);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -21,8 +21,8 @@ macro(add_mpp_test module)
|
|||||||
target_link_libraries(${test_name} mpp mpp_legacy utils)
|
target_link_libraries(${test_name} mpp mpp_legacy utils)
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(${test_name} PROPERTIES FOLDER "test")
|
set_target_properties(${test_name} PROPERTIES FOLDER "test")
|
||||||
install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
#install(TARGETS ${test_name} RUNTIME DESTINATION ${TEST_INSTALL_DIR})
|
||||||
add_test(NAME ${test_name} COMMAND ${test_name})
|
#add_test(NAME ${test_name} COMMAND ${test_name})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
MPP_RET ret;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
MppPacket packet = NULL;
|
MppPacket packet = NULL;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
size_t size = MPP_PACKET_TEST_SIZE;
|
size_t size = MPP_PACKET_TEST_SIZE;
|
||||||
|
Reference in New Issue
Block a user