mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-12-26 11:17:44 +01:00
refactor[mpp]: Refactor C++ mpp to C
Change-Id: Icfe26b36d066b32355bda919e605e165399c0781 Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
This commit is contained in:
parent
9a079f8c6f
commit
60dfbcaace
18 changed files with 1723 additions and 1695 deletions
|
|
@ -40,10 +40,10 @@ add_subdirectory(hal)
|
||||||
# add mpp implement
|
# add mpp implement
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
set (MPP_SRC
|
set (MPP_SRC
|
||||||
mpp_info.cpp
|
mpp_info.c
|
||||||
mpp.cpp
|
mpp.c
|
||||||
mpp_impl.cpp
|
mpp_impl.c
|
||||||
mpi.cpp
|
mpi.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(MPP_VERSION "0")
|
set(MPP_VERSION "0")
|
||||||
|
|
@ -63,7 +63,7 @@ endif()
|
||||||
set_target_properties(${MPP_SHARED} PROPERTIES FOLDER "mpp")
|
set_target_properties(${MPP_SHARED} PROPERTIES FOLDER "mpp")
|
||||||
set_target_properties(${MPP_SHARED} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
set_target_properties(${MPP_SHARED} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||||
target_link_libraries(${MPP_SHARED} mpp_codec mpp_hal mpp_vproc kmpp
|
target_link_libraries(${MPP_SHARED} mpp_codec mpp_hal mpp_vproc kmpp
|
||||||
${BEGIN_WHOLE_ARCHIVE} mpp_base kmpp_base osal ${END_WHOLE_ARCHIVE})
|
${BEGIN_WHOLE_ARCHIVE} mpp_base kmpp_base osal ${END_WHOLE_ARCHIVE} m)
|
||||||
|
|
||||||
# build static library
|
# build static library
|
||||||
add_library(${MPP_STATIC} STATIC ${MPP_SRC})
|
add_library(${MPP_STATIC} STATIC ${MPP_SRC})
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@
|
||||||
# add mpp_dec implement
|
# add mpp_dec implement
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
add_library(mpp_codec OBJECT
|
add_library(mpp_codec OBJECT
|
||||||
mpp_enc_impl.cpp
|
mpp_enc_impl.c
|
||||||
mpp_enc_v2.cpp
|
mpp_enc_v2.c
|
||||||
enc_impl.cpp
|
enc_impl.c
|
||||||
mpp_dec_no_thread.cpp
|
mpp_dec_no_thread.c
|
||||||
mpp_dec_normal.cpp
|
mpp_dec_normal.c
|
||||||
mpp_dec.cpp
|
mpp_dec.c
|
||||||
mpp_parser.c
|
mpp_parser.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
|
* Copyright (c) 2010 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 "enc_impl"
|
#define MODULE_TAG "enc_impl"
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpp_dec"
|
#define MODULE_TAG "mpp_dec"
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2022 Rockchip Electronics Co. LTD
|
* Copyright (c) 2022 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 "mpp_dec_nt"
|
#define MODULE_TAG "mpp_dec_nt"
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpp_dec"
|
#define MODULE_TAG "mpp_dec"
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpp_enc"
|
#define MODULE_TAG "mpp_enc"
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpp_enc"
|
#define MODULE_TAG "mpp_enc"
|
||||||
116
mpp/inc/mpp.h
116
mpp/inc/mpp.h
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 __MPP_H__
|
#ifndef __MPP_H__
|
||||||
|
|
@ -26,6 +15,10 @@
|
||||||
#include "kmpp_obj.h"
|
#include "kmpp_obj.h"
|
||||||
#include "kmpp.h"
|
#include "kmpp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MPP_DBG_FUNCTION (0x00000001)
|
#define MPP_DBG_FUNCTION (0x00000001)
|
||||||
#define MPP_DBG_PACKET (0x00000002)
|
#define MPP_DBG_PACKET (0x00000002)
|
||||||
#define MPP_DBG_FRAME (0x00000004)
|
#define MPP_DBG_FRAME (0x00000004)
|
||||||
|
|
@ -101,40 +94,8 @@ typedef enum MppIOMode_e {
|
||||||
* +--------------+ +-----------+ +-----------+ +--------------+
|
* +--------------+ +-----------+ +-----------+ +--------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
typedef struct Mpp {
|
||||||
|
/* Public members that were previously public in C++ class */
|
||||||
class Mpp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Mpp(MppCtx ctx = NULL);
|
|
||||||
~Mpp();
|
|
||||||
MPP_RET init(MppCtxType type, MppCodingType coding);
|
|
||||||
|
|
||||||
MPP_RET start();
|
|
||||||
MPP_RET stop();
|
|
||||||
|
|
||||||
MPP_RET pause();
|
|
||||||
MPP_RET resume();
|
|
||||||
|
|
||||||
MPP_RET put_packet(MppPacket packet);
|
|
||||||
MPP_RET get_frame(MppFrame *frame);
|
|
||||||
MPP_RET get_frame_noblock(MppFrame *frame);
|
|
||||||
|
|
||||||
MPP_RET put_frame(MppFrame frame);
|
|
||||||
MPP_RET get_packet(MppPacket *packet);
|
|
||||||
|
|
||||||
MPP_RET poll(MppPortType type, MppPollType timeout);
|
|
||||||
MPP_RET dequeue(MppPortType type, MppTask *task);
|
|
||||||
MPP_RET enqueue(MppPortType type, MppTask task);
|
|
||||||
|
|
||||||
MPP_RET decode(MppPacket packet, MppFrame *frame);
|
|
||||||
|
|
||||||
MPP_RET reset();
|
|
||||||
MPP_RET control(MpiCmd cmd, MppParam param);
|
|
||||||
|
|
||||||
MPP_RET notify(RK_U32 flag);
|
|
||||||
MPP_RET notify(MppBufferGroup group);
|
|
||||||
|
|
||||||
MppList *mPktIn;
|
MppList *mPktIn;
|
||||||
MppList *mPktOut;
|
MppList *mPktOut;
|
||||||
MppList *mFrmIn;
|
MppList *mFrmIn;
|
||||||
|
|
@ -204,8 +165,6 @@ public:
|
||||||
/* kmpp infos */
|
/* kmpp infos */
|
||||||
Kmpp *mKmpp;
|
Kmpp *mKmpp;
|
||||||
KmppObj mVencInitKcfg;
|
KmppObj mVencInitKcfg;
|
||||||
private:
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
MppCtxType mType;
|
MppCtxType mType;
|
||||||
MppCodingType mCoding;
|
MppCodingType mCoding;
|
||||||
|
|
@ -222,26 +181,57 @@ private:
|
||||||
RK_U32 mImmediateOut;
|
RK_U32 mImmediateOut;
|
||||||
/* backup extra packet for seek */
|
/* backup extra packet for seek */
|
||||||
MppPacket mExtraPacket;
|
MppPacket mExtraPacket;
|
||||||
|
} Mpp;
|
||||||
|
|
||||||
MPP_RET control_mpp(MpiCmd cmd, MppParam param);
|
MPP_RET mpp_ctx_create(Mpp **mpp, MppCtx ctx);
|
||||||
MPP_RET control_osal(MpiCmd cmd, MppParam param);
|
MPP_RET mpp_ctx_destroy(Mpp *mpp);
|
||||||
MPP_RET control_codec(MpiCmd cmd, MppParam param);
|
MPP_RET mpp_ctx_init(Mpp *mpp, MppCtxType type, MppCodingType coding);
|
||||||
MPP_RET control_dec(MpiCmd cmd, MppParam param);
|
void mpp_clear(Mpp *mpp);
|
||||||
MPP_RET control_enc(MpiCmd cmd, MppParam param);
|
|
||||||
MPP_RET control_isp(MpiCmd cmd, MppParam param);
|
|
||||||
|
|
||||||
/* for special encoder async io mode */
|
/* Control functions */
|
||||||
MPP_RET put_frame_async(MppFrame frame);
|
MPP_RET mpp_start(Mpp *mpp);
|
||||||
MPP_RET get_packet_async(MppPacket *packet);
|
MPP_RET mpp_stop(Mpp *mpp);
|
||||||
|
MPP_RET mpp_pause(Mpp *mpp);
|
||||||
|
MPP_RET mpp_resume(Mpp *mpp);
|
||||||
|
|
||||||
void set_io_mode(MppIoMode mode);
|
/* Data processing functions */
|
||||||
|
MPP_RET mpp_put_packet(Mpp *mpp, MppPacket packet);
|
||||||
|
MPP_RET mpp_get_frame(Mpp *mpp, MppFrame *frame);
|
||||||
|
MPP_RET mpp_get_frame_noblock(Mpp *mpp, MppFrame *frame);
|
||||||
|
|
||||||
Mpp(const Mpp &);
|
MPP_RET mpp_put_frame(Mpp *mpp, MppFrame frame);
|
||||||
Mpp &operator=(const Mpp &);
|
MPP_RET mpp_get_packet(Mpp *mpp, MppPacket *packet);
|
||||||
};
|
|
||||||
|
|
||||||
|
/* Task queue functions */
|
||||||
|
MPP_RET mpp_poll(Mpp *mpp, MppPortType type, MppPollType timeout);
|
||||||
|
MPP_RET mpp_dequeue(Mpp *mpp, MppPortType type, MppTask *task);
|
||||||
|
MPP_RET mpp_enqueue(Mpp *mpp, MppPortType type, MppTask task);
|
||||||
|
|
||||||
extern "C" {
|
/* Decode function */
|
||||||
|
MPP_RET mpp_decode(Mpp *mpp, MppPacket packet, MppFrame *frame);
|
||||||
|
|
||||||
|
/* System functions */
|
||||||
|
MPP_RET mpp_reset(Mpp *mpp);
|
||||||
|
MPP_RET mpp_control(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
|
||||||
|
/* Notification functions */
|
||||||
|
MPP_RET mpp_notify_flag(Mpp *mpp, RK_U32 flag);
|
||||||
|
MPP_RET mpp_notify_group(Mpp *mpp, MppBufferGroup group);
|
||||||
|
|
||||||
|
MPP_RET mpp_control_mpp(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
MPP_RET mpp_control_osal(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
MPP_RET mpp_control_codec(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
MPP_RET mpp_control_dec(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
MPP_RET mpp_control_enc(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
MPP_RET mpp_control_isp(Mpp *mpp, MpiCmd cmd, MppParam param);
|
||||||
|
|
||||||
|
/* for special encoder async io mode */
|
||||||
|
MPP_RET mpp_put_frame_async(Mpp *mpp, MppFrame frame);
|
||||||
|
MPP_RET mpp_get_packet_async(Mpp *mpp, MppPacket *packet);
|
||||||
|
|
||||||
|
void mpp_set_io_mode(Mpp *mpp, MppIoMode mode);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ set (MPP_LEGACY_SRC
|
||||||
vpu_mem_legacy.c
|
vpu_mem_legacy.c
|
||||||
rk_list.cpp
|
rk_list.cpp
|
||||||
ppOp.cpp
|
ppOp.cpp
|
||||||
../mpp_info.cpp
|
../mpp_info.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(VPU_VERSION "0")
|
set(VPU_VERSION "0")
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpi"
|
#define MODULE_TAG "mpi"
|
||||||
|
|
@ -117,7 +106,7 @@ static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
||||||
if (frame)
|
if (frame)
|
||||||
*frame = NULL;
|
*frame = NULL;
|
||||||
|
|
||||||
ret = p->ctx->decode(packet, frame);
|
ret = mpp_decode(p->ctx, packet, frame);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -141,7 +130,7 @@ static MPP_RET mpi_decode_put_packet(MppCtx ctx, MppPacket packet)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->put_packet(packet);
|
ret = mpp_put_packet(p->ctx, packet);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -165,7 +154,7 @@ static MPP_RET mpi_decode_get_frame(MppCtx ctx, MppFrame *frame)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->get_frame(frame);
|
ret = mpp_get_frame(p->ctx, frame);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -213,7 +202,7 @@ static MPP_RET mpi_encode_put_frame(MppCtx ctx, MppFrame frame)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->put_frame(frame);
|
ret = mpp_put_frame(p->ctx, frame);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -237,7 +226,7 @@ static MPP_RET mpi_encode_get_packet(MppCtx ctx, MppPacket *packet)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->get_packet(packet);
|
ret = mpp_get_packet(p->ctx, packet);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -296,7 +285,7 @@ static MPP_RET mpi_poll(MppCtx ctx, MppPortType type, MppPollType timeout)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->poll(type, timeout);
|
ret = mpp_poll(p->ctx, type, timeout);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = MPP_OK;
|
ret = MPP_OK;
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
@ -322,7 +311,7 @@ static MPP_RET mpi_dequeue(MppCtx ctx, MppPortType type, MppTask *task)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->dequeue(type, task);
|
ret = mpp_dequeue(p->ctx, type, task);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -346,7 +335,7 @@ static MPP_RET mpi_enqueue(MppCtx ctx, MppPortType type, MppTask task)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->enqueue(type, task);
|
ret = mpp_enqueue(p->ctx, type, task);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -364,7 +353,7 @@ static MPP_RET mpi_reset(MppCtx ctx)
|
||||||
if (ret)
|
if (ret)
|
||||||
break;;
|
break;;
|
||||||
|
|
||||||
ret = p->ctx->reset();
|
ret = mpp_reset(p->ctx);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -382,7 +371,7 @@ static MPP_RET mpi_control(MppCtx ctx, MpiCmd cmd, MppParam param)
|
||||||
if (ret)
|
if (ret)
|
||||||
break;;
|
break;;
|
||||||
|
|
||||||
ret = p->ctx->control(cmd, param);
|
ret = mpp_control(p->ctx, cmd, param);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
||||||
|
|
@ -433,10 +422,10 @@ MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
p->ctx = new Mpp(p);
|
ret = mpp_ctx_create(&p->ctx, p);
|
||||||
if (NULL == p->ctx) {
|
if (ret || NULL == p->ctx) {
|
||||||
mpp_free(p);
|
mpp_free(p);
|
||||||
mpp_err_f("failed to new Mpp\n");
|
mpp_err_f("failed to create Mpp context ret %d\n", ret);
|
||||||
ret = MPP_ERR_MALLOC;
|
ret = MPP_ERR_MALLOC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -472,7 +461,7 @@ MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = p->ctx->init(type, coding);
|
ret = mpp_ctx_init(p->ctx, type, coding);
|
||||||
p->type = type;
|
p->type = type;
|
||||||
p->coding = coding;
|
p->coding = coding;
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
@ -494,7 +483,7 @@ MPP_RET mpp_destroy(MppCtx ctx)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (p->ctx)
|
if (p->ctx)
|
||||||
delete p->ctx;
|
mpp_ctx_destroy(p->ctx);
|
||||||
|
|
||||||
mpp_free(p);
|
mpp_free(p);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
@ -519,7 +508,7 @@ MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpp_show_support_format()
|
void mpp_show_support_format(void)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
|
|
||||||
|
|
@ -566,7 +555,7 @@ static MppFrameFormatInfo color_list[] = {
|
||||||
{ MPP_FMT_RGBA8888, "RGBA8888" },
|
{ MPP_FMT_RGBA8888, "RGBA8888" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void mpp_show_color_format()
|
void mpp_show_color_format(void)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
|
|
||||||
1439
mpp/mpp.cpp
1439
mpp/mpp.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -1,18 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
*
|
* Copyright (c) 2015 Rockchip Electronics Co., Ltd.
|
||||||
* 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 "mpp_impl"
|
#define MODULE_TAG "mpp_impl"
|
||||||
|
|
@ -69,35 +57,36 @@ typedef struct MppDumpImpl_t {
|
||||||
RK_U32 idx;
|
RK_U32 idx;
|
||||||
} MppDumpImpl;
|
} MppDumpImpl;
|
||||||
|
|
||||||
|
typedef union OpsArgs_u {
|
||||||
|
struct MppOpsInitArg_t {
|
||||||
|
MppCtxType type;
|
||||||
|
MppCodingType coding;
|
||||||
|
} init_arg;
|
||||||
|
|
||||||
|
struct MppOpsPktArg_t {
|
||||||
|
RK_U32 offset; // offset in packet file
|
||||||
|
RK_U32 length; // pakcet length
|
||||||
|
RK_S64 pts;
|
||||||
|
} pkt_arg;
|
||||||
|
|
||||||
|
struct MppOpsFrmArg_t {
|
||||||
|
RK_U32 fd;
|
||||||
|
RK_U32 info_change;
|
||||||
|
RK_U32 error;
|
||||||
|
RK_U32 discard;
|
||||||
|
RK_S64 pts;
|
||||||
|
} frm_arg;
|
||||||
|
|
||||||
|
struct MppOpCtrlArg_t {
|
||||||
|
MpiCmd cmd;
|
||||||
|
} ctrl_arg;
|
||||||
|
} OpsArgs;
|
||||||
|
|
||||||
typedef struct MppOpsInfo_t {
|
typedef struct MppOpsInfo_t {
|
||||||
RK_U32 idx;
|
RK_U32 idx;
|
||||||
RK_U32 id;
|
RK_U32 id;
|
||||||
RK_S64 time;
|
RK_S64 time;
|
||||||
|
OpsArgs args;
|
||||||
union OpsArgs_u {
|
|
||||||
struct MppOpsInitArg_t {
|
|
||||||
MppCtxType type;
|
|
||||||
MppCodingType coding;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MppOpsPktArg_t {
|
|
||||||
RK_U32 offset; // offset in packet file
|
|
||||||
RK_U32 length; // pakcet length
|
|
||||||
RK_S64 pts;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MppOpsFrmArg_t {
|
|
||||||
RK_U32 fd;
|
|
||||||
RK_U32 info_change;
|
|
||||||
RK_U32 error;
|
|
||||||
RK_U32 discard;
|
|
||||||
RK_S64 pts;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MppOpCtrlArg_t {
|
|
||||||
MpiCmd cmd;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} MppOpsInfo;
|
} MppOpsInfo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -147,7 +136,7 @@ static RK_U8 fetch_data(RK_U32 fmt, RK_U8 *line, RK_U32 num)
|
||||||
value = line[num];
|
value = line[num];
|
||||||
}
|
}
|
||||||
|
|
||||||
return RK_U8(value);
|
return (RK_U8)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rearrange_pix(RK_U8 *tmp_line, RK_U8 *base, RK_U32 n)
|
static void rearrange_pix(RK_U8 *tmp_line, RK_U8 *base, RK_U32 n)
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright (c) 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 "mpp_info"
|
#define MODULE_TAG "mpp_info"
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# add mpp video process implement
|
# add mpp video process implement
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
add_library(mpp_vproc STATIC mpp_dec_vproc.cpp mpp_vproc_dev.c)
|
add_library(mpp_vproc STATIC mpp_dec_vproc.c mpp_vproc_dev.c)
|
||||||
target_link_libraries(mpp_vproc vproc_rga vproc_iep vproc_iep2 ${VPROC_VDPP} mpp_base)
|
target_link_libraries(mpp_vproc vproc_rga vproc_iep vproc_iep2 ${VPROC_VDPP} mpp_base)
|
||||||
|
|
||||||
add_subdirectory(rga)
|
add_subdirectory(rga)
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
|
||||||
/*
|
/*
|
||||||
* Copyright 2020 Rockchip Electronics Co. LTD
|
* Copyright (c) 2020 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 "mpp_dec_vproc"
|
#define MODULE_TAG "mpp_dec_vproc"
|
||||||
|
|
@ -90,7 +79,7 @@ typedef struct MppDecVprocCtxImpl_t {
|
||||||
IepCtx iep_ctx;
|
IepCtx iep_ctx;
|
||||||
iep_com_ctx *com_ctx;
|
iep_com_ctx *com_ctx;
|
||||||
IepCmdParamDeiCfg dei_cfg;
|
IepCmdParamDeiCfg dei_cfg;
|
||||||
iep2_api_info dei_info;
|
struct iep2_api_info dei_info;
|
||||||
|
|
||||||
VprocTaskStatus task_status;
|
VprocTaskStatus task_status;
|
||||||
VprocTaskWait task_wait;
|
VprocTaskWait task_wait;
|
||||||
|
|
@ -278,7 +267,7 @@ static MPP_RET dec_vproc_set_dei_v1(MppDecVprocCtx *vproc_ctx, MppFrame frm)
|
||||||
if (ret)
|
if (ret)
|
||||||
mpp_log_f("IEP_CMD_INIT failed %d\n", ret);
|
mpp_log_f("IEP_CMD_INIT failed %d\n", ret);
|
||||||
|
|
||||||
IepCap_t *cap = NULL;
|
struct IepCap_t *cap = NULL;
|
||||||
ret = ctx->com_ctx->ops->control(ctx->iep_ctx, IEP_CMD_QUERY_CAP, &cap);
|
ret = ctx->com_ctx->ops->control(ctx->iep_ctx, IEP_CMD_QUERY_CAP, &cap);
|
||||||
if (ret)
|
if (ret)
|
||||||
mpp_log_f("IEP_CMD_QUERY_CAP failed %d\n", ret);
|
mpp_log_f("IEP_CMD_QUERY_CAP failed %d\n", ret);
|
||||||
|
|
@ -12,7 +12,7 @@ set_target_properties(vproc_vdpp PROPERTIES FOLDER "mpp/vproc/vdpp")
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
# libvdpp.so for hwpq
|
# libvdpp.so for hwpq
|
||||||
add_library(vdpp SHARED hwpq_vdpp_proc.c ../../mpp_info.cpp)
|
add_library(vdpp SHARED hwpq_vdpp_proc.c ../../mpp_info.c)
|
||||||
set_target_properties(vdpp PROPERTIES FOLDER "mpp/vproc/vdpp")
|
set_target_properties(vdpp PROPERTIES FOLDER "mpp/vproc/vdpp")
|
||||||
set_target_properties(vdpp PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
set_target_properties(vdpp PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||||
target_link_libraries(vdpp osal mpp_base kmpp_base vproc_vdpp m)
|
target_link_libraries(vdpp osal mpp_base kmpp_base vproc_vdpp m)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue