Skip to content

Commit

Permalink
Squashed 'codec' changes from 5aba8ac~10..5aba8ac (#706)
Browse files Browse the repository at this point in the history
5aba8ac Merge pull request Xilinx#287 from yunleiz/fnext
19dee47 [CR] fixed CR-1135031
b040292 Merge pull request Xilinx#282 from siyangw/next
9a9cb58 revise platform to try hw building
1d9e5ca Merge pull request Xilinx#285 from yunleiz/fnext
71f0059 add jks max run time
687d1be [CR] fixed CR-1131396
6e9d17e [CR] fixed CR-1135031
66df00b Merge pull request Xilinx#281 from liyuanz/next
e861b73 Merge pull request Xilinx#283 from yuxiangz/cr_gui
3242569 add opts for vivado timing
56b80a3 turn gui off
3736af1 fix cr-1136890
593736c Merge remote-tracking branch 'xf_codec/next' into next
920328a Merge branch 'next' of https://gitenterprise.xilinx.com/siyangw/xf_codec into next
d741262 update mk
346140b Merge pull request Xilinx#279 from yuanqian/update_doc_next
99c323b update
027fc06 update
dfe3f08 update
5c1fa81 Merge pull request Xilinx#280 from liyuanz/next
252e3de update
34d3995 fix bug in description
7f2b6c2 update doc for portal
3cec66e Merge pull request Xilinx#278 from liyuanz/next
6be5245 fix bug in makefile
fa91918 update makefile
97b29b0 delete pikEnc/host/third_party/lcms/m4
aa87fb5 change 2022.1_stable_latest to 2022.2_stable_latest
84c4c7f add hls_pre.tcl for fixing CR

Co-authored-by: sdausr <sdausr@xilinx.com>
  • Loading branch information
2 people authored and GitHub Enterprise committed Sep 16, 2022
1 parent d031f49 commit d5529bc
Show file tree
Hide file tree
Showing 1,617 changed files with 600,149 additions and 462 deletions.
1 change: 0 additions & 1 deletion codec/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.log
*.yuv
*.jpg
_x_*
build_dir*
emconfig.json
Expand Down
5 changes: 2 additions & 3 deletions codec/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@Library('pipeline-library')_
VitisLibPipeline (branch: 'regression', libname: 'xf_codec', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
VitisLibPipeline (branch: 'next', libname: 'xf_codec', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu:vitis_hw_build',
upstream_dependencies: 'xf_utils_hw,next,../utils; xf_database,next,../database; xf_fintech,next,../quantitative_finance',
devtest: 'RunDeploy.sh', TOOLVERSION: '2022.1_stable_latest')

devtest: 'RunDeploy.sh', TOOLVERSION: '2022.2_stable_latest')
130 changes: 26 additions & 104 deletions codec/L1/README.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,26 @@
JPEG Decoder
============

Jpeg Decoder example resides in ``L2/demos/jpegDec`` directory. The tutorial provides a step-by-step guide that covers commands for building and running kernel.

Executable Usage
----------------

* **Work Directory(Step 1)**

The steps for library download and environment setup can be found in :ref:`l2_vitis_codec`. For getting the design,

```
cd L2/demos/jpegDec
```

* **Build kernel(Step 2)**

Run the following make command to build your XCLBIN and host binary targeting a specific device. Please be noticed that this process will take a long time, maybe couple of hours.

```
make run TARGET=hw DEVICE=xilinx_u250_xdma_201830_2
```

* **Run kernel(Step 3)**

To get the benchmark results, please run the following command.

```
./build_dir.hw.xilinx_u250_xdma_201830_2/host.exe -xclbin build_dir.hw.xilinx_u250_xdma_201830_2/jpegDecoder.xclbin -JPEGFile android.jpg
```

JPEG Decoder Input Arguments:

```
Usage: host.exe -[-xclbin -dataSetDir -refDir]
-xclbin: the kernel name
-JPEGFile: the path point to input *.jpg
```

Note: Default arguments are set in Makefile, you can use other :ref:`pictures` listed in the table.

* **Example output(Step 4)**

```
Found Platform
Platform Name: Xilinx
INFO: Found Device=xilinx_u250_xdma_201830_2
INFO: Importing build_dir.hw.xilinx_u250_xdma_201830_2/jpegDecoder.xclbin
Loading: 'build_dir.hw.xilinx_u250_xdma_201830_2/jpegDecoder.xclbin'
INFO: Kernel has been created
INFO: Finish kernel setup
...
INFO: Finish kernel execution
INFO: Finish E2E execution
INFO: Data transfer from host to device: 40 us
INFO: Data transfer from device to host: 6 us
INFO: Average kernel execution per run: 988 us
...
INFO: android.yuv will be generated from the jpeg decoder's output oINFO: android.yuv is generated correctly
INFO: android.yuv is generated correctly
```

Profiling
---------

The hardware resource utilizations are listed in the following table.
Different tool versions may result slightly different resource.

##### Table 1 IP resources for jpegDecoder with huffman decoder(L1 IP)

| IP | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
|-----------------------|----------|----------|----------|----------|---------|-----------------|
| huffman_decoder | 5 | 0 | 12 | 6963 | 7344 | 286 |

##### Table 2 IP resources for jpegDecoder with jfif parser and huffman decoder(L1 IP)

| IP | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
|-----------------------|----------|----------|----------|----------|---------|-----------------|
| kernel_parser_decoder | 5 | 0 | 12 | 7615 | 8382 | 257 |

##### Table 3 Hardware resources for jpegDecoder with jfif parser, huffman, iq and idct (L2 kernel)

| Kernel | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
|-----------------------|----------|----------|----------|----------|---------|-----------------|
| jpegDecoder | 7 | 0 | 39 | 12298 | 13417 | 257 |

Result
------

To check the output yuv file, download https://sourceforge.net/projects/raw-yuvplayer/ .
Then upload the rebuild_image.yuv, set the right sample radio and custom size on the software, and check the yuv file.

Table 1 : Jpeg Decoder profiling

![Table 1 : Jpeg Decoder profiling](../../../docs/images/jpegDecoderpofile.png)

##### Note
```
| 1. MAX_DEC_PIX is for benchmark. If testcase image is larger than 20M, the value of MAX_DEC_PIX should be enlarged following the size of image.
| 2. MAXCMP_BC is for benchmark. If testcase image is larger than 20M, the value of MAXCMP_BC should be enlarged following the size of image.
```
# Level 1: HLS Modules

The Level 1 APIs of Vitis Codec Library is presented as HLS C++ modules.

This level of API is mainly provided for hardware-savvy developers.
The API description and design details of these modules can be found
in _L1 Module User Guide_ section of the library document.

## License

Licensed using the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).

