[FFmpeg-cvslog] lavu/tx: add missing prints for the type of dctI/dstI

2023-09-07 Thread Lynne
ffmpeg | branch: master | Lynne  | Sun Sep  3 16:47:53 2023 
+0200| [00e77fd21a0327404f61bab19c50d73a7bec5007] | committer: Lynne

lavu/tx: add missing prints for the type of dctI/dstI

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

 libavutil/tx.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index e9826e6107..24b2015b44 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -578,12 +578,18 @@ static void print_type(AVBPrint *bp, enum AVTXType type)
type == AV_TX_FLOAT_FFT   ? "fft_float"   :
type == AV_TX_FLOAT_MDCT  ? "mdct_float"  :
type == AV_TX_FLOAT_RDFT  ? "rdft_float"  :
+   type == AV_TX_FLOAT_DCT_I ? "dctI_float"  :
+   type == AV_TX_FLOAT_DST_I ? "dstI_float"  :
type == AV_TX_DOUBLE_FFT  ? "fft_double"  :
type == AV_TX_DOUBLE_MDCT ? "mdct_double" :
type == AV_TX_DOUBLE_RDFT ? "rdft_double" :
+   type == AV_TX_DOUBLE_DCT_I ? "dctI_double" :
+   type == AV_TX_DOUBLE_DST_I ? "dstI_double" :
type == AV_TX_INT32_FFT   ? "fft_int32"   :
type == AV_TX_INT32_MDCT  ? "mdct_int32"  :
type == AV_TX_INT32_RDFT  ? "rdft_int32"  :
+   type == AV_TX_INT32_DCT_I ? "dctI_int32" :
+   type == AV_TX_INT32_DST_I ? "dstI_int32" :
"unknown");
 }
 

___
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] vulkan_decode: convert max level from vulkan to av for comparisons

2023-09-07 Thread Lynne
ffmpeg | branch: master | Lynne  | Wed Sep  6 06:15:32 2023 
+0200| [398467f519b3b4e954ac9e6868358c052b407fc5] | committer: Lynne

vulkan_decode: convert max level from vulkan to av for comparisons

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

 libavcodec/vulkan_decode.c |  4 ++--
 libavcodec/vulkan_video.c  | 45 +
 libavcodec/vulkan_video.h  |  7 +++
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 9a57369df7..3986330c81 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -837,8 +837,8 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, 
AVBufferRef *frames_
 return AVERROR_EXTERNAL;
 }
 
-max_level = avctx->codec_id == AV_CODEC_ID_H264 ? h264_caps.maxLevelIdc :
-avctx->codec_id == AV_CODEC_ID_H265 ? h265_caps.maxLevelIdc :
+max_level = avctx->codec_id == AV_CODEC_ID_H264 ? 
ff_vk_h264_level_to_av(h264_caps.maxLevelIdc) :
+avctx->codec_id == AV_CODEC_ID_H265 ? 
ff_vk_h265_level_to_av(h265_caps.maxLevelIdc) :
 avctx->codec_id == AV_CODEC_ID_AV1  ? av1_caps.maxLevelIdc  :
 0;
 
diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
index 9a363aab02..236aa124bb 100644
--- a/libavcodec/vulkan_video.c
+++ b/libavcodec/vulkan_video.c
@@ -154,6 +154,51 @@ VkVideoComponentBitDepthFlagBitsKHR 
ff_vk_depth_from_av_depth(int depth)
 return VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR;
 }
 
+int ff_vk_h264_level_to_av(StdVideoH264LevelIdc level)
+{
+switch (level) {
+case STD_VIDEO_H264_LEVEL_IDC_1_0: return 10;
+case STD_VIDEO_H264_LEVEL_IDC_1_1: return 11;
+case STD_VIDEO_H264_LEVEL_IDC_1_2: return 12;
+case STD_VIDEO_H264_LEVEL_IDC_1_3: return 13;
+case STD_VIDEO_H264_LEVEL_IDC_2_0: return 20;
+case STD_VIDEO_H264_LEVEL_IDC_2_1: return 21;
+case STD_VIDEO_H264_LEVEL_IDC_2_2: return 22;
+case STD_VIDEO_H264_LEVEL_IDC_3_0: return 30;
+case STD_VIDEO_H264_LEVEL_IDC_3_1: return 31;
+case STD_VIDEO_H264_LEVEL_IDC_3_2: return 32;
+case STD_VIDEO_H264_LEVEL_IDC_4_0: return 40;
+case STD_VIDEO_H264_LEVEL_IDC_4_1: return 41;
+case STD_VIDEO_H264_LEVEL_IDC_4_2: return 42;
+case STD_VIDEO_H264_LEVEL_IDC_5_0: return 50;
+case STD_VIDEO_H264_LEVEL_IDC_5_1: return 51;
+case STD_VIDEO_H264_LEVEL_IDC_5_2: return 52;
+case STD_VIDEO_H264_LEVEL_IDC_6_0: return 60;
+case STD_VIDEO_H264_LEVEL_IDC_6_1: return 61;
+default:
+case STD_VIDEO_H264_LEVEL_IDC_6_2: return 62;
+}
+}
+
+int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level)
+{
+switch (level) {
+case STD_VIDEO_H265_LEVEL_IDC_1_0: return 10;
+case STD_VIDEO_H265_LEVEL_IDC_2_0: return 20;
+case STD_VIDEO_H265_LEVEL_IDC_2_1: return 21;
+case STD_VIDEO_H265_LEVEL_IDC_3_0: return 30;
+case STD_VIDEO_H265_LEVEL_IDC_3_1: return 31;
+case STD_VIDEO_H265_LEVEL_IDC_4_0: return 40;
+case STD_VIDEO_H265_LEVEL_IDC_4_1: return 41;
+case STD_VIDEO_H265_LEVEL_IDC_5_0: return 50;
+case STD_VIDEO_H265_LEVEL_IDC_5_1: return 51;
+case STD_VIDEO_H265_LEVEL_IDC_6_0: return 60;
+case STD_VIDEO_H265_LEVEL_IDC_6_1: return 61;
+default:
+case STD_VIDEO_H265_LEVEL_IDC_6_2: return 62;
+}
+}
+
 static void free_data_buf(void *opaque, uint8_t *data)
 {
 FFVulkanContext *ctx = opaque;
diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h
index 183ce89bf0..b28e3fe0bd 100644
--- a/libavcodec/vulkan_video.h
+++ b/libavcodec/vulkan_video.h
@@ -71,6 +71,13 @@ VkVideoChromaSubsamplingFlagBitsKHR 
ff_vk_subsampling_from_av_desc(const AVPixFm
  */
 VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth(int depth);
 
+
+/**
+ * Convert level from Vulkan to AV.
+ */
+int ff_vk_h264_level_to_av(StdVideoH264LevelIdc level);
+int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level);
+
 typedef struct FFVkVideoBuffer {
 FFVkBuffer buf;
 uint8_t *mem;

___
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] avcodec/hevcdec: Fix undefined memcpy()

2023-09-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Jul 23 19:45:18 2023 +0200| [94bd1796ff45b396021cd260e9b037bc61815933] | 
committer: Michael Niedermayer

avcodec/hevcdec: Fix undefined memcpy()

There is likely a better way to fix this, this is mainly to show the problem

Fixes: MC within same frame resulting in overlapping memcpy()
Fixes: 
60189/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4992746590175232
Fixes: 
61753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5022150806077440
Fixes: 
58062/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4717458841010176

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

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

 libavcodec/hevcdec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index abdf19a15e..ad22d0a30c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1563,7 +1563,8 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t 
*dst, ptrdiff_t dststride,
 
 if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER ||
 x_off >= pic_width - block_w - QPEL_EXTRA_AFTER ||
-y_off >= pic_height - block_h - QPEL_EXTRA_AFTER) {
+y_off >= pic_height - block_h - QPEL_EXTRA_AFTER ||
+ref == s->frame) {
 const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << 
s->ps.sps->pixel_shift;
 int offset = QPEL_EXTRA_BEFORE * srcstride   + 
(QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
 int buf_offset = QPEL_EXTRA_BEFORE * edge_emu_stride + 
(QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
@@ -1713,6 +1714,7 @@ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t 
*dst0,
 intptr_t my  = av_mod_uintp2(mv->y, 2 + vshift);
 intptr_t _mx = mx << (1 - hshift);
 intptr_t _my = my << (1 - vshift);
+int emu  = src0 == s->frame->data[1] || src0 == 
s->frame->data[2];
 
 x_off += mv->x >> (2 + hshift);
 y_off += mv->y >> (2 + vshift);
@@ -1720,7 +1722,8 @@ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t 
*dst0,
 
 if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
 x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
-y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) {
+y_off >= pic_height - block_h - EPEL_EXTRA_AFTER ||
+emu) {
 const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << 
s->ps.sps->pixel_shift;
 int offset0 = EPEL_EXTRA_BEFORE * (srcstride + (1 << 
s->ps.sps->pixel_shift));
 int buf_offset0 = EPEL_EXTRA_BEFORE *

___
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] avcodec/vmixdec: Check for end of input in decode_dcac()

2023-09-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Jul 23 18:48:54 2023 +0200| [d5cc9d8dd9eb592f9467a614ef28e6d5c5381e7c] | 
committer: Michael Niedermayer

avcodec/vmixdec: Check for end of input in decode_dcac()

Fixes: Timeout
Fixes: 
59952/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-6718213736759296

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

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

 libavcodec/vmixdec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c
index b77c90929a..4cc5963e25 100644
--- a/libavcodec/vmixdec.c
+++ b/libavcodec/vmixdec.c
@@ -115,6 +115,8 @@ static int decode_dcac(AVCodecContext *avctx,
 if (dc_run > 0) {
 dc_run--;
 } else {
+if (get_bits_left(dc_gb) < 1)
+return AVERROR_INVALIDDATA;
 dc_v = get_se_golomb_vmix(dc_gb);
 dc += (unsigned)dc_v;
 if (!dc_v)
@@ -127,6 +129,8 @@ static int decode_dcac(AVCodecContext *avctx,
 continue;
 }
 
+if (get_bits_left(ac_gb) < 1)
+return AVERROR_INVALIDDATA;
 ac_v = get_se_golomb_vmix(ac_gb);
 i = scan[n];
 block[i] = ((unsigned)ac_v * factors[i]) >> 4;

___
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] avcodec/mpeg4videodec: consider lowres in dest_pcm[]

2023-09-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Jul 23 19:01:37 2023 +0200| [d48476183fad230c8e457b2f314f8e136b973c4e] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: consider lowres in dest_pcm[]

Fixes: out of array access
Fixes: 
5/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5767982157266944

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

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 72bf9eb115..256215cb81 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -295,7 +295,7 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t 
*dest_y, uint8_t *dest_cb
 int hsub = i ? s->chroma_x_shift : 0;
 int lowres = s->avctx->lowres;
 int step = 1 << lowres;
-dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
+dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub + lowres) - 1);
 for (int h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
 for (int w = (16 >> (hsub + lowres)) - 1, idx = 0; w >= 0; 
w--, idx += step)
 dest_pcm[i][w] = src[idx];

___
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: add forgotten rpza reference test

2023-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Sep  7 22:55:54 
2023 +0200| [929eb728760cd54a3d29594f418105a16d9836fc] | committer: Paul B Mahol

fate: add forgotten rpza reference test

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

 tests/ref/vsynth/vsynth_lena-rpza | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/ref/vsynth/vsynth_lena-rpza 
b/tests/ref/vsynth/vsynth_lena-rpza
new file mode 100644
index 00..abdb56ff7a
--- /dev/null
+++ b/tests/ref/vsynth/vsynth_lena-rpza
@@ -0,0 +1,4 @@
+c9850c9f02376ccad32188ec3fd0109d *tests/data/fate/vsynth_lena-rpza.mov
+8795888 tests/data/fate/vsynth_lena-rpza.mov
+94ab32b81b82e1f24a7aeb4435668f84 *tests/data/fate/vsynth_lena-rpza.out.rawvideo
+stddev:2.47 PSNR: 40.25 MAXDIFF:   17 bytes:  7603200/  7603200

___
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] avcodec/tiff: Don't cast const away

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  7 15:01:57 2023 +0200| [e34d5d1e3b519290c5fc6c9b3226146096c42ae7] | 
committer: Andreas Rheinhardt

avcodec/tiff: Don't cast const away

lzma_stream.next_in is const for more than 15 years now
and has been so in every release of liblzma.

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 148964590b..adb49e4525 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -337,7 +337,7 @@ static void av_always_inline dng_blit(TiffContext *s, 
uint8_t *dst, int dst_stri
(split vertically in the middle). */
 for (line = 0; line < height / 2; line++) {
 uint16_t *dst_u16 = (uint16_t *)dst;
-uint16_t *src_u16 = (uint16_t *)src;
+const uint16_t *src_u16 = (const uint16_t *)src;
 
 /* Blit first half of input row row to initial row of output */
 for (col = 0; col < width; col++)
@@ -360,7 +360,7 @@ static void av_always_inline dng_blit(TiffContext *s, 
uint8_t *dst, int dst_stri
 if (is_u16) {
 for (line = 0; line < height; line++) {
 uint16_t *dst_u16 = (uint16_t *)dst;
-uint16_t *src_u16 = (uint16_t *)src;
+const uint16_t *src_u16 = (const uint16_t *)src;
 
 for (col = 0; col < width; col++)
 *dst_u16++ = dng_process_color16(*src_u16++, s->dng_lut,
@@ -570,7 +570,7 @@ static int tiff_uncompress_lzma(uint8_t *dst, uint64_t 
*len, const uint8_t *src,
 lzma_stream stream = LZMA_STREAM_INIT;
 lzma_ret ret;
 
-stream.next_in   = (uint8_t *)src;
+stream.next_in   = src;
 stream.avail_in  = size;
 stream.next_out  = dst;
 stream.avail_out = *len;

___
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/blend_modes: Always preserve constness

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  7 15:30:30 2023 +0200| [44dcc4d6060c6dfffb60777396ee8ed8bd1fed76] | 
committer: Andreas Rheinhardt

avfilter/blend_modes: Always preserve constness

These casts cast const away temporarily; they are safe, because
the pointers that are initialized point to const data. But this
is nevertheless not nice and leads to warnings when using
-Wcast-qual. blend_modes.c generates 546 (2*39*7) such warnings
which is the majority of such warnings for FFmpeg as a whole.
vf_blend.c and vf_blend_init.h also use this pattern;
they have also been changed.

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

 libavfilter/blend_modes.c   | 4 ++--
 libavfilter/vf_blend.c  | 4 ++--
 libavfilter/vf_blend_init.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavfilter/blend_modes.c b/libavfilter/blend_modes.c
index e2be676243..65c5e6f890 100644
--- a/libavfilter/blend_modes.c
+++ b/libavfilter/blend_modes.c
@@ -93,8 +93,8 @@ static void fn0(NAME)(const uint8_t *_top, ptrdiff_t 
top_linesize, \
  ptrdiff_t width, ptrdiff_t height,   \
  FilterParams *param, double *values, int starty) \
 {  
 \
-const PIXEL *top = (PIXEL *)_top;  
 \
-const PIXEL *bottom = (PIXEL *)_bottom;
 \
+const PIXEL *top = (const PIXEL *)_top;
 \
+const PIXEL *bottom = (const PIXEL *)_bottom;  
 \
 PIXEL *dst = (PIXEL *)_dst;
 \
 const float opacity = param->opacity;  
 \

 \
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index dfe2b8b174..7100d9f372 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -133,8 +133,8 @@ static void blend_expr_## name(const uint8_t *_top, 
ptrdiff_t top_linesize,
ptrdiff_t width, ptrdiff_t height,  
\
FilterParams *param, double *values, int 
starty) \
 {  
\
-const type *top = (type*)_top; 
\
-const type *bottom = (type*)_bottom;   
\
+const type *top = (const type*)_top;   
\
+const type *bottom = (const type*)_bottom; 
\
 type *dst = (type*)_dst;   
\
 AVExpr *e = param->e;  
\
 int y, x;  
\
diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h
index f531338a54..d24f178032 100644
--- a/libavfilter/vf_blend_init.h
+++ b/libavfilter/vf_blend_init.h
@@ -82,8 +82,8 @@ static void blend_normal_##name(const uint8_t *_top, 
ptrdiff_t top_linesize,
 ptrdiff_t width, ptrdiff_t height, 
   \
 FilterParams *param, double *values, int 
starty)  \
 {  
   \
-const type *top = (type*)_top; 
   \
-const type *bottom = (type*)_bottom;   
   \
+const type *top = (const type*)_top;   
   \
+const type *bottom = (const type*)_bottom; 
   \
 type *dst = (type*)_dst;   
   \
 const float opacity = param->opacity;  
   \

   \

___
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/vf_varblur: Don't use pointer-to-const for destination

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  7 15:02:22 2023 +0200| [29c6f4329aee832405236b40726fa75b1d391e91] | 
committer: Andreas Rheinhardt

avfilter/vf_varblur: Don't use pointer-to-const for destination

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavfilter/vf_varblur.c b/libavfilter/vf_varblur.c
index f6f8382adc..6ebb9c0663 100644
--- a/libavfilter/vf_varblur.c
+++ b/libavfilter/vf_varblur.c
@@ -45,7 +45,7 @@ typedef struct VarBlurContext {
 void (*compute_sat)(const uint8_t *ssrc,
 int linesize,
 int w, int h,
-const uint8_t *dstp,
+uint8_t *dstp,
 int dst_linesize);
 
 int (*blur_plane)(AVFilterContext *ctx,
@@ -98,7 +98,7 @@ static const enum AVPixelFormat pix_fmts[] = {
 static void compute_sat##depth(const uint8_t *ssrc,  \
int linesize, \
int w, int h, \
-   const uint8_t *dstp,  \
+   uint8_t *dstp,\
int dst_linesize) \
 {\
 const type *src = (const type *)ssrc;\

___
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/vsrc_testsrc: Don't use const uint8_t* when pointee changes

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  7 14:59:07 2023 +0200| [6378a6b3fe3cd9622feebbce9901e238d69fce47] | 
committer: Andreas Rheinhardt

avfilter/vsrc_testsrc: Don't use const uint8_t* when pointee changes

The const makes no sense and is later cast away.

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

 libavfilter/vsrc_testsrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index d24481e6c4..5e41416464 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -327,7 +327,7 @@ static void haldclutsrc_fill_picture(AVFilterContext *ctx, 
AVFrame *frame)
 float scale;
 const int w = frame->width;
 const int h = frame->height;
-const uint8_t *data = frame->data[0];
+uint8_t *data = frame->data[0];
 const int linesize  = frame->linesize[0];
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
 const int depth = desc->comp[0].depth;

___
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/vf_vif: Don't cast const away unnecessarily

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  7 14:38:38 2023 +0200| [bdccb27ba41bbdc4cbef2476dfddc9a144258811] | 
committer: Andreas Rheinhardt

avfilter/vf_vif: Don't cast const away unnecessarily

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c
index 3c662491b2..a927abaf6f 100644
--- a/libavfilter/vf_vif.c
+++ b/libavfilter/vf_vif.c
@@ -301,8 +301,8 @@ static int compute_vif2(AVFilterContext *ctx,
 float *main_sq_filt = data_buf[11];
 float *ref_main_filt = data_buf[12];
 
-float *curr_ref_scale = (float *)ref;
-float *curr_main_scale = (float *)main;
+const float *curr_ref_scale  = ref;
+const float *curr_main_scale = main;
 int curr_ref_stride = ref_stride;
 int curr_main_stride = main_stride;
 

___
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] avcodec/v210dec: Don't cast const away

2023-09-07 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Wed Sep  6 23:34:56 2023 +0200| [2f9a33995a7be728d7ab4dce913be5a871c5cc5f] | 
committer: Andreas Rheinhardt

avcodec/v210dec: Don't cast const away

Reviewed-by: Paul B Mahol 
Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 814d65bbda..04bcc612b7 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -33,7 +33,7 @@
 
 typedef struct ThreadData {
 AVFrame *frame;
-uint8_t *buf;
+const uint8_t *buf;
 int stride;
 } ThreadData;
 
@@ -111,7 +111,7 @@ static int v210_decode_slice(AVCodecContext *avctx, void 
*arg, int jobnr, int th
 int stride = td->stride;
 int slice_start = (avctx->height *  jobnr) / s->thread_count;
 int slice_end = (avctx->height * (jobnr+1)) / s->thread_count;
-uint8_t *psrc = td->buf + stride * slice_start;
+const uint8_t *psrc = td->buf + stride * slice_start;
 int16_t *py = (uint16_t*)frame->data[0] + slice_start * frame->linesize[0] 
/ 2;
 int16_t *pu = (uint16_t*)frame->data[1] + slice_start * frame->linesize[1] 
/ 2;
 int16_t *pv = (uint16_t*)frame->data[2] + slice_start * frame->linesize[2] 
/ 2;
@@ -191,7 +191,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
 
 if (stride) {
 td.stride = stride;
-td.buf = (uint8_t*)psrc;
+td.buf = psrc;
 td.frame = pic;
 avctx->execute2(avctx, v210_decode_slice, , NULL, s->thread_count);
 } else {

___
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: add rpza encoder tests

2023-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Sep  7 10:08:30 
2023 +0200| [74375305efd9636556a82823bff0a9300f5b7cec] | committer: Paul B Mahol

fate: add rpza encoder tests

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

 tests/fate/vcodec.mak | 4 
 tests/ref/vsynth/vsynth1-rpza | 4 
 tests/ref/vsynth/vsynth2-rpza | 4 
 tests/ref/vsynth/vsynth3-rpza | 4 
 4 files changed, 16 insertions(+)

diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index e32d28c556..45ed88da96 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -396,6 +396,10 @@ fate-vsynth%-roqvideo:   ENCOPTS = -frames 5
 fate-vsynth%-roqvideo:   RAWDECOPTS = -r 30
 fate-vsynth%-roqvideo:   FMT = roq
 
+FATE_VCODEC_SCALE-$(call ENCDEC, RPZA, MOV) += rpza
+fate-vsynth%-rpza:   CODEC   = rpza
+fate-vsynth%-rpza:   FMT = mov
+
 FATE_VCODEC-$(call ENCDEC, RV10, RM)+= rv10
 fate-vsynth%-rv10:   ENCOPTS = -qscale 10
 fate-vsynth%-rv10:   FMT = rm
diff --git a/tests/ref/vsynth/vsynth1-rpza b/tests/ref/vsynth/vsynth1-rpza
new file mode 100644
index 00..b238b245d3
--- /dev/null
+++ b/tests/ref/vsynth/vsynth1-rpza
@@ -0,0 +1,4 @@
+e4e9660c4a13709b277aac42419b9a23 *tests/data/fate/vsynth1-rpza.mov
+10138529 tests/data/fate/vsynth1-rpza.mov
+99bece160cfb0da47f446b60d42fa3ae *tests/data/fate/vsynth1-rpza.out.rawvideo
+stddev:4.06 PSNR: 35.94 MAXDIFF:   47 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-rpza b/tests/ref/vsynth/vsynth2-rpza
new file mode 100644
index 00..1913688751
--- /dev/null
+++ b/tests/ref/vsynth/vsynth2-rpza
@@ -0,0 +1,4 @@
+b67a1d20eda31a463291de90067c6013 *tests/data/fate/vsynth2-rpza.mov
+8473292 tests/data/fate/vsynth2-rpza.mov
+0f3567cb28439a55a15f2b33275efeae *tests/data/fate/vsynth2-rpza.out.rawvideo
+stddev:3.11 PSNR: 38.27 MAXDIFF:   19 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth3-rpza b/tests/ref/vsynth/vsynth3-rpza
new file mode 100644
index 00..c933a44c4b
--- /dev/null
+++ b/tests/ref/vsynth/vsynth3-rpza
@@ -0,0 +1,4 @@
+791ad5931c5d54eff406c639be0c79e2 *tests/data/fate/vsynth3-rpza.mov
+130493 tests/data/fate/vsynth3-rpza.mov
+19f61c34cbdef98b0f4aca6c19f59ed4 *tests/data/fate/vsynth3-rpza.out.rawvideo
+stddev:4.35 PSNR: 35.35 MAXDIFF:   46 bytes:86700/86700

___
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] avcodec/rpzaenc: replace float-point calculations with integer ones

2023-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Sep  7 11:00:38 
2023 +0200| [03ed48aeca2d6cf524c41f29536e0e7e045f290b] | committer: Paul B Mahol

avcodec/rpzaenc: replace float-point calculations with integer ones

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

 libavcodec/rpzaenc.c | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/libavcodec/rpzaenc.c b/libavcodec/rpzaenc.c
index a399d55c93..d84555d6c6 100644
--- a/libavcodec/rpzaenc.c
+++ b/libavcodec/rpzaenc.c
@@ -30,6 +30,7 @@
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
+#include "mathops.h"
 #include "put_bits.h"
 
 typedef struct RpzaContext {
@@ -65,7 +66,7 @@ typedef struct rgb {
 #define SQR(x) ((x) * (x))
 
 /* 15 bit components */
-#define GET_CHAN(color, chan) (((color) >> ((chan) * 5) & 0x1F) * 8)
+#define GET_CHAN(color, chan) (((color) >> ((chan) * 5) & 0x1F))
 #define R(color) GET_CHAN(color, RED)
 #define G(color) GET_CHAN(color, GREEN)
 #define B(color) GET_CHAN(color, BLUE)
@@ -141,9 +142,9 @@ static uint16_t rgb24_to_rgb555(const uint8_t *rgb24)
 uint16_t rgb555 = 0;
 uint32_t r, g, b;
 
-r = rgb24[0] >> 3;
-g = rgb24[1] >> 3;
-b = rgb24[2] >> 3;
+r = rgb24[0];
+g = rgb24[1];
+b = rgb24[2];
 
 rgb555 |= (r << 10);
 rgb555 |= (g << 5);
@@ -185,7 +186,7 @@ static int max_component_diff(const uint16_t *colorA, const 
uint16_t *colorB)
 if (diff > max) {
 max = diff;
 }
-return max * 8;
+return max;
 }
 
 /*
@@ -266,9 +267,9 @@ static int compare_blocks(const uint16_t *block1, const 
uint16_t *block2,
  */
 static int leastsquares(const uint16_t *block_ptr, const BlockInfo *bi,
 channel_offset xchannel, channel_offset ychannel,
-double *slope, double *y_intercept, double 
*correlation_coef)
+int *slope, int *y_intercept, int *correlation_coef)
 {
-double sumx = 0, sumy = 0, sumx2 = 0, sumy2 = 0, sumxy = 0,
+int sumx = 0, sumy = 0, sumx2 = 0, sumy2 = 0, sumxy = 0,
sumx_sq = 0, sumy_sq = 0, tmp, tmp2;
 int i, j, count;
 uint8_t x, y;
@@ -305,10 +306,10 @@ static int leastsquares(const uint16_t *block_ptr, const 
BlockInfo *bi,
 
 tmp2 = count * sumy2 - sumy_sq;
 if (tmp2 == 0) {
-*correlation_coef = 0.0;
+*correlation_coef = 0;
 } else {
 *correlation_coef = (count * sumxy - sumx * sumy) /
-sqrt(tmp * tmp2);
+ff_sqrt((unsigned)tmp * tmp2);
 }
 
 return 0; // success
@@ -332,18 +333,18 @@ static int calc_lsq_max_fit_error(const uint16_t 
*block_ptr, const BlockInfo *bi
 y = GET_CHAN(block_ptr[j], ychannel);
 
 /* calculate x_inc as the 4-color index (0..3) */
-x_inc = floor( (x - min) * 3.0 / (max - min) + 0.5);
+x_inc = (x - min) * 3 / (max - min) + 1;
 x_inc = FFMAX(FFMIN(3, x_inc), 0);
 
 /* calculate lin_y corresponding to x_inc */
-lin_y = (int)(tmp_min + (tmp_max - tmp_min) * x_inc / 3.0 + 0.5);
+lin_y = tmp_min + (tmp_max - tmp_min) * x_inc / 3 + 1;
 
 err = FFABS(lin_y - y);
 if (err > max_err)
 max_err = err;
 
 /* calculate lin_x corresponding to x_inc */
-lin_x = (int)(min + (max - min) * x_inc / 3.0 + 0.5);
+lin_x = min + (max - min) * x_inc / 3 + 1;
 
 err = FFABS(lin_x - x);
 if (err > max_err)
@@ -577,7 +578,7 @@ static void rpza_encode_stream(RpzaContext *s, const 
AVFrame *pict)
 uint8_t avg_color[3];
 int pixel_count;
 uint8_t min_color[3], max_color[3];
-double slope, y_intercept, correlation_coef;
+int slope, y_intercept, correlation_coef;
 const uint16_t *src_pixels = (const uint16_t *)pict->data[0];
 uint16_t *prev_pixels = (uint16_t *)s->prev_frame->data[0];
 
@@ -730,8 +731,8 @@ post_skip :
 min_color[i] = GET_CHAN(src_pixels[block_offset], i);
 max_color[i] = GET_CHAN(src_pixels[block_offset], i);
 } else {
-tmp_min = (int)(0.5 + min * slope + y_intercept);
-tmp_max = (int)(0.5 + max * slope + y_intercept);
+tmp_min = 1 + min * slope + y_intercept;
+tmp_max = 1 + max * slope + y_intercept;
 
 av_assert0(tmp_min <= tmp_max);
 // clamp min and max color values

___
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] avcodec/utvideodec: fix possible write past end of array

2023-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Sep  7 09:34:00 
2023 +0200| [b97ac6b3df75620bd5428204d7c45d22c6af2223] | committer: Paul B Mahol

avcodec/utvideodec: fix possible write past end of array

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

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

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index ab390be0fa..694896d61f 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -985,7 +985,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 }
 
-c->buffer = av_calloc(avctx->width, c->pro?2:1);
+c->buffer = av_calloc(avctx->width + 8, c->pro?2:1);
 if (!c->buffer)
 return AVERROR(ENOMEM);
 

___
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] avcodec/smcenc: remove useless cast

2023-09-07 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Sep  7 11:18:32 
2023 +0200| [9c9f48e7f2d77d84428bab311aa55e59c156059c] | committer: Paul B Mahol

avcodec/smcenc: remove useless cast

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

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

diff --git a/libavcodec/smcenc.c b/libavcodec/smcenc.c
index 40b53c40ee..fb15489ad2 100644
--- a/libavcodec/smcenc.c
+++ b/libavcodec/smcenc.c
@@ -583,7 +583,7 @@ static int smc_encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 
 static int smc_encode_end(AVCodecContext *avctx)
 {
-SMCContext *s = (SMCContext *)avctx->priv_data;
+SMCContext *s = avctx->priv_data;
 
 av_frame_free(>prev_frame);
 

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