[FFmpeg-cvslog] fate/dca: Fix test requirements

2022-06-01 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 31 21:37:54 2022 +0200| [77b529fbd228fe30a870e3157f051885b436ad92] | 
committer: Andreas Rheinhardt

fate/dca: Fix test requirements

Signed-off-by: Andreas Rheinhardt 

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

 tests/fate/dca.mak | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/fate/dca.mak b/tests/fate/dca.mak
index 5168c1bc78..2b8f83497c 100644
--- a/tests/fate/dca.mak
+++ b/tests/fate/dca.mak
@@ -22,7 +22,7 @@ DCADEC_SUITE_LOSSY   = core_51_24_48_768_0\
xxch_71_24_48_2046 \
 
 define FATE_DCADEC_LOSSLESS_SUITE
-FATE_DCADEC_LOSSLESS += fate-dca-$(1) fate-dca-$(1)-dmix_2 fate-dca-$(1)-dmix_6
+FATE_DCADEC_LOSSLESS_$(2) += fate-dca-$(1) fate-dca-$(1)-dmix_2 
fate-dca-$(1)-dmix_6
 fate-dca-$(1): CMD = framemd5 -i $(TARGET_SAMPLES)/dts/dcadec-suite/$(1).dtshd 
-c:a pcm_$(2) -af aresample
 fate-dca-$(1)-dmix_2: CMD = framemd5 -request_channel_layout 0x3   -i 
$(TARGET_SAMPLES)/dts/dcadec-suite/$(1).dtshd -c:a pcm_$(2) -af aresample
 fate-dca-$(1)-dmix_6: CMD = framemd5 -request_channel_layout 0x60f -i 
$(TARGET_SAMPLES)/dts/dcadec-suite/$(1).dtshd -c:a pcm_$(2) -af aresample
@@ -61,22 +61,24 @@ $(FATE_DCADEC_LOSSY): CMP = oneoff
 $(FATE_DCADEC_LOSSY): CMP_UNIT = f32
 $(FATE_DCADEC_LOSSY): FUZZ = 9
 
-FATE_DCA-$(call DEMDEC, DTSHD, DCA) += $(FATE_DCADEC_LOSSLESS) 
$(FATE_DCADEC_LOSSY)
+FATE_DCA-$(call FRAMEMD5, DTSHD, DCA, ARESAMPLE_FILTER PCM_S16LE_ENCODER) += 
$(FATE_DCADEC_LOSSLESS_s16le)
+FATE_DCA-$(call FRAMEMD5, DTSHD, DCA, ARESAMPLE_FILTER PCM_S24LE_ENCODER) += 
$(FATE_DCADEC_LOSSLESS_s24le)
+FATE_DCA-$(call FILTERDEMDECENCMUX, ARESAMPLE, DTSHD, DCA, PCM_F32LE, 
PCM_F32LE, PIPE_PROTOCOL) += $(FATE_DCADEC_LOSSY)
 
-FATE_DCA-$(call DEMDEC, MPEGTS, DCA) += fate-dca-core
+FATE_DCA-$(call PCM, MPEGTS, DCA, DTS_DEMUXER ARESAMPLE_FILTER) += 
fate-dca-core
 fate-dca-core: CMD = pcm -i $(TARGET_SAMPLES)/dts/dts.ts
 fate-dca-core: CMP = oneoff
 fate-dca-core: REF = $(SAMPLES)/dts/dts.pcm
 
-FATE_DCA-$(call DEMDEC, DTS, DCA) += fate-dca-xll
+FATE_DCA-$(call DEMDEC, DTS, DCA, ARESAMPLE_FILTER PCM_S24LE_ENCODER 
PCM_S24LE_MUXER) += fate-dca-xll
 fate-dca-xll: CMD = md5 -i $(TARGET_SAMPLES)/dts/master_audio_7.1_24bit.dts -f 
s24le -af aresample
 
