[FFmpeg-cvslog] avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout

2022-09-11 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Sep 10 00:36:34 
2022 -0300| [60d8c2019f59fcbeb597c900a56c8c4cd9ec8838] | committer: James Almer

avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout

Do it only if the value conflicts with the previous channels value.

Fixes ticket #9912

Signed-off-by: James Almer 

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

 libavformat/riffdec.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 3946ecb72f..c1e4a04550 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -102,6 +102,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
 return AVERROR_INVALIDDATA;
 }
 
+av_channel_layout_uninit(&par->ch_layout);
+
 par->codec_type  = AVMEDIA_TYPE_AUDIO;
 if (!big_endian) {
 id = avio_rl16(pb);
@@ -189,9 +191,12 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
 if (par->codec_id == AV_CODEC_ID_ADPCM_G726 && par->sample_rate)
 par->bits_per_coded_sample = par->bit_rate / par->sample_rate;
 
-av_channel_layout_uninit(&par->ch_layout);
-par->ch_layout.order   = AV_CHANNEL_ORDER_UNSPEC;
-par->ch_layout.nb_channels = channels;
+/* ignore WAVEFORMATEXTENSIBLE layout if different from channel count */
+if (channels != par->ch_layout.nb_channels) {
+av_channel_layout_uninit(&par->ch_layout);
+par->ch_layout.order   = AV_CHANNEL_ORDER_UNSPEC;
+par->ch_layout.nb_channels = channels;
+}
 
 return 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] avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout

2022-09-11 Thread James Almer
ffmpeg | branch: release/5.1 | James Almer  | Sat Sep 10 
00:36:34 2022 -0300| [425ffaec23fbe79f2d8150d0bc5eafb6668e3c5d] | committer: 
James Almer

avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout

Do it only if the value conflicts with the previous channels value.

Fixes ticket #9912

Signed-off-by: James Almer 
(cherry picked from commit 60d8c2019f59fcbeb597c900a56c8c4cd9ec8838)

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

 libavformat/riffdec.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 3946ecb72f..c1e4a04550 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -102,6 +102,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
 return AVERROR_INVALIDDATA;
 }
 
+av_channel_layout_uninit(&par->ch_layout);
+
 par->codec_type  = AVMEDIA_TYPE_AUDIO;
 if (!big_endian) {
 id = avio_rl16(pb);
@@ -189,9 +191,12 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
 if (par->codec_id == AV_CODEC_ID_ADPCM_G726 && par->sample_rate)
 par->bits_per_coded_sample = par->bit_rate / par->sample_rate;
 
-av_channel_layout_uninit(&par->ch_layout);
-par->ch_layout.order   = AV_CHANNEL_ORDER_UNSPEC;
-par->ch_layout.nb_channels = channels;
+/* ignore WAVEFORMATEXTENSIBLE layout if different from channel count */
+if (channels != par->ch_layout.nb_channels) {
+av_channel_layout_uninit(&par->ch_layout);
+par->ch_layout.order   = AV_CHANNEL_ORDER_UNSPEC;
+par->ch_layout.nb_channels = channels;
+}
 
 return 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] avcodec/vp8: Remove unused macros

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Sep  9 01:23:21 2022 +0200| [361c8753407cc91b462090e90bd0f78f0c2e2664] | 
committer: Andreas Rheinhardt

avcodec/vp8: Remove unused macros

Reviewed-by: Peter Ross 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/vp8.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 0e16e75faa..f83a0d66bb 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -44,14 +44,6 @@
 #   include "arm/vp8.h"
 #endif
 
