Commit graph

38 commits

Author SHA1 Message Date
Herman Chen
f507421f8b chore[mpp_enc_cfg]: Remove MppEncCodecCfg
1. Revert codec cfg to separate h264/h265/jpeg/vp8 cfg.
2. Update enc/dec/sys cfg_test print.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ida5da8a6b738fbf710e1ab590bc6b6f3438319c4
2025-09-10 17:39:55 +08:00
xueman.ruan
36e263402a fix[hal_h264e]: fix segment err when encode tsvc
update segment info after amend stream

Change-Id: I6dc1ace0bcd58746f3fd0755c980e22482219f3d
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
2024-06-13 09:17:12 +08:00
xueman.ruan
de396c2ac2 fix[hal_h264e_vepu]: terminate task if not support
Change-Id: I1349ba43e57ff1b983bd5475f328cd9921137d89
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
2023-09-22 09:09:50 +08:00
xueman.ruan
f91f152a1a [hal_h264e]: fix log2_max_frm_num config error.
Issue is introduced when user configs log2_max_frm_num.

1. use MppEncH264HwCfg instead of hw_poc_type.
2. slice_write can only use corresponding hardware config.

Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: Id5f3622512075eedc1e9dc99636c3f0dff43d6f1
2023-05-30 14:04:31 +08:00
Hongjin Li
962a88827b [vepu540_gdr]: Support h264 intra refresh
Signed-off-by: Hongjin Li <vic.hong@rock-chips.com>
Change-Id: Ia30e11d29f24f82525ed675142dbdd42a07b4d6c
2023-01-11 11:04:44 +08:00
xueman.ruan
9d00c8811d [hal_h264e_vepu]: Add rotation function.
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: Ie520f8bbeac43423ef7e5319c0bb94649111d93e
2022-11-08 15:29:42 +08:00
sayon.chen
9405c48f97 [hal_h264e]: Support poc_type 2 & add tsvc prefix
Change-Id: Ibbb0ee179974fdade590b97c9b3b38bcf822dffc
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2022-11-04 17:05:12 +08:00
Herman Chen
072a0d6f0d [hal_h264e]: Fix extra syntax error log for dpb
https://github.com/HermanChen/mpp/issues/42

Change-Id: I85298a2cece2166932519a7cacc22806b42d5092
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-04-08 14:32:23 +08:00
Herman Chen
31814aea59 [vepu]: Add offset_x offset_y support for vepu
Change-Id: I672ac7f9518544fc08bdf8a887b7686f2f7b1abf
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-09-30 16:46:58 +08:00
Yandong Lin
5599465f7d [hal_vepu]: Support fd and offset to be set separately
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ie186589473420cc10551b6c113b9f9c8a3ed4d5d
2021-03-16 16:36:19 +08:00
Herman Chen
0be1763725 [mpp_enc]: Add hal prepare function
Add prepare function to hal interface.

NOTE: The hal prepare function is the hal hook on user control.
When user config is changed hal can process some cfg before enc_impl
updated the config through syntax in task.

Also when encoder is in low delay mode the user control should not be
processed if the current frame is not finished.

Change-Id: Ie287e05daff0d139cf04d93d97246fa176d14d53
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-24 14:59:37 +08:00
Herman Chen
b07f45a708 [mpp_enc]: Add encoder slice encoding function
Add empty function first.

Change-Id: Icb325448a2d1a2216adb01118fbd5afd554e661e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-09 10:59:36 +08:00
Herman Chen
60b6800287 [rc]: Remove unused rc code
Change-Id: I27a62c48b757ddc90924691522eb7aa881e94b62
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-10 16:00:38 +08:00
Herman Chen
b0c1f86b32 [mpp_enc]: Add MppDev and HalInfo to mpp_enc
1. Add MppDev output for all encoder.
2. Update HalInfo to MppDev on each header update.

Change-Id: I8fce811dda7232740042917c9738bc11253ee672
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2020-11-09 10:28:12 +08:00
Herman Chen
af6938b235 [mpp_device]: Move mpp_device to osal
Change-Id: Ia196f01945d47c24e821da8935f3694834afa839
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-06 11:47:53 +08:00
Herman Chen
3f8e880a39 [hal]: Use new mpp_device interface in hal
Switch all hal module to new api.

