From 9537d91e8f1e389e7c957d3ca62d35f27453d347 Mon Sep 17 00:00:00 2001 From: Max Rudolph Date: Tue, 6 May 2025 14:52:30 +0200 Subject: [PATCH] avformat/cinedec: add support for additional Bayer CFA patterns for Phantom CINE file format Signed-off-by: Michael Niedermayer --- libavformat/cinedec.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c index e0bcca4ce5..cd13f132c3 100644 --- a/libavformat/cinedec.c +++ b/libavformat/cinedec.c @@ -52,6 +52,8 @@ enum { CFA_VRIV6 = 2, /**< BGGR/GRBG */ CFA_BAYER = 3, /**< GB/RG */ CFA_BAYERFLIP = 4, /**< RG/GB */ + CFA_BAYERFLIPB = 5, /**< GR/BG */ + CFA_BAYERFLIPH = 6, /**< BG/GR */ }; #define CFA_TLGRAY 0x80000000U @@ -237,6 +239,26 @@ static int cine_read_header(AVFormatContext *avctx) return AVERROR_INVALIDDATA; } break; + case CFA_BAYERFLIPB: + if (biBitCount == 8) { + st->codecpar->format = AV_PIX_FMT_BAYER_GRBG8; + } else if (biBitCount == 16) { + st->codecpar->format = AV_PIX_FMT_BAYER_GRBG16LE; + } else { + avpriv_request_sample(avctx, "unsupported biBitCount %i", biBitCount); + return AVERROR_INVALIDDATA; + } + break; + case CFA_BAYERFLIPH: + if (biBitCount == 8) { + st->codecpar->format = AV_PIX_FMT_BAYER_BGGR8; + } else if (biBitCount == 16) { + st->codecpar->format = AV_PIX_FMT_BAYER_BGGR16LE; + } else { + avpriv_request_sample(avctx, "unsupported biBitCount %i", biBitCount); + return AVERROR_INVALIDDATA; + } + break; default: avpriv_request_sample(avctx, "unsupported Color Field Array (CFA) %i", CFA & 0xFFFFFF); return AVERROR_INVALIDDATA;