x86-64 SSSE3 expansion of the camera's own YUYV image into JPEG Y/Cb/Cr scanlines. More...

Go to the source code of this file.
Functions | |
| unsigned | lwir_sensor_ssse3 (const uint8_t *frame, ptrdiff_t first, ptrdiff_t step, unsigned width, uint8_t *output) |
| Expand eight YUYV pixels per iteration into interleaved Y/Cb/Cr, forwards or reversed. | |
Detailed Description
x86-64 SSSE3 expansion of the camera's own YUYV image into JPEG Y/Cb/Cr scanlines.
This is the only translation unit built with -mssse3 (see build-support/make/lwircam.mk), so the rest of LWIRcam stays baseline x86-64. lwir_render.c calls it from sensor_row() only after a cached CPUID check and only for horizontal (+1/-1 stride) display rows of at least eight pixels; transposed rows, the remainder tail and CPUs without SSSE3 use the scalar loop, which produces the same bytes. No camera bytes are modified and no allocation is made.
Input layout: packed YUYV, four bytes per pixel pair Y0 U Y1 V, so the two pixels of a pair share one Cb (U) and one Cr (V). Output layout: three bytes per pixel Y Cb Cr, ready for a libjpeg YCbCr scanline without an RGB round trip.
Definition in file lwir_ssse3.c.
Function Documentation
◆ lwir_sensor_ssse3()
| unsigned lwir_sensor_ssse3 | ( | const uint8_t * | frame, |
| ptrdiff_t | first, | ||
| ptrdiff_t | step, | ||
| unsigned | width, | ||
| uint8_t * | output ) |
Expand eight YUYV pixels per iteration into interleaved Y/Cb/Cr, forwards or reversed.
One unaligned 16-byte load holds exactly four YUYV pairs (pixels 0..7 in memory). Two PSHUFB masks scatter those bytes into the 24 output bytes: the low mask fills output bytes 0..15 (five whole pixels plus the sixth pixel's Y) and the high mask fills bytes 16..23 (the sixth pixel's Cb/Cr and the last two pixels); -128 lanes are zeroed by PSHUFB and fall outside the 8-byte store.
Forward (step > 0) masks follow memory order: pixel p takes Y at byte 2p and the pair's U/V at bytes (p/2)*4+1 and (p/2)*4+3. Reversed (step < 0) rows load the block that ENDS at the current pixel (pixel - 7) and the masks list memory pixels 7..0, so mirroring costs no extra instruction.
- Parameters
-
frame Image plane start (combined frame or image-only YUYV buffer). first Native pixel index of display column 0, from row_source(). step Native pixel stride per display column; must be +1 or -1. width Display row width in pixels. output Destination row with room for at least width * 3 bytes.
- Returns
- Number of leading display columns written, a multiple of 8 (<= width); the caller completes the remainder with the scalar path.
- Warning
- Requires SSSE3; callers must check CPU support first. Reversed rows rely on pixel - 7 being even (even native width puts the row's last pixel at an odd index), so each load starts on an intact YUYV pair; arbitrary first values would split pairs.
Definition at line 58 of file lwir_ssse3.c.