Change-Id: I066da7e06c999a01b80ee193365c5752e9bb19aa
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-06 11:47:53 +08:00
Herman Chen
f8b77d6aa2 [h264e_syntax]: Simplify h264e_syntax
1. Move sps / pps / slice / dpb definition to there own header.
2. Prepare to add new h264e syntax struct for hal.

Change-Id: I95e884afcf08fa51bdeb6f1e6571c264d9a609ec
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-09-28 09:53:49 +08:00
Herman Chen
04137732ac [h264e_syntax]: Rename syntax for h264 encoder
Change-Id: I742d251905f083d5636c61b98d9125421b90f3de
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-09-28 09:33:48 +08:00
Herman Chen
16ba8b5820 [hal_h264e_vepu]: Fix stride parameter compatible
Fix stride definition to compatible to both pixel stride and byte
stride.

In MPI the stride is defined to byte stride. But vepu requires 8 pixel
aligned pixel stride.

So we add more code to adapt to both case and check 8 pixel alignment.

From opengles definition:

Stride means bytes in a row of pixels including padding. So an image
could be 510 pixels in width and rounded up to 512 pixels. The stride
would be 512 * bit depth of the image's format. You could also have
stride in pixels in which case the stride would be 512 pixels

Pitch is a little more vague, but typically could be interchangeable
with stride. Considering your reference is specifying in bytes, it's
likely safe to assume they're not measuring in pixels. So the reference
likely means the number of bytes in a row + padding, the only
alternative would be number of bytes without padding e.g. image width *
bit depth.

Change-Id: I20acf71e2a6bea2eb08b41fe7df531154ebef897
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-09-28 09:25:06 +08:00
Herman Chen
ccf97315fe [mpp]: Remove obsolete mpp_enc path
All encoders will use mpp_enc_v2 path.

Change-Id: I7ab66e70760a4685086f73735fb11386039d639e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-09-10 10:22:46 +08:00
sayon.chen
c0fef41211 [hal_vepu_v2]: Fix vepu hor_stride setup
vepu h264 input stride must be aligned to 8 for vepu limitation.
If it is not 8 aligned some buffer conversion preprocess should be done
before the buffer is sent encoder.

1. The hor_stride in vepu hardware is in pixel unit not byte unit.
2. The hor_stride in vepu must be 8 pixels aligned.
3. The YUV420P should be 16 pixels aligned for chroma.
4. Fix log print when hor_stride != width 8align

Change-Id: If30136a4673399c3be40a41a055e832db4c321d5
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2020-09-08 09:04:55 +08:00
Johnson Ding
cba637c3f1 [jpege/h264e]: fix RGB encode config
Change-Id: Iec9d928ad6fb1a31cbf6f224b264ebb6797294a3
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2020-08-05 10:52:05 +08:00
Herman Chen
aec5989e03 [hal_h264e_vepu]: Add checking on nal_ref_idc
Mainly for MLVEC test.

Change-Id: I1f329e0401d69147152e57e9329e3b670802c264
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-07-24 15:00:00 +08:00
Herman Chen
7604d66417 [h264e]: Change prefix nal process
1. Prefix nal is setup in h264e_api and send to hal by syntax.
2. Hal receives prefix config and writes prefix nal before each slice.
3. Add vepu1 / vepu2 prefix implement. vepu541 is not implemented yet.
4. Add max temporal layer id check to enable prefix nal.

Change-Id: I8bc40af12b9d9cedd64c1aa6a2666d3ffe7bf694
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-07-24 14:59:53 +08:00
Herman Chen
f1d7f6e717 [vepu_v2]: Use quality min/max to limit qp
Change-Id: I1291c64d52821191cfb84af9a2656097a7d77b0d
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-06-29 17:25:57 +08:00
sayon.chen
fb6cdcb9c0 [vepu]: Add slice split support for vepu1/2
Change-Id: If9f26b1090e4fda50068b325ed15404bd514d1d7
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2020-06-02 20:06:13 +08:00
Herman Chen
23d3e82c0c [hal_h264e_vepu1/2]: Add stream amend to hal flow
Change-Id: Ic92959a922983e2e251b03dbc58bf91ab67f9050
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2020-06-02 20:06:13 +08:00
Herman Chen
6a6521ed13 [gop_ref]: Remove gop_ref
New reference frame config interface will be added.

