Commit Graph

2434 Commits

Author SHA1 Message Date
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
ec1673276c [rc]: Add rate control debug header rc_debug.h
Change-Id: Ib66f0f1f4dcf30eeac72db2ff84f4b8a1febccd6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-20 10:54:51 +08:00
Herman Chen
a686811240 [hal_h264e]: Add new hal_h264e_api to mpp_enc_hal
1. Add mpp_enc_hal module.
2. Connect hal_h264e_api to mpp_enc_hal for later usage.

Change-Id: Ia5dcb9a38004dd1f87daaa766699abb798297684
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
Herman Chen
a712acd78e [enc_impl]: Change enc_impl interface
1. Add start function for fps process and dpb backup.
2. Remove update_dpb function for dpb should be processed at one time.
3. Add device id to encoder config for header generation.
4. Add hal_ret syntax to encoder hal task.

Change-Id: I9dbbc831d46b267701901dc6e80db7efaa7a0b14
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-20 10:54:51 +08:00
Johnson Ding
711a15ad43 [h264d]: fix vdpu2 reg type mistake
Reg of pps_id should be 8-bits long, instead of 5-bits long. This leads
to hard error when pps_id is greater than 31.

Change-Id: I0ecb894a1aa0af4e66bffb97a19c8b4b9ab5a401
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-12-20 08:41:41 +08:00
Herman Chen
2c7f6c2d95 [rc_data]: Add rc data implement
The principle of rc_data is to maintain rate control related data for
default and user define rate control algorithm.

Mpp internal work flow will automatically maintain these data. Then rate
control algorithm can just use the data by some APIs.

RC data has some status transaction betweeen different flow stage.
Stage 1. RcData is at unused status.
Stage 2. RcData is got by encoder and encoder starts to filling data.
Stage 3. When data filling is finished RcData is marked as done status.
Stage 4. When data receive max life cycle it returns to unused status.

Encoder will fill in the RC related data including:
1. Unique sequence id
2. Frame type / status
3. Stream size
4. Extra info (hardware feedback)

 Overall status and stage diagram

 oldest                                                       latest
 +                                               +           +
 |last                                           |  current  | next
 +----------------------------------------------------------------->
 |                     done                      |  filling  |unused
 +head                                       tail+head   tail+head

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ib71581d0585f60b46de20662ffe1d20989270884
2019-12-19 10:43:41 +08:00
Herman Chen
4b3ed83529 [rc]: Add hardware related RC parameter header
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I12e96fbf96619b1e30297b7501ed320d96f2b0c8
2019-12-19 10:43:41 +08:00
Johnson Ding
06a6014817 [build]: Update Android build script
1. Detect NDK path and version
2. Enable cmake multithread compiling if version > 3.12
3. Support specifying args to build script

Change-Id: I2179aeb5460de6b8d39a867ba3a4200c51b61be7
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-12-19 10:43:41 +08:00
Herman Chen
2797a44932 [mpp_list]: Add list_for_each_entry_reverse
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I0270f5d045434e1a7a9bd25fe35f2a75c1759f2a
2019-12-19 09:02:11 +08:00
Johnson Ding
2026c7b655 [build]: Fix wrong CMAKE_SYSTEM_PROCESSOR issue
See: https://github.com/rockchip-linux/mpp/issues/121

