[FFmpeg-devel] [PATCH] libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.

2023-06-19 Thread toots
From: Romain Beauxis 

Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams
in mpegts (commit 4a4437c0fbc8f7afe0c533070395a42e56b4ee75), 
AV_CODEC_ID_SMPTE_KLV
was the only existing codec for metadata.

It seems that this codec has a 5-bytes metadata header[1] that, for some reason,
was always skipped when decoding data packets.

However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the
5 first bytes of the payload being cut-off, which includes essential 
informations
such as the ID3 tag version.

This patch fixes the issue by keeping the 5-bytes skip only for 
AV_CODEC_ID_SMPTE_KLV
streams.

To test:
1. download this file: https://www.dropbox.com/s/jy8sih3pe8qskxb/bla.ts?dl=1

This file was download from: 
http://playertest.longtailvideo.com/adaptive/wowzaid3/playlist.m3u8

2. run this command:
  ffprobe -show_streams -select_streams 0 -show_packets -show_private_data \
  -show_data /path/to/bla.ts

Before:
[PACKET]
codec_type=data
stream_index=0
pts=494646418
pts_time=5496.071311
dts=494646418
dts_time=5496.071311
duration=N/A
duration_time=N/A
size=21
pos=482784
flags=K__
data=
:   1054 4954 3200  0600 0003  .TIT2...
0010: 7465 7374 00 test.

After:
[PACKET]
codec_type=data
stream_index=0
pts=494646418
pts_time=5496.071311
dts=494646418
dts_time=5496.071311
duration=N/A
duration_time=N/A
size=26
pos=482784
flags=K__
data=
: 4944 3304   0010 5449 5432   ID3...TIT2..
0010: 0006  0374 6573 7400 .test.

---
 libavformat/mpegts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index fb8b0bf8fd..0b3edda817 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1305,7 +1305,7 @@ skip:
 p += sl_header_bytes;
 buf_size -= sl_header_bytes;
 }
-if (pes->stream_type == 0x15 && buf_size >= 5) {
+if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && 
buf_size >= 5) {
 /* skip metadata access unit header */
 pes->pes_header_size += 5;
 p += 5;
-- 
2.39.2 (Apple Git-143)

___
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 v2 1/3] avutil/hwcontext_qsv: register free function for device_derive

2023-06-19 Thread Xiang, Haihao
On Ma, 2023-06-19 at 14:15 +0800, Tong Wu wrote:
> When qsv device is created by device_derive, the ctx->free function is
> not registered, causing potential memory leak because of not properly
> closing the MFX session.
> 
> Signed-off-by: Tong Wu 
> Signed-off-by: Wenbin Chen 
> ---
>  libavutil/hwcontext_qsv.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index 4ed4242ddf..878ecd886e 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -2094,6 +2094,15 @@ static int qsv_device_derive(AVHWDeviceContext *ctx,
>   AVDictionary *opts, int flags)
>  {
>  mfxIMPL impl;
> +    QSVDevicePriv *priv;
> +
> +    priv = av_mallocz(sizeof(*priv));
> +    if (!priv)
> +    return AVERROR(ENOMEM);
> +
> +    ctx->user_opaque = priv;
> +    ctx->free = qsv_device_free;
> +    
>  impl = choose_implementation("hw_any", child_device_ctx->type);
>  return qsv_device_derive_from_child(ctx, impl,
>  child_device_ctx, flags);

Patchset LGTM and will apply

Thanks
Haihao


___
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 v2 1/3] lavfi/vaapi: Add function to get surface ID from AVFrame

2023-06-19 Thread Xiang, Haihao
On Vr, 2023-06-16 at 08:58 +0800, Fei Wang wrote:
> Signed-off-by: Fei Wang 
> ---
>  libavfilter/vaapi_vpp.c | 10 ++
>  libavfilter/vaapi_vpp.h |  5 +
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
> index a323dab8b8..10d31977c6 100644
> --- a/libavfilter/vaapi_vpp.c
> +++ b/libavfilter/vaapi_vpp.c
> @@ -518,7 +518,6 @@ int ff_vaapi_vpp_init_params(AVFilterContext *avctx,
>   AVFrame *output_frame)
>  {
>  VAAPIVPPContext *ctx = avctx->priv;
> -    VASurfaceID input_surface;
>  int err;
>  
>  ctx->input_region = (VARectangle) {
> @@ -534,10 +533,8 @@ int ff_vaapi_vpp_init_params(AVFilterContext *avctx,
>  output_frame->crop_left   = 0;
>  output_frame->crop_right  = 0;
>  
> -    input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3],
> -
>  *params = (VAProcPipelineParameterBuffer) {
> -    .surface = input_surface,
> +    .surface = ff_vaapi_vpp_get_surface_id(input_frame),
>  .surface_region  = &ctx->input_region,
>  .output_region   = NULL,
>  .output_background_color = VAAPI_VPP_BACKGROUND_BLACK,
> @@ -623,7 +620,6 @@ int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx,
>   AVFrame *output_frame)
>  {
>  VAAPIVPPContext *ctx = avctx->priv;
> -    VASurfaceID output_surface;
>  VABufferID *params_ids;
>  VAStatus vas;
>  int err;
> @@ -635,10 +631,8 @@ int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx,
>  for (int i = 0; i < cout; i++)
>  params_ids[i] = VA_INVALID_ID;
>  
> -    output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
> -
>  vas = vaBeginPicture(ctx->hwctx->display,
> - ctx->va_context, output_surface);
> + ctx->va_context,
> ff_vaapi_vpp_get_surface_id(output_frame));
>  if (vas != VA_STATUS_SUCCESS) {
>  av_log(avctx, AV_LOG_ERROR, "Failed to attach new picture: "
>     "%d (%s).\n", vas, vaErrorStr(vas));
> diff --git a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h
> index ead07036dc..cc845b854c 100644
> --- a/libavfilter/vaapi_vpp.h
> +++ b/libavfilter/vaapi_vpp.h
> @@ -27,6 +27,11 @@
>  
>  #include "avfilter.h"
>  
> +static inline VASurfaceID ff_vaapi_vpp_get_surface_id(const AVFrame *frame)
> +{
> +    return (uintptr_t)frame->data[3];
> +}
> +
>  // ARGB black, for VAProcPipelineParameterBuffer.output_background_color.
>  #define VAAPI_VPP_BACKGROUND_BLACK 0xff00
>  

Patchset LGTM and will apply.

Thanks
Haihao


___
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 1/6] lavfi/qsvvpp: track the runtime version in vpp context

2023-06-19 Thread Xiang, Haihao
On Ma, 2023-06-19 at 04:46 +, Xiang, Haihao wrote:
> On Ma, 2023-06-12 at 16:14 +0800, Xiang, Haihao wrote:
> > From: Haihao Xiang 
> > 
> > We may check whether a feature is supported via the runtime version in
> > future.
> > 
> > Signed-off-by: Haihao Xiang 
> > ---
> >  libavfilter/qsvvpp.c | 6 ++
> >  libavfilter/qsvvpp.h | 2 ++
> >  2 files changed, 8 insertions(+)
> > 
> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> > index b233b81243..779afce66d 100644
> > --- a/libavfilter/qsvvpp.c
> > +++ b/libavfilter/qsvvpp.c
> > @@ -655,6 +655,12 @@ static int init_vpp_session(AVFilterContext *avctx,
> > QSVVPPContext *s)
> >  if (ret)
> >  return ret;
> >  
> > +    ret = MFXQueryVersion(s->session, &s->ver);
> > +    if (ret != MFX_ERR_NONE) {
> > +    av_log(avctx, AV_LOG_ERROR, "Error querying the runtime
> > version\n");
> > +    return AVERROR_UNKNOWN;
> > +    }
> > +
> >  if (handle) {
> >  ret = MFXVideoCORE_SetHandle(s->session, handle_type, handle);
> >  if (ret != MFX_ERR_NONE)
> > diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
> > index 3b32193744..8851185ff3 100644
> > --- a/libavfilter/qsvvpp.h
> > +++ b/libavfilter/qsvvpp.h
> > @@ -83,6 +83,8 @@ typedef struct QSVVPPContext {
> >  int eof;
> >  /** order with frame_out, sync */
> >  AVFifo *async_fifo;
> > +
> > +    mfxVersion ver;
> >  } QSVVPPContext;
> >  
> >  typedef struct QSVVPPCrop {
> 
> Will apply 

Pushed, 

-Haihao


___
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 v2] lavf/rtpenc_jpeg: Retrieve sampling factor from SOF0

2023-06-19 Thread Xiang, Haihao
On Ma, 2023-06-12 at 02:46 +, Xiang, Haihao wrote:
> On Wo, 2023-01-11 at 01:35 +, Yeoh, Hoong Tee wrote:
> > In ff_rtp_send_jpeg, the type is defined based on PIX_FMT and
> > color-range parsed in. There is limitation on current design
> > where need to include support newly introduced PIX_FMT such as
> > AV_PIX_FMT_QSV and there might be more and more in future. Hence,
> > retrive the sampling factor from SOF0 in JPEG compressed header
> > directly. This introduces flexibility to handle different type of
> > new codec introduced in future.
> > 
> > Signed-off-by: Yeoh, Hoong Tee 
> > ---
> >  libavformat/rtpenc_jpeg.c | 41 +--
> >  1 file changed, 26 insertions(+), 15 deletions(-)
> > 
> > diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
> > index 9111683..53be188 100644
> > --- a/libavformat/rtpenc_jpeg.c
> > +++ b/libavformat/rtpenc_jpeg.c
> > @@ -30,7 +30,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t
> > *buf, int size)
> >  RTPMuxContext *s = s1->priv_data;
> >  const uint8_t *qtables[4] = { NULL };
> >  int nb_qtables = 0;
> > -    uint8_t type;
> > +    uint8_t type = 2; /* initialized non-0/1 value for RTP/JPEG type
> > check*/
> >  uint8_t w, h;
> >  uint8_t *p;
> >  int off = 0; /* fragment offset of the current JPEG frame */
> > @@ -45,20 +45,6 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t
> > *buf, int size)
> >  w = AV_CEIL_RSHIFT(s1->streams[0]->codecpar->width, 3);
> >  h = AV_CEIL_RSHIFT(s1->streams[0]->codecpar->height, 3);
> >  
> > -    /* get the pixel format type or fail */
> > -    if (s1->streams[0]->codecpar->format == AV_PIX_FMT_YUVJ422P ||
> > -    (s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG &&
> > - s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV422P)) {
> > -    type = 0;
> > -    } else if (s1->streams[0]->codecpar->format == AV_PIX_FMT_YUVJ420P ||
> > -   (s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG
> > &&
> > -    s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV420P)) {
> > -    type = 1;
> > -    } else {
> > -    av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n");
> > -    return;
> > -    }
> > -
> >  /* preparse the header for getting some info */
> >  for (i = 0; i < size; i++) {
> >  if (buf[i] != 0xff)
> > @@ -90,6 +76,23 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t
> > *buf, int size)
> >     "Only 1x1 chroma blocks are supported. Aborted!\n");
> >  return;
> >  }
> > +
> > +   /*
> > +    * Find out the sampling factor in SOF0.
> > +    * In SOF0, hsample/vsample is inserted in form of (2<<4) |
> > (type
> > ? 2 : 1).
> > +    * First 4-bit is hsample while Last 4-bit is vsample.
> > +    */
> > +
> > +    /* Luma channel sampling factor in 4:2:2 chroma subsampling are
> > 2x1 */
> > +    if (buf[i + 11] == 33) {
> > +    type = 0;
> > +    /* Luma channel sampling factor in 4:2:0 chroma subsampling are
> > 2x2 */
> > +    } else if (buf[i + 11] == 34) {
> > +    type = 1;
> > +    } else {
> > +    av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n");
> > +    return;
> > +    }
> >  } else if (buf[i + 1] == DHT) {
> >  int dht_size = AV_RB16(&buf[i + 2]);
> >  default_huffman_tables |= 1 << 4;
> > @@ -163,6 +166,14 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
> > uint8_t
> > *buf, int size)
> >  break;
> >  }
> >  }
> > +
> > +    /* Check validity of RTP/JPEG type */
> > +    if (type != 0 && type != 1) {
> > +    av_log(s1, AV_LOG_ERROR,
> > +    "Invalid RTP/JPEG type\n");
> > +    return;
> > +    }
> > +
> >  if (default_huffman_tables && default_huffman_tables != 31) {
> >  av_log(s1, AV_LOG_ERROR,
> >     "RFC 2435 requires standard Huffman tables for jpeg\n");
> 
> 
> Sorry to pick up this old thread. This patch looks good and works well for me.
> I
> will merge it if no one objects in a few days. 
> 

Applied, thx. 

___
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 v2] avformat/ivfenc: Set the "number of frames" in IVF header

2023-06-19 Thread Dai, Jianhui J



> -Original Message-
> From: Dai, Jianhui J 
> Sent: Monday, June 5, 2023 8:54 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [PATCH v2] avformat/ivfenc: Set the "number of frames" in IVF header
> 
> Should set "number of frames" to bytes 24-27 of IVF header, not duration.
> It is described by [1], and confirmed by parsing all IVF files in [2].
> 
> This commit also updates the md5sum of refs to pass fate-cbs.
> 
> [1] Duck IVF - MultimediaWiki
> https://wiki.multimedia.cx/index.php/Duck_IVF
> 
> [2] webm/vp8-test-vectors
> https://chromium.googlesource.com/webm/vp8-test-vectors
> 
> Signed-off-by: Jianhui Dai 
> ---
>  libavformat/ivfdec.c|  1 +
>  libavformat/ivfenc.c| 13 +
>  tests/ref/fate/cbs-vp9-vp90-2-03-deltaq |  2 +-
>  tests/ref/fate/cbs-vp9-vp90-2-06-bilinear   |  2 +-
>  tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas  |  2 +-
>  .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame  |  2 +-
>  .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2 |  2 +-  
> tests/ref/fate/cbs-
> vp9-vp90-2-segmentation-aq-akiyo |  2 +-  tests/ref/fate/cbs-vp9-vp90-2-
> segmentation-sf-akiyo |  2 +-
>  tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian |  2 +-
>  tests/ref/fate/cbs-vp9-vp91-2-04-yuv440 |  2 +-
>  tests/ref/fate/cbs-vp9-vp91-2-04-yuv444 |  2 +-
>  tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420   |  2 +-
>  tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422   |  2 +-
>  tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444   |  2 +-
>  15 files changed, 19 insertions(+), 21 deletions(-)
> 
> diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index
> 511f2387ed..01012db948 100644
> --- a/libavformat/ivfdec.c
> +++ b/libavformat/ivfdec.c
> @@ -53,6 +53,7 @@ static int read_header(AVFormatContext *s)
>  st->codecpar->height = avio_rl16(s->pb);
>  time_base.den = avio_rl32(s->pb);
>  time_base.num = avio_rl32(s->pb);
> +// Infer duration from "number of frames".
>  st->duration  = avio_rl32(s->pb);
>  avio_skip(s->pb, 4); // unused
> 
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index
> 47b4efbcd1..88399099d4 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -72,7 +72,8 @@ static int ivf_write_header(AVFormatContext *s)
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
>  avio_wl32(pb, s->streams[0]->time_base.num);
> -avio_wl64(pb, 0xULL); // length is overwritten at the 
> end of
> muxing
> +avio_wl32(pb, 0x); // "number of frames" is overwritten at the 
> end
> of muxing
> +avio_wl32(pb, 0); // unused
> 
>  return 0;
>  }
> @@ -99,16 +100,12 @@ static int ivf_write_trailer(AVFormatContext *s)
>  AVIOContext *pb = s->pb;
>  IVFEncContext *ctx = s->priv_data;
> 
> -if ((pb->seekable & AVIO_SEEKABLE_NORMAL) &&
> -(ctx->frame_cnt > 1 || (ctx->frame_cnt == 1 && 
> ctx->last_pkt_duration))) {
> +// overwrite the "number of frames"
> +if ((pb->seekable & AVIO_SEEKABLE_NORMAL)) {
>  int64_t end = avio_tell(pb);
> 
>  avio_seek(pb, 24, SEEK_SET);
> -// overwrite the "length" field (duration)
> -avio_wl32(pb, ctx->last_pkt_duration ?
> -  ctx->sum_delta_pts + ctx->last_pkt_duration :
> -  ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 
> 1));
> -avio_wl32(pb, 0); // zero out unused bytes
> +avio_wl32(pb, ctx->frame_cnt);
>  avio_seek(pb, end, SEEK_SET);
>  }
> 
> diff --git a/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq b/tests/ref/fate/cbs-vp9-
> vp90-2-03-deltaq
> index db09cfd5e0..f621d7a480 100644
> --- a/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq
> +++ b/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq
> @@ -1 +1 @@
> -bb630ef560f83951fa6547a664fdb636
> +fe62460fe28202e0666e628afd8602ca
> diff --git a/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear 
> b/tests/ref/fate/cbs-vp9-
> vp90-2-06-bilinear
> index f579459179..9359e21e40 100644
> --- a/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear
> +++ b/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear
> @@ -1 +1 @@
> -2ca9d012c7212e38f5e2727ac66ec6c5
> +179e228004c396a301c89f34b6c72f68
> diff --git a/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas 
> b/tests/ref/fate/cbs-vp9-
> vp90-2-09-lf_deltas
> index e0b5686d0b..5b21675c76 100644
> --- a/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas
> +++ b/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas
> @@ -1 +1 @@
> -78f5e46bfaecbcd62b9126697a0d97b7
> +1d1f0768c547461ae2abef57f0aabc24
> diff --git a/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame
> b/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame
> index 4a4d752428..19b7a78dd8 100644
> --- a/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame
> +++ b/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame
> @@ -1 +1 @@
> -eea9d10a696c6ed971e4fae9fb619b10
> +13fa042ee1b4079c227a5c5c96e2

