Commit Graph

2434 Commits

Author SHA1 Message Date
Ding Wei
930a273730 [h264d]: fix bug: fast mode buffer malloc
tips:
cabac_buf, poc_buf and scalist_buf shares one address,
becase these use different section using offset.

Change-Id: I2b3de96909b530e2866990de7f374120e49b587e
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2019-01-11 17:17:42 +08:00
sayon.chen
3642e59e7c [h265d]: Fix prepare failure on non-standard stream
Youku app h265 stream has non-standard at bit before nal_unit_type.
This bit should be zero according to H.265 standard. Hardware does
not parse this bit so software parser can skip this bit to avoid
failure on checking.

Change-Id: Iba4fe42de229c73eb149a84c08e17d1ceef1efdc
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2019-01-11 10:39:34 +08:00
sayon.chen
f7ded0e377 [h265d]: fix hevc parser extra data crash
hevc extra data contain frame data,cause in prepare status parser
frame, when this case founded stop parser frame, no skip extra data
directly but goto prepare status for decode

Change-Id: I3fa9919f1577a551ca9bc3ae9f46cbd8a0910255
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2019-01-07 16:49:35 +08:00
Johnson Ding
c8875a2db9 [mpp]: avoid crash when dumping a frame whose fd is -1
Change-Id: I6c7252ac32a4b857a79a4203fdaa56a2f0443645
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-01-07 09:12:53 +08:00
hh
ce946385b0 [h265e] fix bug set parameters of gop and rc
1. fix some error
2. set parameters of gop and rc at first init operation if the bit of change not set corret

Change-Id: If0bbcfbffb3224c4b3e520fdc7c4a796503dc161
Signed-off-by: hh <hh@rock-chips.com>
2019-01-04 16:29:11 +08:00
Rimon Xu
ea21bdfc5d [h264d]: add sei parser for pic timing.
parser picture timing to judge frame type.

Change-Id: If573a36d84a521ce6a4d4d53905a2822e822baaf
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2019-01-04 16:28:48 +08:00
Rimon Xu
d6bf6dd894 [h264d]: error stream adpative.
when i frame poc and frame_num equal last frame, now dpb is error,
we should flush dpb.

Change-Id: I8b0f4eeab3d07ffc7d0eeb6e8fbf31e648ddd44c
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2019-01-04 15:10:36 +08:00
Herman Chen
10c9a2d64e [jpegd]: Add vpu jpegd stream patch
VPU hardware will generate error when there is extra 0xFF or 0x00FF
before tailing 0xFFD9. Remove them will fix some jpeg stream.

Change-Id: Ifac26870086e13958e17a41b547fa94c763062f6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-01-02 15:40:04 +08:00
hh
ed43d014be [h265e] translate input format for H265E
translate YUV420P(YU12/YV12) to NV12 if input format is YUV420P(YU12/YV12)
and the stride of input buffer not align 32.H265 Encoder need the stride of
luma and chroma must align 16

Change-Id: I0e36d1c249a0270b6e5df3e16d769a817f967a2d
Signed-off-by: hh <hh@rock-chips.com>
2018-12-19 11:30:59 +08:00
hh
8f4199a0f4 [rga]: fix bug of rga config
1. Modify data type of rga_request to keep consistent with kernel
2. Modify error yuv fomrat translate and error yuv2rgb_mode config of rga

Change-Id: Iaee7b101f510c9d6f90aabe7d5ce2794b4502bf7
Signed-off-by: hh <hh@rock-chips.com>
2018-12-19 10:49:08 +08:00
Herman Chen
14de09a401 [jpege]: Add YUYV422 format support
Change-Id: Idbecbab280ce1128d21ee6656307b6c95a9523cf
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-12-19 10:44:41 +08:00
Herman Chen
50d2179ff5 [vepu]: Fix row length errror when not aligned
When picture width is not aligned to 16 vepu row length should be
aligned to 16. This is the case when default luma offset is zero.

