James Almer: > On 2/20/2021 1:37 PM, Paul B Mahol wrote: >> Signed-off-by: Paul B Mahol <one...@gmail.com> >> --- >> libavcodec/dpxenc.c | 21 ++++++++++++++++++--- >> tests/ref/lavf/gbrp10le.dpx | 4 ++-- >> tests/ref/lavf/gbrp12le.dpx | 4 ++-- >> tests/ref/lavf/rgb48le.dpx | 4 ++-- >> tests/ref/lavf/rgb48le_10.dpx | 4 ++-- >> tests/ref/lavf/rgba64le.dpx | 4 ++-- >> 6 files changed, 28 insertions(+), 13 deletions(-) >> >> diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c >> index a5960334d5..b296f9f22e 100644 >> --- a/libavcodec/dpxenc.c >> +++ b/libavcodec/dpxenc.c >> @@ -173,14 +173,25 @@ static void encode_gbrp12(AVCodecContext *avctx, >> const AVFrame *pic, uint16_t *d >> } >> } >> +#define FILE_HEADER_SIZE 768 >> +#define IMAGE_HEADER_SIZE 640 >> +#define ORIENTATION_HEADER_SIZE 256 >> +#define FILM_INFO_HEADER_SIZE 256 >> +#define TV_INFO_HEADER_SIZE 128 >> +#define HEADER_SIZE (FILE_HEADER_SIZE + \ >> + IMAGE_HEADER_SIZE + \ >> + ORIENTATION_HEADER_SIZE + \ >> + FILM_INFO_HEADER_SIZE + \ >> + TV_INFO_HEADER_SIZE) >> + >> static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, >> const AVFrame *frame, int *got_packet) >> { >> DPXContext *s = avctx->priv_data; >> - int size, ret, need_align, len; >> + int ret, need_align, len; >> + int64_t size; >> uint8_t *buf; >> -#define HEADER_SIZE 1664 /* DPX Generic header */ >> if (s->bits_per_component == 10) >> size = avctx->height * avctx->width * 4; >> else if (s->bits_per_component == 12) { >> @@ -196,7 +207,7 @@ static int encode_frame(AVCodecContext *avctx, >> AVPacket *pkt, >> need_align = size - len; >> size *= avctx->height; >> } >> - if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE, 0)) < 0) >> + if ((ret = ff_alloc_packet2(avctx, pkt, HEADER_SIZE + size, 0)) < 0) > > This looks like pointless change. But you could while at it set min_size > to the same value as size. > >> return ret; >> buf = pkt->data; >> @@ -229,6 +240,10 @@ static int encode_frame(AVCodecContext *avctx, >> AVPacket *pkt, >> write32(buf + 1628, avctx->sample_aspect_ratio.num); >> write32(buf + 1632, avctx->sample_aspect_ratio.den); >> + /* Film information header */ >> + if (avctx->framerate.num && avctx->framerate.den) >> + write32(buf + 1724, av_float2int(av_q2d(avctx->framerate))); >> + >> switch(s->bits_per_component) { >> case 8: >> case 16: >> diff --git a/tests/ref/lavf/gbrp10le.dpx b/tests/ref/lavf/gbrp10le.dpx >> index b33da34e20..7c03dc0779 100644 >> --- a/tests/ref/lavf/gbrp10le.dpx >> +++ b/tests/ref/lavf/gbrp10le.dpx >> @@ -1,3 +1,3 @@ >> -7ca935d5d5e00c54acbc85565d3039b6 >> *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx >> +c7c8ecd9d8c8a2c4dce6d92bfb9877d7 >> *tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx >> tests/data/images/gbrp10le.dpx/%02d.gbrp10le.dpx CRC=0xe6663fba >> -407168 tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx >> +407552 tests/data/images/gbrp10le.dpx/02.gbrp10le.dpx > > Nearly 400 more bytes to write a 4 byte long frame rate field? >
That's because HEADER_SIZE has been increased from 1664 to 2048. Don't know if it's necessary. >> diff --git a/tests/ref/lavf/gbrp12le.dpx b/tests/ref/lavf/gbrp12le.dpx >> index e2e794ecc6..5ca855b004 100644 >> --- a/tests/ref/lavf/gbrp12le.dpx >> +++ b/tests/ref/lavf/gbrp12le.dpx >> @@ -1,3 +1,3 @@ >> -a4cfea1797c928f2eff73573e559675d >> *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx >> +79dcf3b32ed8e627a68bba19bf625ca5 >> *tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx >> tests/data/images/gbrp12le.dpx/%02d.gbrp12le.dpx CRC=0x1c755633 >> -609920 tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx >> +610304 tests/data/images/gbrp12le.dpx/02.gbrp12le.dpx >> diff --git a/tests/ref/lavf/rgb48le.dpx b/tests/ref/lavf/rgb48le.dpx >> index 073153898a..33817d95a9 100644 >> --- a/tests/ref/lavf/rgb48le.dpx >> +++ b/tests/ref/lavf/rgb48le.dpx >> @@ -1,3 +1,3 @@ >> -075963c3c08978b6a20555ba09161434 >> *tests/data/images/rgb48le.dpx/02.rgb48le.dpx >> +51c703863c9df1db5ef78a77dd5fbd0f >> *tests/data/images/rgb48le.dpx/02.rgb48le.dpx >> tests/data/images/rgb48le.dpx/%02d.rgb48le.dpx CRC=0xe5b9c023 >> -609920 tests/data/images/rgb48le.dpx/02.rgb48le.dpx >> +610304 tests/data/images/rgb48le.dpx/02.rgb48le.dpx >> diff --git a/tests/ref/lavf/rgb48le_10.dpx >> b/tests/ref/lavf/rgb48le_10.dpx >> index ce36e5079f..3c934168b7 100644 >> --- a/tests/ref/lavf/rgb48le_10.dpx >> +++ b/tests/ref/lavf/rgb48le_10.dpx >> @@ -1,3 +1,3 @@ >> -b9f22728f8ff393bf30cf6cbd624fa95 >> *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx >> +a0ca7132c33a5c0eb25dd4a2b6117743 >> *tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx >> tests/data/images/rgb48le_10.dpx/%02d.rgb48le_10.dpx CRC=0xf38d5830 >> -407168 tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx >> +407552 tests/data/images/rgb48le_10.dpx/02.rgb48le_10.dpx >> diff --git a/tests/ref/lavf/rgba64le.dpx b/tests/ref/lavf/rgba64le.dpx >> index b4092c9fd8..85974bbc98 100644 >> --- a/tests/ref/lavf/rgba64le.dpx >> +++ b/tests/ref/lavf/rgba64le.dpx >> @@ -1,3 +1,3 @@ >> -545603630f30dec2768c8ae8d12eb8ea >> *tests/data/images/rgba64le.dpx/02.rgba64le.dpx >> +cb5fe2ad9c1119a33916a838cb586c45 >> *tests/data/images/rgba64le.dpx/02.rgba64le.dpx >> tests/data/images/rgba64le.dpx/%02d.rgba64le.dpx CRC=0xe72ce131 >> -812672 tests/data/images/rgba64le.dpx/02.rgba64le.dpx >> +813056 tests/data/images/rgba64le.dpx/02.rgba64le.dpx >> > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".