[FFmpeg-cvslog] lavc/snow: only allocate mconly_picture for decoding

2022-05-11 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Mar 23 
16:15:06 2022 +0100| [a4ce3706595edd9b537861f0e5447e31babf2100] | committer: 
Anton Khirnov

lavc/snow: only allocate mconly_picture for decoding

It is not used in the encoder.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4ce3706595edd9b537861f0e5447e31babf2100
---

 libavcodec/snow.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 0a500695ce..97b0448dbf 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -513,16 +513,20 @@ int ff_snow_common_init_after_header(AVCodecContext 
*avctx) {
 int ret, emu_buf_size;
 
 if(!s->scratchbuf) {
-if ((ret = ff_get_buffer(s->avctx, s->mconly_picture,
- AV_GET_BUFFER_FLAG_REF)) < 0)
-return ret;
+if (av_codec_is_decoder(avctx->codec)) {
+if ((ret = ff_get_buffer(s->avctx, s->mconly_picture,
+ AV_GET_BUFFER_FLAG_REF)) < 0)
+return ret;
+}
+
 emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 
2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1);
 if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf,  
FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) ||
 !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size))
 return AVERROR(ENOMEM);
 }
 
-if(s->mconly_picture->format != avctx->pix_fmt) {
+if (av_codec_is_decoder(avctx->codec) &&
+s->mconly_picture->format != avctx->pix_fmt) {
 av_log(avctx, AV_LOG_ERROR, "pixel format changed\n");
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/avcodec: only allocate decoding packets for decoders

2022-05-11 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Mar 23 
14:25:24 2022 +0100| [2cb86cd00c64ff16b16920eec37ec5b25a59b284] | committer: 
Anton Khirnov

lavc/avcodec: only allocate decoding packets for decoders

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cb86cd00c64ff16b16920eec37ec5b25a59b284
---

 libavcodec/avcodec.c | 7 +--
 libavcodec/decode.c  | 8 
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 8afb6cd62e..9fc5e001f9 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -155,12 +155,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 
 avci->buffer_frame = av_frame_alloc();
 avci->buffer_pkt = av_packet_alloc();
-avci->in_pkt = av_packet_alloc();
-avci->last_pkt_props = av_packet_alloc();
-avci->pkt_props = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
- AV_FIFO_FLAG_AUTO_GROW);
-if (!avci->buffer_frame || !avci->buffer_pkt  ||
-!avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props) {
+if (!avci->buffer_frame || !avci->buffer_pkt) {
 ret = AVERROR(ENOMEM);
 goto free_and_end;
 }
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 909235feb4..264fc66a81 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1527,6 +1527,7 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 
 int ff_decode_preinit(AVCodecContext *avctx)
 {
+AVCodecInternal *avci = avctx->internal;
 int ret = 0;
 
 /* if the decoder init function was already called previously,
@@ -1605,6 +1606,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
 }
 
+avci->in_pkt = av_packet_alloc();
+avci->last_pkt_props = av_packet_alloc();
+avci->pkt_props  = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
+  AV_FIFO_FLAG_AUTO_GROW);
+if (!avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props)
+return AVERROR(ENOMEM);
+
 ret = decode_bsfs_init(avctx);
 if (ret < 0)
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/encode: add an encoder-specific get_buffer() variant

2022-05-11 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Mar 23 
16:17:20 2022 +0100| [c954cf1e1b766a0d1992d5be0a8be0055a8e1a6a] | committer: 
Anton Khirnov

lavc/encode: add an encoder-specific get_buffer() variant

Several encoders (roqvideo, svq1, snow, and the mpegvideo family)
currently call ff_get_buffer(). However this function is written
assuming it is called by a decoder. Though nothing has been obviously
broken by this until now, that may change in the future.

To avoid potential future issues, introduce a simple encode-specific
wrapper around avcodec_default_get_buffer2() and enforce its use in
encoders.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c954cf1e1b766a0d1992d5be0a8be0055a8e1a6a
---

 libavcodec/decode.c  |  2 ++
 libavcodec/encode.c  | 34 ++
 libavcodec/encode.h  |  5 +
 libavcodec/mpegpicture.c | 16 +---
 libavcodec/roqvideoenc.c |  4 ++--
 libavcodec/snow.c|  8 ++--
 libavcodec/svq1enc.c |  4 ++--
 7 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 69e68ab09d..909235feb4 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1405,6 +1405,8 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, 
int flags)
 int override_dimensions = 1;
 int ret;
 
+av_assert0(av_codec_is_decoder(avctx->codec));
+
 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
 if ((unsigned)avctx->width > INT_MAX - STRIDE_ALIGN ||
 (ret = av_image_check_size2(FFALIGN(avctx->width, STRIDE_ALIGN), 
avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || 
avctx->pix_fmt<0) {
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index e7ae2cd4c1..b68bf1e184 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -597,3 +597,37 @@ int ff_encode_preinit(AVCodecContext *avctx)
 
 return 0;
 }
+
+int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
+{
+int ret;
+
+switch (avctx->codec->type) {
+case AVMEDIA_TYPE_VIDEO:
+frame->format = avctx->pix_fmt;
+if (frame->width <= 0 || frame->height <= 0) {
+frame->width  = FFMAX(avctx->width,  avctx->coded_width);
+frame->height = FFMAX(avctx->height, avctx->coded_height);
+}
+
+break;
+case AVMEDIA_TYPE_AUDIO:
+frame->sample_rate = avctx->sample_rate;
+frame->format  = avctx->sample_fmt;
+if (!frame->ch_layout.nb_channels) {
+ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout);
+if (ret < 0)
+return ret;
+}
+break;
+}
+
+ret = avcodec_default_get_buffer2(avctx, frame, 0);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+av_frame_unref(frame);
+return ret;
+}
+
+return 0;
+}
diff --git a/libavcodec/encode.h b/libavcodec/encode.h
index 97b3acf9df..b2536bf0f3 100644
--- a/libavcodec/encode.h
+++ b/libavcodec/encode.h
@@ -44,6 +44,11 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame 
*frame);
  */
 int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, 
int flags);
 
+/**
+ * Allocate buffers for a frame. Encoder equivalent to ff_get_buffer().
+ */
+int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame);
+
 /**
  * Check AVPacket size and allocate data.
  *
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 681ccc2b82..aaa1df0bd8 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -26,6 +26,7 @@
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
+#include "encode.h"
 #include "motion_est.h"
 #include "mpegpicture.h"
 #include "mpegutils.h"
@@ -123,14 +124,15 @@ static int alloc_frame_buffer(AVCodecContext *avctx,  
Picture *pic,
 int r, ret;
 
 pic->tf.f = pic->f;
-if (avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
-avctx->codec_id != AV_CODEC_ID_VC1IMAGE  &&
-avctx->codec_id != AV_CODEC_ID_MSS2) {
-if (edges_needed) {
-pic->f->width  = avctx->width  + 2 * EDGE_WIDTH;
-pic->f->height = avctx->height + 2 * EDGE_WIDTH;
-}
 
+if (edges_needed) {
+pic->f->width  = avctx->width  + 2 * EDGE_WIDTH;
+pic->f->height = avctx->height + 2 * EDGE_WIDTH;
+
+r = ff_encode_alloc_frame(avctx, pic->f);
+} else if (avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
+   avctx->codec_id != AV_CODEC_ID_VC1IMAGE  &&
+   avctx->codec_id != AV_CODEC_ID_MSS2) {
 r = ff_thread_get_ext_buffer(avctx, &pic->tf,
  pic->reference ? AV_GET_BUFFER_FLAG_REF : 
0);
 } else {
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index 8cdc9f389c..c0c67dbed9 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -1081,8 +1081,8 @@ static int roq_encode_frame(AVCodecContext *avctx, 
AVPacket 

[FFmpeg-cvslog] lavc/pthread_frame: do not copy AVCodecInternal contents

2022-05-11 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Mar 23 
16:30:01 2022 +0100| [28b8b41e5acecdb0c2e5f7a3b69c14706548aa0a] | committer: 
Anton Khirnov

lavc/pthread_frame: do not copy AVCodecInternal contents

None of its fields have meaningful values at that point that would need
to be copied to frame thread workers.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28b8b41e5acecdb0c2e5f7a3b69c14706548aa0a
---

 libavcodec/pthread_frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 10b84e57b0..c667706206 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -791,7 +791,7 @@ static av_cold int init_thread(PerThreadContext *p, int 
*threads_to_free,
 p->parent = fctx;
 p->avctx  = copy;
 
-copy->internal = av_memdup(avctx->internal, sizeof(*avctx->internal));
+copy->internal = av_mallocz(sizeof(*copy->internal));
 if (!copy->internal)
 return AVERROR(ENOMEM);
 copy->internal->thread_ctx = p;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc: drop a confusing message about "thread emulation"

2022-05-11 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Wed Mar 23 
16:43:55 2022 +0100| [80162194728e3da3262db8d1bdc9f39e6cde9e51] | committer: 
Anton Khirnov

lavc: drop a confusing message about "thread emulation"

There is no such thing.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80162194728e3da3262db8d1bdc9f39e6cde9e51
---

 libavcodec/avcodec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 9fc5e001f9..e8fff48e5d 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -284,9 +284,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (ret < 0)
 goto free_and_end;
 
-if (!HAVE_THREADS)
-av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
support, using thread emulation\n");
-
 if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
 ret = ff_frame_thread_encoder_init(avctx);
 if (ret < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/af_biquads: add zdf transform type

2022-05-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed May 11 21:23:59 
2022 +0200| [cbc1b8adad80dd433aeda575f4c5873dfecb7c6f] | committer: Paul B Mahol

avfilter/af_biquads: add zdf transform type

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbc1b8adad80dd433aeda575f4c5873dfecb7c6f
---

 doc/filters.texi |   9 ++
 libavfilter/af_biquads.c | 250 ---
 2 files changed, 248 insertions(+), 11 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 22a88d7f58..e27cd805e4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2054,6 +2054,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -3484,6 +3485,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -3580,6 +3582,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -3686,6 +3689,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -3777,6 +3781,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -4585,6 +4590,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -5095,6 +5101,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -5454,6 +5461,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
@@ -6699,6 +6707,7 @@ Set transform type of IIR filter.
 @item tdii
 @item latt
 @item svf
+@item zdf
 @end table
 
 @item precision, r
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 060569948a..cab7c95dcb 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -104,6 +104,7 @@ enum TransformType {
 TDII,
 LATT,
 SVF,
+ZDF,
 NB_TTYPE,
 };
 
@@ -150,7 +151,7 @@ typedef struct BiquadsContext {
 
 void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int 
len,
double *i1, double *i2, double *o1, double *o2,
-   double b0, double b1, double b2, double a1, double a2, int 
*clippings,
+   double b0, double b1, double b2, double a0, double a1, 
double a2, int *clippings,
int disabled);
 } BiquadsContext;
 
@@ -203,7 +204,7 @@ static void biquad_## name (BiquadsContext *s,  
  \
 double *in1, double *in2, \
 double *out1, double *out2,   \
 double b0, double b1, double b2,  \
-double a1, double a2, int *clippings, \
+double a0, double a1, double a2, int *clippings,  \
 int disabled) \
 { \
 const type *ibuf = input; \
@@ -286,7 +287,7 @@ static void biquad_dii_## name (BiquadsContext *s,  
  \
 double *z1, double *z2,   \
 double *unused1, double *unused2, \
 double b0, double b1, double b2,  \
-double a1, double a2, int *clippings, \
+double a0, double a1, double a2, int *clippings,  \
 int disabled) \
 { \
 const type *ibuf = input; \
@@ -334,7 +335,7 @@ static void biquad_tdi_## name (BiquadsContext *s,  
  \
 double *z1, double *z2,   \
 double *z3, double *z4,   \
 double b0, double b1, double b2,  \
-double a1, double a2, int *clippings, \
+double a0, double a1, double a2, int *clippings,  \
 int disabled) \
 { \
 const type *ibuf = input; \
@@ -390,7 +391,7 @@ static void biquad_tdii_## name (BiquadsContext *s, 
  \
 double *z1, double *z2,   \

[FFmpeg-cvslog] avformat/http: remove unused function ff_http_get_shutdown_status

2022-05-11 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Sun May  8 
07:46:57 2022 +0800| [1d6e9a7a3083ce07c8431f7b93958d8496531fcf] | committer: 
Steven Liu

avformat/http: remove unused function ff_http_get_shutdown_status

ff_http_get_shutdown_status is unused after ticket 9010 fixed.

Signed-off-by: Steven Liu 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d6e9a7a3083ce07c8431f7b93958d8496531fcf
---

 libavformat/http.c | 15 ---
 libavformat/http.h |  9 -
 2 files changed, 24 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index c4eeb58cd0..c8f3f4b6a3 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -441,21 +441,6 @@ fail:
 return ret;
 return ff_http_averror(s->http_code, AVERROR(EIO));
 }
-int ff_http_get_shutdown_status(URLContext *h)
-{
-int ret = 0;
-HTTPContext *s = h->priv_data;
-
-/* flush the receive buffer when it is write only mode */
-char buf[1024];
-int read_ret;
-read_ret = ffurl_read(s->hd, buf, sizeof(buf));
-if (read_ret < 0) {
-ret = read_ret;
-}
-
-return ret;
-}
 
 int ff_http_do_new_request(URLContext *h, const char *uri) {
 return ff_http_do_new_request2(h, uri, NULL);
diff --git a/libavformat/http.h b/libavformat/http.h
index 5557ce9b58..5f650ef143 100644
--- a/libavformat/http.h
+++ b/libavformat/http.h
@@ -37,15 +37,6 @@
  */
 void ff_http_init_auth_state(URLContext *dest, const URLContext *src);
 
-/**
- * Get the HTTP shutdown response status, be used after http_shutdown.
- *
- * @param h pointer to the resource
- * @return a negative value if an error condition occurred, 0
- * otherwise
- */
-int ff_http_get_shutdown_status(URLContext *h);
-
 /**
  * Send a new HTTP request, reusing the old connection.
  *

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] configure: extend SDL check to accept all 2.x versions

2022-05-11 Thread Christopher Degawa
ffmpeg | branch: master | Christopher Degawa  | Wed May 11 
15:11:04 2022 -0500| [e5163b1d34381a3319214a902ef1df923dd2eeba] | committer: 
Gyan Doshi

configure: extend SDL check to accept all 2.x versions

sdl2 recently changed their versioning, moving the patch level to minor level
https://github.com/libsdl-org/SDL/commit/cd7c2f1de7d9e418bb554047d714dd7cacc020ff
and have said that they will instead ship sdl3.pc for 3.0.0

Fixes ticket 9768

Signed-off-by: Christopher Degawa 
Signed-off-by: Gyan Doshi 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5163b1d34381a3319214a902ef1df923dd2eeba
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 4d2f4d9112..0faf2455b7 100755
--- a/configure
+++ b/configure
@@ -6742,7 +6742,7 @@ fi
 
 if enabled sdl2; then
 SDL2_CONFIG="${cross_prefix}sdl2-config"
-test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h 
SDL_PollEvent
+test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 3.0.0" SDL_events.h 
SDL_PollEvent
 if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 sdl2_extralibs=$("${SDL2_CONFIG}" --libs)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] fate/matroska: Add test for remuxing DVB subtitles to Matroska

2022-05-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 10 11:13:33 2022 +0200| [cf9e470d05e69dd7e534dda59ad91dd8a0337670] | 
committer: Andreas Rheinhardt

fate/matroska: Add test for remuxing DVB subtitles to Matroska

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf9e470d05e69dd7e534dda59ad91dd8a0337670
---

 tests/fate/matroska.mak  | 10 +++
 tests/ref/fate/matroska-dvbsub-remux | 52 
 2 files changed, 62 insertions(+)

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index ebd95ced04..b49ec761cf 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -171,6 +171,16 @@ fate-matroska-pgs-remux: CMD = transcode sup 
$(TARGET_SAMPLES)/sub/pgs_sub.sup m
 FATE_MATROSKA-$(call REMUX, MATROSKA, SUP_DEMUXER PGS_FRAME_MERGE_BSF 
SETTS_BSF) += fate-matroska-pgs-remux-durations
 fate-matroska-pgs-remux-durations: CMD = transcode sup 
$(TARGET_SAMPLES)/sub/pgs_sub.sup matroska "-copyts -c:s copy -bsf 
pgs_frame_merge,setts=duration=if(gt(DURATION\,0)\,DURATION\,if(eq(PTS\,NOPTS)\,0\,if(eq(NEXT_PTS\,NOPTS)\,0\,NEXT_PTS-PTS))):pts=PTS"
 "-copyts -c:s copy"
 
+# This test muxes DVB subtitles twice into Matroska: Once normally
+# and once with durations derived via the setts filter. Said filter
+# sets the duration for every packet except the last it receives.
+# The "-t 20" also tests that the BSF is properly flushed even
+# when processing ended due to something else than the input's EOF.
+# Notice that the last packet of stream 0 before 20s is present,
+# but has no duration (like stream 1).
+FATE_MATROSKA-$(call REMUX, MATROSKA, MPEGTS_DEMUXER DVBSUB_PARSER SETTS_BSF) 
+= fate-matroska-dvbsub-remux
+fate-matroska-dvbsub-remux: CMD = transcode mpegts 
$(TARGET_SAMPLES)/sub/dvbsubtest_filter.ts matroska "-map 0:s -map 0:s -t 20 -c 
copy -bsf:0 
setts=duration=if(gt(DURATION\,0)\,DURATION\,if(eq(PTS\,NOPTS)\,0\,if(eq(NEXT_PTS\,NOPTS)\,0\,NEXT_PTS-PTS))):pts=PTS"
 "-map 0 -c copy"
+
 FATE_MATROSKA_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += 
fate-matroska-spherical-mono
 fate-matroska-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
-show_entries stream_side_data_list -select_streams v -v 0 
$(TARGET_SAMPLES)/mkv/spherical.mkv
 
diff --git a/tests/ref/fate/matroska-dvbsub-remux 
b/tests/ref/fate/matroska-dvbsub-remux
new file mode 100644
index 00..7c543e5a7d
--- /dev/null
+++ b/tests/ref/fate/matroska-dvbsub-remux
@@ -0,0 +1,52 @@
+e675d3a76a4720f3e65bf56ec6041fe1 
*tests/data/fate/matroska-dvbsub-remux.matroska
+39025 tests/data/fate/matroska-dvbsub-remux.matroska
+#extradata 0:5, 0x00bb0064
+#extradata 1:5, 0x00bb0064
+#tb 0: 1/1000
+#media_type 0: subtitle
+#codec_id 0: dvb_subtitle
+#tb 1: 1/1000
+#media_type 1: subtitle
+#codec_id 1: dvb_subtitle
+0,  0,  0,  280,   14, 0x05f400e1
+1,  0,  0,0,   14, 0x05f400e1
+0,280,280, 5000,   14, 0x066400f1
+1,280,280,0,   14, 0x066400f1
+0,   5280,   5280, 5020,   14, 0x06d40101
+1,   5280,   5280,0,   14, 0x06d40101
+0,  10300,  10300, 3600,   14, 0x07440111
+1,  10300,  10300,0,   14, 0x07440111
+0,  13900,  13900,  220,   14, 0x07b40121
+1,  13900,  13900,0,   14, 0x07b40121
+0,  14120,  14120, 1440,   14, 0x08240131
+1,  14120,  14120,0,   14, 0x08240131
+0,  15560,  15560,   40,   14, 0x08940141
+1,  15560,  15560,0,   14, 0x08940141
+0,  15600,  15600,  160,  944, 0x454c0939
+1,  15600,  15600,0,  944, 0x454c0939
+0,  15760,  15760,  240,  630, 0x49dbb35f
+1,  15760,  15760,0,  630, 0x49dbb35f
+0,  16000,  16000,  340,  344, 0xb1eb63ed
+1,  16000,  16000,0,  344, 0xb1eb63ed
+0,  16340,  16340,  600,  966, 0xb8a61edf
+1,  16340,  16340,0,  966, 0xb8a61edf
+0,  16940,  16940,  460,  470, 0x80597fba
+1,  16940,  16940,0,  470, 0x80597fba
+0,  17400,  17400,  360, 1212, 0x554768d6
+1,  17400,  17400,0, 1212, 0x554768d6
+0,  17760,  17760,  220, 4804, 0xab67ddbe
+1,  17760,  17760,0, 4804, 0xab67ddbe
+0,  17980,  17980,  960, 1016, 0x15e42d56
+1,  17980,  17980,0, 1016, 0x15e42d56
+0,  18940,  18940,  220,  456, 0x57917e6f
+1,  18940,  18940,0,  456, 0x57917e6f
+0,  19160,  19160,  260,  830, 0xcff3efde
+1,  19160,  19160,0,  830, 0xcff3efde
+0,  19420,  19420,  100,  860, 0xd89903b6
+1,  19420,  19420,0,  860, 0xd89903b6
+0,  19520,  19520

[FFmpeg-cvslog] avcodec/texturedspenc: Fix invalid shift

2022-05-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 10 18:00:56 2022 +0200| [e92e74b89766146869f2ffe44b85b63fd39a3b66] | 
committer: Andreas Rheinhardt

avcodec/texturedspenc: Fix invalid shift

Left shifts of signed types are UB unless the results fit
into the type. (Furthermore the value to be shifted need to be
nonnegative.)

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e92e74b89766146869f2ffe44b85b63fd39a3b66
---

 libavcodec/texturedspenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 381be16f75..21e341c613 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -181,9 +181,9 @@ static unsigned int match_colors(const uint8_t *block, 
ptrdiff_t stride,
 int x, y, k = 0;
 int c0_point, half_point, c3_point;
 uint8_t color[16];
-static const int indexMap[8] = {
-0 << 30, 2 << 30, 0 << 30, 2 << 30,
-3 << 30, 3 << 30, 1 << 30, 1 << 30,
+static const uint32_t indexMap[8] = {
+0U << 30, 2U << 30, 0U << 30, 2U << 30,
+3U << 30, 3U << 30, 1U << 30, 1U << 30,
 };
 
 /* Fill color and compute direction for each component */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".