This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0def4ceb18c70180283df58bf38fa5685ef0cc9e Author: Lynne <[email protected]> AuthorDate: Sat May 16 17:40:35 2026 +0900 Commit: Lynne <[email protected]> CommitDate: Wed Jun 10 02:38:35 2026 +0900 prores_raw: export raw camera color data values --- libavcodec/prores_raw.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/libavcodec/prores_raw.c b/libavcodec/prores_raw.c index db6bfcd6eb..4ebf9add45 100644 --- a/libavcodec/prores_raw.c +++ b/libavcodec/prores_raw.c @@ -21,9 +21,12 @@ */ #include "libavutil/avassert.h" +#include "libavutil/intfloat.h" #include "libavutil/intreadwrite.h" #include "libavutil/mem_internal.h" #include "libavutil/mem.h" +#include "libavutil/raw_color_params.h" +#include "libavutil/rational.h" #define CACHED_BITSTREAM_READER !ARCH_X86_32 @@ -417,12 +420,22 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } - bytestream2_skip(&gb_hdr, 2); /* senselValueRange (white_level = value + 0x100, black_level = 0x100) */ - bytestream2_skip(&gb_hdr, 4); /* WhiteBalanceRedFactor (float, pre-debayer R gain) */ - bytestream2_skip(&gb_hdr, 4); /* WhiteBalanceBlueFactor (float, pre-debayer B gain) */ - bytestream2_skip(&gb_hdr, 4 * 3 * 3); /* ColorMatrix (3x3 float, camera RGB -> Rec.2020 linear, row-major) */ - bytestream2_skip(&gb_hdr, 4); /* GainFactor (float, post-matrix scene-linear scale) */ - bytestream2_skip(&gb_hdr, 2); /* WhiteBalanceCCT (Kelvin, informational) */ + /* senselValueRange: black_level is hardcoded to 0x100, + * white_level = senselValueRange + 0x100 */ + uint16_t black_level = 0x100; + uint16_t white_level = bytestream2_get_be16(&gb_hdr) + 0x100; + + float wb_red = av_int2float(bytestream2_get_be32(&gb_hdr)); /* WhiteBalanceRedFactor */ + float wb_blue = av_int2float(bytestream2_get_be32(&gb_hdr)); /* WhiteBalanceBlueFactor */ + + /* ColorMatrix (3x3 float, camera RGB -> CIE 1931 XYZ D65, row-major) */ + float color_matrix[3][3]; + for (int r = 0; r < 3; r++) + for (int c = 0; c < 3; c++) + color_matrix[r][c] = av_int2float(bytestream2_get_be32(&gb_hdr)); + + float gain = av_int2float(bytestream2_get_be32(&gb_hdr)); /* GainFactor (post-matrix mult) */ + uint16_t wb_cct = bytestream2_get_be16(&gb_hdr); /* WhiteBalanceCCT (Kelvin, informational) */ /* Flags */ int flags = bytestream2_get_be16(&gb_hdr); @@ -537,6 +550,22 @@ static int decode_frame(AVCodecContext *avctx, frame->pict_type = AV_PICTURE_TYPE_I; frame->flags |= AV_FRAME_FLAG_KEY; + AVRawColorParams *rcp = av_raw_color_params_create_side_data(frame); + if (!rcp) + return AVERROR(ENOMEM); + rcp->type = AV_RAW_COLOR_PARAMS_PRORES_RAW; + rcp->black_level = av_make_q(black_level, 65535); + rcp->white_level = av_make_q(white_level, 65535); + rcp->wb_cct = wb_cct; + + AVProResRawColorParams *pr = &rcp->codec.prores_raw; + pr->wb_red = av_d2q(wb_red, INT_MAX); + pr->wb_blue = av_d2q(wb_blue, INT_MAX); + pr->gain = av_d2q(gain, INT_MAX); + for (int r = 0; r < 3; r++) + for (int c = 0; c < 3; c++) + pr->color_matrix[r][c] = av_d2q(color_matrix[r][c], INT_MAX); + *got_frame_ptr = 1; return avpkt->size; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
