[FFmpeg-devel] [PATCH 1/4] lav/dnxhd: better support 4:2:0 in DNXHR profiles

2021-01-30 Thread Christophe Gisquet
From: Christophe Gisquet 

Where they are allowed. No validation of profile + colorformat is performed,
however.
---
 libavcodec/dnxhddec.c | 55 +++
 1 file changed, 40 insertions(+), 15 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index c78d55aee5..359588f963 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -49,6 +49,13 @@ typedef struct RowContext {
 int format;
 } RowContext;
 
+typedef enum {
+DNX_CHROMAFORMAT_422 = 0,
+DNX_CHROMAFORMAT_420 = 1,
+DNX_CHROMAFORMAT_444 = 2,
+DNX_CHROMAFORMAT_UNKNOWN = 3,
+} DNXChromaFormat;
+
 typedef struct DNXHDContext {
 AVCodecContext *avctx;
 RowContext *rows;
@@ -67,7 +74,7 @@ typedef struct DNXHDContext {
 ScanTable scantable;
 const CIDEntry *cid_table;
 int bit_depth; // 8, 10, 12 or 0 if not initialized at all.
-int is_444;
+int chromafmt;
 int alpha;
 int lla;
 int mbaff;
@@ -168,6 +175,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
const uint8_t *buf, int buf_size,
int first_field)
 {
+static const char* cfname[4] = { "4:2:2", "4:2:0", "4:4:4", "Unknown" };
 int i, cid, ret;
 int old_bit_depth = ctx->bit_depth, bitdepth;
 uint64_t header_prefix;
@@ -234,8 +242,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 av_log(ctx->avctx, AV_LOG_WARNING,
"Adaptive color transform in an unsupported profile.\n");
 
-ctx->is_444 = (buf[0x2C] >> 6) & 1;
-if (ctx->is_444) {
+ctx->chromafmt = (buf[0x2C] >> 5) & 3;
+if (ctx->chromafmt == DNX_CHROMAFORMAT_444) {
 if (bitdepth == 8) {
 avpriv_request_sample(ctx->avctx, "4:4:4 8 bits");
 return AVERROR_INVALIDDATA;
@@ -250,16 +258,16 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 }
 } else if (bitdepth == 12) {
 ctx->decode_dct_block = dnxhd_decode_dct_block_12;
-ctx->pix_fmt = AV_PIX_FMT_YUV422P12;
+ctx->pix_fmt = ctx->chromafmt == DNX_CHROMAFORMAT_420 ? 
AV_PIX_FMT_YUV420P12 : AV_PIX_FMT_YUV422P12;
 } else if (bitdepth == 10) {
 if (ctx->avctx->profile == FF_PROFILE_DNXHR_HQX)
 ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
 else
 ctx->decode_dct_block = dnxhd_decode_dct_block_10;
-ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+ctx->pix_fmt = ctx->chromafmt == DNX_CHROMAFORMAT_420 ? 
AV_PIX_FMT_YUV420P10 : AV_PIX_FMT_YUV422P10;
 } else {
 ctx->decode_dct_block = dnxhd_decode_dct_block_8;
-ctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ctx->pix_fmt = ctx->chromafmt == DNX_CHROMAFORMAT_420 ? 
AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV422P;
 }
 
 ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;
@@ -292,8 +300,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)
 ctx->height <<= 1;
 
-av_log(ctx->avctx, AV_LOG_VERBOSE, "%dx%d, 4:%s %d bits, MBAFF=%d 
ACT=%d\n",
-   ctx->width, ctx->height, ctx->is_444 ? "4:4" : "2:2",
+av_log(ctx->avctx, AV_LOG_VERBOSE, "%dx%d, %s %d bits, MBAFF=%d ACT=%d\n",
+   ctx->width, ctx->height, cfname[ctx->chromafmt],
ctx->bit_depth, ctx->mbaff, ctx->act);
 
 // Newer format supports variable mb_scan_index sizes
@@ -360,7 +368,7 @@ static av_always_inline int dnxhd_decode_dct_block(const 
DNXHDContext *ctx,
 
 ctx->bdsp.clear_block(block);
 
-if (!ctx->is_444) {
+if (ctx->chromafmt != DNX_CHROMAFORMAT_444) {
 if (n & 2) {
 component = 1 + (n & 1);
 scale = row->chroma_scale;
@@ -478,6 +486,9 @@ static int dnxhd_decode_dct_block_12_444(const DNXHDContext 
*ctx,
 static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
AVFrame *frame, int x, int y)
 {
+static const char yoff[4] = { 1, 0, 1, 0 };
+static const char xoff[4] = { 0, 0, 1, 0 };
+static const uint8_t num_blocks[4] = { 8, 6, 12, 0 };
 int shift1 = ctx->bit_depth >= 10;
 int dct_linesize_luma   = frame->linesize[0];
 int dct_linesize_chroma = frame->linesize[1];
@@ -516,7 +527,7 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, 
RowContext *row,
 row->last_qscale = qscale;
 }
 
-for (i = 0; i < 8 + 4 * ctx->is_444; i++) {
+for (i = 0; i < num_blocks[ctx->chromafmt]; i++) {
 if (ctx->decode_dct_block(ctx, row, i) < 0)
 return AVERROR_INVALIDDATA;
 }
@@ -526,9 +537,9 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, 
RowContext *row,
 dct_linesize_chroma <<= 1;
 }
 
-dest_y = frame->data[0] + ((y * dct_linesize_luma)   << 4) + (x << (4 + 
shift1));
-dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) +

[FFmpeg-devel] [PATCH 0/4] Better colorspace support in dnxhddec

2021-01-30 Thread Christophe Gisquet
Nobody complained so the CIDs are likely litle used.
This was developped without reference to the ST2019-1:2016 specs (some
fields are therefore guessed) but with reference to (unredistributable)
samples likely generated by the Avid SDK.

I have no idea how the alpha is coded, but it is variable-length.

Christophe Gisquet (4):
  lav/dnxhd: better support 4:2:0 in DNXHR profiles
  lav/dnxhd: CID 1256 is RGB, not BGR or YUV444
  dnxhd: add partial alpha support for parsing
  dnxhddec: partial alpha support

 libavcodec/dnxhd_parser.c |   7 +-
 libavcodec/dnxhddata.c|  17 +++--
 libavcodec/dnxhddata.h|   6 +-
 libavcodec/dnxhddec.c | 139 --
 libavcodec/dnxhdenc.c |   2 +-
 libavformat/mxfenc.c  |   7 +-
 6 files changed, 128 insertions(+), 50 deletions(-)

-- 
2.29.2

___
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] [PATCH 2/4] lav/dnxhd: CID 1256 is RGB, not BGR or YUV444

2021-01-30 Thread Christophe Gisquet
From: Christophe Gisquet 

Fix the logic around checking the ACT flag per MB and row.
This also requires adding a 444 path to swap channels into
the ffmpeg formats, as they are GBR, and not RGB.
---
 libavcodec/dnxhddec.c | 64 +++
 1 file changed, 47 insertions(+), 17 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 359588f963..11da1c286c 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -249,12 +249,10 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 return AVERROR_INVALIDDATA;
 } else if (bitdepth == 10) {
 ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
-ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10
-: AV_PIX_FMT_GBRP10;
+ctx->pix_fmt = ctx->act ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
 } else {
 ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;
-ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12
-: AV_PIX_FMT_GBRP12;
+ctx->pix_fmt = ctx->act ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
 }
 } else if (bitdepth == 12) {
 ctx->decode_dct_block = dnxhd_decode_dct_block_12;
@@ -504,19 +502,19 @@ static int dnxhd_decode_macroblock(const DNXHDContext 
*ctx, RowContext *row,
 qscale = get_bits(&row->gb, 11);
 }
 act = get_bits1(&row->gb);
-if (act) {
-if (!ctx->act) {
-static int act_warned;
-if (!act_warned) {
-act_warned = 1;
-av_log(ctx->avctx, AV_LOG_ERROR,
-   "ACT flag set, in violation of frame header.\n");
-}
-} else if (row->format == -1) {
+if (ctx->act) {
+if (row->format == -1) {
 row->format = act;
 } else if (row->format != act) {
 row->format = 2; // Variable
 }
+} else if (act) {
+static int act_warned;
+if (!act_warned) {
+act_warned = 1;
+av_log(ctx->avctx, AV_LOG_ERROR,
+   "ACT flag set, in violation of frame header.\n");
+}
 }
 
 if (qscale != row->last_qscale) {
@@ -569,6 +567,21 @@ static int dnxhd_decode_macroblock(const DNXHDContext 
*ctx, RowContext *row,
 }
 break;
 case DNX_CHROMAFORMAT_444:
+if (ctx->avctx->profile == FF_PROFILE_DNXHD) {
+ctx->idsp.idct_put(dest_y,   
dct_linesize_luma, row->blocks[2]);
+ctx->idsp.idct_put(dest_y + dct_x_offset,
dct_linesize_luma, row->blocks[3]);
+ctx->idsp.idct_put(dest_y + dct_y_offset,
dct_linesize_luma, row->blocks[8]);
+ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, 
dct_linesize_luma, row->blocks[9]);
+
+ctx->idsp.idct_put(dest_u,   
dct_linesize_luma, row->blocks[4]);
+ctx->idsp.idct_put(dest_u + dct_x_offset,
dct_linesize_luma, row->blocks[5]);
+ctx->idsp.idct_put(dest_u + dct_y_offset,
dct_linesize_luma, row->blocks[10]);
+ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, 
dct_linesize_luma, row->blocks[11]);
+ctx->idsp.idct_put(dest_v,   
dct_linesize_luma, row->blocks[0]);
+ctx->idsp.idct_put(dest_v + dct_x_offset,
dct_linesize_luma, row->blocks[1]);
+ctx->idsp.idct_put(dest_v + dct_y_offset,
dct_linesize_luma, row->blocks[6]);
+ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, 
dct_linesize_luma, row->blocks[7]);
+} else {
 ctx->idsp.idct_put(dest_y,   
dct_linesize_luma, row->blocks[0]);
 ctx->idsp.idct_put(dest_y + dct_x_offset,
dct_linesize_luma, row->blocks[1]);
 ctx->idsp.idct_put(dest_y + dct_y_offset,
dct_linesize_luma, row->blocks[6]);
@@ -585,6 +598,7 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, 
RowContext *row,
 ctx->idsp.idct_put(dest_v + dct_y_offset,
dct_linesize_chroma, row->blocks[10]);
 ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, 
dct_linesize_chroma, row->blocks[11]);
 }
+}
 break;
 case DNX_CHROMAFORMAT_420:
 ctx->idsp.idct_put(dest_y,   
dct_linesize_luma, row->blocks[0]);
@@ -610,6 +624,8 @@ static int dnxhd_decode_row(AVCodecContext *avctx, void 
*data,
 RowContext *row = ctx->rows + threadnb;
 int x, ret;
 
+row->format = -1;
+
 row->last_dc[0] =
 row->last_dc[1] =
 row->last_dc[2] = 1 << (ctx->bit_depth + 2); // for levels +2^(bitdepth-1)
@@ -694,14 +710,21 @@ decode_coding_unit:
 static int act_warned;
 int format = ctx->rows[0]

[FFmpeg-devel] [PATCH 3/4] dnxhd: add partial alpha support for parsing

2021-01-30 Thread Christophe Gisquet
From: Christophe Gisquet 

This multiplies the framesize by 1.5 when there is alpha, for the CIDs
allowing alpha. In addition, a new header is checked, because the alpha
marking seems to be different.
---
 libavcodec/dnxhd_parser.c |  7 ---
 libavcodec/dnxhddata.c| 17 -
 libavcodec/dnxhddata.h|  6 --
 libavcodec/dnxhdenc.c |  2 +-
 libavformat/mxfenc.c  |  7 ---
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 63b4ff89e1..726fb2f5de 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -31,7 +31,7 @@ typedef struct {
 ParseContext pc;
 int cur_byte;
 int remaining;
-int w, h;
+int w, h, alpha;
 } DNXHDParserContext;
 
 static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
@@ -58,6 +58,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (pic_found && !dctx->remaining) {
 if (!buf_size) /* EOF considered as end of frame */
 return 0;
+dctx->alpha = (state >> 8) & 5;
 for (; i < buf_size; i++) {
 dctx->cur_byte++;
 state = (state << 8) | buf[i];
@@ -73,9 +74,9 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
 if (cid <= 0)
 continue;
 
-remaining = avpriv_dnxhd_get_frame_size(cid);
+remaining = avpriv_dnxhd_get_frame_size(cid, dctx->alpha);
 if (remaining <= 0) {
-remaining = avpriv_dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h);
+remaining = avpriv_dnxhd_get_hr_frame_size(cid, dctx->w, 
dctx->h, dctx->alpha);
 if (remaining <= 0)
 continue;
 }
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index 3a69a0f501..54663aa432 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -1083,15 +1083,19 @@ const CIDEntry *ff_dnxhd_get_cid_table(int cid)
 return NULL;
 }
 
-int avpriv_dnxhd_get_frame_size(int cid)
+int avpriv_dnxhd_get_frame_size(int cid, int alpha)
 {
 const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
+int result;
 if (!entry)
 return -1;
-return entry->frame_size;
+result = entry->frame_size;
+if (alpha && (entry->flags & DNXHD_444))
+result = (result * 3) >> 1;
+return result;
 }
 
-int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
+int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h, int alpha)
 {
 const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
 int result;
@@ -1099,8 +1103,11 @@ int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
 if (!entry)
 return -1;
 
-result = ((h + 15) / 16) * ((w + 15) / 16) * 
(int64_t)entry->packet_scale.num / entry->packet_scale.den;
-result = (result + 2048) / 4096 * 4096;
+result = AV_CEIL_RSHIFT(h, 4) * AV_CEIL_RSHIFT(w, 4)
+   * (int64_t)entry->packet_scale.num / entry->packet_scale.den;
+if (alpha && (entry->flags & DNXHD_444))
+result = (result * 3) >> 1;
+result = (result + 2048) & -4096;
 
 return FFMAX(result, 8192);
 }
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 898079cffc..21738af453 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -35,6 +35,7 @@
 /** Frame headers, extra 0x00 added to end for parser */
 #define DNXHD_HEADER_INITIAL 0x02800100
 #define DNXHD_HEADER_444 0x02800200
+#define DNXHD_HEADER_RGBA0x02800400
 
 /** Indicate that a CIDEntry value must be read in the bitstream */
 #define DNXHD_VARIABLE 0
@@ -76,6 +77,7 @@ static av_always_inline uint64_t 
ff_dnxhd_check_header_prefix(uint64_t prefix)
 {
 if (prefix == DNXHD_HEADER_INITIAL ||
 prefix == DNXHD_HEADER_444 ||
+prefix == DNXHD_HEADER_RGBA||
 ff_dnxhd_check_header_prefix_hr(prefix))
 return prefix;
 return 0;
@@ -88,8 +90,8 @@ static av_always_inline uint64_t 
ff_dnxhd_parse_header_prefix(const uint8_t *buf
 return ff_dnxhd_check_header_prefix(prefix);
 }
 
-int avpriv_dnxhd_get_frame_size(int cid);
-int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h);
+int avpriv_dnxhd_get_frame_size(int cid, int alpha);
+int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h, int alpha);
 int avpriv_dnxhd_get_interlaced(int cid);
 
 #endif /* AVCODEC_DNXHDDATA_H */
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 2461c51727..fb059060aa 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -467,7 +467,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 
 if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
 ctx->frame_size = avpriv_dnxhd_get_hr_frame_size(ctx->cid,
- avctx->width, 
avctx->height);
+ avctx->width, 
avctx->height, 0);
 av_

