mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-19 18:35:07 +03:00
apps: common: dng_writer: Fix thumbnail generation on BE machines
The 16-bit padded raw 10 and raw 12 formats are stored in memory in little endian order, regardless of the machine's endianness. Swap the 16-bit values on big-endian machines when reading pixels from memory to generate thumbnails. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
parent
7e3a351a29
commit
7735d65ce8
1 changed files with 3 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "dng_writer.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <endian.h>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
|
@ -185,7 +186,8 @@ void thumbScanlineRaw(const FormatInfo &info, void *output, const void *input,
|
|||
|
||||
/* Simple averaging that produces greyscale RGB values. */
|
||||
for (unsigned int x = 0; x < width; x++) {
|
||||
uint16_t value = (in[0] + in[1] + in2[0] + in2[1]) >> 2;
|
||||
uint16_t value = (le16toh(in[0]) + le16toh(in[1]) +
|
||||
le16toh(in2[0]) + le16toh(in2[1])) >> 2;
|
||||
value = value >> shift;
|
||||
*out++ = value;
|
||||
*out++ = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue