Merge branch 'metadata' into 'master'
Metadata fixes See merge request postmarketOS/megapixels!1
This commit is contained in:
22
src/camera.c
22
src/camera.c
@@ -122,6 +122,28 @@ mp_pixel_format_bits_per_pixel(MPPixelFormat pixel_format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
mp_pixel_format_pixel_depth(MPPixelFormat pixel_format)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail(pixel_format < MP_PIXEL_FMT_MAX, 0);
|
||||||
|
switch (pixel_format) {
|
||||||
|
case MP_PIXEL_FMT_BGGR8:
|
||||||
|
case MP_PIXEL_FMT_GBRG8:
|
||||||
|
case MP_PIXEL_FMT_GRBG8:
|
||||||
|
case MP_PIXEL_FMT_RGGB8:
|
||||||
|
case MP_PIXEL_FMT_UYVY:
|
||||||
|
case MP_PIXEL_FMT_YUYV:
|
||||||
|
return 8;
|
||||||
|
case MP_PIXEL_FMT_GBRG10P:
|
||||||
|
case MP_PIXEL_FMT_GRBG10P:
|
||||||
|
case MP_PIXEL_FMT_RGGB10P:
|
||||||
|
case MP_PIXEL_FMT_BGGR10P:
|
||||||
|
return 10;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
mp_pixel_format_width_to_bytes(MPPixelFormat pixel_format, uint32_t width)
|
mp_pixel_format_width_to_bytes(MPPixelFormat pixel_format, uint32_t width)
|
||||||
{
|
{
|
||||||
|
@@ -30,6 +30,7 @@ uint32_t mp_pixel_format_to_v4l_pixel_format(MPPixelFormat pixel_format);
|
|||||||
uint32_t mp_pixel_format_to_v4l_bus_code(MPPixelFormat pixel_format);
|
uint32_t mp_pixel_format_to_v4l_bus_code(MPPixelFormat pixel_format);
|
||||||
|
|
||||||
uint32_t mp_pixel_format_bits_per_pixel(MPPixelFormat pixel_format);
|
uint32_t mp_pixel_format_bits_per_pixel(MPPixelFormat pixel_format);
|
||||||
|
uint32_t mp_pixel_format_pixel_depth(MPPixelFormat pixel_format);
|
||||||
uint32_t mp_pixel_format_width_to_bytes(MPPixelFormat pixel_format, uint32_t width);
|
uint32_t mp_pixel_format_width_to_bytes(MPPixelFormat pixel_format, uint32_t width);
|
||||||
uint32_t mp_pixel_format_width_to_colors(MPPixelFormat pixel_format, uint32_t width);
|
uint32_t mp_pixel_format_width_to_colors(MPPixelFormat pixel_format, uint32_t width);
|
||||||
uint32_t mp_pixel_format_height_to_colors(MPPixelFormat pixel_format,
|
uint32_t mp_pixel_format_height_to_colors(MPPixelFormat pixel_format,
|
||||||
|
@@ -427,9 +427,11 @@ process_image_for_capture(const uint8_t *image, int count)
|
|||||||
TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, "\002\001\001\000"); // BGGR
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, "\002\001\001\000"); // BGGR
|
||||||
#endif
|
#endif
|
||||||
printf("TIFF version %d\n", TIFFLIB_VERSION);
|
printf("TIFF version %d\n", TIFFLIB_VERSION);
|
||||||
if (camera->whitelevel) {
|
int whitelevel = camera->whitelevel;
|
||||||
TIFFSetField(tif, TIFFTAG_WHITELEVEL, 1, &camera->whitelevel);
|
if (!whitelevel) {
|
||||||
|
whitelevel = (1 << mp_pixel_format_pixel_depth(mode.pixel_format)) - 1;
|
||||||
}
|
}
|
||||||
|
TIFFSetField(tif, TIFFTAG_WHITELEVEL, 1, &whitelevel);
|
||||||
if (camera->blacklevel) {
|
if (camera->blacklevel) {
|
||||||
const float blacklevel = camera->blacklevel;
|
const float blacklevel = camera->blacklevel;
|
||||||
TIFFSetField(tif, TIFFTAG_BLACKLEVEL, 1, &blacklevel);
|
TIFFSetField(tif, TIFFTAG_BLACKLEVEL, 1, &blacklevel);
|
||||||
@@ -455,10 +457,11 @@ process_image_for_capture(const uint8_t *image, int count)
|
|||||||
(mode.frame_interval.numerator /
|
(mode.frame_interval.numerator /
|
||||||
(float)mode.frame_interval.denominator) /
|
(float)mode.frame_interval.denominator) /
|
||||||
((float)mode.height / (float)exposure));
|
((float)mode.height / (float)exposure));
|
||||||
uint16_t isospeed[1];
|
if (camera->iso_min && camera->iso_max) {
|
||||||
isospeed[0] = (uint16_t)remap(gain - 1, 0, gain_max, camera->iso_min,
|
uint16_t isospeed = remap(gain - 1, 0, gain_max, camera->iso_min,
|
||||||
camera->iso_max);
|
camera->iso_max);
|
||||||
TIFFSetField(tif, EXIFTAG_ISOSPEEDRATINGS, 1, isospeed);
|
TIFFSetField(tif, EXIFTAG_ISOSPEEDRATINGS, 1, &isospeed);
|
||||||
|
}
|
||||||
TIFFSetField(tif, EXIFTAG_FLASH, 0);
|
TIFFSetField(tif, EXIFTAG_FLASH, 0);
|
||||||
|
|
||||||
TIFFSetField(tif, EXIFTAG_DATETIMEORIGINAL, datetime);
|
TIFFSetField(tif, EXIFTAG_DATETIMEORIGINAL, datetime);
|
||||||
|
Reference in New Issue
Block a user