Re: [FFmpeg-devel] [PATCH 3/4] dnxhd: add partial alpha support for parsing

2021-01-30 Thread Paul B Mahol
Are you telling us that you do not have specification for this?

Last time I checked AVID files had uncompressed alpha that did not matched
with specification at all.
___
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".

Re: [FFmpeg-devel] [PATCH] lavc/hevc_parser: remove repeated profile/level settings

2021-01-30 Thread Hendrik Leppkes
On Sat, Jan 30, 2021 at 7:58 AM Linjie Fu  wrote:
>
> Since avctx->profile/level would be set in export_stream_params()
> in set_sps(), identical codes here seem to be redundant.
>
> Signed-off-by: Linjie Fu 
> ---
>  libavcodec/hevc_parser.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
> index 463d352055..0eb7fb074c 100644
> --- a/libavcodec/hevc_parser.c
> +++ b/libavcodec/hevc_parser.c
> @@ -95,8 +95,6 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, 
> H2645NAL *nal,
>  s->width= ps->sps->width  - ow->left_offset - ow->right_offset;
>  s->height   = ps->sps->height - ow->top_offset  - ow->bottom_offset;
>  s->format   = ps->sps->pix_fmt;
> -avctx->profile  = ps->sps->ptl.general_ptl.profile_idc;
> -avctx->level= ps->sps->ptl.general_ptl.level_idc;
>
>  if (ps->vps->vps_timing_info_present_flag) {
>  num = ps->vps->vps_num_units_in_tick;

This is in the parser, not the decoder, an independent component, and
the parser does not export this information through other means, this
without it, it would be exporting less information then it does now.
Please leave this in. :)