-FATE_DCA-$(call DEMDEC, DTS, DCA) += fate-dts_es
+FATE_DCA-$(call PCM, DTS, DCA, ARESAMPLE_FILTER) += fate-dts_es
 fate-dts_es: CMD = pcm -i $(TARGET_SAMPLES)/dts/dts_es.dts
 fate-dts_es: CMP = oneoff
 fate-dts_es: REF = $(SAMPLES)/dts/dts_es_2.pcm
 
-FATE_DCA-$(call ALLYES, DTS_DEMUXER DTS_MUXER DCA_CORE_BSF) += 
fate-dca-core-bsf
+FATE_DCA-$(call DEMMUX, DTS, DTS, DCA_CORE_BSF MD5_PROTOCOL) += 
fate-dca-core-bsf
 fate-dca-core-bsf: CMD = md5pipe -i 
$(TARGET_SAMPLES)/dts/master_audio_7.1_24bit.dts -c:a copy -bsf:a dca_core 
-fflags +bitexact -f dts
 fate-dca-core-bsf: CMP = oneline
 fate-dca-core-bsf: REF = ca22b00d8c641cd168e2f7ca8d2f340e

___
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] tests/Makefile: Add PCM function

2022-06-01 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 31 21:27:05 2022 +0200| [bdfe9d5418ec27c7877119f17d1c6f2a035d5103] | 
committer: Andreas Rheinhardt

tests/Makefile: Add PCM function

For use with the "pcm" command.

Signed-off-by: Andreas Rheinhardt 

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

 tests/Makefile | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/Makefile b/tests/Makefile
index 035bdf783e..d9c509a415 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -108,6 +108,10 @@ FRAMECRC = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER) 
$(3)  \
   PCM_S16LE_ENCODER RAWVIDEO_ENCODER FRAMECRC_MUXER   \
   PIPE_PROTOCOL FILE_PROTOCOL)
 
+# Variant of DEMDEC for use with the "pcm" command.
+PCM = $(call ALLYES, $(1)_DEMUXER $(2)_DECODER  $(3) FILE_PROTOCOL\
+ PCM_S16LE_ENCODER PCM_S16LE_MUXER PIPE_PROTOCOL)
+
 DEMMUX  = $(call ALLYES, $(1)_DEMUXER $(2)_MUXER $(3) FILE_PROTOCOL)
 
 # Variant of FRAMECRC for the cases with -lavfi where no demuxer is involved.

___
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] avutil/csp: create public API for colorspace structs

2022-06-01 Thread Leo Izen
ffmpeg | branch: master | Leo Izen  | Sat May 28 09:30:36 
2022 -0400| [d42b410e05ad1c4d6e74aa981b4a4423103291fb] | committer: Ronald S. 
Bultje

avutil/csp: create public API for colorspace structs

This commit moves some of the functionality from avfilter/colorspace
into avutil/csp and exposes it as a public API so it can be used by
libavcodec and/or libavformat. It also converts those structs from
double values to AVRational to make regression testing easier and
more consistent.

Signed-off-by: Ronald S. Bultje 

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

 libavfilter/colorspace.c| 143 ++--
 libavfilter/colorspace.h|  31 ++
 libavfilter/fflcms2.c   |  33 +-
 libavfilter/fflcms2.h   |   4 +-
 libavfilter/vf_colorspace.c |  37 ++--
 libavfilter/vf_iccdetect.c  |   5 +-
 libavfilter/vf_tonemap.c|  17 ++
 libavutil/Makefile  |   2 +
 libavutil/csp.c | 128 +++
 libavutil/csp.h | 106 
 libavutil/version.h |   2 +-
 11 files changed, 317 insertions(+), 191 deletions(-)

diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c
index 8d7b882375..7f74fe5113 100644
--- a/libavfilter/colorspace.c
+++ b/libavfilter/colorspace.c
@@ -65,24 +65,28 @@ void ff_matrix_mul_3x3(double dst[3][3],
 /*
  * see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
  */
-void ff_fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
-   const struct WhitepointCoefficients *wp,
+void ff_fill_rgb2xyz_table(const AVPrimaryCoefficients *coeffs,
+   const AVWhitepointCoefficients *wp,
double rgb2xyz[3][3])
 {
 double i[3][3], sr, sg, sb, zw;
-
-rgb2xyz[0][0] = coeffs->xr / coeffs->yr;
-rgb2xyz[0][1] = coeffs->xg / coeffs->yg;
-rgb2xyz[0][2] = coeffs->xb / coeffs->yb;
+double xr = av_q2d(coeffs->r.x), yr = av_q2d(coeffs->r.y);
+double xg = av_q2d(coeffs->g.x), yg = av_q2d(coeffs->g.y);
+double xb = av_q2d(coeffs->b.x), yb = av_q2d(coeffs->b.y);
+double xw = av_q2d(wp->x), yw = av_q2d(wp->y);
+
+rgb2xyz[0][0] = xr / yr;
+rgb2xyz[0][1] = xg / yg;
+rgb2xyz[0][2] = xb / yb;
 rgb2xyz[1][0] = rgb2xyz[1][1] = rgb2xyz[1][2] = 1.0;
-rgb2xyz[2][0] = (1.0 - coeffs->xr - coeffs->yr) / coeffs->yr;
-rgb2xyz[2][1] = (1.0 - coeffs->xg - coeffs->yg) / coeffs->yg;
-rgb2xyz[2][2] = (1.0 - coeffs->xb - coeffs->yb) / coeffs->yb;
+rgb2xyz[2][0] = (1.0 - xr - yr) / yr;
+rgb2xyz[2][1] = (1.0 - xg - yg) / yg;
+rgb2xyz[2][2] = (1.0 - xb - yb) / yb;
 ff_matrix_invert_3x3(rgb2xyz, i);
-zw = 1.0 - wp->xw - wp->yw;
-sr = i[0][0] * wp->xw + i[0][1] * wp->yw + i[0][2] * zw;
-sg = i[1][0] * wp->xw + i[1][1] * wp->yw + i[1][2] * zw;
-sb = i[2][0] * wp->xw + i[2][1] * wp->yw + i[2][2] * zw;
+zw = 1.0 - xw - yw;
+sr = i[0][0] * xw + i[0][1] * yw + i[0][2] * zw;
+sg = i[1][0] * xw + i[1][1] * yw + i[1][2] * zw;
+sb = i[2][0] * xw + i[2][1] * yw + i[2][2] * zw;
 rgb2xyz[0][0] *= sr;
 rgb2xyz[0][1] *= sg;
 rgb2xyz[0][2] *= sb;
@@ -107,119 +111,32 @@ static const double gbr_matrix[3][3] =
 { 0.5, -0.5, 0   },
 };
 
-/*
- * All constants explained in e.g. 
https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html
- * The older ones (bt470bg/m) are also explained in their respective ITU docs
- * (e.g. 
https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-5-199802-S!!PDF-E.pdf)
- * whereas the newer ones can typically be copied directly from wikipedia :)
- */
-static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = {
-[AVCOL_SPC_FCC]= { 0.30,   0.59,   0.11   },
-[AVCOL_SPC_BT470BG]= { 0.299,  0.587,  0.114  },
-[AVCOL_SPC_SMPTE170M]  = { 0.299,  0.587,  0.114  },
-[AVCOL_SPC_BT709]  = { 0.2126, 0.7152, 0.0722 },
-[AVCOL_SPC_SMPTE240M]  = { 0.212,  0.701,  0.087  },
-[AVCOL_SPC_YCOCG]  = { 0.25,   0.5,0.25   },
-[AVCOL_SPC_RGB]= { 1,  1,  1  },
-[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
-[AVCOL_SPC_BT2020_CL]  = { 0.2627, 0.6780, 0.0593 },
-};
-
-const struct LumaCoefficients *ff_get_luma_coefficients(enum AVColorSpace csp)
-{
-const struct LumaCoefficients *coeffs;
-
-if (csp >= AVCOL_SPC_NB)
-return NULL;
-coeffs = &luma_coefficients[csp];
-if (!coeffs->cr)
-return NULL;
-
-return coeffs;
-}
-
-#define WP_D65 { 0.3127, 0.3290 }
-#define WP_C   { 0.3100, 0.3160 }
-#define WP_DCI { 0.3140, 0.3510 }
-#define WP_E   { 1/3.0f, 1/3.0f }
-
-static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = {
-[AVCOL_PRI_BT709] = { WP_D65, { 0.640, 0.330, 0.300, 0.600, 0.150, 
0.060 } },
-[AVCOL_PRI_BT470M]= { WP_C,   { 0.670, 0.330, 0.210, 0.710

[FFmpeg-cvslog] vp9: don't overread by 4 pixels in ff_vp9_avg4_mmxext().

2022-06-01 Thread Ronald S . Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Tue May 31 
08:30:37 2022 -0400| [6e13c30a8fd45e14303ef4a8e4da3554d5b4ba8e] | committer: 
Ronald S. Bultje

vp9: don't overread by 4 pixels in ff_vp9_avg4_mmxext().

If the block is at the end of the allocated buffer and there is no
padding, this will over-read, which may cause crashes. Reported by
Firefox.

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

 libavcodec/x86/vp9mc.asm | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/x86/vp9mc.asm b/libavcodec/x86/vp9mc.asm
index f64161b2c2..efc4cfbef1 100644
--- a/libavcodec/x86/vp9mc.asm
+++ b/libavcodec/x86/vp9mc.asm
@@ -604,7 +604,12 @@ cglobal vp9_%1%2 %+ %%szsuf, 5, 5, %8, dst, dstride, src, 
sstride, h
 %%pavg  m0, [dstq]
 %%pavg  m1, [dstq+d%3]
 %%pavg  m2, [dstq+d%4]
+%if %2 == 4
+%%srcfn m4, [dstq+d%5]
+%%pavg  m3, m4
+%else
 %%pavg  m3, [dstq+d%5]
+%endif
 %if %2/mmsize == 8
 %%pavg  m4, [dstq+mmsize*4]
 %%pavg  m5, [dstq+mmsize*5]

___
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] lavfi/blockdetect: Remove nop init() function

2022-06-01 Thread Thilo Borgmann
ffmpeg | branch: master | Thilo Borgmann  | Wed Jun  1 
21:31:20 2022 +0200| [e9107d16f3ea1eff48f0bfdcaff49f7c32a20919] | committer: 
Thilo Borgmann

lavfi/blockdetect: Remove nop init() function

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

 libavfilter/vf_blockdetect.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libavfilter/vf_blockdetect.c b/libavfilter/vf_blockdetect.c
index 624dcfdeda..8503b8d815 100644
--- a/libavfilter/vf_blockdetect.c
+++ b/libavfilter/vf_blockdetect.c
@@ -60,11 +60,6 @@ static const AVOption blockdetect_options[] = {
 
 AVFILTER_DEFINE_CLASS(blockdetect);
 
-static av_cold int blockdetect_init(AVFilterContext *ctx)
-{
-return 0;
-}
-
 static int blockdetect_config_input(AVFilterLink *inlink)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -284,7 +279,6 @@ const AVFilter ff_vf_blockdetect = {
 .name  = "blockdetect",
 .description   = NULL_IF_CONFIG_SMALL("Blockdetect filter."),
 .priv_size = sizeof(BLKContext),
-.init  = blockdetect_init,
 .uninit= blockdetect_uninit,
 FILTER_PIXFMTS_ARRAY(pix_fmts),
 FILTER_INPUTS(blockdetect_inputs),

___
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/videotoolboxdec: warn on nonzero status in the callback

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 02:46:49 2022 
-0500| [dfbc921f9f6b940c7de48f7795f20fcd553e792a] | committer: rcombs

lavc/videotoolboxdec: warn on nonzero status in the callback

Signed-off-by: rcombs 

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

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

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 9083f6ff29..7c4c4c6e1b 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -691,7 +691,7 @@ static void videotoolbox_decoder_callback(void *opaque,
 }
 
 if (!image_buffer) {
-av_log(avctx, AV_LOG_DEBUG, "vt decoder cb: output image buffer is 
null\n");
+av_log(avctx, status ? AV_LOG_WARNING : AV_LOG_DEBUG, "vt decoder cb: 
output image buffer is null: %i\n", status);
 return;
 }
 

___
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/videotoolboxdec: fix generating HEVC general_profile_compatibility_flags

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 02:49:09 2022 
-0500| [928b22edfe429d17ccfba572eff1f9f3e6892e00] | committer: rcombs

lavc/videotoolboxdec: fix generating HEVC general_profile_compatibility_flags

We store this as an array of bools, not a bitfield.

Signed-off-by: rcombs 

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

 libavcodec/videotoolbox.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index a1933f03f2..c95c53fcf0 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -273,7 +273,16 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
  ptlc.profile_idc);
 
 /* unsigned int(32) general_profile_compatibility_flags; */
-memcpy(p + 2, ptlc.profile_compatibility_flag, 4);
+for (i = 0; i < 4; i++) {
+AV_W8(p + 2 + i, ptlc.profile_compatibility_flag[i * 8] << 7 |
+ ptlc.profile_compatibility_flag[i * 8 + 1] << 6 |
+ ptlc.profile_compatibility_flag[i * 8 + 2] << 5 |
+ ptlc.profile_compatibility_flag[i * 8 + 3] << 4 |
+ ptlc.profile_compatibility_flag[i * 8 + 4] << 3 |
+ ptlc.profile_compatibility_flag[i * 8 + 5] << 2 |
+ ptlc.profile_compatibility_flag[i * 8 + 6] << 1 |
+ ptlc.profile_compatibility_flag[i * 8 + 7]);
+}
 
 /* unsigned int(48) general_constraint_indicator_flags; */
 AV_W8(p + 6, ptlc.progressive_source_flag<< 7 |

___
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/videotoolboxdec: fix escaping sequential zero sequences

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 02:47:30 2022 
-0500| [686b64e15526fbc1410104212aa291b66b0f488e] | committer: rcombs

lavc/videotoolboxdec: fix escaping sequential zero sequences

This ensure that e.g. 00 becomes 0300 000300,
rather than 0300 .

Signed-off-by: rcombs 

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

 libavcodec/videotoolbox.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 7c4c4c6e1b..a1933f03f2 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -166,14 +166,13 @@ static int escape_ps(uint8_t* dst, const uint8_t* src, 
int src_size)
 src[i + 2] <= 0x03) {
 if (dst) {
 *p++ = src[i++];
-*p++ = src[i++];
+*p++ = src[i];
 *p++ = 0x03;
 } else {
-i += 2;
+i++;
 }
 size++;
-}
-if (dst)
+} else if (dst)
 *p++ = src[i];
 }
 

___
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/videotoolboxdec: insert emu-prevention bytes for HEVC as well

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 02:52:48 2022 
-0500| [792a9f2406a52a26ddfd3045e97fda791db323d2] | committer: rcombs

lavc/videotoolboxdec: insert emu-prevention bytes for HEVC as well

Fixes decoding of files with sync-fooling sequences in their PSs.

Signed-off-by: rcombs 

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

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

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 921fed9619..ce83c2594a 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -246,7 +246,7 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
 for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
 if (h->ps.t##ps_list[i]) { \
 const HEVC##T##PS *lps = (const HEVC##T##PS 
*)h->ps.t##ps_list[i]->data; \
-vt_extradata_size += 2 + lps->data_size; \
+vt_extradata_size += 2 + escape_ps(NULL, lps->data, 
lps->data_size); \
 num_##t##ps++; \
 } \
 }
@@ -369,11 +369,11 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
 for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
 if (h->ps.t##ps_list[i]) { \
 const HEVC##T##PS *lps = (const HEVC##T##PS 
*)h->ps.t##ps_list[i]->data; \
+int size = escape_ps(p + 2, lps->data, lps->data_size); \
 /* unsigned int(16) nalUnitLength; */ \
-AV_WB16(p, lps->data_size); \
+AV_WB16(p, size); \
 /* bit(8*nalUnitLength) nalUnit; */ \
-memcpy(p + 2, lps->data, lps->data_size); \
-p += 2 + lps->data_size; \
+p += 2 + size; \
 } \
 }
 

___
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/videotoolboxdec: fix writing too many 1 bits for the reserved fields

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 02:50:58 2022 
-0500| [a465e2c39ed1aed0415403e74b37d23f227e2914] | committer: rcombs

lavc/videotoolboxdec: fix writing too many 1 bits for the reserved fields

Signed-off-by: rcombs 

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

 libavcodec/videotoolbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index c95c53fcf0..921fed9619 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -328,13 +328,13 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
  * bit(5) reserved = ‘1’b;
  * unsigned int(3) bitDepthLumaMinus8;
  */
-AV_W8(p + 17, (sps->bit_depth - 8) | 0xfc);
+AV_W8(p + 17, (sps->bit_depth - 8) | 0xf8);
 
 /*
  * bit(5) reserved = ‘1’b;
  * unsigned int(3) bitDepthChromaMinus8;
  */
-AV_W8(p + 18, (sps->bit_depth_chroma - 8) | 0xfc);
+AV_W8(p + 18, (sps->bit_depth_chroma - 8) | 0xf8);
 
 /* bit(16) avgFrameRate; */
 AV_WB16(p + 19, 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] lavc/h264_ps: always include the stop bit in [s|p]ps->data

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Apr 16 03:41:29 2022 
-0500| [c534d9f72a89542ed639071b1ae15893aadf1f18] | committer: rcombs

lavc/h264_ps: always include the stop bit in [s|p]ps->data

The VideoToolbox hwaccel needs the entire NAL (including the stop bit),
but ff_h2645_packet_split may remove it. Detect this case by looking for
bit counts divisible by 8 and insert a stop-bit-only 0x80 byte.

Signed-off-by: rcombs 

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

 libavcodec/h264_ps.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 051f06692c..e16da68dec 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -351,6 +351,10 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, 
AVCodecContext *avctx,
 }
 memcpy(sps->data, gb->buffer, sps->data_size);
 