Change-Id: Ia8e97fd89fd396f59b448ae6e759dcde40af5519
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-12-12 10:43:29 +08:00
Herman Chen
e350315c34 [mpp_dec]: Fix eos on info change
Eos should not go alone with info change flag.
If input stream is only 1 frame and require info change decoder will
create a info change with eos flag which will cause buf_slot dump log
like this: "can not clr queue_use on slot"

This patch clears eos flag on creating info change task to hal thread.

Change-Id: Ibbb92155ec1d7d0d406c781ebaaa81a98a2fc893
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-12-10 16:21:36 +08:00
Rimon Xu
b4199f0c84 [vproc]: close iep config: dei_high_freq_en = 0
We need to turn off this switch to prevent some areas
of the video from flickering, but there may be other effects.
However, a choice needs to be made.

Change-Id: Ia52a604eed21e381f7310b1c85fe1c0434a1db13
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2018-12-05 10:42:04 +08:00
Herman Chen
4a6fd29168 [h265d]: Fix error on multi-frame packet decoding
When need_split flag is disabled decoder can only receive input packet
as one frame. But if user send two frames in one packet decoder will
loss a valid frame and finally lead to memory leak.

This patch treat this case as an error and bypass later hardware
proccsing. Althrough this process will lead to frame skip it still
brings in more stability.

Change-Id: Ibe566c847e0c7e259d14913ac210171edcfc903b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-11-30 18:19:08 +08:00
Ding Wei
1babbc9cc2 [h264d]: fix bug: fast output frame
tip: when first frame is field, missing to write out.

Change-Id: I22f3e6041b9cceebefd3bec953c333a91e721b00
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-11-21 10:28:58 +08:00
Jeffy Chen
1bd32f0745 [cmake]: Skip processor detection for buildroot toolchain
Buildroot uses it's own toolchain.cmake, which leads to completely
different CMAKE_SYSTEM_PROCESSOR settings.

And buildroot's toolchain is built for specific architecture, there's
no need to specify architecture features.

Change-Id: I6516bc083f809b01f485db7ba92b1543c6191959
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2018-11-21 10:23:35 +08:00
Ding Wei
3e5ad4fed3 [h265e]: add h265 encoder code
Change-Id: I08350dc76d3040bc1a16a3d8234f836f5fbf69d0
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-11-21 09:59:31 +08:00
Herman Chen
4553fac11e [test]: Add read packet config function
When mpp output packet binary file with size config file test case
should be enable to parser the corresponding config file.
This patch implement the config file option with "-c" prefix.

Command line sample:
mpi_dec_test -t 7 -i /sdcard/in.bin -i /sdcard/ops.bin
Then the test case will read in.bin file with size division specified
in ops.bin.

Change-Id: I8b18a6475d77f0303f12614a063888dcd9505f16
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-11-21 09:57:32 +08:00
Herman Chen
a0f76729d5 [utils]: Optimize YUV422SP frame write function
When decoding 422 source the YUV422 frame is default in YUV422SP mode.
But software like vooya does not support this format. So we change it to
YUV422P format for better user experience.

Change-Id: I103445470db5e6dd46ff1dc2cb705ae7e47bd8bc
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-11-20 11:43:06 +08:00
Ding Wei
455832480f [mpp_bitread]: fix bug when using mpp_read_longbits
tips: when bits less than 16, it will be wrong.

Change-Id: I8e371f77dfdd6dcb37eb75d66ca039a37d16d9cf
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-11-19 10:37:50 +08:00
Herman Chen
e2b49ac9d4 [mpp_dec]: Fix stuck issue on field source seek
When there is hal_task on PROC_DONE status on reset the reset process
should set these tasks to IDLE status.