Re: [FFmpeg-devel] [PATCH v3] avcodec/cbs_vp8: Add support for VP8 codec bitstream READ methods

2023-06-19 Thread Dai, Jianhui J



> -Original Message-
> From: Dai, Jianhui J
> Sent: Thursday, June 8, 2023 11:18 AM
> To: FFmpeg development discussions and patches 
> Subject: RE: [PATCH v3] avcodec/cbs_vp8: Add support for VP8 codec bitstream
> READ methods
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Dai,
> > Jianhui J
> > Sent: Tuesday, May 30, 2023 4:00 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v3] avcodec/cbs_vp8: Add support for
> > VP8 codec bitstream READ methods
> >
> > This commit adds VP8 into cbs supported codec list, and enables the
> > `trace_headers` bitstream filters to support VP8, besides existing
> > AV1, H.264,
> > H.265 and VP9. It can be useful to debug VP8 stream issues.
> >
> > Only the READ methods `read_unit` and `split_fragment` are
> > implemented, the WRITE methods `write_unit` and `assemble_fragment`
> > return `AVERROR_PATCHWELCOME` error code. It is because the CBS VP8
> > WRITE is unlikely used by any applications at the moment. The WRITE
> > methods can be added later if there are real requirments.
> >
> > TESTS: ffmpeg -i fate-suite/vp8/frame_size_change.webm -vcodec copy
> > -bsf:v trace_headers -f null -
> >
> > Signed-off-by: Jianhui Dai 
> > ---
> >  configure|   4 +-
> >  libavcodec/Makefile  |   1 +
> >  libavcodec/cbs.c |   6 +
> >  libavcodec/cbs_internal.h|   1 +
> >  libavcodec/cbs_vp8.c | 360 +++
> >  libavcodec/cbs_vp8.h | 112 +
> >  libavcodec/cbs_vp8_syntax_template.c | 224 +
> >  7 files changed, 707 insertions(+), 1 deletion(-)  create mode 100644
> > libavcodec/cbs_vp8.c  create mode 100644 libavcodec/cbs_vp8.h  create
> > mode
> > 100644 libavcodec/cbs_vp8_syntax_template.c
> >
> > diff --git a/configure b/configure
> > index bb7be67676..b8960d2639 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2432,6 +2432,7 @@ CONFIG_EXTRA="
> >  cbs_h265
> >  cbs_jpeg
> >  cbs_mpeg2
> > +cbs_vp8
> >  cbs_vp9
> >  deflate_wrapper
> >  dirac_parse
> > @@ -2713,6 +2714,7 @@ cbs_h264_select="cbs"
> >  cbs_h265_select="cbs"
> >  cbs_jpeg_select="cbs"
> >  cbs_mpeg2_select="cbs"
> > +cbs_vp8_select="cbs"
> >  cbs_vp9_select="cbs"
> >  dct_select="rdft"
> >  deflate_wrapper_deps="zlib"
> > @@ -3284,7 +3286,7 @@ h264_redundant_pps_bsf_select="cbs_h264"
> >  hevc_metadata_bsf_select="cbs_h265"
> >  mjpeg2jpeg_bsf_select="jpegtables"
> >  mpeg2_metadata_bsf_select="cbs_mpeg2"
> > -trace_headers_bsf_select="cbs"
> > +trace_headers_bsf_select="cbs cbs_vp8"
> >  vp9_metadata_bsf_select="cbs_vp9"
> >
> >  # external libraries
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile index
> > 3cfb7e..1c4f0da1d2 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -78,6 +78,7 @@ OBJS-$(CONFIG_CBS_H264)+= cbs_h2645.o
> > cbs_sei.o h2645_parse.o
> >  OBJS-$(CONFIG_CBS_H265)+= cbs_h2645.o cbs_sei.o 
> > h2645_parse.o
> >  OBJS-$(CONFIG_CBS_JPEG)+= cbs_jpeg.o
> >  OBJS-$(CONFIG_CBS_MPEG2)   += cbs_mpeg2.o
> > +OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vpx_rac.o
> >  OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
> >  OBJS-$(CONFIG_CRYSTALHD)   += crystalhd.o
> >  OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
> > diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index
> > 504197e06d..c77110abb1
> > 100644
> > --- a/libavcodec/cbs.c
> > +++ b/libavcodec/cbs.c
> > @@ -46,6 +46,9 @@ static const CodedBitstreamType *const
> > cbs_type_table[] = {  #if CONFIG_CBS_MPEG2
> >  &ff_cbs_type_mpeg2,
> >  #endif
> > +#if CONFIG_CBS_VP8
> > +&ff_cbs_type_vp8,
> > +#endif
> >  #if CONFIG_CBS_VP9
> >  &ff_cbs_type_vp9,
> >  #endif
> > @@ -67,6 +70,9 @@ const enum AVCodecID ff_cbs_all_codec_ids[] = {  #if
> > CONFIG_CBS_MPEG2
> >  AV_CODEC_ID_MPEG2VIDEO,
> >  #endif
> > +#if CONFIG_CBS_VP8
> > +AV_CODEC_ID_VP8,
> > +#endif
> >  #if CONFIG_CBS_VP9
> >  AV_CODEC_ID_VP9,
> >  #endif
> > diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h
> > index
> > e585c77934..beaf8505d1 100644
> > --- a/libavcodec/cbs_internal.h
> > +++ b/libavcodec/cbs_internal.h
> > @@ -247,6 +247,7 @@ extern const CodedBitstreamType ff_cbs_type_h264;
> > extern const CodedBitstreamType ff_cbs_type_h265;  extern const
> > CodedBitstreamType ff_cbs_type_jpeg;  extern const CodedBitstreamType
> > ff_cbs_type_mpeg2;
> > +extern const CodedBitstreamType ff_cbs_type_vp8;
> >  extern const CodedBitstreamType ff_cbs_type_vp9;
> >
> >
> > diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c new file mode
> > 100644 index 00..a890590cd9
> > --- /dev/null
> > +++ b/libavcodec/cbs_vp8.c
> > @@ -0,0 +1,360 @@
> > +/*
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg is free software; you can redistribute it and/or
> > 

[FFmpeg-devel] [PATCH] lavu/tx: make 32-bit fixed-point transforms more bitexact

2023-06-19 Thread Lynne
Using the sqrt/cos/sin approximations we have, the only parts left
which may be inexact are multiplies and divisions in some transforms.

Patch attached.

>From b2fd8fde86d421109d7922ded7b4691384af2214 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Tue, 20 Jun 2023 02:47:17 +0200
Subject: [PATCH] lavu/tx: make 32-bit fixed-point transforms more bitexact

Using the sqrt/cos/sin approximations we have, the only parts left
which may be inexact are multiplies and divisions in some transforms.
---
 libavutil/tx_priv.h   |  2 ++
 libavutil/tx_template.c   | 38 +++
 tests/fate/ac3.mak|  2 +-
 tests/ref/fate/unknown_layout-ac3 |  2 +-
 tests/ref/lavf/rm |  2 +-
 5 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index d5ff8e1421..2f056a777c 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -110,6 +110,8 @@ typedef void TXComplex;
 
 #elif defined(TX_INT32)
 
+#include "softfloat.h"
+
 /* Properly rounds the result */
 #define CMUL(dre, dim, are, aim, bre, bim) \
 do {   \
diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index 983de75a47..719dae2440 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -60,6 +60,17 @@ typedef struct FFTabInitData {
 int factors[TX_MAX_SUB]; /* Must be sorted high -> low */
 } FFTabInitData;
 
+#if defined(TX_INT32)
+static TXSample COS_GEN(double freq)
+{
+int c_f, s_f;
+av_sincos_sf(llrintf(freq * (1 << 30) / M_PI), &s_f, &c_f);
+return av_clip64(((int64_t)c_f) << 1, INT32_MIN, INT32_MAX);
+}
+#else
+#define COS_GEN cos
+#endif
+
 #define SR_TABLE(len)  \
 static av_cold void TX_TAB(ff_tx_init_tab_ ##len)(void)\
 {  \
@@ -67,7 +78,7 @@ static av_cold void TX_TAB(ff_tx_init_tab_ ##len)(void)\
 TXSample *tab = TX_TAB(ff_tx_tab_ ##len);  \
\
 for (int i = 0; i < len/4; i++)\
-*tab++ = RESCALE(cos(i*freq)); \
+*tab++ = COS_GEN(i*freq);  \
\
 *tab = 0;  \
 }
@@ -1903,22 +1914,39 @@ int TX_TAB(ff_tx_mdct_gen_exp)(AVTXContext *s, int *pre_tab)
 {
 int off = 0;
 int len4 = s->len >> 1;
-double scale = s->scale_d;
-const double theta = (scale < 0 ? len4 : 0) + 1.0/8.0;
+const double theta = (s->scale_d < 0 ? len4 : 0) + 1.0/8.0;
 size_t alloc = pre_tab ? 2*len4 : len4;
 
+#if defined(TX_INT32)
+int scale = llrintf(fabs(s->scale_d) * (1 << 30));
+SoftFloat scale_sf = av_int2sf(scale, 30);
+scale_sf = av_sqrt_sf(scale_sf);
+#else
+double scale = sqrt(fabs(s->scale_d));
+#endif
+
 if (!(s->exp = av_malloc_array(alloc, sizeof(*s->exp
 return AVERROR(ENOMEM);
 
-scale = sqrt(fabs(scale));
-
 if (pre_tab)
 off = len4;
 
 for (int i = 0; i < len4; i++) {
 const double alpha = M_PI_2 * (i + theta) / len4;
+
+#if defined(TX_INT32)
+int c_f, s_f;
+SoftFloat cos_sf, sin_sf;
+av_sincos_sf(llrintf(alpha * (1 << 30) / M_PI), &s_f, &c_f);
+cos_sf = av_int2sf(c_f, 30);
+sin_sf = av_int2sf(s_f, 30);
+cos_sf = av_mul_sf(cos_sf, scale_sf);
+sin_sf = av_mul_sf(sin_sf, scale_sf);
+s->exp[off + i] = (TXComplex){ av_sf2int(cos_sf, 30) << 1, av_sf2int(sin_sf, 30) << 1 };
+#else
 s->exp[off + i] = (TXComplex){ RESCALE(cos(alpha) * scale),
RESCALE(sin(alpha) * scale) };
+#endif
 }
 
 if (pre_tab)
diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak
index 2dfd59dfb1..85766e82c7 100644
--- a/tests/fate/ac3.mak
+++ b/tests/fate/ac3.mak
@@ -89,7 +89,7 @@ fate-ac3-fixed-encode: tests/data/asynth-44100-2.wav
 fate-ac3-fixed-encode: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-ac3-fixed-encode: CMD = md5 -i $(SRC) -c ac3_fixed -ab 128k -f ac3 -flags +bitexact -af aresample
 fate-ac3-fixed-encode: CMP = oneline
-fate-ac3-fixed-encode: REF = e9d78bca187b4bbafc4512bcea8efd3e
+fate-ac3-fixed-encode: REF = 3c1781a78ba3ea653c145798511644eb
 
 FATE_EAC3-$(call ALLYES, EAC3_DEMUXER EAC3_MUXER EAC3_CORE_BSF) += fate-eac3-core-bsf
 fate-eac3-core-bsf: CMD = md5pipe -i $(TARGET_SAMPLES)/eac3/the_great_wall_7.1.eac3 -c:a copy -bsf:a eac3_core -fflags +bitexact -f eac3
diff --git a/tests/ref/fate/unknown_layout-ac3 b/tests/ref/fate/unknown_layout-ac3
index a694c52899..c535c4ff05 100644
--- a/tests/ref/fate/unknown_layout-ac3
+++ b/tests/ref/fate/unknown_layout-ac3
@@ -1 +1 @@
-ff7e25844b3cb6abb571ef7e226cbafa
+c40992cfc42a620b

Re: [FFmpeg-devel] [PATCH 1/3] closed caption decoder: accept and decode a new codec type of 'raw 608 byte pairs'

2023-06-19 Thread Roger Pack
OK updated patches to work with latest git master, made coded id less verbose.
These have been tested against a "real device" and seem to work properly.
I'd like to get feedback on the Closed caption decoder first if that's possible.
I pinged the decoder "maintainer" about it once and didn't get a
response so seems it's up to us.

Thank you.
-=roger=-

On Thu, May 7, 2020 at 7:06 AM Paul B Mahol  wrote:
>
> Is it just me, or the coded id is too much verbose?
>
> On 5/7/20, Anton Khirnov  wrote:
> > Quoting Roger Pack (2020-04-28 08:15:19)
> >> From 5d7c12a3f703e794e1092087355bc9523d5f4d93 Mon Sep 17 00:00:00 2001
> >> From: rogerdpack 
> >> Date: Tue, 28 Apr 2020 05:15:15 +
> >> Subject: [PATCH 1/3] closed caption decoder: accept and decode a new codec
> >>  type of 'raw 608 byte pairs'
> >>
> >> Signed-off-by: rogerdpack 
> >> ---
> >> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> >> index e7d6e059db..805e18758b 100644
> >> --- a/libavcodec/codec_id.h
> >> +++ b/libavcodec/codec_id.h
> >> @@ -513,6 +513,7 @@ enum AVCodecID {
> >>
> >>  AV_CODEC_ID_MICRODVD   = 0x17800,
> >>  AV_CODEC_ID_EIA_608,
> >> +AV_CODEC_ID_EIA_608_RAW_BYTE_PAIRS,
> >
> > You can't just add new IDs in the middle of the table, it changes the
> > IDs of all the following codecs which breaks ABI.
> > Add it to the end of the subtitle block.
> >
> > --
> > Anton Khirnov
> > ___
> > 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".


0001-Closed-caption-add-ability-to-read-EIA-608-byte-pair.patch
Description: Binary data


0002-dshow-add-ability-to-capture-closed-caption-EIA-608-.patch
Description: Binary data
___
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] avutil/softfloat: Basic documentation for av_sincos_sf()

2023-06-19 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavutil/softfloat.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 1520027ddc..399ca6d682 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -236,6 +236,10 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
 
 /**
  * Rounding-to-nearest used.
+ *
+ * @param a angle in units of (1ULL<<30)/M_PI radians
+ * @param s pointer to where   sine in units of (1<<30) is returned
+ * @param c pointer to where cosine in units of (1<<30) is returned
  */
 static av_unused void av_sincos_sf(int a, int *s, int *c)
 {
-- 
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 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure

2023-06-19 Thread Michael Niedermayer
On Tue, Jun 20, 2023 at 01:05:45AM +0200, Paul B Mahol wrote:
>  Shouldnt it error out instead?

yes but that would make it slower. Also i think real files (not fuzzeed files)
would use vlc tables that have no "holes" that can generate invalid returns
so the check might on top of being slow also be not that useful.
But i surely can add a check if thats what people prefer?

thx

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure

2023-06-19 Thread Paul B Mahol
 Shouldnt it error out instead?
___
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] avutil/softfloat: fix av_sincos_sf()

2023-06-19 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavutil/softfloat.h   | 2 +-
 libavutil/tests/softfloat.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index a651406f74..1520027ddc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -281,7 +281,7 @@ static av_unused void av_sincos_sf(int a, int *s, int *c)
 (int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) +
 0x400) >> 11);
 
-*c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x2000) >> 30);
+*c = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000) >> 30);
 
 *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000) >> 30);
 }
diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c
index c06de44933..a2e628fe81 100644
--- a/libavutil/tests/softfloat.c
+++ b/libavutil/tests/softfloat.c
@@ -148,7 +148,7 @@ int main(void){
 av_sincos_sf(i*(1ULL<<32)/36/4, &s, &c);
 errs = (double)s/ (1<<30) - sin(i*M_PI/36);
 errc = (double)c/ (1<<30) - cos(i*M_PI/36);
-if (fabs(errs) > 0.0002 || fabs(errc) >0.001) {
+if (fabs(errs) > 0.4 || fabs(errc) >0.4) {
 printf("sincos FAIL %d %f %f %f %f\n", i, (float)s/ (1<<30), 
(float)c/ (1<<30), sin(i*M_PI/36), cos(i*M_PI/36));
 }
 
-- 
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] tools/target_dec_fuzzer: Adjust threshold for speex

2023-06-19 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832

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 42de479829..165951dc9d 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -278,6 +278,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_SCPR:maxpixels  /= 32;break;
 case AV_CODEC_ID_SCREENPRESSO:maxpixels  /= 64;break;
 case AV_CODEC_ID_SIMBIOSIS_IMX:maxpixels /= 16384; break;
+case AV_CODEC_ID_SPEEX:   maxsamples /= 128;   break;
 case AV_CODEC_ID_SMACKAUDIO:  maxsamples /= 4096;  break;
 case AV_CODEC_ID_SMACKVIDEO:  maxpixels  /= 64;break;
 case AV_CODEC_ID_SNOW:maxpixels  /= 128;   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/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure

2023-06-19 Thread Michael Niedermayer
Fixes: left shift of negative value -1
Fixes: 
59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352

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

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 8ba67bbdeb..1a7690da94 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -755,7 +755,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int 
width, int plane)
 }
 }
 if( width&1 && get_bits_left(&s->gb)>0 ) {
-int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
+int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, 
VLC_BITS, 3)<<2;
 s->temp16[0][width-1] = dst + get_bits(&s->gb, 2);
 }
 }