-#if CONFIG_VP7_DECODER && CONFIG_VP8_DECODER
-#define VPX(vp7, f) (vp7 ? vp7_ ## f : vp8_ ## f)
-#elif CONFIG_VP7_DECODER
-#define VPX(vp7, f) vp7_ ## f
-#else // CONFIG_VP8_DECODER
-#define VPX(vp7, f) vp8_ ## f
-#endif
-
 // fixme: add 1 bit to all the calls to this?
 static int vp8_rac_get_sint(VPXRangeCoder *c, int bits)
 {

___
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/vp8dsp: Remove declarations of inexistent functions

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Sep 10 00:02:46 2022 +0200| [b3591ccdf1f364ecea1f0d4b5777d1818e2ec13e] | 
committer: Andreas Rheinhardt

avcodec/vp8dsp: Remove declarations of inexistent functions

Forgotten in d6f8476be4895c620d58e021ab880823d2fe25bf.

Reviewed-by: Peter Ross 
Reviewed-by: Ronald S. Bultje 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/vp8dsp.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libavcodec/vp8dsp.h b/libavcodec/vp8dsp.h
index 7c6208df39..bbd7f60a4f 100644
--- a/libavcodec/vp8dsp.h
+++ b/libavcodec/vp8dsp.h
@@ -81,13 +81,6 @@ typedef struct VP8DSPContext {
 vp8_mc_func put_vp8_bilinear_pixels_tab[3][3][3];
 } VP8DSPContext;
 
-void ff_put_vp8_pixels16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
-   int h, int x, int y);
-void ff_put_vp8_pixels8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
-  int h, int x, int y);
-void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
-  int h, int x, int y);
-
 void ff_vp7dsp_init(VP8DSPContext *c);
 
 void ff_vp78dsp_init(VP8DSPContext *c);

___
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/vp8: Move fade_present from context to stack

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Sep  9 17:17:15 2022 +0200| [4130789f4f20e67ef44f8c721955c5e3bcbc1b09] | 
committer: Andreas Rheinhardt

avcodec/vp8: Move fade_present from context to stack

It is only an auxiliary value used for parsing the VP7 frame header.

Reviewed-by: Peter Ross 
Reviewed-by: Ronald S. Bultje 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/vp8.c | 6 +++---
 libavcodec/vp8.h | 5 -
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index f83a0d66bb..07ea3c6dd1 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -580,6 +580,7 @@ static int vp7_decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_si
 int height = s->avctx->height;
 int alpha = 0;
 int beta  = 0;