+// Re-add the removed stop bit (may be used by hwaccels).
+if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
+sps->data[sps->data_size++] = 0x80;
+
 profile_idc   = get_bits(gb, 8);
 constraint_set_flags |= get_bits1(gb) << 0;   // constraint_set0_flag
 constraint_set_flags |= get_bits1(gb) << 1;   // constraint_set1_flag
@@ -775,6 +779,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext 
*gb, AVCodecContext *avct
 }
 memcpy(pps->data, gb->buffer, pps->data_size);
 
+// Re-add the removed stop bit (may be used by hwaccels).
+if (!(bit_length & 7) && pps->data_size < sizeof(pps->data))
+pps->data[pps->data_size++] = 0x80;
+
 pps->sps_id = get_ue_golomb_31(gb);
 if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
 !ps->sps_list[pps->sps_id]) {

___
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] Makefile: avoid cp-ing over existing executable files

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Tue May 24 22:46:55 2022 
-0500| [bb6d9a0f326c3ba8ddbba28fdf9ca70759db99aa] | committer: rcombs

Makefile: avoid cp-ing over existing executable files

On macOS, code-signing information for executables (including those signed
automatically by the linker) is cached by the system on a per-inode basis.
The cp(1) tool will truncate and overwrite an existing file if present,
so we need to delete it first to avoid strange crashes.