-- 
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] avcodec/jpeg2000htdec: Check for invalid magref length.

2023-06-19 Thread Michael Niedermayer
On Mon, Jun 19, 2023 at 06:47:16PM +0300, Caleb Etemesi wrote:
> Ping on this?

will apply
sorry for not looking sooner, i thought someone else would
thx

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


[FFmpeg-devel] [PATCH 11/17 v2] avformat/evc: don't use an AVIOContext as log context

2023-06-19 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/evc_parse.h | 6 --
 libavformat/evc.c  | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/evc_parse.h b/libavcodec/evc_parse.h
index a1fbbc643d..6fc19d0868 100644
--- a/libavcodec/evc_parse.h
+++ b/libavcodec/evc_parse.h
@@ -89,7 +89,8 @@ static inline int evc_get_nalu_type(const uint8_t *bits, int 
bits_size, void *lo
 unsigned char *p = (unsigned char *)bits;
 // forbidden_zero_bit
 if ((p[0] & 0x80) != 0) {
-av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit header\n");
+if (logctx) // Don't log without a context
+av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit header\n");
 return -1;
 }
 
@@ -105,7 +106,8 @@ static inline uint32_t evc_read_nal_unit_length(const 
uint8_t *bits, int bits_si
 uint32_t nalu_len = 0;
 
 if (bits_size < EVC_NALU_LENGTH_PREFIX_SIZE) {
-av_log(logctx, AV_LOG_ERROR, "Can't read NAL unit length\n");
+if (logctx) // Don't log without a context
+av_log(logctx, AV_LOG_ERROR, "Can't read NAL unit length\n");
 return 0;
 }
 
diff --git a/libavformat/evc.c b/libavformat/evc.c
index 421ff84cb7..caead88bba 100644
--- a/libavformat/evc.c
+++ b/libavformat/evc.c
@@ -361,7 +361,7 @@ int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data,
 evcc_init(&evcc);
 
 while (bytes_to_read > EVC_NALU_LENGTH_PREFIX_SIZE) {
-nalu_size = evc_read_nal_unit_length(data, 
EVC_NALU_LENGTH_PREFIX_SIZE, pb);
+nalu_size = evc_read_nal_unit_length(data, 
EVC_NALU_LENGTH_PREFIX_SIZE, NULL);
 if (nalu_size == 0) break;
 
 data += EVC_NALU_LENGTH_PREFIX_SIZE;
@@ -369,7 +369,7 @@ int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data,
 
 if (bytes_to_read < nalu_size) break;
 
-nalu_type = evc_get_nalu_type(data, bytes_to_read, pb);
+nalu_type = evc_get_nalu_type(data, bytes_to_read, NULL);
 if (nalu_type < EVC_NOIDR_NUT || nalu_type > EVC_UNSPEC_NUT62) {
 ret = AVERROR_INVALIDDATA;
 goto end;
-- 
2.41.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".


Re: [FFmpeg-devel] [PATCH 13/17] avformat/evcdec: simplify probe function

2023-06-19 Thread James Almer

On 6/19/2023 5:29 PM, Michael Niedermayer wrote:

On Sun, Jun 18, 2023 at 08:43:28PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  libavformat/evcdec.c | 29 +++--
  1 file changed, 7 insertions(+), 22 deletions(-)


This or the previous might cause "Invalid NAL unit header" noise
from tools/probetest 256 4096
(not 100% sure as some patches didnt apply so maybe my tree was
broken) just reporting (please ignore if it doesnt reproduce)

thx


It was patch 11/17. Forgot to add a logctx in evc_get_nalu_type().
Fixed locally.
___
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 13/17] avformat/evcdec: simplify probe function

2023-06-19 Thread Michael Niedermayer
On Sun, Jun 18, 2023 at 08:43:28PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavformat/evcdec.c | 29 +++--
>  1 file changed, 7 insertions(+), 22 deletions(-)

This or the previous might cause "Invalid NAL unit header" noise
from tools/probetest 256 4096
(not 100% sure as some patches didnt apply so maybe my tree was
broken) just reporting (please ignore if it doesnt reproduce)

thx

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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 4/6] avcodec/evc_parse: Check log2_sub_gop_length

2023-06-19 Thread James Almer

On 6/18/2023 8:01 PM, James Almer wrote:

On 6/18/2023 7:27 PM, James Almer wrote:

On 6/18/2023 6:50 PM, Michael Niedermayer wrote:
Fixes: 1.70141e+38 is outside the range of representable values of 
type 'int'
Fixes: 
59883/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-5557887217565696


Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Signed-off-by: Michael Niedermayer 
---
  libavcodec/evc_parse.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/libavcodec/evc_parse.c b/libavcodec/evc_parse.c
index 44be5c5291..822b236423 100644
--- a/libavcodec/evc_parse.c
+++ b/libavcodec/evc_parse.c
@@ -277,6 +277,8 @@ EVCParserSPS *ff_evc_parse_sps(EVCParserContext 
*ctx, const uint8_t *bs, int bs_

  if (!sps->sps_pocs_flag || !sps->sps_rpl_flag) {
  sps->log2_sub_gop_length = get_ue_golomb(&gb);
+    if (sps->log2_sub_gop_length > 5U)
+    return NULL;
  if (sps->log2_sub_gop_length == 0)
  sps->log2_ref_pic_gap_length = get_ue_golomb(&gb);
  }


LGTM, but please let me apply it as part of my evc patchset to prevent 
conflicts.


Actually, this is leaving the SPS allocated in the array, which should 
be freed if we're going to start erroring out on failed range checks.

I'll amend it before applying it.


Applied.
___
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 1/3] avcodec/evc_frame_merge: use av_fast_realloc()

2023-06-19 Thread James Almer

On 6/17/2023 12:18 PM, James Almer wrote:

Signed-off-by: James Almer 
---
  libavcodec/evc_frame_merge_bsf.c | 24 
  1 file changed, 8 insertions(+), 16 deletions(-)


Will apply the first ten patches.
___
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] libavfilter/vf_drawtext: add letter_spacing as an evaluated parameter

2023-06-19 Thread Mark Ren
Ah alright I see. When might that push come through and is there somewhere
I can look at the kind of changes in the meantime?

On Mon, Jun 19, 2023 at 12:39 PM Paul B Mahol  wrote:

>
>
> On Mon, Jun 19, 2023 at 6:34 PM Mark Ren  wrote:
>
>> When enabled it will add pixels (or subtract if given a negative value)
>> between each letters,
>> set use_kerning to false,
>> and add the pixels to text_w.
>>
>
> Conflicts with big drawtext filter set that will be pushed soon.
>
>
>>
>> Signed-off-by: Mark Ren 
>> ---
>>  libavfilter/vf_drawtext.c | 24 
>>  1 file changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
>> index 71ab851462..ec8313820d 100644
>> --- a/libavfilter/vf_drawtext.c
>> +++ b/libavfilter/vf_drawtext.c
>> @@ -183,6 +183,7 @@ typedef struct DrawTextContext {
>>  unsigned int fontsize;  ///< font size to use
>>  unsigned int default_fontsize;  ///< default font size to use
>>
>> +int letter_spacing; ///< letter spacing in pixels
>>  int line_spacing;   ///< lines spacing in pixels
>>  short int draw_box; ///< draw box around text - true or
>> false
>>  int boxborderw; ///< box border width
>> @@ -208,6 +209,8 @@ typedef struct DrawTextContext {
>>  char   *a_expr;
>>  AVExpr *a_pexpr;
>>  int alpha;
>> +char* letter_spacing_expr;  ///< expression for letter spacing
>> +AVExpr* letter_spacing_pexpr;   ///< parsed expression for letter
>> spacing
>>  AVLFG  prng;///< random
>>  char   *tc_opt_string;  ///< specified timecode option string
>>  AVRational  tc_rate;///< frame rate for timecode
>> @@ -237,6 +240,7 @@ static const AVOption drawtext_options[]= {
>>  {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba),
>>  AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0, FLAGS},
>>  {"box", "set box",  OFFSET(draw_box),
>>  AV_OPT_TYPE_BOOL,   {.i64=0}, 0,1   , FLAGS},
>>  {"boxborderw",  "set box border width", OFFSET(boxborderw),
>>  AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,  INT_MAX , FLAGS},
>> +{"letter_spacing", "set letter spacing in pixels",
>> OFFSET(letter_spacing_expr), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS},
>>  {"line_spacing",  "set line spacing in pixels",
>> OFFSET(line_spacing),   AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,
>> INT_MAX,FLAGS},
>>  {"fontsize","set font size",OFFSET(fontsize_expr),
>> AV_OPT_TYPE_STRING, {.str=NULL},  0, 0 , FLAGS},
>>  {"x",   "set x expression", OFFSET(x_expr),
>>  AV_OPT_TYPE_STRING, {.str="0"},   0, 0, FLAGS},
>> @@ -812,7 +816,7 @@ static av_cold int init(AVFilterContext *ctx)
>> FT_STROKER_LINEJOIN_ROUND, 0);
>>  }
>>
>> -s->use_kerning = FT_HAS_KERNING(s->face);
>> +s->use_kerning = FT_HAS_KERNING(s->face) && !s->letter_spacing;
>>
>>  /* load the fallback glyph with code 0 */
>>  load_glyph(ctx, NULL, 0);
>> @@ -857,8 +861,9 @@ static av_cold void uninit(AVFilterContext *ctx)
>>  av_expr_free(s->y_pexpr);
>>  av_expr_free(s->a_pexpr);
>>  av_expr_free(s->fontsize_pexpr);
>> +av_expr_free(s->letter_spacing_pexpr);
>>
>> -s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr = NULL;
>> +s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr =
>> s->letter_spacing_pexpr = NULL;
>>
>>  av_freep(&s->positions);
>>  s->nb_positions = 0;
>> @@ -903,13 +908,16 @@ static int config_input(AVFilterLink *inlink)
>>  av_expr_free(s->x_pexpr);
>>  av_expr_free(s->y_pexpr);
>>  av_expr_free(s->a_pexpr);
>> -s->x_pexpr = s->y_pexpr = s->a_pexpr = NULL;
>> +av_expr_free(s->letter_spacing_pexpr);
>> +s->x_pexpr = s->y_pexpr = s->a_pexpr = s->letter_spacing_pexpr =
>> NULL;
>>
>>  if ((ret = av_expr_parse(&s->x_pexpr, expr = s->x_expr, var_names,
>>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0
>> ||
>>  (ret = av_expr_parse(&s->y_pexpr, expr = s->y_expr, var_names,
>>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0
>> ||
>>  (ret = av_expr_parse(&s->a_pexpr, expr = s->a_expr, var_names,
>> + NULL, NULL, fun2_names, fun2, 0, ctx)) < 0
>> ||
>> +(ret = av_expr_parse(&s->letter_spacing_pexpr, expr =
>> s->letter_spacing_expr, var_names,
>>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0)
>> {
>>  av_log(ctx, AV_LOG_ERROR, "Failed to parse expression: %s \n",
>> expr);
>>  return AVERROR(EINVAL);
>> @@ -1525,6 +1533,9 @@ continue_on_invalid2:
>>  dummy.fontsize = s->fontsize;
>>  glyph = av_tree_find(s->glyphs, &dummy, glyph_cmp, NULL);
>>
>> +/* letter spacing */
>> +x += s->letter_spacing;
>> +
>>  /* kerning */
>>  if (s->use_kernin

Re: [FFmpeg-devel] [PATCH 3/6] avformat/jpegxl_anim_dec: add FF_JPEGXL_CONTAINER_SIGNATURE_LE

2023-06-19 Thread Michael Niedermayer
On Sun, Jun 18, 2023 at 06:57:58PM -0400, Leo Izen wrote:
> On 6/18/23 17:50, Michael Niedermayer wrote:
> > Fixes: out of array read
> > Fixes: 
> > 59828/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5029813220671488
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavformat/jpegxl_anim_dec.c | 13 +++--
> >   1 file changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c
> > index c62b596f76..7e4d39385c 100644
> > --- a/libavformat/jpegxl_anim_dec.c
> > +++ b/libavformat/jpegxl_anim_dec.c
> > @@ -108,7 +108,7 @@ static int jpegxl_collect_codestream_header(const 
> > uint8_t *input_buffer, int inp
> >   static int jpegxl_anim_probe(const AVProbeData *p)
> >   {
> > -uint8_t buffer[4096];
> > +uint8_t buffer[4096 + AV_INPUT_BUFFER_PADDING_SIZE];
> >   int copied;
> >   /* this is a raw codestream */
> > @@ -123,7 +123,7 @@ static int jpegxl_anim_probe(const AVProbeData *p)
> >   if (AV_RL64(p->buf) != FF_JPEGXL_CONTAINER_SIGNATURE_LE)
> >   return 0;
> > -if (jpegxl_collect_codestream_header(p->buf, p->buf_size, buffer, 
> > sizeof(buffer), &copied) <= 0 || copied <= 0)
> > +if (jpegxl_collect_codestream_header(p->buf, p->buf_size, buffer, 
> > sizeof(buffer) - AV_INPUT_BUFFER_PADDING_SIZE, &copied) <= 0 || copied <= 0)
> >   return 0;
> >   if (ff_jpegxl_verify_codestream_header(buffer, copied, 0) >= 1)
> > @@ -138,7 +138,8 @@ static int jpegxl_anim_read_header(AVFormatContext *s)
> >   AVIOContext *pb = s->pb;
> >   AVStream *st;
> >   int offset = 0;
> > -uint8_t head[256];
> > +uint8_t head[256 + AV_INPUT_BUFFER_PADDING_SIZE];
> > +const int sizeofhead = sizeof(head) - AV_INPUT_BUFFER_PADDING_SIZE;
> >   int headsize = 0;
> >   int ctrl;
> >   AVRational tb;
> > @@ -147,7 +148,7 @@ static int jpegxl_anim_read_header(AVFormatContext *s)
> >   uint64_t sig16 = avio_rl16(pb);
> >   if (sig16 == FF_JPEGXL_CODESTREAM_SIGNATURE_LE) {
> >   AV_WL16(head, sig16);
> > -headsize = avio_read(s->pb, head + 2, sizeof(head) - 2);
> > +headsize = avio_read(s->pb, head + 2, sizeofhead - 2);
> >   if (headsize < 0)
> >   return headsize;
> >   headsize += 2;
> > @@ -178,10 +179,10 @@ static int jpegxl_anim_read_header(AVFormatContext *s)
> >   if (av_buffer_realloc(&ctx->initial, ctx->initial->size + 
> > read) < 0)
> >   return AVERROR(ENOMEM);
> >   }
> > -jpegxl_collect_codestream_header(buf, read, head + headsize, 
> > sizeof(head) - headsize, &copied);
> > +jpegxl_collect_codestream_header(buf, read, head + headsize, 
> > sizeofhead - headsize, &copied);
> >   memcpy(ctx->initial->data + (ctx->initial->size - read), buf, 
> > read);
> >   headsize += copied;
> > -if (headsize >= sizeof(head) || read < sizeof(buf))
> > +if (headsize >= sizeofhead || read < sizeof(buf))
> >   break;
> >   }
> >   }
> 

> What's with the commit message? Seems unrelated to the change.

Must be some copy and paste mistake



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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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 1/2] lavc/riffenc: Fix msrle support on Windows 95

2023-06-19 Thread Tomas Härdin
mån 2023-06-19 klockan 11:42 -0400 skrev Leo Izen:
> On 6/8/23 07:44, Tomas Härdin wrote:
> > tor 2023-06-08 klockan 13:27 +0200 skrev Paul B Mahol:
> > > But does this break it on other platforms?
> > 
> > That is a good question. What other RIFF decoders are there for
> > which
> > MSRLE support is important and depends on behavior different from
> > VfW?
> > mpv and vlc work just fine.
> > 
> > /Tomas
> > 
> 
> mpv's RIFF decoder is really avformat, so this doesn't say much. VLC
> has 
> its own though, iirc.

Yeah. Also we'd be hard pressed to find an msrle decoder that isn't
either ffmpeg, vlc or VfW

It might be necessary to do this same thing for more codecs. We only
tested msrle which was painful enough. I wouldn't be surprised if say
msvideo1 requires similar hacks. This patch is conservative until we
learn why VfW needs this.

/Tomas

___
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] MAINTAINERS: change Leo Izen IRC nickname

2023-06-19 Thread Michael Niedermayer
On Sun, Jun 18, 2023 at 10:39:20AM -0400, Leo Izen wrote:
> I use a different nick on IRC now, Traneptora, instead of what I
> formerly used, thebombzen.
> 
> Signed-off-by: 
> ---
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thx

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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] libavfilter/vf_drawtext: add letter_spacing as an evaluated parameter

2023-06-19 Thread Paul B Mahol
On Mon, Jun 19, 2023 at 6:34 PM Mark Ren  wrote:

> When enabled it will add pixels (or subtract if given a negative value)
> between each letters,
> set use_kerning to false,
> and add the pixels to text_w.
>

Conflicts with big drawtext filter set that will be pushed soon.


>
> Signed-off-by: Mark Ren 
> ---
>  libavfilter/vf_drawtext.c | 24 
>  1 file changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index 71ab851462..ec8313820d 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -183,6 +183,7 @@ typedef struct DrawTextContext {
>  unsigned int fontsize;  ///< font size to use
>  unsigned int default_fontsize;  ///< default font size to use
>
> +int letter_spacing; ///< letter spacing in pixels
>  int line_spacing;   ///< lines spacing in pixels
>  short int draw_box; ///< draw box around text - true or
> false
>  int boxborderw; ///< box border width
> @@ -208,6 +209,8 @@ typedef struct DrawTextContext {
>  char   *a_expr;
>  AVExpr *a_pexpr;
>  int alpha;
> +char* letter_spacing_expr;  ///< expression for letter spacing
> +AVExpr* letter_spacing_pexpr;   ///< parsed expression for letter
> spacing
>  AVLFG  prng;///< random
>  char   *tc_opt_string;  ///< specified timecode option string
>  AVRational  tc_rate;///< frame rate for timecode
> @@ -237,6 +240,7 @@ static const AVOption drawtext_options[]= {
>  {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba),
>  AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0, FLAGS},
>  {"box", "set box",  OFFSET(draw_box),
>  AV_OPT_TYPE_BOOL,   {.i64=0}, 0,1   , FLAGS},
>  {"boxborderw",  "set box border width", OFFSET(boxborderw),
>  AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,  INT_MAX , FLAGS},
> +{"letter_spacing", "set letter spacing in pixels",
> OFFSET(letter_spacing_expr), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS},
>  {"line_spacing",  "set line spacing in pixels",
> OFFSET(line_spacing),   AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,
> INT_MAX,FLAGS},
>  {"fontsize","set font size",OFFSET(fontsize_expr),
> AV_OPT_TYPE_STRING, {.str=NULL},  0, 0 , FLAGS},
>  {"x",   "set x expression", OFFSET(x_expr),
>  AV_OPT_TYPE_STRING, {.str="0"},   0, 0, FLAGS},
> @@ -812,7 +816,7 @@ static av_cold int init(AVFilterContext *ctx)
> FT_STROKER_LINEJOIN_ROUND, 0);
>  }
>
> -s->use_kerning = FT_HAS_KERNING(s->face);
> +s->use_kerning = FT_HAS_KERNING(s->face) && !s->letter_spacing;
>
>  /* load the fallback glyph with code 0 */
>  load_glyph(ctx, NULL, 0);
> @@ -857,8 +861,9 @@ static av_cold void uninit(AVFilterContext *ctx)
>  av_expr_free(s->y_pexpr);
>  av_expr_free(s->a_pexpr);
>  av_expr_free(s->fontsize_pexpr);
> +av_expr_free(s->letter_spacing_pexpr);
>
> -s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr = NULL;
> +s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr =
> s->letter_spacing_pexpr = NULL;
>
>  av_freep(&s->positions);
>  s->nb_positions = 0;
> @@ -903,13 +908,16 @@ static int config_input(AVFilterLink *inlink)
>  av_expr_free(s->x_pexpr);
>  av_expr_free(s->y_pexpr);
>  av_expr_free(s->a_pexpr);
> -s->x_pexpr = s->y_pexpr = s->a_pexpr = NULL;
> +av_expr_free(s->letter_spacing_pexpr);
> +s->x_pexpr = s->y_pexpr = s->a_pexpr = s->letter_spacing_pexpr = NULL;
>
>  if ((ret = av_expr_parse(&s->x_pexpr, expr = s->x_expr, var_names,
>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
>  (ret = av_expr_parse(&s->y_pexpr, expr = s->y_expr, var_names,
>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
>  (ret = av_expr_parse(&s->a_pexpr, expr = s->a_expr, var_names,
> + NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
> +(ret = av_expr_parse(&s->letter_spacing_pexpr, expr =
> s->letter_spacing_expr, var_names,
>   NULL, NULL, fun2_names, fun2, 0, ctx)) < 0) {
>  av_log(ctx, AV_LOG_ERROR, "Failed to parse expression: %s \n",
> expr);
>  return AVERROR(EINVAL);
> @@ -1525,6 +1533,9 @@ continue_on_invalid2:
>  dummy.fontsize = s->fontsize;
>  glyph = av_tree_find(s->glyphs, &dummy, glyph_cmp, NULL);
>
> +/* letter spacing */
> +x += s->letter_spacing;
> +
>  /* kerning */
>  if (s->use_kerning && prev_glyph && glyph->code) {
>  FT_Get_Kerning(s->face, prev_glyph->code, glyph->code,
> @@ -1539,7 +1550,12 @@ continue_on_invalid2:
>  else  x += glyph->advance;
>  }
>
> -max_text_line_w = FFMAX(x, max_text_line_w);
> +s->letter_spacing = av_expr_eval(s->le

Re: [FFmpeg-devel] [PATCH] tests/fate/ffmpeg: actually use aac_fixed for fate-ffmpeg-streamloop-transcode-av

2023-06-19 Thread Zhao Zhili
On Mon, 2023-06-19 at 15:33 +0200, Anton Khirnov wrote:
> ---
>  tests/fate/ffmpeg.mak |   2 +-
>  tests/ref/fate/ffmpeg-streamloop-transcode-av | 186 +-
>  2 files changed, 94 insertions(+), 94 deletions(-)
> 
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index 87cd0b46d0..a1050fe1ee 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -134,7 +134,7 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout 
> srt -fix_sub_duration \
>  
>  FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
> PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>  fate-ffmpeg-streamloop-transcode-av: CMD = \
> - framecrc -auto_conversion_filters -stream_loop 3 -i 
> $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
> + framecrc -auto_conversion_filters -stream_loop 3 -c:a aac_fixed -i 
> $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>  
>  FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
>  fate-copy-trac3074: CMD = transcode eac3 
> $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
> b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> index 50a626b281..c95315a540 100644
> --- a/tests/ref/fate/ffmpeg-streamloop-transcode-av
> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> @@ -9,143 +9,143 @@
>  #sample_rate 1: 48000
>  #channel_layout_name 1: stereo
>  0,  0,  0,1,  1378560, 0xbaf121ba
> -1,  0,  0, 1024, 8192, 0x
> -1,   1024,   1024, 1024, 8192, 0x
> +1,  0,  0, 1024, 8192, 0xc069003c
> +1,   1024,   1024, 1024, 8192, 0xc069003c
>  0,  1,  1,1,  1378560, 0xbaf121ba
> -1,   2040,   2040, 1024, 8192, 0x
> -1,   3048,   3048, 1024, 8192, 0x
> +1,   2040,   2040, 1024, 8192, 0xc069003c
> +1,   3048,   3048, 1024, 8192, 0xc069003c
>  0,  2,  2,1,  1378560, 0x6579d31a
> -1,   4072,   4072, 1024, 8192, 0x
> -1,   5096,   5096, 1024, 8192, 0x
> +1,   4072,   4072, 1024, 8192, 0xc069003c
> +1,   5096,   5096, 1024, 8192, 0xc069003c
>  0,  3,  3,1,  1378560, 0xca1deba8
> -1,   6120,   6120, 1024, 8192, 0x687330d2
> -1,   7128,   7128, 1024, 8192, 0x9131462c
> +1,   6120,   6120, 1024, 8192, 0x0ebff31c
> +1,   7128,   7128, 1024, 8192, 0x149104ac
>  0,  4,  4,1,  1378560, 0xd4eed467
> -1,   8208,   8208, 1024, 8192, 0x48c01c32
> -1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
> +1,   8208,   8208, 1024, 8192, 0x882a224a
> +1,   9232,   9232, 1024, 8192, 0x643ed265

Still failed on AMD:

TESTffmpeg-streamloop-transcode-av  
   
--- /home/ubuntu/work/ffmpeg/tests/ref/fate/ffmpeg-streamloop-transcode-av  
2023-06-19
23:20:29.782355000 +0800
   
+++ tests/data/fate/ffmpeg-streamloop-transcode-av  2023-06-20 
00:31:42.398355000 +0800
@@ -21,28 +21,28 @@ 
   
 1,   6120,   6120, 1024, 8192, 0x0ebff31c  
   
 1,   7128,   7128, 1024, 8192, 0x149104ac  
   
 0,  4,  4,1,  1378560, 0xd4eed467  
   
-1,   8208,   8208, 1024, 8192, 0x882a224a  
   
-1,   9232,   9232, 1024, 8192, 0x643ed265  
   
+1,   8208,   8208, 1024, 8192, 0x1db0244a  
   
+1,   9232,   9232, 1024, 8192, 0x4ad2d267 

There have some rounding errors, I don't know where are they come from, e.g.,

./ffmpeg -v debug -auto_conversion_filters -c:a aac_fixed -i 
../../ffmpeg-fate-sample/mkv/1242-
small.mkv -vn -frames 16 -f s32le out.pcm

Intel:
00011190  00 b9 95 0b 00 b9 95 0b  00 9a d8 09 00 9a d8 09  ||
  ^^  ^^
AMD:
00011190  80 b9 95 0b 80 b9 95 0b  00 9a d8 09 00 9a d8 09  ||
  ^^  ^^

>  0,  5,  5,1,  1378560, 0xd6e1d5b7
> -1,  10248,  10248, 1024, 8192, 0xd50cbe9f
> -1,  11256,  11256, 1024, 8192, 0xbe069303
> +1,  10248,  10248, 1024, 8192, 0xb92133d0
> +1,  11256,  11256, 1024, 8192, 0x6b6ee3f1
>  0,  6,  6,1,  1378560, 0x0b574d39
> -1,  12280,

[FFmpeg-devel] [PATCH] libavfilter/vf_drawtext: add letter_spacing as an evaluated parameter

2023-06-19 Thread Mark Ren
When enabled it will add pixels (or subtract if given a negative value) between 
each letters,
set use_kerning to false,
and add the pixels to text_w.

Signed-off-by: Mark Ren 
---
 libavfilter/vf_drawtext.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 71ab851462..ec8313820d 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -183,6 +183,7 @@ typedef struct DrawTextContext {
 unsigned int fontsize;  ///< font size to use
 unsigned int default_fontsize;  ///< default font size to use
 
+int letter_spacing; ///< letter spacing in pixels
 int line_spacing;   ///< lines spacing in pixels
 short int draw_box; ///< draw box around text - true or false
 int boxborderw; ///< box border width
@@ -208,6 +209,8 @@ typedef struct DrawTextContext {
 char   *a_expr;
 AVExpr *a_pexpr;
 int alpha;
+char* letter_spacing_expr;  ///< expression for letter spacing
+AVExpr* letter_spacing_pexpr;   ///< parsed expression for letter spacing
 AVLFG  prng;///< random
 char   *tc_opt_string;  ///< specified timecode option string
 AVRational  tc_rate;///< frame rate for timecode
@@ -237,6 +240,7 @@ static const AVOption drawtext_options[]= {
 {"shadowcolor", "set shadow color", OFFSET(shadowcolor.rgba),   
AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0, FLAGS},
 {"box", "set box",  OFFSET(draw_box),   
AV_OPT_TYPE_BOOL,   {.i64=0}, 0,1   , FLAGS},
 {"boxborderw",  "set box border width", OFFSET(boxborderw), 
AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,  INT_MAX , FLAGS},
+{"letter_spacing", "set letter spacing in pixels", 
OFFSET(letter_spacing_expr), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS},
 {"line_spacing",  "set line spacing in pixels", OFFSET(line_spacing),   
AV_OPT_TYPE_INT,{.i64=0}, INT_MIN,  INT_MAX,FLAGS},
 {"fontsize","set font size",OFFSET(fontsize_expr),  
AV_OPT_TYPE_STRING, {.str=NULL},  0, 0 , FLAGS},
 {"x",   "set x expression", OFFSET(x_expr), 
AV_OPT_TYPE_STRING, {.str="0"},   0, 0, FLAGS},
@@ -812,7 +816,7 @@ static av_cold int init(AVFilterContext *ctx)
FT_STROKER_LINEJOIN_ROUND, 0);
 }
 
-s->use_kerning = FT_HAS_KERNING(s->face);
+s->use_kerning = FT_HAS_KERNING(s->face) && !s->letter_spacing;
 
 /* load the fallback glyph with code 0 */
 load_glyph(ctx, NULL, 0);
@@ -857,8 +861,9 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_expr_free(s->y_pexpr);
 av_expr_free(s->a_pexpr);
 av_expr_free(s->fontsize_pexpr);
+av_expr_free(s->letter_spacing_pexpr);
 
-s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr = NULL;
+s->x_pexpr = s->y_pexpr = s->a_pexpr = s->fontsize_pexpr = 
s->letter_spacing_pexpr = NULL;
 
 av_freep(&s->positions);
 s->nb_positions = 0;
@@ -903,13 +908,16 @@ static int config_input(AVFilterLink *inlink)
 av_expr_free(s->x_pexpr);
 av_expr_free(s->y_pexpr);
 av_expr_free(s->a_pexpr);
-s->x_pexpr = s->y_pexpr = s->a_pexpr = NULL;
+av_expr_free(s->letter_spacing_pexpr);
+s->x_pexpr = s->y_pexpr = s->a_pexpr = s->letter_spacing_pexpr = NULL;
 
 if ((ret = av_expr_parse(&s->x_pexpr, expr = s->x_expr, var_names,
  NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
 (ret = av_expr_parse(&s->y_pexpr, expr = s->y_expr, var_names,
  NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
 (ret = av_expr_parse(&s->a_pexpr, expr = s->a_expr, var_names,
+ NULL, NULL, fun2_names, fun2, 0, ctx)) < 0 ||
+(ret = av_expr_parse(&s->letter_spacing_pexpr, expr = 
s->letter_spacing_expr, var_names,
  NULL, NULL, fun2_names, fun2, 0, ctx)) < 0) {
 av_log(ctx, AV_LOG_ERROR, "Failed to parse expression: %s \n", expr);
 return AVERROR(EINVAL);
@@ -1525,6 +1533,9 @@ continue_on_invalid2:
 dummy.fontsize = s->fontsize;
 glyph = av_tree_find(s->glyphs, &dummy, glyph_cmp, NULL);
 
+/* letter spacing */
+x += s->letter_spacing;
+
 /* kerning */
 if (s->use_kerning && prev_glyph && glyph->code) {
 FT_Get_Kerning(s->face, prev_glyph->code, glyph->code,
@@ -1539,7 +1550,12 @@ continue_on_invalid2:
 else  x += glyph->advance;
 }
 
-max_text_line_w = FFMAX(x, max_text_line_w);
+s->letter_spacing = av_expr_eval(s->letter_spacing_pexpr, s->var_values, 
&s->prng);
+if (s->letter_spacing < 0) {
+max_text_line_w = x+ s->letter_spacing;
+} else {
+max_text_line_w = FFMAX(x, max_text_line_w) + s->letter_spacing;
+}
 
 s->var_values[VAR_TW] = s->var_values[

Re: [FFmpeg-devel] [PATCH 6/6] doc/developer: Require new modules to include tests

2023-06-19 Thread Paul B Mahol
NAK
___
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 6/6] doc/developer: Require new modules to include tests

2023-06-19 Thread Anton Khirnov
Quoting Lynne (2023-06-18 23:55:56)
> Jun 18, 2023, 23:50 by mich...@niedermayer.cc:
> 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  doc/developer.texi | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/developer.texi b/doc/developer.texi
> > index a7da2ce2d5..0c2f2cd7d1 100644
> > --- a/doc/developer.texi
> > +++ b/doc/developer.texi
> > @@ -805,7 +805,10 @@ Lines with similar content should be aligned 
> > vertically when doing so
> >  improves readability.
> >  
> >  @item
> > -Consider adding a regression test for your code.
> > +Consider adding a regression test for your code. All new modules
> > +should be covered by tests. That includes demuxers, muxers, decoders, 
> > encoders
> > +filters, bitstream filters, parsers. If its not possible to do that, add
> > +an explanation why to your patchset, its ok to not test if theres a reason.
> >
> 
> Could you add assembly code to this as well?
> checkasm is super useful, but is currently lacking quite
> a few tests.

The SIMD/DSP section already says new asm should have tests.
I would be in favor of making that into 'must' (unless very good reason
otherwise).

-- 
Anton Khirnov
___
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 6/6] doc/developer: Require new modules to include tests

2023-06-19 Thread Anton Khirnov
Quoting Michael Niedermayer (2023-06-18 23:50:21)
> Signed-off-by: Michael Niedermayer 
> ---
>  doc/developer.texi | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/developer.texi b/doc/developer.texi
> index a7da2ce2d5..0c2f2cd7d1 100644
> --- a/doc/developer.texi
> +++ b/doc/developer.texi
> @@ -805,7 +805,10 @@ Lines with similar content should be aligned vertically 
> when doing so
>  improves readability.
>  
>  @item
> -Consider adding a regression test for your code.
> +Consider adding a regression test for your code. All new modules
> +should be covered by tests. That includes demuxers, muxers, decoders, 
> encoders

s/should/must/?

-- 
Anton Khirnov
___
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] flvdec: Check the avio_seek return value after reading a metadata packet

2023-06-19 Thread Armstrong Huang

In most cases, flv_read_metabody reads pass the beginning of the meta_pos.
if the beginning of the meta_pos had been flushed from the IO buffer,
we would not be able to seek to the right position (for a nonseekable 
stream).


Is better to check the seek result and skip the current flv body if 
necessary, than to silently try to read from a

desynchronized stream that will only be interpreted as garbage.

Signed-off-by: Armstrong Huang 
---
 libavformat/flvdec.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index d83edff727..9d2b0730f1 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1096,7 +1096,14 @@ retry:
 } else if (type == TYPE_UNKNOWN) {
 stream_type = FLV_STREAM_TYPE_DATA;
 }
-avio_seek(s->pb, meta_pos, SEEK_SET);
+if (avio_seek(s->pb, meta_pos, SEEK_SET) != meta_pos) {
+// This can happen after flv_read_metabody
+// above, on a non-seekable input, and the
+// preceding data has been flushed out from
+// the IO buffer.
+av_log(s, AV_LOG_ERROR, "Unable to seek back to the flv 
tag body\n");

+goto skip;
+}
 }
 } else {
 av_log(s, AV_LOG_DEBUG,
--
2.20.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] avcodec/jpeg2000htdec: Check for invalid magref length.

2023-06-19 Thread Caleb Etemesi
Ping on this?


On Wed, Jun 7, 2023 at 10:35 AM  wrote:

> From: caleb 
>
> ---
>  libavcodec/jpeg2000htdec.c | 18 +-
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> index 51cd96e0f1..4c4e54710d 100644
> --- a/libavcodec/jpeg2000htdec.c
> +++ b/libavcodec/jpeg2000htdec.c
> @@ -1101,8 +1101,9 @@ static void
> jpeg2000_decode_sigprop_segment(Jpeg2000Cblk *cblk, uint16_t width,
>   * See procedure decodeSigPropMag at Rec. ITU-T T.814, 7.5.
>  */
>  static int
> -jpeg2000_decode_magref_segment(Jpeg2000Cblk *cblk, uint16_t width,
> uint16_t block_height, uint8_t *magref_segment,
> -   uint32_t magref_length, uint8_t pLSB, int32_t
> *sample_buf, uint8_t *block_states)
> +jpeg2000_decode_magref_segment( uint16_t width, uint16_t block_height,
> +uint8_t *magref_segment,uint32_t
> magref_length,
> +uint8_t pLSB, int32_t *sample_buf,
> uint8_t *block_states)
>  {
>
>  StateVars mag_ref   = { 0 };
> @@ -1260,10 +1261,17 @@ ff_jpeg2000_decode_htj2k(const
> Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
>  jpeg2000_decode_sigprop_segment(cblk, width, height, Dref, Lref,
>  pLSB - 1, sample_buf, block_states);
>
> -if (cblk->npasses > 2)
> -if ((ret = jpeg2000_decode_magref_segment(cblk, width, height,
> Dref, Lref,
> -  pLSB - 1, sample_buf,
> block_states)) < 0)
> +if (cblk->npasses > 2) {
> +
> +if (Lref < 2){
> +av_log(s->avctx,AV_LOG_ERROR,"Invalid magnitude refinement
> length\n");
> +ret = AVERROR_INVALIDDATA;
> +goto free;
> +}
> +if ((ret = jpeg2000_decode_magref_segment(width, height, Dref,
> Lref,
> +  pLSB - 1, sample_buf,
> block_states)) < 0)
>  goto free;
> +}
>
>  pLSB = 31 - M_b;
>
> --
> 2.40.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 1/2] lavc/riffenc: Fix msrle support on Windows 95

2023-06-19 Thread Leo Izen

On 6/8/23 07:44, Tomas Härdin wrote:

tor 2023-06-08 klockan 13:27 +0200 skrev Paul B Mahol:

But does this break it on other platforms?


That is a good question. What other RIFF decoders are there for which
MSRLE support is important and depends on behavior different from VfW?
mpv and vlc work just fine.

/Tomas



mpv's RIFF decoder is really avformat, so this doesn't say much. VLC has 
its own though, iirc.


- Leo Izen

___
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 v1 1/2] lavc/vp9: set yuvj pixel format for full range decode

2023-06-19 Thread Leo Izen



On 6/19/23 04:14, Thilo Borgmann wrote:

Am 18.06.23 um 23:21 schrieb Leo Izen:

On 6/17/23 10:26, Thilo Borgmann wrote:

Am 17.06.23 um 16:02 schrieb Leo Izen:

On 6/17/23 04:11, Thilo Borgmann wrote:

While the yuvj pixel formats are deprecated lots of code still relies
on them to be set. Without setting a yuvj420p pixel format VP9
decoding ends up incorrectly due to auto conversion.



I oppose this on principle. If there's code that relies on YUVJ 
being set, then *that code* needs to be changed so it respects the 
AVFrame->color_range field. Which code is working improperly with this?


I don't like adding YUVJ stuff either. If I do

  ./ffmpeg -i full-range-in.mp4 -c:v libvpx-vp9 -lossless 1 
lossless-out.mp4


and then comparing the frames, they are not equal. E.g. by

  ./ffmpeg -i full-range-in.mp4 -i lossless-out.mp4 -filter_complex 
ssim -f crc -


they are not 1.0 in ssim terms.



Are you sure? I just tested a sample and found that I got exactly 1.0 
in ssim terms. Do you have a link to a sample for which this fails?


IIRC I had the same impression when testing, I think I mixed up patched 
and unpatched ffmpeg builds.


Anyway, happy you retest, I used

./ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -pix_fmt 
yuvj420p -color_range pc full-range-in.mp4


to generate my input sample. I cannot test myself again until Thursday, 
my Laptop is not equipped with libvpx.




I used: ./ffmpeg -i input.mkv -vf libplacebo=format=yuv420p:range=pc -c 
ffv1 full-range-in.mkv


I wonder if using yuv420p with pc range changes the results. Running 
ffmpeg -i full-range-in.mkv by itself reports ffv1, yuv420p(pc, 
progressive) as its format.


- Leo Izen

___
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 1/5] avcodec: Add new side data type to contain original PTS value

2023-06-19 Thread Devin Heitmueller
On Mon, Jun 19, 2023 at 10:32 AM Anton Khirnov  wrote:
> This reasoning is backwards IMO. You'd be creating an implicit API while
> pretending not to. If anyone uses it, they would expect stability,
> otherwise what's the point.

My concern was that given right now it only has a single use case that
we might not have thought of other ways it may be used in the future,
so using a metadata field might allow us to keep it "semi-private"
until others wanted the functionality.  My fear was that we wouldn't
be able to reach a consensus on a new public API definition that we
would be willing to support indefinitely.

> > functionality is really specific to one use case.  However I figured
> > side data might be better since it avoids the conversion of the PTS to
> > a string and back.
>
> One one hand it does feel hacky, on the other I can see valid uses for
> it. Though 'orig' is rather vague, I'd call it something like 'transport
> timestamp' instead. A timebase should definitely be bundled with it.

I don't feel strongly about the naming.  My goal was to convey that
this was the original input timestamp on arrival, and not something
that has been transformed, and I worry that "transport" might be a bit
vague as it isn't clear whether this was on input, output, or
somewhere else in the workflow.  That said, pick a name that will be
considered acceptable to be merged upstream, and I'll adjust the patch
accordingly.

Devin

-- 
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmuel...@ltnglobal.com
___
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 1/5] avcodec: Add new side data type to contain original PTS value

2023-06-19 Thread Anton Khirnov
Quoting Devin Heitmueller (2023-06-19 15:14:38)
> Hi Andreas,
> 
> Thanks for the feedback.  I put out an RFC back in March but got no comments.
> 
> On Fri, Jun 16, 2023 at 6:01 PM Andreas Rheinhardt
>  wrote:
> > A timestamp without a timebase? Doesn't sound good to me. And it also
> > seems quite hacky.
> > Apart from that: It needs to specify that the data is a int64_t.
> 
> So you're suggesting a struct that contains both the timestamp and a
> timebase?  I don't have any real objection to this.
> 
> I agree it seems hacky, but don't have a better solution.  I welcome
> constructive suggestions.  I had considered using an AVPacket metadata
> field rather than a new side data type (as that won't necessarily lock
> us into a new side data type that we would have to support),

This reasoning is backwards IMO. You'd be creating an implicit API while
pretending not to. If anyone uses it, they would expect stability,
otherwise what's the point.

> functionality is really specific to one use case.  However I figured
> side data might be better since it avoids the conversion of the PTS to
> a string and back.

One one hand it does feel hacky, on the other I can see valid uses for
it. Though 'orig' is rather vague, I'd call it something like 'transport
timestamp' instead. A timebase should definitely be bundled with it.

-- 
Anton Khirnov
___
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] fate/cbs: simplify calling discard tests

2023-06-19 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/cbs.mak | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak
index 02560cfc84..54b58b7a4a 100644
--- a/tests/fate/cbs.mak
+++ b/tests/fate/cbs.mak
@@ -24,6 +24,12 @@ fate-cbs-$(1)-discard-$2: ffprobe$(PROGSSUF)$(EXESUF) 
tests/data/fate/cbs-$(1)-d
 fate-cbs-$(1)-discard-$2: CMD = ffprobe_demux 
$(TARGET_PATH)/tests/data/fate/cbs-$(1)-discard-$(2).$(4)
 endef
 
+FATE_CBS_DISCARD_TYPE = \
+nonref  \
+bidir   \
+nonintra\
+nonkey
+
 # AV1 read/write
 
 FATE_CBS_AV1_CONFORMANCE_SAMPLES = \
@@ -79,10 +85,7 @@ $(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call 
FATE_CBS_TEST,h264,$(basename
 
 FATE_CBS_H264-$(call FATE_CBS_DEPS, H264, H264, H264, H264, H264) = 
$(FATE_CBS_h264)
 
-$(eval $(call 
FATE_CBS_DISCARD_TEST,h264,nonref,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,h264,bidir,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,h264,nonintra,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,h264,nonkey,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
+$(foreach N,$(FATE_CBS_DISCARD_TYPE),$(eval $(call 
FATE_CBS_DISCARD_TEST,h264,$(basename 
$(N)),$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4)))
 
 FATE_CBS_H264-$(call ALLYES, H264_DEMUXER, H264_PARSER, MP4_MUXER, 
MOV_DEMUXER, FILTER_UNITS_BSF) += $(FATE_CBS_h264_DISCARD)
 
@@ -153,10 +156,7 @@ $(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call 
FATE_CBS_TEST,hevc,$(basename
 
 FATE_CBS_HEVC-$(call FATE_CBS_DEPS, HEVC, HEVC, HEVC, HEVC, HEVC) = 
$(FATE_CBS_hevc)
 
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonref,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,bidir,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonintra,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonkey,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
+$(foreach N,$(FATE_CBS_DISCARD_TYPE),$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,$(basename 
$(N)),$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4)))
 
 FATE_CBS_HEVC-$(call ALLYES, HEVC_DEMUXER, HEVC_PARSER, MP4_MUXER, 
MOV_DEMUXER, FILTER_UNITS_BSF) += $(FATE_CBS_hevc_DISCARD)
 
-- 
2.41.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".


[FFmpeg-devel] [PATCH 2/3] fate/cbs: fix h264-discard dependencies

2023-06-19 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/cbs.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak
index 8aefc000e0..02560cfc84 100644
--- a/tests/fate/cbs.mak
+++ b/tests/fate/cbs.mak
@@ -84,7 +84,7 @@ $(eval $(call 
FATE_CBS_DISCARD_TEST,h264,bidir,$(TARGET_SAMPLES)/h264/interlaced
 $(eval $(call 
FATE_CBS_DISCARD_TEST,h264,nonintra,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
 $(eval $(call 
FATE_CBS_DISCARD_TEST,h264,nonkey,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
 
-FATE_CBS_H264-$(call ALLYES, MP4_MUXER, H264_PARSER, FILTER_UNITS_BSF, 
H264_MUXER) += $(FATE_CBS_h264_DISCARD)
+FATE_CBS_H264-$(call ALLYES, H264_DEMUXER, H264_PARSER, MP4_MUXER, 
MOV_DEMUXER, FILTER_UNITS_BSF) += $(FATE_CBS_h264_DISCARD)
 
 
 FATE_H264_REDUNDANT_PPS-$(call REMUX, H264, MOV_DEMUXER H264_REDUNDANT_PPS_BSF 
  \
-- 
2.41.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".


[FFmpeg-devel] [PATCH 1/3] fate/cbs: remove unnecessary remuxing step on hevc-discard tests

2023-06-19 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/cbs.mak | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak
index 0084c3d25c..8aefc000e0 100644
--- a/tests/fate/cbs.mak
+++ b/tests/fate/cbs.mak
@@ -13,10 +13,10 @@ fate-cbs-$(1)-$(2): CMD = md5 -c:v $(3) -i 
$(TARGET_SAMPLES)/$(4) -c:v copy -y -
 endef
 
 define FATE_CBS_DISCARD_TEST
-# (codec, discard_type, sample_file, output_format, dep)
+# (codec, discard_type, sample_file, output_format)
 FATE_CBS_$(1)_DISCARD += fate-cbs-$(1)-discard-$(2)
 tests/data/fate/cbs-$(1)-discard-$2.$(4): TAG = GEN
-tests/data/fate/cbs-$(1)-discard-$2.$(4): ffmpeg$(PROGSSUF)$(EXESUF) $(5) | 
tests/data
+tests/data/fate/cbs-$(1)-discard-$2.$(4): ffmpeg$(PROGSSUF)$(EXESUF) | 
tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/ffmpeg$(PROGSSUF)$(EXESUF) -nostdin \
-i $(3) -c:v copy -fflags +bitexact -an -bsf:v 
filter_units=discard=$(2) \
-f $(4) $(TARGET_PATH)/tests/data/fate/cbs-$(1)-discard-$(2).$(4) -y 
2>/dev/null
@@ -153,12 +153,12 @@ $(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call 
FATE_CBS_TEST,hevc,$(basename
 
 FATE_CBS_HEVC-$(call FATE_CBS_DEPS, HEVC, HEVC, HEVC, HEVC, HEVC) = 
$(FATE_CBS_hevc)
 
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonref,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,bidir,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonintra,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
-$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonkey,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
+$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonref,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
+$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,bidir,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
+$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonintra,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
+$(eval $(call 
FATE_CBS_DISCARD_TEST,hevc,nonkey,$(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit,mp4))
 
-FATE_CBS_HEVC-$(call ALLYES, MP4_MUXER, HEVC_PARSER, FILTER_UNITS_BSF, 
HEVC_MUXER) += $(FATE_CBS_hevc_DISCARD)
+FATE_CBS_HEVC-$(call ALLYES, HEVC_DEMUXER, HEVC_PARSER, MP4_MUXER, 
MOV_DEMUXER, FILTER_UNITS_BSF) += $(FATE_CBS_hevc_DISCARD)
 
 FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes)
 fate-cbs-hevc: $(FATE_CBS_HEVC-yes)
-- 
2.41.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".


Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio

2023-06-19 Thread Zhao Zhili

> 在 2023年6月19日,21:22,James Almer  写道:
> 
> On 6/19/2023 9:34 AM, "zhilizhao(赵志立)" wrote:
 On Jun 19, 2023, at 20:29, James Almer  wrote:
>>> 
>>> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
 ---
 Now using aacdec_fixed with s32le output
 ---
  tests/fate/ffmpeg.mak |   4 +
  tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++
  2 files changed, 155 insertions(+)
  create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
 diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
 index c26c748934..87cd0b46d0 100644
 --- a/tests/fate/ffmpeg.mak
 +++ b/tests/fate/ffmpeg.mak
 @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = 
 fmtstdout srt -fix_sub_duration \
-c:s srt \
-f null -
  +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
 PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
 +fate-ffmpeg-streamloop-transcode-av: CMD = \
 + framecrc -auto_conversion_filters -stream_loop 3 -i 
 $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>>> 
>>> I think this is missing -c:a ac3_fixed before the -i
>> You mean aac_fixed? I have tried, but the result on two processor don't 
>> match neither.
> 
> The output will of course be different than what's in the reference file in 
> this patch. What matters is that the new output does match across different 
> CPUs.

Yes I know the idea, what I said is the second case.

> 
>>> 
 +
  FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
  fate-copy-trac3074: CMD = transcode eac3 
 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
   mp4 "-codec copy -map 0" "-codec copy"
 diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
 b/tests/ref/fate/ffmpeg-streamloop-transcode-av
 new file mode 100644
 index 00..50a626b281
 --- /dev/null
 +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
 @@ -0,0 +1,151 @@
 +#tb 0: 125/2997
 +#media_type 0: video
 +#codec_id 0: rawvideo
 +#dimensions 0: 1280x718
 +#sar 0: 1/1
 +#tb 1: 1/48000
 +#media_type 1: audio
 +#codec_id 1: pcm_s32le
 +#sample_rate 1: 48000
 +#channel_layout_name 1: stereo
 +0,  0,  0,1,  1378560, 0xbaf121ba
 +1,  0,  0, 1024, 8192, 0x
 +1,   1024,   1024, 1024, 8192, 0x
 +0,  1,  1,1,  1378560, 0xbaf121ba
 +1,   2040,   2040, 1024, 8192, 0x
 +1,   3048,   3048, 1024, 8192, 0x
 +0,  2,  2,1,  1378560, 0x6579d31a
 +1,   4072,   4072, 1024, 8192, 0x
 +1,   5096,   5096, 1024, 8192, 0x
 +0,  3,  3,1,  1378560, 0xca1deba8
 +1,   6120,   6120, 1024, 8192, 0x687330d2
 +1,   7128,   7128, 1024, 8192, 0x9131462c
 +0,  4,  4,1,  1378560, 0xd4eed467
 +1,   8208,   8208, 1024, 8192, 0x48c01c32
 +1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
 +0,  5,  5,1,  1378560, 0xd6e1d5b7
 +1,  10248,  10248, 1024, 8192, 0xd50cbe9f
 +1,  11256,  11256, 1024, 8192, 0xbe069303
 +0,  6,  6,1,  1378560, 0x0b574d39
 +1,  12280,  12280, 1024, 8192, 0x85fccf5b
 +1,  13304,  13304, 1024, 8192, 0x4180de71
 +0,  7,  7,1,  1378560, 0x1bdd4d61
 +1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
 +1,  15336,  15336, 1024, 8192, 0x5c33f724
 +0,  8,  8,1,  1378560, 0x3b28f549
 +1,  16360,  16360, 1024, 8192, 0x668aaaec
 +1,  17384,  17384, 1024, 8192, 0xd137d412
 +0,  9,  9,1,  1378560, 0x45b2f57b
 +1,  18408,  18408, 1024, 8192, 0x08e1fbf6
 +1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
 +0, 10, 10,1,  1378560, 0x8955570e
 +1,  20440,  20440, 1024, 8192, 0x69cd08a4
 +1,  21464,  21464, 1024, 8192, 0xe0fe6297
 +1,  22488,  22488, 1024, 8192, 0x172867ad
 +1,  23496,  23496, 1024, 8192, 0xcbcc1461
 +0, 12, 12,1,  1378560, 0x9c598000
 +1,  25488,  25488, 1024, 8192, 0x
 +0, 13, 13,1,  1378560, 0xbaf121ba
 +1,  26512,  26512, 1024, 8192, 0x
 +1,  27528,  27528, 1024, 8192, 0x
 +0, 14, 14,1,  1378560, 0xbaf121ba
 +1,  28552,  28552, 1024, 8192,

[FFmpeg-devel] [PATCH] tests/fate/ffmpeg: actually use aac_fixed for fate-ffmpeg-streamloop-transcode-av

2023-06-19 Thread Anton Khirnov
---
 tests/fate/ffmpeg.mak |   2 +-
 tests/ref/fate/ffmpeg-streamloop-transcode-av | 186 +-
 2 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 87cd0b46d0..a1050fe1ee 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -134,7 +134,7 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt 
-fix_sub_duration \
 
 FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
 fate-ffmpeg-streamloop-transcode-av: CMD = \
-   framecrc -auto_conversion_filters -stream_loop 3 -i 
$(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
+   framecrc -auto_conversion_filters -stream_loop 3 -c:a aac_fixed -i 
$(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
 
 FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
 fate-copy-trac3074: CMD = transcode eac3 
$(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
b/tests/ref/fate/ffmpeg-streamloop-transcode-av
index 50a626b281..c95315a540 100644
--- a/tests/ref/fate/ffmpeg-streamloop-transcode-av
+++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
@@ -9,143 +9,143 @@
 #sample_rate 1: 48000
 #channel_layout_name 1: stereo
 0,  0,  0,1,  1378560, 0xbaf121ba
-1,  0,  0, 1024, 8192, 0x
-1,   1024,   1024, 1024, 8192, 0x
+1,  0,  0, 1024, 8192, 0xc069003c
+1,   1024,   1024, 1024, 8192, 0xc069003c
 0,  1,  1,1,  1378560, 0xbaf121ba
-1,   2040,   2040, 1024, 8192, 0x
-1,   3048,   3048, 1024, 8192, 0x
+1,   2040,   2040, 1024, 8192, 0xc069003c
+1,   3048,   3048, 1024, 8192, 0xc069003c
 0,  2,  2,1,  1378560, 0x6579d31a
-1,   4072,   4072, 1024, 8192, 0x
-1,   5096,   5096, 1024, 8192, 0x
+1,   4072,   4072, 1024, 8192, 0xc069003c
+1,   5096,   5096, 1024, 8192, 0xc069003c
 0,  3,  3,1,  1378560, 0xca1deba8
-1,   6120,   6120, 1024, 8192, 0x687330d2
-1,   7128,   7128, 1024, 8192, 0x9131462c
+1,   6120,   6120, 1024, 8192, 0x0ebff31c
+1,   7128,   7128, 1024, 8192, 0x149104ac
 0,  4,  4,1,  1378560, 0xd4eed467
-1,   8208,   8208, 1024, 8192, 0x48c01c32
-1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
+1,   8208,   8208, 1024, 8192, 0x882a224a
+1,   9232,   9232, 1024, 8192, 0x643ed265
 0,  5,  5,1,  1378560, 0xd6e1d5b7
-1,  10248,  10248, 1024, 8192, 0xd50cbe9f
-1,  11256,  11256, 1024, 8192, 0xbe069303
+1,  10248,  10248, 1024, 8192, 0xb92133d0
+1,  11256,  11256, 1024, 8192, 0x6b6ee3f1
 0,  6,  6,1,  1378560, 0x0b574d39
-1,  12280,  12280, 1024, 8192, 0x85fccf5b
-1,  13304,  13304, 1024, 8192, 0x4180de71
+1,  12280,  12280, 1024, 8192, 0x5c861fab
+1,  13304,  13304, 1024, 8192, 0x3c632ba7
 0,  7,  7,1,  1378560, 0x1bdd4d61
-1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
-1,  15336,  15336, 1024, 8192, 0x5c33f724
+1,  14328,  14328, 1024, 8192, 0xe01ec84e
+1,  15336,  15336, 1024, 8192, 0xfc88f915
 0,  8,  8,1,  1378560, 0x3b28f549
-1,  16360,  16360, 1024, 8192, 0x668aaaec
-1,  17384,  17384, 1024, 8192, 0xd137d412
+1,  16360,  16360, 1024, 8192, 0xbf6bcc76
+1,  17384,  17384, 1024, 8192, 0xffc70974
 0,  9,  9,1,  1378560, 0x45b2f57b
-1,  18408,  18408, 1024, 8192, 0x08e1fbf6
-1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
+1,  18408,  18408, 1024, 8192, 0x17d53c22
+1,  19416,  19416, 1024, 8192, 0xb60fc617
 0, 10, 10,1,  1378560, 0x8955570e
-1,  20440,  20440, 1024, 8192, 0x69cd08a4
-1,  21464,  21464, 1024, 8192, 0xe0fe6297
-1,  22488,  22488, 1024, 8192, 0x172867ad
-1,  23496,  23496, 1024, 8192, 0xcbcc1461
+1,  20440,  20440, 1024, 8192, 0x0e531873
+1,  21464,  21464, 1024, 8192, 0xa46eaad5
+1,  22488,  22488, 1024, 8192, 0x5255b254
+1,  23496,  23496, 1024, 8192, 0xbea84190
 0, 12, 12,1,  1378560, 0x9c598000
-1,  25488,  25488, 1024, 8192, 0x
+1,  25488,  25488, 1024, 8192, 0xc06

Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio

2023-06-19 Thread James Almer

On 6/19/2023 9:34 AM, "zhilizhao(赵志立)" wrote:




On Jun 19, 2023, at 20:29, James Almer  wrote:

On 6/16/2023 3:01 AM, Anton Khirnov wrote:

---
Now using aacdec_fixed with s32le output
---
  tests/fate/ffmpeg.mak |   4 +
  tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++
  2 files changed, 155 insertions(+)
  create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index c26c748934..87cd0b46d0 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout 
srt -fix_sub_duration \
-c:s srt \
-f null -
  +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
+fate-ffmpeg-streamloop-transcode-av: CMD = \
+ framecrc -auto_conversion_filters -stream_loop 3 -i 
$(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le


I think this is missing -c:a ac3_fixed before the -i


You mean aac_fixed? I have tried, but the result on two processor don't match 
neither.


The output will of course be different than what's in the reference file 
in this patch. What matters is that the new output does match across 
different CPUs.







+
  FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
  fate-copy-trac3074: CMD = transcode eac3 
$(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
   mp4 "-codec copy -map 0" "-codec copy"
diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
b/tests/ref/fate/ffmpeg-streamloop-transcode-av
new file mode 100644
index 00..50a626b281
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
@@ -0,0 +1,151 @@
+#tb 0: 125/2997
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x718
+#sar 0: 1/1
+#tb 1: 1/48000
+#media_type 1: audio
+#codec_id 1: pcm_s32le
+#sample_rate 1: 48000
+#channel_layout_name 1: stereo
+0,  0,  0,1,  1378560, 0xbaf121ba
+1,  0,  0, 1024, 8192, 0x
+1,   1024,   1024, 1024, 8192, 0x
+0,  1,  1,1,  1378560, 0xbaf121ba
+1,   2040,   2040, 1024, 8192, 0x
+1,   3048,   3048, 1024, 8192, 0x
+0,  2,  2,1,  1378560, 0x6579d31a
+1,   4072,   4072, 1024, 8192, 0x
+1,   5096,   5096, 1024, 8192, 0x
+0,  3,  3,1,  1378560, 0xca1deba8
+1,   6120,   6120, 1024, 8192, 0x687330d2
+1,   7128,   7128, 1024, 8192, 0x9131462c
+0,  4,  4,1,  1378560, 0xd4eed467
+1,   8208,   8208, 1024, 8192, 0x48c01c32
+1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
+0,  5,  5,1,  1378560, 0xd6e1d5b7
+1,  10248,  10248, 1024, 8192, 0xd50cbe9f
+1,  11256,  11256, 1024, 8192, 0xbe069303
+0,  6,  6,1,  1378560, 0x0b574d39
+1,  12280,  12280, 1024, 8192, 0x85fccf5b
+1,  13304,  13304, 1024, 8192, 0x4180de71
+0,  7,  7,1,  1378560, 0x1bdd4d61
+1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
+1,  15336,  15336, 1024, 8192, 0x5c33f724
+0,  8,  8,1,  1378560, 0x3b28f549
+1,  16360,  16360, 1024, 8192, 0x668aaaec
+1,  17384,  17384, 1024, 8192, 0xd137d412
+0,  9,  9,1,  1378560, 0x45b2f57b
+1,  18408,  18408, 1024, 8192, 0x08e1fbf6
+1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
+0, 10, 10,1,  1378560, 0x8955570e
+1,  20440,  20440, 1024, 8192, 0x69cd08a4
+1,  21464,  21464, 1024, 8192, 0xe0fe6297
+1,  22488,  22488, 1024, 8192, 0x172867ad
+1,  23496,  23496, 1024, 8192, 0xcbcc1461
+0, 12, 12,1,  1378560, 0x9c598000
+1,  25488,  25488, 1024, 8192, 0x
+0, 13, 13,1,  1378560, 0xbaf121ba
+1,  26512,  26512, 1024, 8192, 0x
+1,  27528,  27528, 1024, 8192, 0x
+0, 14, 14,1,  1378560, 0xbaf121ba
+1,  28552,  28552, 1024, 8192, 0x
+1,  29576,  29576, 1024, 8192, 0x
+0, 15, 15,1,  1378560, 0x6579d31a
+1,  30600,  30600, 1024, 8192, 0x687330d2
+1,  31608,  31608, 1024, 8192, 0x9131462c
+0, 16, 16,1,  1378560, 0xca1deba8
+1,  32688,  32688, 1024, 8192, 0x48c01c32
+1,  33712,  33712, 1024, 8192, 0x0ccd8d5f
+0, 17, 17,1,  1378560, 0xd4eed467
+1,  34728,  34728, 1024, 8192, 0xd5

Re: [FFmpeg-devel] [PATCH 4/5] bsf: Add new bitstream filter to set pts_adjustment when reclocking

2023-06-19 Thread Devin Heitmueller
On Fri, Jun 16, 2023 at 5:58 PM Andreas Rheinhardt
 wrote:
>
> Devin Heitmueller:
> > Because SCTE-35 messages are represented in TS streams as sections
> > rather than PES packets, we cannot rely on ffmpeg's standard
> > mechanisms to adjust PTS values if reclocking the stream.
> > This filter will leverage the SCTE-35 pts_adjust field to
> > compensate for any change in the PTS values in the stream.
> >
> > See SCTE-35 2019 Sec 9.6 for information about the use of
> > the pts_adjust field.
> >
> > This filter also tweaks the mpegtsenc mux to automatically
> > add it so the user doesn't have to include it manually.
> >
> > Signed-off-by: Devin Heitmueller 
> > ---
> >  libavcodec/Makefile  |   1 +
> >  libavcodec/bitstream_filters.c   |   1 +
> >  libavcodec/scte35ptsadjust_bsf.c | 114 
> > +++
> >  libavformat/mpegtsenc.c  |   2 +
> >  4 files changed, 118 insertions(+)
> >  create mode 100644 libavcodec/scte35ptsadjust_bsf.c
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index 0ce8fe5..6944c82 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -1250,6 +1250,7 @@ OBJS-$(CONFIG_PCM_RECHUNK_BSF)+= 
> > pcm_rechunk_bsf.o
> >  OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF)+= pgs_frame_merge_bsf.o
> >  OBJS-$(CONFIG_PRORES_METADATA_BSF)+= prores_metadata_bsf.o
> >  OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += remove_extradata_bsf.o 
> > av1_parse.o
> > +OBJS-$(CONFIG_SCTE35PTSADJUST_BSF)+= scte35ptsadjust_bsf.o
> >  OBJS-$(CONFIG_SETTS_BSF)  += setts_bsf.o
> >  OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
> >  OBJS-$(CONFIG_TRACE_HEADERS_BSF)  += trace_headers_bsf.o
> > diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
> > index 7512fcc..d30dfbd 100644
> > --- a/libavcodec/bitstream_filters.c
> > +++ b/libavcodec/bitstream_filters.c
> > @@ -57,6 +57,7 @@ extern const FFBitStreamFilter ff_pcm_rechunk_bsf;
> >  extern const FFBitStreamFilter ff_pgs_frame_merge_bsf;
> >  extern const FFBitStreamFilter ff_prores_metadata_bsf;
> >  extern const FFBitStreamFilter ff_remove_extradata_bsf;
> > +extern const FFBitStreamFilter ff_scte35ptsadjust_bsf;
> >  extern const FFBitStreamFilter ff_setts_bsf;
> >  extern const FFBitStreamFilter ff_text2movsub_bsf;
> >  extern const FFBitStreamFilter ff_trace_headers_bsf;
> > diff --git a/libavcodec/scte35ptsadjust_bsf.c 
> > b/libavcodec/scte35ptsadjust_bsf.c
> > new file mode 100644
> > index 000..e6e9ec9
> > --- /dev/null
> > +++ b/libavcodec/scte35ptsadjust_bsf.c
> > @@ -0,0 +1,114 @@
> > +/*
> > + * SCTE-35 PTS fixup bitstream filter
> > + * Copyright (c) 2023 LTN Global Communications, Inc.
> > + *
> > + * Author: Devin Heitmueller 
> > + *
> > + * Because SCTE-35 messages are represented in TS streams as sections
> > + * rather than PES packets, we cannot rely on ffmpeg's standard
> > + * mechanisms to adjust PTS values if reclocking the stream.
> > + * This filter will leverage the SCTE-35 pts_adjust field to
> > + * compensate for any change in the PTS values in the stream.
> > + *
> > + * See SCTE-35 2019 Sec 9.6 for information about the use of
> > + * the pts_adjust field.
> > + *
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * FFmpeg is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
> > 02110-1301 USA
> > + */
> > +
> > +#include "avcodec.h"
>
> What is that for? The BSF API is separate from the AVCodecContext stuff.
>
> > +#include "bsf.h"
> > +#include "bsf_internal.h"
> > +
> > +static int scte35ptsadjust_filter(AVBSFContext *ctx, AVPacket *out)
> > +{
> > +AVPacket *in;
> > +size_t size;
>
> av_packet_get_side_data() can work with NULL for the size pointer.
>
> > +const int64_t *orig_pts;
> > +int64_t cur_pts_adjust;
> > +int ret = 0;
> > +
> > +ret = ff_bsf_get_packet(ctx, &in);
> > +if (ret < 0)
> > +return ret;
> > +
> > +/* Retrieve the original PTS, which will be used to calculate the 
> > pts_adjust */
> > +orig_pts = (int64_t *) av_packet_get_side_data(in, 
> > AV_PKT_DATA_ORIG_PTS, &size);
> > +if (orig_pts == NULL) {
> > +/* No original PTS specified, so just pass the packet through */
> > +av_packet_move_

Re: [FFmpeg-devel] [PATCH 1/5] avcodec: Add new side data type to contain original PTS value

2023-06-19 Thread Devin Heitmueller
Hi Andreas,

Thanks for the feedback.  I put out an RFC back in March but got no comments.

On Fri, Jun 16, 2023 at 6:01 PM Andreas Rheinhardt
 wrote:
> A timestamp without a timebase? Doesn't sound good to me. And it also
> seems quite hacky.
> Apart from that: It needs to specify that the data is a int64_t.

So you're suggesting a struct that contains both the timestamp and a
timebase?  I don't have any real objection to this.

I agree it seems hacky, but don't have a better solution.  I welcome
constructive suggestions.  I had considered using an AVPacket metadata
field rather than a new side data type (as that won't necessarily lock
us into a new side data type that we would have to support), and the
functionality is really specific to one use case.  However I figured
side data might be better since it avoids the conversion of the PTS to
a string and back.

Devin

-- 
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmuel...@ltnglobal.com
___
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 v2] lavc/h264chroma: RISC-V V add motion compensation for 4xH and 2xH chroma blocks

2023-06-19 Thread Arnie Chang
Optimize the put and avg filtering for 4xH and 2xH blocks

Signed-off-by: Arnie Chang 
---
V2:
1. Change the \width to an run time argument
2. Call to an internal function instead of instantiating similar code three 
times

RVVi32:
 - h264chroma.chroma_mc [OK]
checkasm: all 6 tests passed
avg_h264_chroma_mc1_8_c: 1821.5
avg_h264_chroma_mc1_8_rvv_i32: 466.5
avg_h264_chroma_mc2_8_c: 939.2
avg_h264_chroma_mc2_8_rvv_i32: 466.5
avg_h264_chroma_mc4_8_c: 502.2
avg_h264_chroma_mc4_8_rvv_i32: 466.5
put_h264_chroma_mc1_8_c: 1436.5
put_h264_chroma_mc1_8_rvv_i32: 382.5
put_h264_chroma_mc2_8_c: 824.2
put_h264_chroma_mc2_8_rvv_i32: 382.5
put_h264_chroma_mc4_8_c: 431.2
put_h264_chroma_mc4_8_rvv_i32: 382.5

 libavcodec/riscv/h264_chroma_init_riscv.c |   8 +
 libavcodec/riscv/h264_mc_chroma.S | 237 ++
 2 files changed, 160 insertions(+), 85 deletions(-)

diff --git a/libavcodec/riscv/h264_chroma_init_riscv.c 
b/libavcodec/riscv/h264_chroma_init_riscv.c
index 7c905edfcd..9f95150ea3 100644
--- a/libavcodec/riscv/h264_chroma_init_riscv.c
+++ b/libavcodec/riscv/h264_chroma_init_riscv.c
@@ -27,6 +27,10 @@
 
 void h264_put_chroma_mc8_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
 void h264_avg_chroma_mc8_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
+void h264_put_chroma_mc4_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
+void h264_avg_chroma_mc4_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
+void h264_put_chroma_mc2_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
+void h264_avg_chroma_mc2_rvv(uint8_t *p_dst, const uint8_t *p_src, ptrdiff_t 
stride, int h, int x, int y);
 
 av_cold void ff_h264chroma_init_riscv(H264ChromaContext *c, int bit_depth)
 {
@@ -36,6 +40,10 @@ av_cold void ff_h264chroma_init_riscv(H264ChromaContext *c, 
int bit_depth)
 if (bit_depth == 8 && (flags & AV_CPU_FLAG_RVV_I32) && ff_get_rv_vlenb() 
>= 16) {
 c->put_h264_chroma_pixels_tab[0] = h264_put_chroma_mc8_rvv;
 c->avg_h264_chroma_pixels_tab[0] = h264_avg_chroma_mc8_rvv;
+c->put_h264_chroma_pixels_tab[1] = h264_put_chroma_mc4_rvv;
+c->avg_h264_chroma_pixels_tab[1] = h264_avg_chroma_mc4_rvv;
+c->put_h264_chroma_pixels_tab[2] = h264_put_chroma_mc2_rvv;
+c->avg_h264_chroma_pixels_tab[2] = h264_avg_chroma_mc2_rvv;
 }
 #endif
 }
diff --git a/libavcodec/riscv/h264_mc_chroma.S 
b/libavcodec/riscv/h264_mc_chroma.S
index 364bc3156e..ce99bda44d 100644
--- a/libavcodec/riscv/h264_mc_chroma.S
+++ b/libavcodec/riscv/h264_mc_chroma.S
@@ -19,8 +19,7 @@
  */
 #include "libavutil/riscv/asm.S"
 
-.macro  h264_chroma_mc8 type
-func h264_\type\()_chroma_mc8_rvv, zve32x
+.macro  do_chroma_mc type unroll
 csrwvxrm, zero
 sllit2, a5, 3
 mul t1, a5, a4
@@ -30,94 +29,100 @@ func h264_\type\()_chroma_mc8_rvv, zve32x
 sub a7, a4, t1
 addia6, a5, 64
 sub t0, t2, t1
-vsetivlit3, 8, e8, m1, ta, mu
+vsetvli t3, t6, e8, m1, ta, mu
 beqzt1, 2f
 bleza3, 8f
 li  t4, 0
 li  t2, 0
 li  t5, 1
 addia5, t3, 1
-sllit3, a2, 2
+sllit3, a2, (1 + \unroll)
 1:# if (xy != 0)
 add a4, a1, t4
 vsetvli zero, a5, e8, m1, ta, ma
+  .ifc \unroll,1
 addit2, t2, 4
+  .else
+addit2, t2, 2
+  .endif
 vle8.v  v10, (a4)
 add a4, a4, a2
 vslide1down.vx  v11, v10, t5
-vsetivlizero, 8, e8, m1, ta, ma
+vsetvli zero, t6, e8, m1, ta, ma
 vwmulu.vx   v8, v10, a6
 vwmaccu.vx  v8, a7, v11
 vsetvli zero, a5, e8, m1, ta, ma
 vle8.v  v12, (a4)
-vsetivlizero, 8, e8, m1, ta, ma
+vsetvli zero, t6, e8, m1, ta, ma
 add a4, a4, a2
 vwmaccu.vx  v8, t0, v12
 vsetvli zero, a5, e8, m1, ta, ma
 vslide1down.vx  v13, v12, t5
-vsetivlizero, 8, e8, m1, ta, ma
+vsetvli zero, t6, e8, m1, ta, ma
 vwmulu.vx   v10, v12, a6
 vwmaccu.vx  v8, t1, v13
 vwmaccu.vx  v10, a7, v13
 vsetvli zero, a5, e8, m1, ta, ma
 vle8.v  v14, (a4)
-vsetivlizero, 8, e8, m1, ta, ma
+vsetvli zero, t6, e8, m1, ta, ma
 add a4, a4, a2
 vwmaccu.vx  v10, t0, v14
 vsetvli zero, a5, e8, m1, ta, ma
 vslide1down.vx  v15, v14, t5
-vsetivlizero, 8, e8, m1, ta, ma
+vsetvli zer

Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio

2023-06-19 Thread zhilizhao(赵志立)



> On Jun 19, 2023, at 20:29, James Almer  wrote:
> 
> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
>> ---
>> Now using aacdec_fixed with s32le output
>> ---
>>  tests/fate/ffmpeg.mak |   4 +
>>  tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++
>>  2 files changed, 155 insertions(+)
>>  create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
>> index c26c748934..87cd0b46d0 100644
>> --- a/tests/fate/ffmpeg.mak
>> +++ b/tests/fate/ffmpeg.mak
>> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout 
>> srt -fix_sub_duration \
>>-c:s srt \
>>-f null -
>>  +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
>> PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>> +fate-ffmpeg-streamloop-transcode-av: CMD = \
>> + framecrc -auto_conversion_filters -stream_loop 3 -i 
>> $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
> 
> I think this is missing -c:a ac3_fixed before the -i

You mean aac_fixed? I have tried, but the result on two processor don't match 
neither.

> 
>> +
>>  FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
>>  fate-copy-trac3074: CMD = transcode eac3 
>> $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
>>   mp4 "-codec copy -map 0" "-codec copy"
>> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
>> b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>> new file mode 100644
>> index 00..50a626b281
>> --- /dev/null
>> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>> @@ -0,0 +1,151 @@
>> +#tb 0: 125/2997
>> +#media_type 0: video
>> +#codec_id 0: rawvideo
>> +#dimensions 0: 1280x718
>> +#sar 0: 1/1
>> +#tb 1: 1/48000
>> +#media_type 1: audio
>> +#codec_id 1: pcm_s32le
>> +#sample_rate 1: 48000
>> +#channel_layout_name 1: stereo
>> +0,  0,  0,1,  1378560, 0xbaf121ba
>> +1,  0,  0, 1024, 8192, 0x
>> +1,   1024,   1024, 1024, 8192, 0x
>> +0,  1,  1,1,  1378560, 0xbaf121ba
>> +1,   2040,   2040, 1024, 8192, 0x
>> +1,   3048,   3048, 1024, 8192, 0x
>> +0,  2,  2,1,  1378560, 0x6579d31a
>> +1,   4072,   4072, 1024, 8192, 0x
>> +1,   5096,   5096, 1024, 8192, 0x
>> +0,  3,  3,1,  1378560, 0xca1deba8
>> +1,   6120,   6120, 1024, 8192, 0x687330d2
>> +1,   7128,   7128, 1024, 8192, 0x9131462c
>> +0,  4,  4,1,  1378560, 0xd4eed467
>> +1,   8208,   8208, 1024, 8192, 0x48c01c32
>> +1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
>> +0,  5,  5,1,  1378560, 0xd6e1d5b7
>> +1,  10248,  10248, 1024, 8192, 0xd50cbe9f
>> +1,  11256,  11256, 1024, 8192, 0xbe069303
>> +0,  6,  6,1,  1378560, 0x0b574d39
>> +1,  12280,  12280, 1024, 8192, 0x85fccf5b
>> +1,  13304,  13304, 1024, 8192, 0x4180de71
>> +0,  7,  7,1,  1378560, 0x1bdd4d61
>> +1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
>> +1,  15336,  15336, 1024, 8192, 0x5c33f724
>> +0,  8,  8,1,  1378560, 0x3b28f549
>> +1,  16360,  16360, 1024, 8192, 0x668aaaec
>> +1,  17384,  17384, 1024, 8192, 0xd137d412
>> +0,  9,  9,1,  1378560, 0x45b2f57b
>> +1,  18408,  18408, 1024, 8192, 0x08e1fbf6
>> +1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
>> +0, 10, 10,1,  1378560, 0x8955570e
>> +1,  20440,  20440, 1024, 8192, 0x69cd08a4
>> +1,  21464,  21464, 1024, 8192, 0xe0fe6297
>> +1,  22488,  22488, 1024, 8192, 0x172867ad
>> +1,  23496,  23496, 1024, 8192, 0xcbcc1461
>> +0, 12, 12,1,  1378560, 0x9c598000
>> +1,  25488,  25488, 1024, 8192, 0x
>> +0, 13, 13,1,  1378560, 0xbaf121ba
>> +1,  26512,  26512, 1024, 8192, 0x
>> +1,  27528,  27528, 1024, 8192, 0x
>> +0, 14, 14,1,  1378560, 0xbaf121ba
>> +1,  28552,  28552, 1024, 8192, 0x
>> +1,  29576,  29576, 1024, 8192, 0x
>> +0, 15, 15,1,  1378560, 0x6579d31a
>> +1,  30600,  30600, 1024, 8192, 0x687330d2
>> +1,  31608,  31608, 1024, 8192, 0x9131462c
>> +0, 16, 16,1,  1378560, 0xca1deba8
>> +1,  32688,  32688, 1024, 8192, 0x48c01c32
>> +1,  33712,  33712, 1024, 8192, 0x0ccd8d5f
>> +0, 17, 17,1,  1378560, 0xd

Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio

2023-06-19 Thread James Almer

On 6/16/2023 3:01 AM, Anton Khirnov wrote:

---
Now using aacdec_fixed with s32le output
---
  tests/fate/ffmpeg.mak |   4 +
  tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++
  2 files changed, 155 insertions(+)
  create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index c26c748934..87cd0b46d0 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout 
srt -fix_sub_duration \
-c:s srt \
-f null -
  
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av

+fate-ffmpeg-streamloop-transcode-av: CMD = \
+   framecrc -auto_conversion_filters -stream_loop 3 -i 
$(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le


I think this is missing -c:a ac3_fixed before the -i


+
  FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
  fate-copy-trac3074: CMD = transcode eac3 
$(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
   mp4 "-codec copy -map 0" "-codec copy"
diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
b/tests/ref/fate/ffmpeg-streamloop-transcode-av
new file mode 100644
index 00..50a626b281
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
@@ -0,0 +1,151 @@
+#tb 0: 125/2997
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x718
+#sar 0: 1/1
+#tb 1: 1/48000
+#media_type 1: audio
+#codec_id 1: pcm_s32le
+#sample_rate 1: 48000
+#channel_layout_name 1: stereo
+0,  0,  0,1,  1378560, 0xbaf121ba
+1,  0,  0, 1024, 8192, 0x
+1,   1024,   1024, 1024, 8192, 0x
+0,  1,  1,1,  1378560, 0xbaf121ba
+1,   2040,   2040, 1024, 8192, 0x
+1,   3048,   3048, 1024, 8192, 0x
+0,  2,  2,1,  1378560, 0x6579d31a
+1,   4072,   4072, 1024, 8192, 0x
+1,   5096,   5096, 1024, 8192, 0x
+0,  3,  3,1,  1378560, 0xca1deba8
+1,   6120,   6120, 1024, 8192, 0x687330d2
+1,   7128,   7128, 1024, 8192, 0x9131462c
+0,  4,  4,1,  1378560, 0xd4eed467
+1,   8208,   8208, 1024, 8192, 0x48c01c32
+1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
+0,  5,  5,1,  1378560, 0xd6e1d5b7
+1,  10248,  10248, 1024, 8192, 0xd50cbe9f
+1,  11256,  11256, 1024, 8192, 0xbe069303
+0,  6,  6,1,  1378560, 0x0b574d39
+1,  12280,  12280, 1024, 8192, 0x85fccf5b
+1,  13304,  13304, 1024, 8192, 0x4180de71
+0,  7,  7,1,  1378560, 0x1bdd4d61
+1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
+1,  15336,  15336, 1024, 8192, 0x5c33f724
+0,  8,  8,1,  1378560, 0x3b28f549
+1,  16360,  16360, 1024, 8192, 0x668aaaec
+1,  17384,  17384, 1024, 8192, 0xd137d412
+0,  9,  9,1,  1378560, 0x45b2f57b
+1,  18408,  18408, 1024, 8192, 0x08e1fbf6
+1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
+0, 10, 10,1,  1378560, 0x8955570e
+1,  20440,  20440, 1024, 8192, 0x69cd08a4
+1,  21464,  21464, 1024, 8192, 0xe0fe6297
+1,  22488,  22488, 1024, 8192, 0x172867ad
+1,  23496,  23496, 1024, 8192, 0xcbcc1461
+0, 12, 12,1,  1378560, 0x9c598000
+1,  25488,  25488, 1024, 8192, 0x
+0, 13, 13,1,  1378560, 0xbaf121ba
+1,  26512,  26512, 1024, 8192, 0x
+1,  27528,  27528, 1024, 8192, 0x
+0, 14, 14,1,  1378560, 0xbaf121ba
+1,  28552,  28552, 1024, 8192, 0x
+1,  29576,  29576, 1024, 8192, 0x
+0, 15, 15,1,  1378560, 0x6579d31a
+1,  30600,  30600, 1024, 8192, 0x687330d2
+1,  31608,  31608, 1024, 8192, 0x9131462c
+0, 16, 16,1,  1378560, 0xca1deba8
+1,  32688,  32688, 1024, 8192, 0x48c01c32
+1,  33712,  33712, 1024, 8192, 0x0ccd8d5f
+0, 17, 17,1,  1378560, 0xd4eed467
+1,  34728,  34728, 1024, 8192, 0xd50cbe9f
+1,  35736,  35736, 1024, 8192, 0xbe069303
+0, 18, 18,1,  1378560, 0xd6e1d5b7
+1,  36760,  36760, 1024, 8192, 0x85fccf5b
+1,  37784,  37784, 1024, 8192, 0x4180de71
+0, 19, 19,1,  1378560, 0x0b574d39
+1,  38808,  38808, 1024, 819

Re: [FFmpeg-devel] [PATCH 1/2] lavc/riffenc: Fix msrle support on Windows 95

2023-06-19 Thread Tomas Härdin
Will push later today

/Tomas

___
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 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio

2023-06-19 Thread zhilizhao(赵志立)


> On Jun 16, 2023, at 14:01, Anton Khirnov  wrote:
> 
> ---
> Now using aacdec_fixed with s32le output
> ---
> tests/fate/ffmpeg.mak |   4 +
> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++
> 2 files changed, 155 insertions(+)
> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
> 
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index c26c748934..87cd0b46d0 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout 
> srt -fix_sub_duration \
>   -c:s srt \
>   -f null -
> 
> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, 
> PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
> +fate-ffmpeg-streamloop-transcode-av: CMD = \
> + framecrc -auto_conversion_filters -stream_loop 3 -i 
> $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
> +

This test success on Intel(R) Core(TM) i7-10700 but failed on AMD EPYC 7K62.

--- /home/ubuntu/work/ffmpeg/tests/ref/fate/ffmpeg-streamloop-transcode-av  
2023-06-19 18:49:26.666355000 +0800
+++ tests/data/fate/ffmpeg-streamloop-transcode-av  2023-06-19 
18:49:40.674355000 +0800
@@ -19,30 +19,30 @@   

 1,   5096,   5096, 1024, 8192, 0x
 0,  3,  3,1,  1378560, 0xca1deba8
 1,   6120,   6120, 1024, 8192, 0x687330d2
-1,   7128,   7128, 1024, 8192, 0x9131462c
+1,   7128,   7128, 1024, 8192, 0x039b4628
 0,  4,  4,1,  1378560, 0xd4eed467
-1,   8208,   8208, 1024, 8192, 0x48c01c32
-1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
+1,   8208,   8208, 1024, 8192, 0x4cbe1c62
+1,   9232,   9232, 1024, 8192, 0x1d8b8ad3

…


> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
> fate-copy-trac3074: CMD = transcode eac3 
> $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
>  mp4 "-codec copy -map 0" "-codec copy"
> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av 
> b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> new file mode 100644
> index 00..50a626b281
> --- /dev/null
> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> @@ -0,0 +1,151 @@
> +#tb 0: 125/2997
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 1280x718
> +#sar 0: 1/1
> +#tb 1: 1/48000
> +#media_type 1: audio
> +#codec_id 1: pcm_s32le
> +#sample_rate 1: 48000
> +#channel_layout_name 1: stereo
> +0,  0,  0,1,  1378560, 0xbaf121ba
> +1,  0,  0, 1024, 8192, 0x
> +1,   1024,   1024, 1024, 8192, 0x
> +0,  1,  1,1,  1378560, 0xbaf121ba
> +1,   2040,   2040, 1024, 8192, 0x
> +1,   3048,   3048, 1024, 8192, 0x
> +0,  2,  2,1,  1378560, 0x6579d31a
> +1,   4072,   4072, 1024, 8192, 0x
> +1,   5096,   5096, 1024, 8192, 0x
> +0,  3,  3,1,  1378560, 0xca1deba8
> +1,   6120,   6120, 1024, 8192, 0x687330d2
> +1,   7128,   7128, 1024, 8192, 0x9131462c
> +0,  4,  4,1,  1378560, 0xd4eed467
> +1,   8208,   8208, 1024, 8192, 0x48c01c32
> +1,   9232,   9232, 1024, 8192, 0x0ccd8d5f
> +0,  5,  5,1,  1378560, 0xd6e1d5b7
> +1,  10248,  10248, 1024, 8192, 0xd50cbe9f
> +1,  11256,  11256, 1024, 8192, 0xbe069303
> +0,  6,  6,1,  1378560, 0x0b574d39
> +1,  12280,  12280, 1024, 8192, 0x85fccf5b
> +1,  13304,  13304, 1024, 8192, 0x4180de71
> +0,  7,  7,1,  1378560, 0x1bdd4d61
> +1,  14328,  14328, 1024, 8192, 0x0e9b6ac3
> +1,  15336,  15336, 1024, 8192, 0x5c33f724
> +0,  8,  8,1,  1378560, 0x3b28f549
> +1,  16360,  16360, 1024, 8192, 0x668aaaec
> +1,  17384,  17384, 1024, 8192, 0xd137d412
> +0,  9,  9,1,  1378560, 0x45b2f57b
> +1,  18408,  18408, 1024, 8192, 0x08e1fbf6
> +1,  19416,  19416, 1024, 8192, 0xbf3fb4f6
> +0, 10, 10,1,  1378560, 0x8955570e
> +1,  20440,  20440, 1024, 8192, 0x69cd08a4
> +1,  21464,  21464, 1024, 8192, 0xe0fe6297
> +1,  22488,  22488, 1024, 8192, 0x172867ad
> +1,  23496,  23496, 1024, 8192, 0xcbcc1461
> +0, 12, 12,1,  1378560, 0x9c598000
> +1,  25488,  25488, 1024, 8192, 0x
> +0, 13, 13,1,  1378560, 0xbaf121ba
> +1,  26512,  26512, 1024, 8192, 0x
> +1, 

Re: [FFmpeg-devel] [PATCH 6/6] doc/developer: Require new modules to include tests

2023-06-19 Thread Jean-Baptiste Kempf
On Sun, 18 Jun 2023, at 23:50, Michael Niedermayer wrote:
>  doc/developer.texi | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

+1

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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 v1 1/2] lavc/vp9: set yuvj pixel format for full range decode

2023-06-19 Thread Thilo Borgmann

Am 18.06.23 um 23:21 schrieb Leo Izen:

On 6/17/23 10:26, Thilo Borgmann wrote:

Am 17.06.23 um 16:02 schrieb Leo Izen:

On 6/17/23 04:11, Thilo Borgmann wrote:

While the yuvj pixel formats are deprecated lots of code still relies
on them to be set. Without setting a yuvj420p pixel format VP9
decoding ends up incorrectly due to auto conversion.



I oppose this on principle. If there's code that relies on YUVJ being set, 
then *that code* needs to be changed so it respects the AVFrame->color_range 
field. Which code is working improperly with this?


I don't like adding YUVJ stuff either. If I do

  ./ffmpeg -i full-range-in.mp4 -c:v libvpx-vp9 -lossless 1 lossless-out.mp4

and then comparing the frames, they are not equal. E.g. by

  ./ffmpeg -i full-range-in.mp4 -i lossless-out.mp4 -filter_complex ssim -f crc 
-

they are not 1.0 in ssim terms.



Are you sure? I just tested a sample and found that I got exactly 1.0 in ssim 
terms. Do you have a link to a sample for which this fails?


IIRC I had the same impression when testing, I think I mixed up patched and 
unpatched ffmpeg builds.


Anyway, happy you retest, I used

./ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -pix_fmt yuvj420p 
-color_range pc full-range-in.mp4


to generate my input sample. I cannot test myself again until Thursday, my 
Laptop is not equipped with libvpx.


Thank you!
-Thilo


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