- Hendrik
___
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".

Re: [FFmpeg-devel] [PATCH 0/4] Better colorspace support in dnxhddec

2021-01-30 Thread Carl Eugen Hoyos
Am Sa., 30. Jan. 2021 um 10:20 Uhr schrieb Christophe Gisquet
:
>
> Nobody complained so the CIDs are likely litle used.

https://trac.ffmpeg.org/ticket/7342

There are also tickets #7258 and #3707.

Thank you, Carl Eugen
___
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] [PATCH 4/4] dnxhddec: partial alpha support

2021-01-30 Thread Christophe Gisquet
From: Christophe Gisquet 

This consists in just ignoring the alpha at the end of the bitstream
---
 libavcodec/dnxhddec.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 11da1c286c..1de95996cf 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -202,7 +202,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 ctx->cur_field = 0;
 }
 ctx->mbaff = (buf[0x6] >> 5) & 1;
-ctx->alpha = buf[0x7] & 1;
+ctx->alpha = buf[0x7] & 5;
 ctx->lla   = (buf[0x7] >> 1) & 1;
 if (ctx->alpha)
 avpriv_request_sample(ctx->avctx, "alpha");
@@ -249,10 +249,14 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 return AVERROR_INVALIDDATA;
 } else if (bitdepth == 10) {
 ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
-ctx->pix_fmt = ctx->act ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
+ctx->pix_fmt = ctx->act
+ ? (/*ctx->alpha ? AV_PIX_FMT_GBRAP10LE :*/ 
AV_PIX_FMT_GBRP10)
+ : (/*ctx->alpha ? AV_PIX_FMT_YUVA444P10LE :*/ 
AV_PIX_FMT_YUV444P10);
 } else {
 ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;
-ctx->pix_fmt = ctx->act ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
+ctx->pix_fmt = ctx->act
+ ? (/*ctx->alpha ? AV_PIX_FMT_GBRAP12LE :*/ 
AV_PIX_FMT_GBRP12)
+ : (/*ctx->alpha ? AV_PIX_FMT_YUVA444P12LE :*/ 
AV_PIX_FMT_YUV444P12);
 }
 } else if (bitdepth == 12) {
 ctx->decode_dct_block = dnxhd_decode_dct_block_12;
@@ -337,7 +341,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 i, 0x170 + (i << 2), ctx->mb_scan_index[i]);
 if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {
 av_log(ctx->avctx, AV_LOG_ERROR,
-   "invalid mb scan index (%"PRIu32" vs %u).\n",
+   "invalid mb %i scan index (%"PRIu32" vs %u).\n", i,
ctx->mb_scan_index[i], buf_size - ctx->data_offset);
 return AVERROR_INVALIDDATA;
 }