+int fade_present = 1;
 
 if (buf_size < 4) {
 return AVERROR_INVALIDDATA;
@@ -681,7 +682,6 @@ static int vp7_decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_si
 
 s->update_last  = 1;
 s->update_probabilities = 1;
-s->fade_present = 1;
 
 if (s->profile > 0) {
 s->update_probabilities = vp89_rac_get(c);
@@ -689,13 +689,13 @@ static int vp7_decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_si
 s->prob[1] = s->prob[0];
 
 if (!s->keyframe)
-s->fade_present = vp89_rac_get(c);
+fade_present = vp89_rac_get(c);
 }
 
 if (vpx_rac_is_end(c))
 return AVERROR_INVALIDDATA;
 /* E. Fading information for previous frame */
-if (s->fade_present && vp89_rac_get(c)) {
+if (fade_present && vp89_rac_get(c)) {
 alpha = (int8_t) vp89_rac_get_uint(c, 8);
 beta  = (int8_t) vp89_rac_get_uint(c, 8);
 }
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 30aeb4cb06..6f29156b53 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -335,11 +335,6 @@ typedef struct VP8Context {
 
 int vp7;
 
-/**
- * Fade bit present in bitstream (VP7)
- */
-int fade_present;
-
 /**
  * Interframe DC prediction (VP7)
  * [0] VP8_FRAME_PREVIOUS

___
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/vp8dsp: Constify src in vp8_mc_func

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sat Sep 10 00:44:22 2022 +0200| [a54e53a1c428299b19c7b4e2b66d01c0482c41dd] | 
committer: Andreas Rheinhardt

avcodec/vp8dsp: Constify src in vp8_mc_func

Reviewed-by: Peter Ross 
Reviewed-by: Ronald S. Bultje 
Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/aarch64/vp8dsp.h |   2 +-
 libavcodec/arm/vp8dsp.h |   2 +-
 libavcodec/arm/vp8dsp_armv6.S   |   6 +-
 libavcodec/loongarch/vp8_mc_lsx.c   |  31 +++
 libavcodec/loongarch/vp8dsp_loongarch.h |  28 +++
 libavcodec/mips/vp8_mc_msa.c| 110 
 libavcodec/mips/vp8dsp_mips.h   | 144 
 libavcodec/ppc/vp8dsp_altivec.c |  12 +--
 libavcodec/vp8dsp.c |  14 ++--
 libavcodec/vp8dsp.h |   2 +-
 libavcodec/x86/vp8dsp.asm   |   2 +-
 libavcodec/x86/vp8dsp_init.c|  58 ++---
 12 files changed, 206 insertions(+), 205 deletions(-)

diff --git a/libavcodec/aarch64/vp8dsp.h b/libavcodec/aarch64/vp8dsp.h
index 871fed7a95..4e59de28b1 100644
--- a/libavcodec/aarch64/vp8dsp.h
+++ b/libavcodec/aarch64/vp8dsp.h
@@ -53,7 +53,7 @@
 
 #define VP8_MC(n, opt)  \
 void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride,  \
-uint8_t *src, ptrdiff_t srcstride,  \
+const uint8_t *src, ptrdiff_t srcstride,\
 int h, int x, int y)
 
 #define VP8_EPEL(w, opt)\
diff --git a/libavcodec/arm/vp8dsp.h b/libavcodec/arm/vp8dsp.h
index 7281d0bfb1..11dcc78d7a 100644
--- a/libavcodec/arm/vp8dsp.h
+++ b/libavcodec/arm/vp8dsp.h
@@ -58,7 +58,7 @@ void ff_vp8dsp_init_neon(VP8DSPContext *dsp);
 
 #define VP8_MC(n, opt)  \
 void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride,  \
-uint8_t *src, ptrdiff_t srcstride,  \
+const uint8_t *src, ptrdiff_t srcstride,\
 int h, int x, int y)
 
 #define VP8_EPEL(w, opt)\
diff --git a/libavcodec/arm/vp8dsp_armv6.S b/libavcodec/arm/vp8dsp_armv6.S
index 2320bf4d23..395debe866 100644
--- a/libavcodec/arm/vp8dsp_armv6.S
+++ b/libavcodec/arm/vp8dsp_armv6.S
@@ -1113,7 +1113,7 @@ endfunc
 
 @ MC
 
-@ void put_vp8_pixels16(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,
+@ void put_vp8_pixels16(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,
 @   ptrdiff_t srcstride, int h, int mx, int my)
 function ff_put_vp8_pixels16_armv6, export=1
 push{r4-r11}
@@ -1137,7 +1137,7 @@ function ff_put_vp8_pixels16_armv6, export=1
 bx  lr
 endfunc
 
-@ void put_vp8_pixels8(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,
+@ void put_vp8_pixels8(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,
 @  ptrdiff_t srcstride, int h, int mx, int my)
 function ff_put_vp8_pixels8_armv6, export=1
 push{r4-r11}
@@ -1161,7 +1161,7 @@ function ff_put_vp8_pixels8_armv6, export=1
 bx  lr
 endfunc
 
-@ void put_vp8_pixels4(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,
+@ void put_vp8_pixels4(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,
 @  ptrdiff_t srcstride, int h, int mx, int my)
 function ff_put_vp8_pixels4_armv6, export=1
 ldr r12, [sp, #0]   @ h
diff --git a/libavcodec/loongarch/vp8_mc_lsx.c 
b/libavcodec/loongarch/vp8_mc_lsx.c
index 80c4f87e80..034d84cc5d 100644
--- a/libavcodec/loongarch/vp8_mc_lsx.c
+++ b/libavcodec/loongarch/vp8_mc_lsx.c
@@ -122,7 +122,7 @@ static const int8_t subpel_filters_lsx[7][8] = {
 } )
 
 void ff_put_vp8_epel8_h6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
- uint8_t *src, ptrdiff_t src_stride,
+ const uint8_t *src, ptrdiff_t src_stride,
  int height, int mx, int my)
 {
 uint32_t loop_cnt;
@@ -187,7 +187,7 @@ void ff_put_vp8_epel8_h6_lsx(uint8_t *dst, ptrdiff_t 
dst_stride,
 }
 
 void ff_put_vp8_epel16_h6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
-  uint8_t *src, ptrdiff_t src_stride,
+  const uint8_t *src, ptrdiff_t src_stride,
   int height, int mx, int my)
 {
 uint32_t loop_cnt;
@@ -241,7 +241,7 @@ void ff_put_vp8_epel16_h6_lsx(uint8_t *dst, ptrdiff_t 
dst_stride,
 }
 
 void ff_put_vp8_epel8_v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
- uint8_t *src, ptrdiff_t src_stride,
+ const uint8_t *src, ptrdiff_t src_stride,
  int

[FFmpeg-cvslog] avutil/x86/intreadwrite: Add ability to detect whether MMX code is used

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  8 15:00:06 2022 +0200| [29c4c0886d143790fcbeddbe40a23dfc6f56345c] | 
committer: Andreas Rheinhardt

avutil/x86/intreadwrite: Add ability to detect whether MMX code is used

It can be used to call emms_c() only when needed.

Signed-off-by: Andreas Rheinhardt 

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

 libavutil/x86/intreadwrite.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h
index 4061d19231..40f375b013 100644
--- a/libavutil/x86/intreadwrite.h
+++ b/libavutil/x86/intreadwrite.h
@@ -29,6 +29,8 @@
 
 #if !HAVE_FAST_64BIT && defined(__MMX__)
 
+#define FF_COPY_SWAP_ZERO_USES_MMX
+
 #define AV_COPY64 AV_COPY64
 static av_always_inline void AV_COPY64(void *d, const void *s)
 {

___
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/dca_core: Only call emms_c() if needed

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Sep  8 15:09:26 2022 +0200| [df215e575850e41b19aeb1fd99e53372a6b3d537] | 
committer: Andreas Rheinhardt

avcodec/dca_core: Only call emms_c() if needed

It is not needed on x64, because the AV_COPY* and AV_ZERO*
macros never use MMX on x64.

Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 1655116eed..bbf36ea678 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -767,7 +767,9 @@ static void erase_adpcm_history(DCACoreDecoder *s)
 for (band = 0; band < DCA_SUBBANDS; band++)
 AV_ZERO128(s->subband_samples[ch][band] - DCA_ADPCM_COEFFS);
 
+#ifdef FF_COPY_SWAP_ZERO_USES_MMX
 emms_c();
+#endif
 }
 
 static int alloc_sample_buffer(DCACoreDecoder *s)
@@ -831,7 +833,9 @@ static int parse_frame_data(DCACoreDecoder *s, enum 
HeaderType header, int xch_b
 }
 }
 
+#ifdef FF_COPY_SWAP_ZERO_USES_MMX
 emms_c();
+#endif
 
 return 0;
 }
@@ -1276,7 +1280,9 @@ static void erase_x96_adpcm_history(DCACoreDecoder *s)
 for (band = 0; band < DCA_SUBBANDS_X96; band++)
 AV_ZERO128(s->x96_subband_samples[ch][band] - DCA_ADPCM_COEFFS);
 
+#ifdef FF_COPY_SWAP_ZERO_USES_MMX
 emms_c();
+#endif
 }
 
 static int alloc_x96_sample_buffer(DCACoreDecoder *s)
@@ -1506,7 +1512,9 @@ static int parse_x96_frame_data(DCACoreDecoder *s, int 
exss, int xch_base)
 }
 }
 
+#ifdef FF_COPY_SWAP_ZERO_USES_MMX
 emms_c();
+#endif
 
 return 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] avcodec/ralf: Move frame allocation after error checks

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Wed Sep  7 01:55:23 2022 +0200| [dcbb7e8a303b4a97b1ff3945277fa1db868ef121] | 
committer: Andreas Rheinhardt

avcodec/ralf: Move frame allocation after error checks

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/ralf.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 20c5f060d0..8f8e49f535 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -451,12 +451,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 src_size = avpkt->size;
 }
 
-frame->nb_samples = ctx->max_frame_size;
-if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
-return ret;
-samples0 = (int16_t *)frame->data[0];
-samples1 = (int16_t *)frame->data[1];
-
 if (src_size < 5) {
 av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n");
 return AVERROR_INVALIDDATA;
@@ -481,6 +475,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 ctx->num_blocks++;
 }
 
+frame->nb_samples = ctx->max_frame_size;
+if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+return ret;
+samples0 = (int16_t *)frame->data[0];
+samples1 = (int16_t *)frame->data[1];
 block_pointer = src  + table_bytes + 2;
 bytes_left= src_size - table_bytes - 2;
 ctx->sample_offset = 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] avcodec/ralf: Move variable from context to stack

2022-09-11 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Wed Sep  7 02:02:54 2022 +0200| [5c19cb3f924c8afafcae08916a4167e36842adcd] | 
committer: Andreas Rheinhardt

avcodec/ralf: Move variable from context to stack

Signed-off-by: Andreas Rheinhardt 

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

 libavcodec/ralf.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 8f8e49f535..591598d8fc 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -63,7 +63,6 @@ typedef struct RALFContext {
 
 unsigned bias[2];///< a constant value added to channel data after 
filtering
 
-int num_blocks;  ///< number of blocks inside the frame
 int sample_offset;
 int block_size[1 << 12]; ///< size of the blocks
 int block_pts[1 << 12];  ///< block start time (in milliseconds)
@@ -418,7 +417,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 int16_t *samples1;
 int ret;
 GetBitContext gb;
-int table_size, table_bytes, i;
+int table_size, table_bytes, num_blocks;
 const uint8_t *src, *block_pointer;
 int src_size;
 int bytes_left;
@@ -462,17 +461,17 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 return AVERROR_INVALIDDATA;
 }
 init_get_bits(&gb, src + 2, table_size);
-ctx->num_blocks = 0;
+num_blocks = 0;
 while (get_bits_left(&gb) > 0) {
-if (ctx->num_blocks >= FF_ARRAY_ELEMS(ctx->block_size))
+if (num_blocks >= FF_ARRAY_ELEMS(ctx->block_size))
 return AVERROR_INVALIDDATA;
-ctx->block_size[ctx->num_blocks] = get_bits(&gb, 13 + 
avctx->ch_layout.nb_channels);
+ctx->block_size[num_blocks] = get_bits(&gb, 13 + 
avctx->ch_layout.nb_channels);
 if (get_bits1(&gb)) {
-ctx->block_pts[ctx->num_blocks] = get_bits(&gb, 9);
+ctx->block_pts[num_blocks] = get_bits(&gb, 9);
 } else {
-ctx->block_pts[ctx->num_blocks] = 0;
+ctx->block_pts[num_blocks] = 0;
 }
-ctx->num_blocks++;
+num_blocks++;
 }
 
 frame->nb_samples = ctx->max_frame_size;
@@ -483,7 +482,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 block_pointer = src  + table_bytes + 2;
 bytes_left= src_size - table_bytes - 2;
 ctx->sample_offset = 0;
-for (i = 0; i < ctx->num_blocks; i++) {
+for (int i = 0; i < num_blocks; i++) {
 if (bytes_left < ctx->block_size[i]) {
 av_log(avctx, AV_LOG_ERROR, "I'm pedaling backwards\n");
 break;

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