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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Some test depend on mpp_base static library which is unwanted.
Change-Id: Ic3ab0826dee1284c0737d1015648c334a6328f8d
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
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>
1. support mb rc rate control
2. modify strategy for last gop fps pid residue bit
3. add virtual buffer interface buf no used in bit alloc
4. support reencoder when p frame stream length is biger then need
5. fix sps vui error when video_signal_type_present_flag is true
Change-Id: I5ce4448ffd78f0c9af94a908d7b1b0e7064550e7
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
tips:
a) when parse syntax error, enable parse_err;
b) when dpb ref error, enable ref_err;
c) when use disable err, only disable ref_err, parse_err cannot.
above all, using these flags, when parse error, it also can
go ahead to hal thread, and loop all.
Change-Id: I639248dbf4499a8ed473b9f44f1e1332409c5c22
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
tips: frmame_num will check in driver layer, so hardware need not
check again. Even these systax error, whether consider it error
by driver, not hardware.
Change-Id: Ide62dd5e5eb0ac04e3d52ca7f11750dbff21ee11
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This handwriting error will cause larger memory usage when decoder is
too fast.
Change-Id: Iea93fcfd265d81c43206499a09d682da2b6231a1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Set get environment string parameter to const char to avoid modification.
Change-Id: Ib5308407fcac2fa58b194fb8df33380efc1487f9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Old external library do not clear the vpu_context. We need to reset
the ori_vpu flag when goto mpp path.
Change-Id: I31e5dceae83bb196253d6d19a149a55a4f59d9ee
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Optimize mpp_dec parser thread wait mechanism to reduce cpu overload.
1. Add mpp signal notify flag
2. Add mpp_dec wait status flag
3. Compare the notify flag with wait status flag. When there wait
condition is fulfilled then signal parser thread to process.
This will greatly reduce cpu overload by block wake up with no sense.
Change-Id: I38da718e80d0487e0300e807bc87cdb1aa070471
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Use MppPollType as block control MPP_SET_INPUT_TIMEOUT and
MPP_SET_OUTPUT_TIMEOUT 's parameter.
Deprecate old block/block_timeout control.
Next step is to change MppPollType to RK_S64 for compatible in different
platform.
Change-Id: I02974f0b8eeb23ff43687448d6c3271ea7dd0a2c
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
tips: when split error, and consumed lager than
input length, it will be wrong.
Change-Id: I43ca99f55cb379b93ff08028ed368ce21e6b3611
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
tips:
Consider case that missing reference is not error,
as warnning instead.
Change-Id: Ia702fda3d427355655dd9dd4c4466dc404e68a46
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
The decoder reset function would push all the reminded
buffers into output queue. It is not necessary and
useless.
A reset order means the application want to be back
to the origin. So we must remove the references
from decoder after a resettting.
Change-Id: Ic4ec5410606ffc815cd6c29e84735a3909b27f62
Signed-off-by: Randy Li <randy.li@rock-chips.com>