@@ -642,6 +646,12 @@ static int dnxhd_decode_row(AVCodecContext *avctx, void 
*data,
 }
 }
 
+/* alpha decoding goes there */
+if (ctx->alpha) {
+   ff_dlog(ctx->avctx, "Row %d: %d left\n", rownb,
+   ((rownb < ctx->mb_height-1 ? ctx->mb_scan_index[rownb+1] : 
ctx->buf_size) - offset) * 8 - get_bits_count(&row->gb));
+}
+
 return 0;
 }
 
@@ -735,11 +745,13 @@ decode_coding_unit:
 case -1:
 case 0:
 ctx->pix_fmt = ctx->bit_depth==10
- ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_GBRP12;
+ ? (/*ctx->alpha ? AV_PIX_FMT_GBRAP10 :*/ 
AV_PIX_FMT_GBRP10)
+ : (/*ctx->alpha ? AV_PIX_FMT_GBRAP12 :*/ 
AV_PIX_FMT_GBRP12);
 break;
 case 1:
 ctx->pix_fmt = ctx->bit_depth==10
- ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV444P12;
+ ? (/*ctx->alpha ? AV_PIX_FMT_YUVA444P10 :*/ 
AV_PIX_FMT_YUV444P10)
+ : (/*ctx->alpha ? AV_PIX_FMT_YUVA444P12 :*/ 
AV_PIX_FMT_YUV444P12);
 break;
 }
 }
-- 
2.29.2

___
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".

Re: [FFmpeg-devel] [PATCH] cbs_h2645: Implement replace-PS with a table rather than many functions

2021-01-30 Thread Nuo Mi
Hi Mark,
Will this fix and merged?
thanks

On Wed, Jan 27, 2021 at 9:52 PM Nuo Mi  wrote:

>
>
> On Wed, Jan 27, 2021 at 7:06 AM Mark Thompson  wrote:
>
>>
>> +
>> +err = ff_cbs_make_unit_refcounted(ctx, unit);
>> +if (err < 0)
>> +return err;
>> +
>> +ref_array =
>> + (AVBufferRef**)((uint8_t*)ctx->priv_data +
>> ps_type->ref_array_offset);
>> +ptr_array = (void**)((uint8_t*)ctx->priv_data +
>> ps_type->ptr_array_offset);
>> +active= (void**)((uint8_t*)ctx->priv_data +
>> ps_type->active_offset);
>> +
>> +if (ptr_array[id] == *active) {
>> +// The old active parameter set is being overwritten, so it can't
>> +// be active after this point.
>> +*active = NULL;
>> +}
>> +av_buffer_unref(&ref_array[id]);
>> +
>> +ref_array[id] = av_buffer_ref(unit->content_ref);
>> +if (!ref_array[id])
>> +return AVERROR(ENOMEM);
>>
> This happend after ff_cbs_make_unit_refcounted, do we need urnef 
> unit->content_ref
> before return?
>
>> +ptr_array[id] = ref_array[id]->data;
>> +
>> +return 0;
>> +}
>>
>>
>> 2.29.2
>> ___
>> 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".

Re: [FFmpeg-devel] [PATCH 4/6] avformat/rtsp: Fix build failure when RTP demuxers are disabled

2021-01-30 Thread Paul B Mahol
probably ok

On Sat, Jan 30, 2021 at 5:45 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> rtsp.c uses a check of the form "if (CONFIG_RTSP_DEMUXER && ...) {}"
> with the intent to make the code compilable even though the part guarded
> by this check contains calls to functions that don't exist when the RTSP
> demuxer is disabled. Yet even then compilers still need a declaration of
> all the functions in the dead code block and error out if not (due to
> our usage of -Werror=implicit-function-declaration) and no such
> declaration exists for a static function in rtsp.c. Simply adding a
> declaration leads to a "used but never defined" warning, therefore this
> commit resorts to an #if.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/rtsp.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 1b24496f3c..9a2933346e 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1941,12 +1941,15 @@ redirect:
>  break;
>  }
>
> -if (CONFIG_RTSP_DEMUXER && s->iformat) {
> +#if CONFIG_RTSP_DEMUXER
> +if (s->iformat) {
>  if (rt->server_type == RTSP_SERVER_SATIP)
>  err = init_satip_stream(s);
>  else
>  err = ff_rtsp_setup_input_streams(s, reply);
> -} else if (CONFIG_RTSP_MUXER)
> +} else
> +#endif
> +   if (CONFIG_RTSP_MUXER)
>  err = ff_rtsp_setup_output_streams(s, host);
>  else
>  av_assert0(0);
> --
> 2.25.1
>
> ___
> 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".