Change-Id: I8a9e25fb98e597e22b9b99a6d13f84a4a0e59e3b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-11-19 10:37:34 +08:00
Ding Wei
44b1e15f7b [vp9d]: remove warnning for unused variabled
Change-Id: I4bbd1f5ce31c903333a374d5c210717fd3e57383
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-11-14 10:56:27 +08:00
Ding Wei
d7ba353e36 [vp9d]: fix bug: update tile info code
tips: update error in commit: ee44ea521a

Change-Id: I2f24cd0c00ece579116172d35c54c9fc0b42d85d
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-11-09 16:08:00 +08:00
sayon.chen
96f3838011 [vepu] vepu reenocder limit
when reencoder qp equal qpmax stop reencoder

Change-Id: I2e6c9af5cd7cad55268cc2335a62fa78dd0a27e1
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2018-11-07 08:27:56 +08:00
Herman Chen
b9dda0fb95 [mpp_dec]: improve reset process
Use semaphore to protect reset process.

Change-Id: I29b7bb009e38fe3be000663f32748ff7cd3d081f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-24 14:23:50 +08:00
Herman Chen
1a388b0a94 [mpp_dec]: Fix error on random reset call
When decoding is not finish (eos) and user call reset the hal thread
may not clear all the reference frame used in decoder and not clear
frame in display queue. There will be memory leak on this case.

This patch fix this error when user randomly call reset funciton on
decoding by flushing decoder and clearing display queue.

Change-Id: I68a12bd8cfb94a4d56d652a11695ef69f2a78825
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-22 15:41:08 +08:00
Ding Wei
6000ab1e8b [h265d]: supplement disable_error flag when mark error
Change-Id: Ic4b1f4a682f399cdcf2499b45e838a1cbd8834f4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-19 16:25:14 +08:00
Herman Chen
203ff537c3 [test]: Fix not enough buffer on YUV444 jpeg decode
When decoding YUV444 jpeg image the buffer size should be larger.
Also we add user specified output format support for jpeg decoding.

Change-Id: If8defbc23162dac111aafee6d96d2726c366b7da
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-12 16:03:08 +08:00
Herman Chen
ae93472665 [utils]: Add YUV444 frame writing support
VDPU hardware only support semi-planar format for YUV444 which is
hard to display on other software. So utils will change it to YUV444P
and write to file.

Change-Id: Ie81149d7638c2e1d36fc3bc06fe1353ca95c6c01
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-12 15:56:46 +08:00
Herman Chen
7d1f812873 [jpegd]: Add YUV444 support
1. Fix missing 444 case on parser stage. Parser should setup YUV444
   format for original jpeg stream format.
2. Fix missing case on MPP_DEC_SET_OUTPUT_FORMAT. When user change
   the output format the corresponding MppFrameFormat should be
   changed.

Change-Id: I111ba2bcadd675339bfe2948a054301780177f9a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-12 15:35:08 +08:00
Herman Chen
3f22788c07 [test]: Add infinite loop decoding mode
When max frame count is set to negtive value mpi_dec_test will always
loop input file.
This is usefull for longterm pressure test.

Change-Id: I64336d5ec6411ee3712b951ef0b0c02bd5f453cf
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-10 10:52:31 +08:00
Ding Wei
ee44ea521a [vp9d]: remove tile info code which is not used
Change-Id: I6d8e8bf951777c260a0f1e3b83c8217f17b926ba
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-10 10:02:00 +08:00
Ding Wei
2a0068de4c [vp9d]: fix warning when build code
Change-Id: I86bdac9205fbc7b58f9d145ef8fcbbb8b21d6591
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-10 09:23:48 +08:00
Ding Wei
39e6d89f90 [h265d]: add max solution support check
Change-Id: I10f16416d72ed47dc7eabc92b4678b71af8fd292
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-09 10:02:41 +08:00
Ding Wei
0b644922ac [vp9d]: fix bug: split frame
tips: updated reference code according to ffmpeg