Change-Id: Iefc47632a53652818f701df7cec01875172d1260
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-12-11 20:28:07 +08:00
Herman Chen
f2ede4569c [h264e_slice]: Add prefix nal and some error fix
1. Fix error on no_output_of_prior_pics and marking syntax.
2. Add max_ref_num_frames and poc type to slice config.
3. Fix mmco count error and reading error.
4. Add more slice syntax log.
5. Add h264e_slice_write_prefix_nal_unit_svc function.
6. Use mpp_writer_align_one and mpp_writer_trailing to write tailing.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ia3871b8818c1ba73884ab74b58200ea309e01a50
2019-12-11 14:57:41 +08:00
Herman Chen
f627310fa0 [hal_h264e]: Fix common define
1. Use mpp define rather than H264E define.
2. Unify debug function to hal_h264e_debug.h.
3. Change h264e_hal macro to hal_h264e.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I924f717bbffbb37230d9eb3300969a4dce807def
2019-12-11 14:57:41 +08:00
Herman Chen
0547a740fe [mpi]: Add better sync call to get encoder header
Change-Id: Ibbd9b4ee178b0994f3c86738cd623eaffd2bca0f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-11 14:55:24 +08:00
Herman Chen
5b2ccb9344 [rc_debug]: Add rate control module debug function
Change-Id: I0e2728f9080ba4d8ec55635bc78dc15c9402c595
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-11 11:09:52 +08:00
Herman Chen
32210ca331 [h264e_syntax]: Add H264ePrefixNal
Add H264ePrefixNal for encoder.

Change-Id: I57ca7d7d24ec89af80f787f3e7b931a2b228d6d8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-11 09:22:05 +08:00
Herman Chen
e6ab284dee [hal_task]: Add temporal_id to HalEncTask
Change-Id: I6e776426891d3a1e19711ca6aca59c460440801a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-11 09:20:04 +08:00
Herman Chen
7453d6a9da [mpi]: Add change flag for MppEncGopRef
MppEncGopRef change flag contains enable, long-term reference loop,
short-term gop loop and layer rate control flags.

Change-Id: I98b84cf13e18da769af6867af96a3257824e5c63
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-10 20:35:01 +08:00
Herman Chen
0a48d53d01 [hal]: Remove mpp_enc_refs
The encoder will get parameter directly from MppEncCfgSet. The
mpp_enc_refs is not needed any more.

Change-Id: Id8b466a905ae10335159bba3ce8d1e5185e3c714
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-12-10 20:25:16 +08:00
Ding Wei
7d05e33de8 [mpp]: add /dev/mpp_service support
Add a new ioctl mode for kernel-4.19 or later.
Tips:
    1. There will be only one device /dev/mpp_service in kernel.
       User should use client type to distinguish different device.
    2. Each codec use the same function as before.
    3. Ioctl magic changes from VPU_IOC to MPP_IOC.
    4. Update structure for ioctl argument.
	Original structure:
	    data_ptr | size
	In this mode has many sortcommings:
	a) Need many ioctl cmd for different requirements.
	b) Data_ptr not to differ library for 32 or 64 system.
	c) Contain only one info ioctl once.

    New data structure:
        cmd_type | flags | size | offset | data_ptr
    a) Cmd_type works like previous ioctl cmd.
    b) Flags is extend to mark current data for any purpose.
    c) Size is the same as before.
    d) Data_ptr use 32 bits build in 32 system while 64 bits in 64 system.

kernel-4.19 related commit:
ib94ac0df876dfcc786b25ed3de6a68d861d2ef1e
cda9d27c62017309519bcbf8fe91057dfdc21076

Change-Id: I13d54a2e4823b7378265f100540916a22f62b9d4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2019-12-10 20:12:50 +08:00
Grey Li
a9d6b3a994 [mpp_dec_vproc]: Add iep deinterlace capacity judge
Add iep deinterlace capacity judge before process. If iep can't suppurt
I4O2 mode, we always choice I2O1 mode.