[FFmpeg-devel] [PATCH 4/4] tools/target_dec_fuzzer: Adjust threshold for theora

2021-01-30 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index affa6e3b51..425089ef20 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -184,6 +184,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_SMACKVIDEO:  maxpixels  /= 64;break;
 case AV_CODEC_ID_SNOW:maxpixels  /= 128;   break;
 case AV_CODEC_ID_TGV: maxpixels  /= 32;break;
+case AV_CODEC_ID_THEORA:  maxpixels  /= 1024;  break;
 case AV_CODEC_ID_TRUEMOTION2: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
 case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
-- 
2.17.1

___
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] [PATCH 1/4] avformat/matroskadec: Check for EOF in resync loop

2021-01-30 Thread Michael Niedermayer
Fixes: Timeout (too long -> instantly)
Fixes: 
29136/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4586141227548672

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/matroskadec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 374831baa3..1f28108887 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2895,6 +2895,8 @@ static int matroska_read_header(AVFormatContext *s)
 goto fail;
 pos = avio_tell(matroska->ctx->pb);
 res = ebml_parse(matroska, matroska_segment, matroska);
+if (res == AVERROR(EIO)) // EOF is translated to EIO, this exists the 
loop on EOF
+goto fail;
 }
 /* Set data_offset as it might be needed later by seek_frame_generic. */
 if (matroska->current_id == MATROSKA_ID_CLUSTER)
-- 
2.17.1

___
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] [PATCH 3/4] avcodec/vp3: Check input amount in theora_decode_header()

2021-01-30 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vp3.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 2a1da6b062..57c6eb1ff9 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2875,6 +2875,9 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 int ret;
 AVRational fps, aspect;
 
+if (get_bits_left(gb) < 206)
+return AVERROR_INVALIDDATA;
+
 s->theora_header = 0;
 s->theora = get_bits(gb, 24);
 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
-- 
2.17.1

___
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] [PATCH 2/4] avformat/wavdec: Check avio_get_str16le() for failure

2021-01-30 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
29195/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5037853281222656

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/wavdec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 3da4150f05..2fba9a08c8 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -922,6 +922,10 @@ static int w64_read_header(AVFormatContext *s)
 return AVERROR(ENOMEM);
 
 ret = avio_get_str16le(pb, chunk_size, value, chunk_size);
+if (ret < 0) {
+av_free(value);
+return ret;
+}
 avio_skip(pb, chunk_size - ret);
 
 av_dict_set(&s->metadata, chunk_key, value, 
AV_DICT_DONT_STRDUP_VAL);
-- 
2.17.1

___
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".

Re: [FFmpeg-devel] [PATCH 2/4] avformat/wavdec: Check avio_get_str16le() for failure

2021-01-30 Thread Paul B Mahol
lgtm

On Sat, Jan 30, 2021 at 4:07 PM Michael Niedermayer 
wrote:

> Fixes: out of array access
> Fixes:
> 29195/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5037853281222656
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  libavformat/wavdec.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> index 3da4150f05..2fba9a08c8 100644
> --- a/libavformat/wavdec.c
> +++ b/libavformat/wavdec.c
> @@ -922,6 +922,10 @@ static int w64_read_header(AVFormatContext *s)
>  return AVERROR(ENOMEM);
>
>  ret = avio_get_str16le(pb, chunk_size, value, chunk_size);
> +if (ret < 0) {
> +av_free(value);
> +return ret;
> +}
>  avio_skip(pb, chunk_size - ret);
>
>  av_dict_set(&s->metadata, chunk_key, value,
> AV_DICT_DONT_STRDUP_VAL);
> --
> 2.17.1
>
> ___
> 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".

[FFmpeg-devel] [PATCH 1/3] avcodec/dcadsp: Fix integer overflow in dmix_add_c()

2021-01-30 Thread Michael Niedermayer
Fixes: signed integer overflow: 1515225320 + 759416059 cannot be represented in 
type 'int'
Fixes: 
29256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-5719088561258496

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/dcadsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index faf244c8ad..9d00ebd281 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -329,7 +329,7 @@ static void dmix_add_c(int32_t *dst, const int32_t *src, 
int coeff, ptrdiff_t le
 int i;
 
 for (i = 0; i < len; i++)
-dst[i] += mul15(src[i], coeff);
+dst[i] += (unsigned)mul15(src[i], coeff);
 }
 
 static void dmix_scale_c(int32_t *dst, int scale, ptrdiff_t len)
-- 
2.17.1

___
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] [PATCH 3/3] avcodec/hapdec: Check that compressed_offset is non negative

2021-01-30 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
29345/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5401813482340352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/hapdec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index ab364aa790..260fda2968 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -86,6 +86,8 @@ static int hap_parse_decode_instructions(HapContext *ctx, int 
size)
 return ret;
 for (i = 0; i < section_size / 4; i++) {
 ctx->chunks[i].compressed_offset = 
bytestream2_get_le32(gbc);
+if (ctx->chunks[i].compressed_offset < 0)
+return AVERROR_INVALIDDATA;
 }
 had_offsets = 1;
 is_first_table = 0;
@@ -106,6 +108,8 @@ static int hap_parse_decode_instructions(HapContext *ctx, 
int size)
 for (i = 0; i < ctx->chunk_count; i++) {
 ctx->chunks[i].compressed_offset = running_size;
 running_size += ctx->chunks[i].compressed_size;
+if (running_size > INT_MAX)
+return AVERROR_INVALIDDATA;
 }
 }
 
-- 
2.17.1