See https://developer.apple.com/documentation/security/updating_mac_software

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

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index f38b521765..35365f09d4 100644
--- a/Makefile
+++ b/Makefile
@@ -121,6 +121,7 @@ $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
 ifeq ($(STRIPTYPE),direct)
$(STRIP) -o $@ $<
 else
+   $(RM) $@
$(CP) $< $@
$(STRIP) $@
 endif

___
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] lavfi/vf_scale_vulkan: fix build

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Wed Jun  1 20:07:47 2022 
-0500| [3e580351bc1dba9d023cd5562df99be9a30fb504] | committer: rcombs

lavfi/vf_scale_vulkan: fix build

This was broken in d42b410e05ad1c4d6e74aa981b4a4423103291fb.

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

 libavfilter/vf_scale_vulkan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 5fe36ca7b0..c140420896 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -239,14 +239,14 @@ static av_cold int init_filter(AVFilterContext *ctx, 
AVFrame *in)
 RET(ff_vk_init_compute_pipeline(vkctx, s->pl));
 
 if (s->vkctx.output_format != s->vkctx.input_format) {
-const struct LumaCoefficients *lcoeffs;
+const AVLumaCoefficients *lcoeffs;
 double tmp_mat[3][3];
 
 struct {
 float yuv_matrix[4][4];
 } *par;
 
-lcoeffs = ff_get_luma_coefficients(in->colorspace);
+lcoeffs = av_csp_luma_coeffs_from_avcsp(in->colorspace);
 if (!lcoeffs) {
 av_log(ctx, AV_LOG_ERROR, "Unsupported colorspace\n");
 return AVERROR(EINVAL);

___
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] lavfi/vf_tonemap_opencl: fix build

2022-06-01 Thread rcombs
ffmpeg | branch: master | rcombs  | Wed Jun  1 20:09:17 2022 
-0500| [c6364b711bad1fe2fbd90e5b2798f87080ddf5ea] | committer: rcombs

lavfi/vf_tonemap_opencl: fix build

This was broken in d42b410e05ad1c4d6e74aa981b4a4423103291fb.

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

 libavfilter/vf_tonemap_opencl.c | 39 +++
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index 121ef7d6f4..f6ebb694a8 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -80,16 +80,6 @@ static const char *const delinearize_funcs[AVCOL_TRC_NB] = {
 [AVCOL_TRC_BT2020_10] = "inverse_eotf_bt1886",
 };
 
-static const struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = {
-[AVCOL_PRI_BT709]  = { 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 },
-[AVCOL_PRI_BT2020] = { 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 },
-};
-
-static const struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = {
-[AVCOL_PRI_BT709]  = { 0.3127, 0.3290 },
-[AVCOL_PRI_BT2020] = { 0.3127, 0.3290 },
-};
-
 static const char *const tonemap_func[TONEMAP_MAX] = {
 [TONEMAP_NONE] = "direct",
 [TONEMAP_LINEAR]   = "linear",
@@ -100,14 +90,22 @@ static const char *const tonemap_func[TONEMAP_MAX] = {
 [TONEMAP_MOBIUS]   = "mobius",
 };
 
-static void get_rgb2rgb_matrix(enum AVColorPrimaries in, enum AVColorPrimaries 
out,
-   double rgb2rgb[3][3]) {
+static int get_rgb2rgb_matrix(enum AVColorPrimaries in, enum AVColorPrimaries 
out,
+  double rgb2rgb[3][3]) {
 double rgb2xyz[3][3], xyz2rgb[3][3];
 
-ff_fill_rgb2xyz_table(&primaries_table[out], &whitepoint_table[out], 
rgb2xyz);
+const AVColorPrimariesDesc *in_primaries = 
av_csp_primaries_desc_from_id(in);
+const AVColorPrimariesDesc *out_primaries = 
av_csp_primaries_desc_from_id(out);
+
+if (!in_primaries || !out_primaries)
+return AVERROR(EINVAL);
+
+ff_fill_rgb2xyz_table(&out_primaries->prim, &out_primaries->wp, rgb2xyz);
 ff_matrix_invert_3x3(rgb2xyz, xyz2rgb);
-ff_fill_rgb2xyz_table(&primaries_table[in], &whitepoint_table[in], 
rgb2xyz);
+ff_fill_rgb2xyz_table(&in_primaries->prim, &in_primaries->wp, rgb2xyz);
 ff_matrix_mul_3x3(rgb2rgb, rgb2xyz, xyz2rgb);
+
+return 0;
 }
 
 #define OPENCL_SOURCE_NB 3
@@ -120,7 +118,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
 TonemapOpenCLContext *ctx = avctx->priv;
 int rgb2rgb_passthrough = 1;
 double rgb2rgb[3][3], rgb2yuv[3][3], yuv2rgb[3][3];
-const struct LumaCoefficients *luma_src, *luma_dst;
+const AVLumaCoefficients *luma_src, *luma_dst;
 cl_int cle;
 int err;
 AVBPrint header;
@@ -184,7 +182,8 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
 av_bprintf(&header, "#define DETECTION_FRAMES %d\n", DETECTION_FRAMES);
 
 if (ctx->primaries_out != ctx->primaries_in) {
-get_rgb2rgb_matrix(ctx->primaries_in, ctx->primaries_out, rgb2rgb);
+if ((err = get_rgb2rgb_matrix(ctx->primaries_in, ctx->primaries_out, 
rgb2rgb)) < 0)
+goto fail;
 rgb2rgb_passthrough = 0;
 }
 if (ctx->range_in == AVCOL_RANGE_JPEG)
@@ -201,7 +200,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
 ff_opencl_print_const_matrix_3x3(&header, "rgb2rgb", rgb2rgb);
 
 
-luma_src = ff_get_luma_coefficients(ctx->colorspace_in);
+luma_src = av_csp_luma_coeffs_from_avcsp(ctx->colorspace_in);
 if (!luma_src) {
 err = AVERROR(EINVAL);
 av_log(avctx, AV_LOG_ERROR, "unsupported input colorspace %d (%s)\n",
@@ -209,7 +208,7 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
 goto fail;
 }
 
-luma_dst = ff_get_luma_coefficients(ctx->colorspace_out);
+luma_dst = av_csp_luma_coeffs_from_avcsp(ctx->colorspace_out);
 if (!luma_dst) {
 err = AVERROR(EINVAL);
 av_log(avctx, AV_LOG_ERROR, "unsupported output colorspace %d (%s)\n",
@@ -225,9 +224,9 @@ static int tonemap_opencl_init(AVFilterContext *avctx)
 ff_opencl_print_const_matrix_3x3(&header, "rgb_matrix", yuv2rgb);
 
 av_bprintf(&header, "constant float3 luma_src = {%.4ff, %.4ff, %.4ff};\n",
-   luma_src->cr, luma_src->cg, luma_src->cb);
+   av_q2d(luma_src->cr), av_q2d(luma_src->cg), 
av_q2d(luma_src->cb));
 av_bprintf(&header, "constant float3 luma_dst = {%.4ff, %.4ff, %.4ff};\n",
-   luma_dst->cr, luma_dst->cg, luma_dst->cb);
+   av_q2d(luma_dst->cr), av_q2d(luma_dst->cg), 
av_q2d(luma_dst->cb));
 
 av_bprintf(&header, "#define linearize %s\n", 
linearize_funcs[ctx->trc_in]);
 av_bprintf(&header, "#define delinearize %s\n",

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