~martijnbraam/public-inbox

Megapixels: TIFF: Use correct subpixel order v1 PROPOSED

Dorota Czaplejewicz
Dorota Czaplejewicz: 1
 TIFF: Use correct subpixel order

 1 files changed, 29 insertions(+), 2 deletions(-)
#497734 alpine.yml success
#497735 arch.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~martijnbraam/public-inbox/patches/22397/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH Megapixels] TIFF: Use correct subpixel order Export this patch

Dorota Czaplejewicz
Except for YUV modes, which don't seem to be supported in the TIFF tag.
---
 process_pipeline.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/process_pipeline.c b/process_pipeline.c
index d18a86b..ab47790 100644
--- a/process_pipeline.c
+++ b/process_pipeline.c
@@ -43,6 +43,31 @@ static int exposure;

static char capture_fname[255];

static const char *pixel_format_names[MP_PIXEL_FMT_MAX] = {
    "\002\001\001\000", // fallback
    "\002\001\001\000",//    "BGGR8",
    "\001\002\000\001",//    "GBRG8",
    "\001\000\002\001",//    "GRBG8",
    "\000\001\001\002",//    "RGGB8",
    "\002\001\001\000",//    "BGGR10P",
    "\001\002\000\001",//    "GBRG10P",
    "\001\000\002\001",//    "GRBG10P",
    "\000\001\001\002",//    "RGGB10P",
    "\002\001\001\000",//    "BGGR10",
    "\001\002\000\001",//    "GBRG10",
    "\001\000\002\001",//    "GRBG10",
    "\000\001\001\002",//    "RGGB10",
    "UYVY",//    does not apply
    "YUYV",//    does not apply
};

static const char *
mp_pixel_format_to_cfa_pattern(uint32_t pixel_format)
{
    g_return_val_if_fail(pixel_format < MP_PIXEL_FMT_MAX, "\002\001\001\000");
    return pixel_format_names[pixel_format];
}

static void
register_custom_tiff_tags(TIFF *tif)
{
@@ -248,10 +273,12 @@ process_image_for_capture(const MPImage *image, int count)
	TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
	static const short cfapatterndim[] = { 2, 2 };
	TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, cfapatterndim);

    const char *cfa_pattern = mp_pixel_format_to_cfa_pattern(image->pixel_format);
#if (TIFFLIB_VERSION < 20201219) && !LIBTIFF_CFA_PATTERN
	TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\002\001\001\000"); // BGGR
    TIFFSetField(tif, TIFFTAG_CFAPATTERN, cfa_pattern);
#else
	TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, "\002\001\001\000"); // BGGR
    TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, cfa_pattern);
#endif
	printf("TIFF version %d\n", TIFFLIB_VERSION);
	if (camera->whitelevel) {
-- 
2.26.3
builds.sr.ht
megapixels/patches: SUCCESS in 52s

[TIFF: Use correct subpixel order][0] from [Dorota Czaplejewicz][1]

[0]: https://lists.sr.ht/~martijnbraam/public-inbox/patches/22397
[1]: mailto:dorota.czaplejewicz@puri.sm

✓ #497734 SUCCESS megapixels/patches/alpine.yml https://builds.sr.ht/~martijnbraam/job/497734
✓ #497735 SUCCESS megapixels/patches/arch.yml   https://builds.sr.ht/~martijnbraam/job/497735