Change-Id: I97ba11c6de57b54ac2068f2c1f348ee83e8d001d
Signed-off-by: Grey Li <grey.li@rock-chips.com>
2019-11-29 19:49:08 +08:00
Herman Chen
5c1476f96d [hal_h264e]: Add hal_h264e_debug.h
Change-Id: I2dfc360d56399a71e23a5a2a237e162212cf83d1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-26 14:21:27 +08:00
Herman Chen
dd83ba3fb2 [vp9d]: Format code
Change-Id: I57483df0b1ca7c7e8fb9edf4b2fa22a1580efc01
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-26 11:05:36 +08:00
Herman Chen
2dc0df3228 [hal_h264e_vepu]: Move macro BIT() to table header
Change-Id: Ib217e6834b7a49703b5717596e8626e92a431d32
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-26 10:55:41 +08:00
Herman Chen
8b9449fce7 [jpegd]: Fix compile warning
Change-Id: Ia56f7078e94e4a2a41b8d673cfa6775c3dcbbe73
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-25 19:24:55 +08:00
sayon.chen
68c836288c [vp9d]: fixed vp9 dec last segment id update issue
fixed Chimera_1080p_short.mp4 decoder error.the issue
for this stream segment enable & map_update flag is set true.
1) in the paser status map_update must init to zero before read.
2) in hal_set last segment enable flag must set true if segment
   enable flag is true.
3) the segment last id must update after this frame decoder when
   segment enable & map_update flag is true.

Change-Id: Ia000c4687185f869229a8b6e36933bb5e1991e5f
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2019-11-25 10:11:20 +08:00
Johnson Ding
5386cd8827 [m2vd]: fix eos flush not working problem
Change-Id: Iab667506639f53d07f6271dbb723e2b5014f8ef9
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-11-22 09:06:56 +08:00
Zhou Jing
37f7e6ac71 Fix input and output timestamp mismatch
Don't do division it will cause missing precision.

Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: If7daba7bb18ef9def5188c386d17832e54f4cded
2019-11-21 11:42:31 +08:00
Herman Chen
7b47085c19 [test]: Add output block for mpi_enc_test
Set encoder output to block mode in mpi_enc_test.

In some case the demo will get NULL return packet. Use block mode to
avoid this error.

Change-Id: I8e7438b07f024a30f62bbb92382e210b06e47a61
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-21 10:19:09 +08:00
Herman Chen
44f3604fb1 [h264e_dpb]: Add H.264 encoder dpb/slice functions
1. Move hal h264e dpb/slice functions to codec.
2. The dpb functions support I frame gop interval, LTR interval, force
   LTR and generating reorder/marking syntax.

Change-Id: I42654f33c9628bb3228afb6acf56c85c984a377e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-19 11:18:08 +08:00
Herman Chen
ed13794d4d [h264e_syntax]: Move new syntax to different file
1. Move H264 encoder new SPS/PPS syntax to a new header.
2. Change include file correspondingly.

Change-Id: I29d2819c61871953f4981703cd11a4a26d90986f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-19 11:01:11 +08:00
Herman Chen
136ef91ba6 [mpp_rc_api]: Add rate control header mpp_rc_api.h
This header is interface for different rate control strategies.

Change-Id: I4db0c3effbd5fbb0b52506774247e1f5483b9209
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-19 10:51:00 +08:00
Chen Jinsen
1af542e405 [legacy]: vframe add vui info
Change-Id: I595e90cd46412a37440b9555f93fb8fa46d9d6dd
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
Signed-off-by: Hery Xu <hery.xu@rock-chips.com>
2019-11-19 09:08:38 +08:00
Zhou Jing
7119de4620 [h264d]: Fix vdpu2 cache issue
Disable cache_en when the video resolution is less than 720p

Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: I17af1241d536ccb5fbabb0cb45537dfbe2e64bbb
2019-11-18 20:40:14 +08:00
Herman Chen
cdadaa9bba [h264e_pps]: Add h264e pps function
NOTE: Add scaling list mode flag to rk_venc_cmd.h

Change-Id: Idd3b33c577ce5ffd79dabc850f7c98a98c1ac19a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-18 19:45:10 +08:00
Herman Chen
50b8dce027 [h264e_sps]: Add h264e sps function
Change-Id: Iaf9bfc8412fb215bf84fbc89f10e86846c8ae0d4
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-18 19:45:10 +08:00
Herman Chen
f54abf9311 [mpp_enc_cfg]: Add frame status to enc_cfg.h
1. EncFrameStatus will be used in dpb, rc and hal config.
2. Remove misc config.

Change-Id: I32eb4460180f3eb0b1c866c3393ed6fc4b95b99b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-18 19:41:00 +08:00
Herman Chen
48ed174d02 [gitignore]: Add VSCode ignore file
Change-Id: I46438925d03ed36f41feecece69a669329d08fdb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-18 19:28:04 +08:00
Chen Jinsen
df4f1a8bc3 [h264d]: check pps id to avoid out of bound error
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
Change-Id: I0c8f6542064c943f4de6cd4c012df66f7a82b8e6
2019-11-18 18:05:21 +08:00
Johnson Ding
27bbe9ff79 [vp8d]: fix reg struct typo mistake
This may cause color distortion.
See https://github.com/rockchip-linux/mpp/issues/113

Change-Id: I9ea1b377d06d9873bf190ced13f061268bf7dd93
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-11-18 14:25:33 +08:00
vicent.chi
82133ab9a1 [hal_h264e]: Print frame size warning only once
Change-Id: If41d9c6c577d16d52162ad9e5c31033765ac346f
Signed-off-by: vicent.chi <vicent.chi@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-11 16:48:30 +08:00
Chen Jinsen
fdc8ef19cb [mpp]: Fix output slot index assertion failure while get parse error
Change-Id: I06a9897bad7edbcd96b171faaecdab38a08d46eb
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
2019-11-10 10:10:54 +08:00
Herman Chen
c774c8befd [mpp_packet]: Increase meta ref_count on copy
Change-Id: Idf4d2525301684896c6f81b6d2144b69649f233e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-11-08 10:59:54 +08:00
sayon.chen
df6a30f682 [vepu]: fix mb rc target_error set issue
Change-Id: I64320f2fdcf315f67d68087993d1cc1982b14cb4
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2019-11-07 10:19:05 +08:00
Chen Jinsen
f46e8eb215 [mpp]: Add buffer match signal at frame group callback
Change-Id: Ia1a7ec20263e94314b210d2c735ca1d35c561b18
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
2019-11-06 10:49:49 +08:00
Zhou Jing
d8e0653169 [dec_vproc]: Fix memory leak on iep open failed
Fix MppDecVprocCtxImpl_t memory leak when iep context create failed

Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: I49c791523822cc3551bb05fa74de2f741ee37bde
2019-11-06 08:16:09 +08:00
Johnson Ding
7c26b23bac [h264d]: Fix dpb size not bigger enough issue
If dpb size calculated from Profile/Level is less than
max_num_ref_frames, then dpb size should equals to max_num_ref_frames.

Refer to this issue: https://redmine.rockchip.com.cn/issues/229257

Change-Id: Ia0b27dbc581e052a5adb82ee505130bc492a524c
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-10-30 15:37:48 +08:00
Johnson Ding
4ef69884a6 [jpegd]: remove tailing 0xff patch from parser
Tailing 0xff will always be done in hal thread. There is not need to
doing this twice.

Change-Id: Ide4fcc4a2e252be04067c6990fc6a8e9ba8ee824
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-10-29 09:43:26 +08:00
Wenjie Yang
ba6c612544 [h264d]: Errorinfo is marked incorrectly
When frame_num_value_allowed_flag is equal to 1,
If frame_num is not continuous,
errorinfo does not need to be marked

Change-Id: Icf68d4186dccdb1d647fbf69c767034dcb7088ac
Signed-off-by: Wenjie Yang <ywj@rock-chips.com>
2019-10-28 09:57:45 +08:00
Herman Chen
c2a781d05d [hal_h264e_vpu_tbl]: Do not copy multiple tables
Change-Id: Ie8bb5b11fec6a0604f8566bb8696a54dea40fe8f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-10-23 20:30:22 +08:00