diff mbox series

[FFmpeg-devel,5/9] avcodec/opus_rc: Don't duplicate define

Message ID GV1P250MB0737D689A6312913587E36968F5F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 5e8ea2bbc6d1798a8b843f9631fcb9da35c902f8
Headers show
Series [FFmpeg-devel,1/9] avcodec/opus_rc: Remove write-only waste from OpusRangeCoder | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 7, 2022, 8:25 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/opus_rc.c     | 4 ++--
 libavcodec/opus_rc.h     | 5 ++---
 libavcodec/opusenc_psy.c | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/opus_rc.c b/libavcodec/opus_rc.c
index 2061418e52..1a26d889b7 100644
--- a/libavcodec/opus_rc.c
+++ b/libavcodec/opus_rc.c
@@ -388,7 +388,7 @@  void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, int size)
         int i, lap;
         uint8_t *rb_src, *rb_dst;
         ff_opus_rc_put_raw(rc, 0, 32 - rc->rb.cachelen);
-        rb_src = rc->buf + OPUS_MAX_PACKET_SIZE + 12 - rc->rb.bytes;
+        rb_src = rc->buf + OPUS_MAX_FRAME_SIZE + 12 - rc->rb.bytes;
         rb_dst = dst + FFMAX(size - rc->rb.bytes, 0);
         lap = &dst[rng_bytes] - rb_dst;
         for (i = 0; i < lap; i++)
@@ -405,5 +405,5 @@  void ff_opus_rc_enc_init(OpusRangeCoder *rc)
     rc->rem = -1;
     rc->ext =  0;
     rc->rng_cur = rc->buf;
-    ff_opus_rc_dec_raw_init(rc, rc->buf + OPUS_MAX_PACKET_SIZE + 8, 0);
+    ff_opus_rc_dec_raw_init(rc, rc->buf + OPUS_MAX_FRAME_SIZE + 8, 0);
 }
diff --git a/libavcodec/opus_rc.h b/libavcodec/opus_rc.h
index 1b3cb93a15..72e683b075 100644
--- a/libavcodec/opus_rc.h
+++ b/libavcodec/opus_rc.h
@@ -25,8 +25,7 @@ 
 
 #include <stdint.h>
 #include "get_bits.h"
-
-#define OPUS_MAX_PACKET_SIZE 1275
+#include "opus.h"
 
 #define opus_ilog(i) (av_log2(i) + !!(i))
 
@@ -45,7 +44,7 @@  typedef struct OpusRangeCoder {
     uint32_t total_bits;
 
     /* Encoder */
-    uint8_t buf[OPUS_MAX_PACKET_SIZE + 12]; /* memcpy vs (memmove + overreading) */
+    uint8_t buf[OPUS_MAX_FRAME_SIZE + 12]; /* memcpy vs (memmove + overreading) */
     uint8_t *rng_cur;                      /* Current range coded byte */
     int ext;                               /* Awaiting propagation */
     int rem;                               /* Carryout flag */
diff --git a/libavcodec/opusenc_psy.c b/libavcodec/opusenc_psy.c
index 5c768ae68e..48ccd2ebd0 100644
--- a/libavcodec/opusenc_psy.c
+++ b/libavcodec/opusenc_psy.c
@@ -359,7 +359,7 @@  static void celt_gauge_psy_weight(OpusPsyContext *s, OpusPsyStep **start,
     rate /= s->avctx->sample_rate/frame_size;
 
     f_out->framebits = lrintf(rate);
-    f_out->framebits = FFMIN(f_out->framebits, OPUS_MAX_PACKET_SIZE*8);
+    f_out->framebits = FFMIN(f_out->framebits, OPUS_MAX_FRAME_SIZE * 8);
     f_out->framebits = FFALIGN(f_out->framebits, 8);
 }