___
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] [PATCH 2/3] avcodec/jpeglsdec: Fix k=16 in ls_get_code_regular()

2021-01-30 Thread Michael Niedermayer
Fixes: Timeout
Fixes: left shift of 33046 by 16 places cannot be represented in type 'int'
Fixes: 
29258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-4889231489105920

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeglsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index ef97bdb297..69980eaa49 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -149,7 +149,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, 
JLSState *state, int Q)
 {
 int k, ret;
 
-for (k = 0; (state->N[Q] << k) < state->A[Q]; k++)
+for (k = 0; ((unsigned)state->N[Q] << k) < state->A[Q]; k++)
 ;
 
 #ifdef JLS_BROKEN
-- 
2.17.1

___
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".

Re: [FFmpeg-devel] [PATCH v5 1/2] avformat/mxf: add platform local tag

2021-01-30 Thread Marton Balint



On Sat, 30 Jan 2021, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Please check the string of platform with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
./ffmpeg -i out.mxf

application_platform: Lavf58.65.101 (linux)


I think this should simply be Lavf (linux), and the version should be 
stored in ToolkitVersion instead.


Regards,
Marton



Signed-off-by: Limin Wang 
---
configure   | 1 +
libavformat/mxfenc.c| 4 
tests/ref/fate/copy-trac4914| 2 +-
tests/ref/fate/mxf-d10-user-comments| 2 +-
tests/ref/fate/mxf-opatom-user-comments | 2 +-
tests/ref/fate/mxf-reel_name| 2 +-
tests/ref/fate/mxf-user-comments| 2 +-
tests/ref/fate/time_base| 2 +-
tests/ref/lavf/mxf  | 6 +++---
tests/ref/lavf/mxf_d10  | 2 +-
tests/ref/lavf/mxf_dv25 | 2 +-
tests/ref/lavf/mxf_dvcpro50 | 2 +-
tests/ref/lavf/mxf_opatom   | 2 +-
tests/ref/lavf/mxf_opatom_audio | 2 +-
14 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index df298b4..a092a6b 100755
--- a/configure
+++ b/configure
@@ -7579,6 +7579,7 @@ cat > $TMPH oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : 
"OPAtom Muxer";
const char *version;
+const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
PLATFROM_IDENT;
int length;

mxf_write_metadata_key(pb, 0x013000);
@@ -735,6 +737,7 @@ static void mxf_write_identification(AVFormatContext *s)
"0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
length = 100 +mxf_utf16_local_tag_length(company) +
  mxf_utf16_local_tag_length(product) +
+  mxf_utf16_local_tag_length(platform) +
  mxf_utf16_local_tag_length(version);
klv_encode_ber_length(pb, length);

@@ -753,6 +756,7 @@ static void mxf_write_identification(AVFormatContext *s)
store_version(s);

mxf_write_local_tag_utf16(pb, 0x3C04, version); // Version String
+mxf_write_local_tag_utf16(pb, 0x3C08, platform); // Platform

// write product uid
mxf_write_local_tag(pb, 16, 0x3C05);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index e8f8afb..743dc8c 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-5d58a32f21b78169d925845f783054e6 *tests/data/fate/copy-trac4914.mxf
+f5150fb82c1bb5a90906fce93dcc3f76 *tests/data/fate/copy-trac4914.mxf
561721 tests/data/fate/copy-trac4914.mxf
#tb 0: 1001/3
#media_type 0: video
diff --git a/tests/ref/fate/mxf-d10-user-comments 
b/tests/ref/fate/mxf-d10-user-comments
index 3b9d9d2..c35add0 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -1 +1 @@
-fe9b43f5b6e7737fe2670b660fd3d860
+7bb9f39e8e05724525154de17f0235d8
diff --git a/tests/ref/fate/mxf-opatom-user-comments 
b/tests/ref/fate/mxf-opatom-user-comments
index be57eb4..ec4fdff 100644
--- a/tests/ref/fate/mxf-opatom-user-comments
+++ b/tests/ref/fate/mxf-opatom-user-comments
@@ -1 +1 @@
-9b3d7201c37c5783702774e46e0da141
+8475bebf3448a972ae89ba59309fd7d6
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index acda8fe..d50f0f6 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-422d6ed4821e7bbecbcdecc553abc6e4
+ce49a0361d3f79106e1952d387eace51
diff --git a/tests/ref/fate/mxf-user-comments b/tests/ref/fate/mxf-user-comments
index 3b77db9..5fcdc58 100644
--- a/tests/ref/fate/mxf-user-comments
+++ b/tests/ref/fate/mxf-user-comments
@@ -1 +1 @@
-c77b632dbcdacd6466e1ec794917556e
+956f653cd75e1a319569caec9df81b4f
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index d3c9795..28815d0 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-e5c9da6972b6f6e7b15bcbbf20a9dbd1
+78ac0348027b75d73acb8bea14e67a59
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 1b1fe1a..21bf2be 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-1703da2e9f0ca49a5f0bcbcc6944c9c0 *tests/data/lavf/lavf.mxf
+8938d5c4a396ff1b24d10d4f917ae1c9 *tests/data/lavf/lavf.mxf
526393 tests/data/lavf/lavf.mxf
tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-b44c4f138f1a87256211c3112dd52c87 *tests/data/lavf/lavf.mxf
+93ea2cfdf5dda7fffdc0d2fdcfb6a9a4 *tests/data/lavf/lavf.mxf
561721 tests/data/lavf/lavf.mxf
tests/data/lavf/lavf.mxf CRC=0x96ff1b48
-9ede3c95054c30eb815fbe598a1f097b *tests/data/lavf/lavf.mxf
+87bdf844ae34bcc758e44419e80177a0 *tests/data/lavf/lavf.mxf
526393 tests/data/lavf/lavf.mxf
tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 19e6f20..47ef244 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3

Re: [FFmpeg-devel] Race condition in libavformat/libsrt.c causes EOF to be missed

2021-01-30 Thread Marton Balint



On Fri, 29 Jan 2021, Belabox Project wrote:


Hi,

The way SRT's async / epoll-based IO works is
that the event status is stored in the epoll containers. That is, if
an event occurs on an SRT socket, and that SRT socket isn't part of
any epoll container, then that event is lost. If we later add that
socket to an epoll container, we still won't receive the event even if
it wasn't serviced. The documentation references this [1].


If that's how it works, then how do you make sure you don't lose an event 
between srt_accept() and adding the returned fd to an epoll container?


Thanks,
Marton
___
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".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/vp3: Check input amount in theora_decode_header()

2021-01-30 Thread Peter Ross
On Sat, Jan 30, 2021 at 04:00:20PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vp3.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index 2a1da6b062..57c6eb1ff9 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -2875,6 +2875,9 @@ static int theora_decode_header(AVCodecContext *avctx, 
> GetBitContext *gb)
>  int ret;
>  AVRational fps, aspect;
>  
> +if (get_bits_left(gb) < 206)
> +return AVERROR_INVALIDDATA;
> +
>  s->theora_header = 0;
>  s->theora = get_bits(gb, 24);
>  av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
> -- 
> 2.17.1

ok

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: PGP signature
___
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".

Re: [FFmpeg-devel] [PATCH 2/4] avformat/wavdec: Check avio_get_str16le() for failure

2021-01-30 Thread Michael Niedermayer
On Sat, Jan 30, 2021 at 06:09:50PM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: PGP signature
___
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".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/vp3: Check input amount in theora_decode_header()

2021-01-30 Thread Michael Niedermayer
On Sun, Jan 31, 2021 at 09:53:27AM +1100, Peter Ross wrote:
> On Sat, Jan 30, 2021 at 04:00:20PM +0100, Michael Niedermayer wrote:
> > Fixes: Timeout
> > Fixes: 
> > 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vp3.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> > index 2a1da6b062..57c6eb1ff9 100644
> > --- a/libavcodec/vp3.c
> > +++ b/libavcodec/vp3.c
> > @@ -2875,6 +2875,9 @@ static int theora_decode_header(AVCodecContext 
> > *avctx, GetBitContext *gb)
> >  int ret;
> >  AVRational fps, aspect;
> >  
> > +if (get_bits_left(gb) < 206)
> > +return AVERROR_INVALIDDATA;
> > +
> >  s->theora_header = 0;
> >  s->theora = get_bits(gb, 24);
> >  av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", 
> > s->theora);
> > -- 
> > 2.17.1
> 
> ok

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
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".

