This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit f8b7f0584422d25c3316783a61bcd94e5d1c54ea Author: Lynne <[email protected]> AuthorDate: Thu May 14 22:50:36 2026 +0900 Commit: Lynne <[email protected]> CommitDate: Sun May 17 12:02:52 2026 +0900 prores_raw: parse the linearization curve from the bitstream After an extended Ghidra session, it turns out that the camera/recorder bakes a custom curve that *has* to be applied. It contains both the camera's inverse transfer curve, plus whatever else the camera applied. It could (and does) contain quantization refinements. And its used to switch between low and high quality encoding by boosting coeffs (thus acting as an additional dequant curve). --- libavcodec/prores_raw.c | 11 +++++++++-- libavcodec/prores_raw.h | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libavcodec/prores_raw.c b/libavcodec/prores_raw.c index 375a4f2c99..f4a1bd03ad 100644 --- a/libavcodec/prores_raw.c +++ b/libavcodec/prores_raw.c @@ -420,8 +420,15 @@ static int decode_frame(AVCodecContext *avctx, bytestream2_get_buffer(&gb_hdr, qmat, 64); if ((flags >> 4) & 1) { - bytestream2_skip(&gb_hdr, 2); - bytestream2_skip(&gb_hdr, 2 * 7); + /* 8-poing 16-bit control points, defining the combined linearization + * curve (inv. transfer fn + encoder-defined shaping) */ + for (int i = 0; i < 8; i++) + s->lin_curve[i] = bytestream2_get_be16(&gb_hdr); + } else { + /* default curve: ptwos */ + static const uint16_t default_lin_curve[8] = + { 0, 512, 1024, 2048, 4096, 8192, 16384, 32768 }; + memcpy(s->lin_curve, default_lin_curve, sizeof(s->lin_curve)); } ff_permute_scantable(s->qmat, s->prodsp.idct_permutation, qmat); diff --git a/libavcodec/prores_raw.h b/libavcodec/prores_raw.h index 23b55661e4..1e7fee435e 100644 --- a/libavcodec/prores_raw.h +++ b/libavcodec/prores_raw.h @@ -54,6 +54,11 @@ typedef struct ProResRAWContext { DECLARE_ALIGNED(32, uint8_t, scan)[64]; DECLARE_ALIGNED(32, uint8_t, qmat)[64]; + + /* 8-point combined linearization curve + * (inv. transfer fn + encoder-defined shaping) from the frame header, + * applied after iDCT */ + uint16_t lin_curve[8]; } ProResRAWContext; extern const uint8_t ff_prores_raw_dc_cb[13]; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