Copyright 2022 Xilinx, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright 2022 Xilinx, Inc.
28 changes: 28 additions & 0 deletions codec/L1/include/xlnx_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2019 Xilinx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef XLNX_CFG_H
#define XLNX_CFG_H

#define XLNX_DEBUG_DCT
#define XLNX_DEBUG_CMAP

#define XLNX_DISABLE_BLK_DICT
#define XLNX_DISABLE_RECT_DCT
#define XLNX_DISABLE_ARC
#define XLNX_DISABLE_2NDCMP

#endif
27 changes: 11 additions & 16 deletions codec/L1/meta/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,46 @@
"type": "const int"
},
{
"name": "img_info",
"name": null,
"direction": "",
"type": "xf::codec::img_info&"
"type": ""
},
{
"name": "hls_cmpnfo[MAX_NUM_COLOR]",
"name": null,
"direction": "",
"type": "xf::codec::hls_compInfo"
"type": "*pout"
},
{
"name": "block_strm",
"direction": "",
"type": "hls::stream<ap_uint<24> >&"
"type": "*pout"
},
{
"name": "rtn",
"direction": "",
"type": "int&"
"type": "*pout"
},
{
"name": "rtn2",
"direction": "",
"type": "bool&"
},
{
"name": "pout",
"direction": "",
"type": "xf::codec::decOutput*"
"type": "*pout"
}
]
}
},
{
"api_name": "xf::codec::top_order_tokenize",
"api_name": "top_order_tokenize",
"spec": {
"schema": "vitis_libraries_api_list_schema-1.0",
"api_name": "xf::codec::top_order_tokenize",
"api_name": "top_order_tokenize",
"display_name": "top_order_tokenize",
"brief": "JXL order_tokenize case",
"target_domain": "",
"header_file_name": [
"topOrderTokenize.hpp"
],
"search_paths": [
"/L1/include/"
"/L1/tests/jxlEnc/order_tokenize/kernel"
],
"instance": "function",
"parameters": [],
Expand Down Expand Up @@ -103,4 +98,4 @@
}
],
"target_domain": ""
}
}
1 change: 0 additions & 1 deletion codec/L1/src/XAcc_jfifparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ void decoder_jpg_top(ap_uint<AXI_WIDTH>* ptr,
* @param block_strm the stream of coefficients in block,23:is_rst, 22:is_endblock,21~16:bpos,15~0:block val
* @param rtn the flag of the jfif parser succeed
* @param rtn2 the flag of the decode succeed
* @param pout the decOutput
*/
void kernelParserDecoderTop(ap_uint<AXI_WIDTH>* datatoDDR,
const int size,
Expand Down
11 changes: 5 additions & 6 deletions codec/L1/src/XAcc_jpegdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,17 @@ void Huffman_decoder(
const int16_t dc_huff_start_addr[2][16],
//
const ap_uint<12> cyc_cmp,
// regs
#ifndef __SYNTHESIS__
// regs
//#ifndef __SYNTHESIS__
const uint8_t hls_cs_cmpc,
const uint16_t hls_mcuh,
#endif
//#endif
const uint8_t hls_mbs[MAX_NUM_COLOR],
const uint32_t hls_mcuc,

// output
bool& rtn2,
hls::stream<ap_uint<24> >& block_strm) {

#pragma HLS INLINE off

ap_uint<12> hls_cmp = cyc_cmp;
Expand Down Expand Up @@ -1133,8 +1132,8 @@ void top_mcu_decoder(

xf::codec::details::Huffman_decoder(huff_sos_strm, sign_no_huff, dht_tbl1, ac_val, ac_huff_start_code,
ac_huff_start_addr, dc_val, dc_huff_start_code, dc_huff_start_addr, hls_cmp,
#ifndef __SYNTHESIS__
//#ifndef __SYNTHESIS__
hls_cs_cmpc, hls_mcuh,
#endif
//#endif
hls_mbs, hls_mcuc, rtn2, block_strm);
}
22 changes: 11 additions & 11 deletions codec/L1/tests/jpegdec/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "Xilinx jpeg decoder HLS Test",
"description": "Xilinx jpeg decoder HLS Test",
"flow": "hls",
"platform_whitelist": [
"platform_allowlist": [
"u200"
],
"platform_blacklist": [],
"part_whitelist": [],
"part_blacklist": [],
"platform_blocklist": [],
"part_allowlist": [],
"part_blocklist": [],
"project": "test",
"solution": "solution1",
"clock": "2.5",
"clock": "3.33",
"topfunction": "kernel_parser_decoder",
"top": {
"source": [
Expand Down Expand Up @@ -41,17 +41,17 @@
"env": "",
"cmd": "",
"max_memory_MB": {
"hls_vivado_syn": 16384,
"vivado_syn": 16384,
"hls_csim": 16384,
"hls_cosim": 16384,
"hls_vivado_impl": 16384,
"vivado_impl": 16384,
"hls_csynth": 16384
},
"max_time_min": {
"hls_vivado_syn": 480,
"vivado_syn": 480,
"hls_csim": 120,
"hls_cosim": 480,
"hls_vivado_impl": 480,
"vivado_impl": 480,
"hls_csynth": 240
}
}
Expand All @@ -60,8 +60,8 @@
"hls_csim",
"hls_csynth",
"hls_cosim",
"hls_vivado_syn",
"hls_vivado_impl"
"vivado_syn",
"vivado_impl"
],
"category": "canary"
}
Expand Down
7 changes: 4 additions & 3 deletions codec/L1/tests/jpegdec/run_hls.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ set PROJ "test.prj"
set SOLN "solution1"

if {![info exists CLKP]} {
set CLKP 2.5
set CLKP 3.33
}

open_project -reset $PROJ

add_files "test_decoder.cpp ${XF_PROJ_ROOT}/L1/src/XAcc_jfifparser.cpp ${XF_PROJ_ROOT}/L1/src/XAcc_jpegdecoder.cpp" -cflags "-I${XF_PROJ_ROOT}/L1/include -std=c++0x"
add_files "test_decoder.cpp ${XF_PROJ_ROOT}/L1/src/XAcc_jfifparser.cpp ${XF_PROJ_ROOT}/L1/src/XAcc_jpegdecoder.cpp" -cflags "-I${XF_PROJ_ROOT}/L1/include -std=c++0x -g -O0"
add_files -tb "test_decoder.cpp" -cflags "-I${XF_PROJ_ROOT}/L1/include -std=c++0x"
set_top kernel_parser_decoder
#set_top Huffman_decoder

open_solution -reset $SOLN

Expand Down Expand Up @@ -57,4 +58,4 @@ if {$VIVADO_IMPL == 1} {
export_design -flow impl -rtl verilog
}

exit
exit
3 changes: 2 additions & 1 deletion codec/L1/tests/jpegdec/test_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int main(int argc, const char* argv[]) {
printf("Warning: [code 3] huffman data is not in expectation!\n");
}
}
printf("Info: Ready to decode next input file!\n");
return 1;
}

xf::codec::details::hls_next_mcupos2(block_strm, hls_block, hls_sfv, hls_sfh, hls_mbs, hls_bch[0], hls_bc[0],
Expand Down Expand Up @@ -214,6 +214,7 @@ int main(int argc, const char* argv[]) {
free(hls_block);

std::cout << "Ready for next image!\n ";
return 0;
}
#endif

Expand Down
Loading

0 comments on commit d5529bc

Please sign in to comment.