Change-Id: Iac61df91e2029c0016f691ec91b8a2bc79229e6f
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-10-09 09:16:52 +08:00
Yann Dirson
70a8b862de Fix extraction of U32 values from SPS header
Change-Id: I0798ca2adc14fb5e82e8a9b0fcece1bb3b0f7062
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-08 09:10:40 +08:00
Herman Chen
b1bc30ad5f [cmake]: Add armv8 support
Change-Id: I5fb13208f23f9dbd1f0cd4c7ec38b26026dd92f2
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-29 15:53:07 +08:00
Herman Chen
47011cd647 [platform]: Add RK1808 support
Change-Id: Id8d1bdd61888cc0fedb324f9c63be184edf3e6d0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-29 15:48:48 +08:00
Ding Wei
7a21a6a045 [h265d]: fix bug: cts in android 9.1
tips:
1. when parse_nal_uint error, should return error back.
2. task->valid need initialize 0, in prepare and parse.
3. when callback, ctx->ref is next frame handle, should
use task->dec.output to get slot_idx.

Change-Id: I802a4ff20683d4fe7e5e1255133a564c46e3c6dc
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-09-14 14:07:56 +08:00
Herman Chen
67e80ebfe4 [mpp]: Remove RKPLATFORM macro
Mpp will only run under Linux environment. Windows support will be
removed.

Change-Id: I52de4bd69f6d7b34507edeb6642668e225fcbd38
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-11 10:31:08 +08:00
Herman Chen
15e357ffd0 [utils]: Add YUV422SP frame write support
Add YUV422SP format support to function dump_mpp_frame_to_file for 422
format jpeg file.

Change-Id: I721551f526c2c981f023f638f4efd20bf695f5e9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-06 09:10:04 +08:00
Herman Chen
b03cad1c4f [platform]: Add 3128H capability description
rk3128H can support 1080p@60fps H.264/H.265 decoding. While it
do NOT have jpeg encoder nor VP9 decoder.

Change-Id: Id1b9583831036e2a43361b11f963be3599bfa7f8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-05 10:23:05 +08:00
Yann Dirson
621dd8592f Fix buffer overflow scanning soc_name.
The soc_name we read from device-tree is NUL-separated so we need to
replace intervening NUL chars, but we don't want to replace the last
one, or the next call to strstr() will overflow the buffer.

Detected with address-sanitizer:

    ==3271==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f940026a0 at pc 0x7f97df7160 bp 0x7fee1fa8e0 sp 0x7fee1fa958
    READ of size 97 at 0x7f940026a0 thread T0
        #0 0x7f97df715f  (/usr/lib/libasan.so.3+0x4215f)
        #1 0x7f97df745b in __interceptor_strstr (/usr/lib/libasan.so.3+0x4245b)
        #2 0x7f97d6b27b in MppPlatformService::MppPlatformService() (/usr/lib/librockchip_mpp.so.1+0x8727b)
        #3 0x7f97d6b64f in mpp_get_vcodec_type (/usr/lib/librockchip_mpp.so.1+0x8764f)
        #4 0x7f97d38da3 in hal_h264d_init (/usr/lib/librockchip_mpp.so.1+0x54da3)

    0x7f940026a0 is located 0 bytes to the right of 96-byte region [0x7f94002640,0x7f940026a0)
    allocated by thread T0 here:
        #0 0x7f97e6445b in __interceptor_posix_memalign (/usr/lib/libasan.so.3+0xaf45b)
        #1 0x7f97d6ed13 in os_malloc (/usr/lib/librockchip_mpp.so.1+0x8ad13)
        #2 0x7f97d6e54b in mpp_osal_malloc (/usr/lib/librockchip_mpp.so.1+0x8a54b)
        #3 0x7f97d6b1d7 in MppPlatformService::MppPlatformService() (/usr/lib/librockchip_mpp.so.1+0x871d7)
        #4 0x7f97d6b64f in mpp_get_vcodec_type (/usr/lib/librockchip_mpp.so.1+0x8764f)
        #5 0x7f97d38da3 in hal_h264d_init (/usr/lib/librockchip_mpp.so.1+0x54da3)
        #6 0x7f97d387c7 in mpp_hal_init (/usr/lib/librockchip_mpp.so.1+0x547c7)
        #7 0x7f97d02ad3 in mpp_dec_init (/usr/lib/librockchip_mpp.so.1+0x1ead3)
        #8 0x7f97cfda3f in Mpp::init(MppCtxType, MppCodingType) (/usr/lib/librockchip_mpp.so.1+0x19a3f)
        #9 0x7f97d0056f in mpp_init (/usr/lib/librockchip_mpp.so.1+0x1c56f)
        #10 0x404347 in mpi_dec_test_decode (/home/root/rockchip-mpp-test/mpi_dec_test+0x404347)
        #11 0x4057b3 in main (/home/root/rockchip-mpp-test/mpi_dec_test+0x4057b3)
        #12 0x7f97bba563 in __libc_start_main (/lib/libc.so.6+0x1f563)
        #13 0x402217  (/home/root/rockchip-mpp-test/mpi_dec_test+0x402217)

    SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/libasan.so.3+0x4215f)
    Shadow bytes around the buggy address:
      0x1ff2800480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
    =>0x1ff28004d0: 00 00 00 00[fa]fa fa fa fa fa fa fa 00 00 00 00
      0x1ff28004e0: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
      0x1ff28004f0: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
      0x1ff2800500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800510: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800520: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa

Change-Id: Ia529035847cc23c612e4039e3d445db9d014d31f
Signed-off-by: Yann Dirson <yann@blade-group.com>
2018-09-05 09:02:22 +08:00
Herman Chen
496808002d [mpp_impl]: Add tid to dump file
1. User often use multi-instance decoder. The dump file name should has
some way to avoid overlap file operation.
Also an extra stream length config file is added for decoder. For
decoder issue reproducing should stay the same with the real user input
stream seperation.
2. Add mpp operation record file for issue reproduction.
3. ops format is similiar to Android time log.

Change-Id: I4b3702fcb4ae1601579762a6d1d7cadc10861759
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-30 15:35:31 +08:00
Ding Wei
fc1e2256b7 [mpeg4]: fix bug: add marco MPP_DIV for division
tips: in mpeg4,the divisor named time_pp is likely to be 0.

Change-Id: If9c055cb03139e819fe901009024e3ad4bbe79a5
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-08-30 08:58:33 +08:00
Ding Wei
f7938a8746 [bitread]: h264d: compatible case: pps has zero tails
tips: when pps rbsp has zeror tails, then the check for
whether has_more_rbsb for pps, will judge error.

Change-Id: If8365fca6d49741302779414ab9ff2cb34f4602d
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-08-24 18:03:32 +08:00
Ding Wei
3b7d0b9e8b [h264d]: fix error: when calculate wrap_frame_num
tips: when frame_num increase by one, must remainder by max_frame_num.

Change-Id: I972e498bf608639dd29293dfed0bd93180d3f2ed
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-08-24 17:37:02 +08:00
Herman Chen
fe17ac5806 [cmake]: Remove static library dependency
Some test depend on mpp_base static library which is unwanted.

Change-Id: Ic3ab0826dee1284c0737d1015648c334a6328f8d
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-23 16:38:32 +08:00
Ding Wei
5c2f044d43 [h264d]: relax condition: check frame_num continue
tips:
1. In h264 protocol, last frame is used for reference, current frame num
must increase by one, otherwise equel last frame.
2. Very few error stream, not increase by one, then consider it error.
for this case, relax condition, just check cur->frame_num is equal to
last_frame->frame_num or increse by one, not consider whehter last_frame
is reference or not.

Change-Id: I885074b781fa5a53419e77e9e73243b439bf15d4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-08-22 16:55:44 +08:00