mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00

Attach MppFrame to EncRcTask as meta data channel between user and internal RC strategy. Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Change-Id: I2787a69bec3911fe2e4f637153925c5ea88031ec
145 lines
3.9 KiB
C
145 lines
3.9 KiB
C
/*
|
|
* Copyright 2016 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 __RC_DEFS_H__
|
|
#define __RC_DEFS_H__
|
|
|
|
#include "rk_type.h"
|
|
|
|
/*
|
|
* EncFrmStatus controls record the encoding frame status and also control
|
|
* work flow of encoder. It is the communicat channel between encoder implement
|
|
* module, rate control module and hardware module.
|
|
*
|
|
* bit 0 ~ 31 frame status
|
|
* 0 ~ 15 current frame status
|
|
* 16 ~ 31 reference frame status
|
|
* bit 32 ~ 63 encoding flow control
|
|
*/
|
|
typedef struct EncFrmStatus_t {
|
|
/*
|
|
* bit 0 ~ 31 frame status
|
|
*/
|
|
/*
|
|
* 0 - inter frame
|
|
* 1 - intra frame
|
|
*/
|
|
RK_U32 is_intra : 1;
|
|
|
|
/*
|
|
* Valid when is_intra is true
|
|
* 0 - normal intra frame
|
|
* 1 - IDR frame
|
|
*/
|
|
RK_U32 is_idr : 1;
|
|
|
|
/*
|
|
* 0 - mark as reference frame
|
|
* 1 - mark as non-refernce frame
|
|
*/
|
|
RK_U32 is_non_ref : 1;
|
|
|
|
/*
|
|
* Valid when is_non_ref is false
|
|
* 0 - mark as short-term reference frame
|
|
* 1 - mark as long-term refernce frame
|
|
*/
|
|
RK_U32 is_lt_ref : 1;
|
|
|
|
RK_U32 reserved0 : 4;
|
|
|
|
/* bit 8 - 15 */
|
|
RK_U32 lt_idx : 4;
|
|
RK_U32 temporal_id : 4;
|
|
|
|
/* distance between current frame and reference frame */
|
|
RK_S32 ref_dist : 16;
|
|
|
|
/*
|
|
* bit 32 ~ 63 encoder flow control flags
|
|
*/
|
|
/*
|
|
* 0 - normal frame encoding
|
|
* 1 - current frame will be dropped
|
|
*/
|
|
RK_U32 drop : 1;
|
|
|
|
/*
|
|
* 0 - rate control module does not change frame type parameter
|
|
* 1 - rate control module changes frame type parameter reencode is needed
|
|
* to reprocess the dpb process. Also this means dpb module will follow
|
|
* the frame status parameter provided by rate control module.
|
|
*/
|
|
RK_U32 re_dpb_proc : 1;
|
|
|
|
/*
|
|
* 0 - current frame encoding is in normal flow
|
|
* 1 - current frame encoding is in reencode flow
|
|
*/
|
|
RK_U32 reencode : 1;
|
|
|
|
/*
|
|
* When true current frame size is super large then the frame should be reencoded.
|
|
*/
|
|
RK_U32 super_frame : 1;
|
|
|
|
/*
|
|
* When true currnet frame is force to encoded as software skip frame
|
|
*/
|
|
RK_U32 force_pskip : 1;
|
|
RK_U32 reserved1 : 3;
|
|
|
|
/* reencode times */
|
|
RK_U32 reencode_times : 8;
|
|
|
|
/* sequential index for each frame */
|
|
RK_U32 seq_idx : 16;
|
|
} EncFrmStatus;
|
|
|
|
/*
|
|
* communication channel between rc / hal / hardware
|
|
*
|
|
* rc -> hal bit_target / bit_max / bit_min
|
|
* hal -> hw quality_target / quality_max / quality_min
|
|
* hw -> rc / hal bit_real / quality_real / madi / madp
|
|
*/
|
|
typedef struct EncRcCommonInfo_t {
|
|
/* rc to hal */
|
|
RK_S32 bit_target;
|
|
RK_S32 bit_max;
|
|
RK_S32 bit_min;
|
|
|
|
RK_S32 quality_target;
|
|
RK_S32 quality_max;
|
|
RK_S32 quality_min;
|
|
|
|
/* rc from hardware */
|
|
RK_S32 bit_real;
|
|
RK_S32 quality_real;
|
|
RK_S32 madi;
|
|
RK_S32 madp;
|
|
|
|
RK_S32 reserve[16];
|
|
} EncRcTaskInfo;
|
|
|
|
typedef struct EncRcTask_s {
|
|
EncFrmStatus frm;
|
|
EncRcTaskInfo info;
|
|
MppFrame frame;
|
|
} EncRcTask;
|
|
|
|
#endif /* __RC_DEFS_H__ */
|