This is a complete implementation of H.264 codec ported for TI C6000 DSP. By using linear assembly language, we can take full advantage of DSP architecture. We tried to optimize several core routines, including DCT, Intra-Predict, Inter-Predict, CABAC, etc.
Add an optional downsample module.
TI 00IC-XDS100V3. See targetConfigs to modify it.
- meson: version must be after this PR
- one backend of meson
- TI-CGT 7.4.24: Download it needs a TI account to log in. If you don't want to register, download this backup. 8.0.0 doesn't support TI DSP DM6467. Refer x264-for-TI-CGT-8.0.0
- ccstudio: for burn.
Default install path is
/opt/ccstudio/ccs
- check: for unit test:
meson test -Cbuild - direnv uses
.envrcin order to:- add the path of toolchains to
$PATH export C6X_C_DIRto let compilercl6xknow where are header files and libraries.
- add the path of toolchains to
Run direnv allow to activate it.
meson setup build --cross-file=meson/ti-c6000.txt -Dbuildtype=release
meson compile -CbuildSee meson configure build to know how to configure.
# load /the/path/of/352x288.yuv to DDR2 and run:
# build/x264.out --input=352x288.yuv --frames=10
scripts/burn.js /the/path/of/352x288.yuv -- build/x264.out --input=352x288.yuv --frames=10
ffplay build/out.264Some test yuv files.
See --help:
meson setup build/host -Dbuildtype=release
meson compile -Cbuild/host
build/host/x264 --helpHere are some details:
There are two methods to pass input/output file to/from TI DSP:
- CIO. for only debug, allow TI DSP read/write host machine filesystem, we can get frame number from file size
loadRaw()/saveRaw(). load/save a file from/to DDR2. We must tell frame number
By default, in TI DSP, it will enable DDR input/output. In PC, it always read/write from itself's filesystem.
$ scripts/burn.js -- build/x264.out --input=../../352x288.yuv --disable-ddr-input
# ...
../../352x288.yuv [info]: 352x288p 0:0 @ 25/1 fps (cfr)
x264 [info]: profile Constrained Baseline, level 1.3
x264 [info]: frame I:1 Avg QP:29.00 size: 5403
encoded 1 frames, 4.28 fps, 1080.60 kb/s
$ scripts/burn.js ../352x288.yuv -- build/x264.out --input=../../352x288.yuv --frames=1
# ...
../../352x288.yuv [info]: 352x288p 0:0 @ 25/1 fps (cfr)
x264 [info]: profile Constrained Baseline, level 1.3
x264 [info]: frame I:1 Avg QP:29.00 size: 5403
encoded 1 frames, 4.97 fps, 1080.60 kb/sIn PC, related path is based on $PWD. In TI DSP, related path is based on the
directory of x264.out.
$ build/host/x264 --input=../352x288.yuv
../352x288.yuv [info]: 352x288p 0:0 @ 25/1 fps (cfr)
x264 [info]: profile Constrained Baseline, level 1.3
x264 [info]: frame I:1 Avg QP:29.00 size: 5403
encoded 1 frames, 227.69 fps, 1080.60 kb/s
# add an extra ../ because build/x264.out is in build/
$ scripts/burn.js -- build/x264.out --input=../../352x288.yuv --disable-ddr-input
# ...If you use DDR input, it will ignore --input. however, x264 get
width and height from --input's WxH. So the following commands are same:
scripts/burn.js ../352x288.yuv -- build/x264.out --input=../../352x288.yuv --frames=1
scripts/burn.js ../352x288.yuv -- build/x264.out --input=foo352x288bar.yuv --frames=1scripts/burn.js ../352x288.yuv will loadRaw() ../352x288.yuv to DDR.
If the power is on, the step only need to be done once:
scripts/burn.js ../352x288.yuv
scripts/burn.js -- build/x264.out --input=../../352x288.yuv --frames=1- codec
- TI DSP