This repository provides a sample implementation for converting YCbCr data to RGB using the CSC controller with the AVC hardware module hosted on the Media Engine.
Unlike VME-based approaches, the Media Engine's AVC hardware module handles color space conversion differently by processing:
- A Y plane (luminance)
- A packed CbCr plane (chrominance)
The AVC hardware module requires YCbCr data to be organized in a specific band-based format:
- 16-pixel-wide vertical bands: Data must be chunked into these narrow vertical strips
- Alternating pattern: Within 32-pixel-wide blocks, bands alternate between left and right halves
- First 16 pixels go to the left half
- Next 16 pixels go to the right half
- Pattern continues across the image width
- Hardware-specific layout: Preprocessing required using the included Python conversion script
- Image dimensions:
- For RGB565 output: width & height must be multiples of 32
- For ARGB8888 output: width & height must be multiples of 64
- Band width requirement: width must be a multiple of 16
Example for a 960×960 image (maximum supported by the hardware in this configuration):
- Generate NV12 data:
.\ffmpeg.exe -i csc960x960.png -vf "scale=960:960,format=nv12" -f rawvideo -pix_fmt nv12 nv12_full.bin -y
- Convert for hardware use:
python ./n12ToHw.py nv12_full.bin 960 960 --max_chunk_height 480
make clean && make
Use arrow keys to move the canvas.
- The PSP homebrew community, for being an invaluable source of knowledge.
- All developers and contributors who have supported and continue to support the scene.
m-c/d