Re: [FFmpeg-devel] [PATCH] libavformat: add librist protocol

2021-01-30 Thread Marton Balint



On Tue, 26 Jan 2021, Paul B Mahol wrote:


This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol 
---
configure   |   5 +
doc/protocols.texi  |  32 +
libavformat/Makefile|   1 +
libavformat/librist.c   | 251 
libavformat/protocols.c |   1 +
5 files changed, 290 insertions(+)
create mode 100644 libavformat/librist.c



[...]


+typedef struct RISTContext {
+const AVClass *class;
+
+int profile;
+int buffer_size;
+int packet_size;
+int log_level;
+int encryption;
+char *secret;
+
+struct rist_logging_settings logging_settings;
+struct rist_peer_config peer_config;


Can you avoid these on the stack? If librist adds new members to them, 
this might break, and there is now API for freeing them properly.


Thanks,
Marton
___
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".

Re: [FFmpeg-devel] [PATCH] libavformat: add librist protocol

2021-01-30 Thread Marton Balint



On Sun, 31 Jan 2021, Marton Balint wrote:




On Tue, 26 Jan 2021, Paul B Mahol wrote:


This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol 
---
configure   |   5 +
doc/protocols.texi  |  32 +
libavformat/Makefile|   1 +
libavformat/librist.c   | 251 
libavformat/protocols.c |   1 +
5 files changed, 290 insertions(+)
create mode 100644 libavformat/librist.c



[...]


+typedef struct RISTContext {
+const AVClass *class;
+
+int profile;
+int buffer_size;
+int packet_size;
+int log_level;
+int encryption;
+char *secret;
+
+struct rist_logging_settings logging_settings;
+struct rist_peer_config peer_config;


Can you avoid these on the stack? If librist adds new members to them, 
this might break, and there is now API for freeing them properly.


Obviously what I meant is avoiding librist structs directly in our data 
structures.


Thanks,
Marton
___
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".

Re: [FFmpeg-devel] [PATCH v5 1/2] avformat/mxf: add platform local tag

2021-01-30 Thread lance . lmwang
On Sat, Jan 30, 2021 at 09:59:16PM +0100, Marton Balint wrote:
> 
> 
> On Sat, 30 Jan 2021, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > Please check the string of platform with below command:
> > ./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
> > ./ffmpeg -i out.mxf
> > 
> > application_platform: Lavf58.65.101 (linux)
> 
> I think this should simply be Lavf (linux), and the version should be stored
> in ToolkitVersion instead.

I agree. Then I prefer to to read and show ToolkitVersion tag in mxfdec first.
how about to use below format for the tag:
...
toolkit_version : 58.65.101

> 
> Regards,
> Marton
> 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > configure   | 1 +
> > libavformat/mxfenc.c| 4 
> > tests/ref/fate/copy-trac4914| 2 +-
> > tests/ref/fate/mxf-d10-user-comments| 2 +-
> > tests/ref/fate/mxf-opatom-user-comments | 2 +-
> > tests/ref/fate/mxf-reel_name| 2 +-
> > tests/ref/fate/mxf-user-comments| 2 +-
> > tests/ref/fate/time_base| 2 +-
> > tests/ref/lavf/mxf  | 6 +++---
> > tests/ref/lavf/mxf_d10  | 2 +-
> > tests/ref/lavf/mxf_dv25 | 2 +-
> > tests/ref/lavf/mxf_dvcpro50 | 2 +-
> > tests/ref/lavf/mxf_opatom   | 2 +-
> > tests/ref/lavf/mxf_opatom_audio | 2 +-
> > 14 files changed, 19 insertions(+), 14 deletions(-)
> > 
> > diff --git a/configure b/configure
> > index df298b4..a092a6b 100755
> > --- a/configure
> > +++ b/configure
> > @@ -7579,6 +7579,7 @@ cat > $TMPH < > #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
> > #define AVCONV_DATADIR "$(eval c_escape $datadir)"
> > #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
> > +#define OS_NAME $target_os
> > #define av_restrict $restrict_keyword
> > #define EXTERN_PREFIX "${extern_prefix}"
> > #define EXTERN_ASM ${extern_prefix}
> > diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> > index 0c464d4..2cf443f 100644
> > --- a/libavformat/mxfenc.c
> > +++ b/libavformat/mxfenc.c
> > @@ -719,6 +719,7 @@ static void store_version(AVFormatContext *s){
> > avio_wb16(pb, 0); // release
> > }
> > 
> > +#define PLATFROM_IDENT"Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION 
> > (OS_NAME))
> > static void mxf_write_identification(AVFormatContext *s)
> > {
> > MXFContext *mxf = s->priv_data;
> > @@ -726,6 +727,7 @@ static void mxf_write_identification(AVFormatContext *s)
> > const char *company = "FFmpeg";
> > const char *product = s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" 
> > : "OPAtom Muxer";
> > const char *version;
> > +const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
> > PLATFROM_IDENT;
> > int length;
> > 
> > mxf_write_metadata_key(pb, 0x013000);
> > @@ -735,6 +737,7 @@ static void mxf_write_identification(AVFormatContext *s)
> > "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
> > length = 100 +mxf_utf16_local_tag_length(company) +
> >   mxf_utf16_local_tag_length(product) +
> > +  mxf_utf16_local_tag_length(platform) +
> >   mxf_utf16_local_tag_length(version);
> > klv_encode_ber_length(pb, length);
> > 
> > @@ -753,6 +756,7 @@ static void mxf_write_identification(AVFormatContext *s)
> > store_version(s);
> > 
> > mxf_write_local_tag_utf16(pb, 0x3C04, version); // Version String
> > +mxf_write_local_tag_utf16(pb, 0x3C08, platform); // Platform
> > 
> > // write product uid
> > mxf_write_local_tag(pb, 16, 0x3C05);
> > diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
> > index e8f8afb..743dc8c 100644
> > --- a/tests/ref/fate/copy-trac4914
> > +++ b/tests/ref/fate/copy-trac4914
> > @@ -1,4 +1,4 @@
> > -5d58a32f21b78169d925845f783054e6 *tests/data/fate/copy-trac4914.mxf
> > +f5150fb82c1bb5a90906fce93dcc3f76 *tests/data/fate/copy-trac4914.mxf
> > 561721 tests/data/fate/copy-trac4914.mxf
> > #tb 0: 1001/3
> > #media_type 0: video
> > diff --git a/tests/ref/fate/mxf-d10-user-comments 
> > b/tests/ref/fate/mxf-d10-user-comments
> > index 3b9d9d2..c35add0 100644
> > --- a/tests/ref/fate/mxf-d10-user-comments
> > +++ b/tests/ref/fate/mxf-d10-user-comments
> > @@ -1 +1 @@
> > -fe9b43f5b6e7737fe2670b660fd3d860
> > +7bb9f39e8e05724525154de17f0235d8
> > diff --git a/tests/ref/fate/mxf-opatom-user-comments 
> > b/tests/ref/fate/mxf-opatom-user-comments
> > index be57eb4..ec4fdff 100644
> > --- a/tests/ref/fate/mxf-opatom-user-comments
> > +++ b/tests/ref/fate/mxf-opatom-user-comments
> > @@ -1 +1 @@
> > -9b3d7201c37c5783702774e46e0da141
> > +8475bebf3448a972ae89ba59309fd7d6
> > diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
> > index acda8fe..d50f0f6 100644
> > --- a/tests/ref/fate/mxf-reel_name
> > +++ b/tests/ref/fate/mxf-reel_name
> > @@ -1 +1 @@
> > -422d6ed4821e7bbecbcdecc553abc6e4
> > +ce49a0361d3f79106e1952d387eace51

Re: [FFmpeg-devel] [PATCH] libavformat: add librist protocol

2021-01-30 Thread James Almer

On 1/30/2021 8:57 PM, Marton Balint wrote:



On Tue, 26 Jan 2021, Paul B Mahol wrote:


This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol 
---
configure   |   5 +
doc/protocols.texi  |  32 +
libavformat/Makefile    |   1 +
libavformat/librist.c   | 251 
libavformat/protocols.c |   1 +
5 files changed, 290 insertions(+)
create mode 100644 libavformat/librist.c



[...]


+typedef struct RISTContext {
+    const AVClass *class;
+
+    int profile;
+    int buffer_size;
+    int packet_size;
+    int log_level;
+    int encryption;
+    char *secret;
+
+    struct rist_logging_settings logging_settings;
+    struct rist_peer_config peer_config;


Can you avoid these on the stack? If librist adds new members to them, 
this might break, and there is now API for freeing them properly.


Not against this suggestion, but it should be ok to have them in stack.
For rist_peer_config, he's calling rist_peer_config_defaults_set() first 
thing on the struct, so any new field will always be properly 
initialized by the library. And rist_logging_settings is zeroed by 
rist_logging_set() in the scenario where it allocs it, so it's the same 
as zeroing it ourselves as part of the RISTContext allocation.


Any changes to either struct should go alongside a soname bump in 
librist, too.




Thanks,
Marton
___
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".

[FFmpeg-devel] [PATCH] ffmpeg: remove dead code for -vol

2021-01-30 Thread Gyan Doshi
It is applied via configure_input_audio_filter()
---
 fftools/ffmpeg_filter.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index e9e31e043e..1cba3055cc 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -641,13 +641,6 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 pad_idx = 0;
 }
 
-if (audio_volume != 256 && 0) {
-char args[256];
-
-snprintf(args, sizeof(args), "%f", audio_volume / 256.);
-AUTO_INSERT_FILTER("-vol", "volume", args);
-}
-
 if (ost->apad && of->shortest) {
 char args[256];
 int i;
-- 
2.30.0

___
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".