Change-Id: I5766cefde12237561bbc20c905e47ed2d3e90011
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-05-26 16:29:40 +08:00
Herman Chen
463ae89b6e [mpp_enc_v2]: Fix hw_length update error
1. hw_length should be only updated by hardware real stream length.
2. hw_length can be updated multi-times by slice encoding.
3. When reenc found the hw_length should be subtracted from total task
stream length.

Change-Id: I1c3f6affcc5dc90ad548a42efed0237c60b98f08
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-05-25 09:48:01 +08:00
Herman Chen
0c5dc02ebd [hal_h264e_vepu]: Fix hardware stream length error
Hardware output stream length includes the 64-bit header aligned length.
So we need to subtract aligned length to get the real hardware length.

Change-Id: I78f16afa02bc4428613cafcca9b8bde9241ba997
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-05-22 15:27:12 +08:00
Herman Chen
a32733c54e [hal_h264e]: Fix H.264 vepu error on kernel 4.19
On kernel 4.19 the send registers and recv registers can be different.
But due to compatibility kernel 4.4 the register copy is needed.

Change-Id: I1af7bbf8c27671627bda1679283693ec7eb4b0b5
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-04-21 08:40:40 +08:00
Ding Wei
8619ac32c0 [vepu]: fix issue of missing platform setup
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Change-Id: I7fe3fe706879b63ed47985fc99894e92fe2288f2
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2020-04-20 17:59:52 +08:00
Herman Chen
fe4b86b025 [mpp_enc]: Update OSD API
1. Update OSD palette config API. User must specify palette is default
or user defined.
2. OSD palette config will go through control and OSD data (region)
config will go through meta data in each frame.
3. Remove unused code.
4. Add mpi_enc_utils for mpi_enc_test cases

Change-Id: Ib4aeb60789a3e999446212841508e604533efb3c
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-04-02 18:21:20 +08:00
Herman Chen
04787b8f4e [hal_h264e_vepu541]: Add MB layer rc
1. Fix error of return bit_real.
2. Add MB rc functions.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I1555b717bf28b776781b58f092ed1d2dd4dc82e6
2020-03-28 18:11:16 +08:00
Herman Chen
6d52e80b27 [encoder]: Change rate control work flow
1. Add mpp_rc_api and mpp_rc_defs for open rc module to external users.
2. Add RcImplApi registration and setup function.
3. Separate RC module from the encoder implement.
4. Use EncFrmStatus and EncRcTaskInfo to control work flow.
5. proc_rc and update_rc function in enc_impl are removed.
6. Use rc_frm_start and rc_hal_start to process rate control.
7. Add more RcCfg setup in mpp_enc_v2.cpp.
8. Use rc_task to replace all the frame status and rc config transmit.
   EncFrmStatus is for encoder flow control.
   EncRcTaskInfo is for communication between rc / hal / hardware

Change-Id: Ia72b0e0804bfca13963c2b2a5887983fd9b5bcbf
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2020-03-19 14:43:02 +08:00
Herman Chen
74d050c4df [h264e]: Output SPS/PPS without GET_EXTRA_INFO
When user does not use GET_EXTRA_INFO to get encoded header stream the
encoder should add the header stream before the hardware output stream.

NOTE: Only vepu2 is fixed.

Change-Id: Idf5c07127ef68bb6553f9fb6550f993f3a29ea63
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-03-18 20:10:41 +08:00
Herman Chen
6533d422a2 [rc]: Add rate control module
1. Move mpp_rc_api.h to rc_api.h
2. Add rc base module from mpp_rc.
3. Add rc api and empty rc model.

RC module design:
Rate control is a highly user defined module. So we perfer to open the
interface and let users add their frame-level rate control model.

In order to limit the user behavior the API input and output is
restricted. User can use the provide rc base components to define their
own model.

Change-Id: I72c251e7807f675e973bc80ea55683cd57070b00
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-20 10:54:51 +08:00
Herman Chen
b514b956e3 [hal_h264e]: Add new h264 encoder hal module
New hal api will change interface to the following functions:

1. get_task - receive one task from encoder and process hw rate control.
2. gen_regs - generate register set according to different hardware.
3. start    - start the hardwara.
4. wait     - wait hardware process one task.
5. ret_task - return the processed task back to encoder.

NOTE: change some function to v2 to avoid linker conflict.
NOTE: vepu2_v2 status
1. Add svc and gop ref implement.
2. Without rc config. The QP is fixed.

Change-Id: I5fa890e8e23c0abbc5abb5ce44111c8a10ea1817
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-20 10:54:51 +08:00