From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 4/9] avcodec/opus: Use prefix for defines
Date: Fri, 7 Oct 2022 22:25:03 +0200
Message-ID: <GV1P250MB0737E8EFA200FE3644150BCE8F5F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB0737F6A03249BF948291E39F8F5F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/opus.h | 6 +++---
libavcodec/opus_parse.c | 12 ++++++------
libavcodec/opus_parse.h | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libavcodec/opus.h b/libavcodec/opus.h
index 4d061cf5f8..f87b63aaca 100644
--- a/libavcodec/opus.h
+++ b/libavcodec/opus.h
@@ -25,9 +25,9 @@
#include <stdint.h>
-#define MAX_FRAME_SIZE 1275
-#define MAX_FRAMES 48
-#define MAX_PACKET_DUR 5760
+#define OPUS_MAX_FRAME_SIZE 1275
+#define OPUS_MAX_FRAMES 48
+#define OPUS_MAX_PACKET_DUR 5760
#define OPUS_TS_HEADER 0x7FE0 // 0x3ff (11 bits)
#define OPUS_TS_MASK 0xFFE0 // top 11 bits
diff --git a/libavcodec/opus_parse.c b/libavcodec/opus_parse.c
index 39765c5b79..e922d1f304 100644
--- a/libavcodec/opus_parse.c
+++ b/libavcodec/opus_parse.c
@@ -128,7 +128,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
}
frame_bytes = end - ptr;
- if (frame_bytes > MAX_FRAME_SIZE)
+ if (frame_bytes > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[0] = ptr - buf;
pkt->frame_size[0] = frame_bytes;
@@ -147,7 +147,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
}
frame_bytes = end - ptr;
- if (frame_bytes & 1 || frame_bytes >> 1 > MAX_FRAME_SIZE)
+ if (frame_bytes & 1 || frame_bytes >> 1 > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[0] = ptr - buf;
pkt->frame_size[0] = frame_bytes >> 1;
@@ -177,7 +177,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
/* calculate 2nd frame size */
frame_bytes = end - ptr - pkt->frame_size[0];
- if (frame_bytes < 0 || frame_bytes > MAX_FRAME_SIZE)
+ if (frame_bytes < 0 || frame_bytes > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[1] = pkt->frame_offset[0] + pkt->frame_size[0];
pkt->frame_size[1] = frame_bytes;
@@ -189,7 +189,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
padding = (i >> 6) & 0x01;
pkt->vbr = (i >> 7) & 0x01;
- if (pkt->frame_count == 0 || pkt->frame_count > MAX_FRAMES)
+ if (pkt->frame_count == 0 || pkt->frame_count > OPUS_MAX_FRAMES)
goto fail;
/* read padding size */
@@ -239,7 +239,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
} else {
frame_bytes = end - ptr - padding;
if (frame_bytes % pkt->frame_count ||
- frame_bytes / pkt->frame_count > MAX_FRAME_SIZE)
+ frame_bytes / pkt->frame_count > OPUS_MAX_FRAME_SIZE)
goto fail;
frame_bytes /= pkt->frame_count;
}
@@ -258,7 +258,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
/* total packet duration cannot be larger than 120ms */
pkt->frame_duration = opus_frame_duration[pkt->config];
- if (pkt->frame_duration * pkt->frame_count > MAX_PACKET_DUR)
+ if (pkt->frame_duration * pkt->frame_count > OPUS_MAX_PACKET_DUR)
goto fail;
/* set mode and bandwidth */
diff --git a/libavcodec/opus_parse.h b/libavcodec/opus_parse.h
index 8e5c6a880c..83ed3c7887 100644
--- a/libavcodec/opus_parse.h
+++ b/libavcodec/opus_parse.h
@@ -37,8 +37,8 @@ typedef struct OpusPacket {
int config; /**< configuration: tells the audio mode,
** bandwidth, and frame duration */
int frame_count; /**< frame count */
- int frame_offset[MAX_FRAMES]; /**< frame offsets */
- int frame_size[MAX_FRAMES]; /**< frame sizes */
+ int frame_offset[OPUS_MAX_FRAMES]; /**< frame offsets */
+ int frame_size[OPUS_MAX_FRAMES]; /**< frame sizes */
int frame_duration; /**< frame duration, in samples @ 48kHz */
enum OpusMode mode; /**< mode */
enum OpusBandwidth bandwidth; /**< bandwidth */
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-10-07 20:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 20:20 [FFmpeg-devel] [PATCH 1/9] avcodec/opus_rc: Remove write-only waste from OpusRangeCoder Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 2/9] avcodec/opusenc_psy: Remove unused function parameter Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 3/9] avcodec/opusenc_psy: Remove unused/write-only context members Andreas Rheinhardt
2022-10-07 20:25 ` Andreas Rheinhardt [this message]
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 5/9] avcodec/opus_rc: Don't duplicate define Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 6/9] avcodec/opus_pvq: Don't build ppp_pvq_search_c when unused Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 7/9] avcodec/opus_rc: Split de/encoder-only parts off OpusRangeContext Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 8/9] avcodec/opus: Rename opus.c->opus_celt.c, opus_celt.c->opusdec_celt.c Andreas Rheinhardt
2022-10-07 20:25 ` [FFmpeg-devel] [PATCH 9/9] avcodec/opus_pvq: Avoid indirection when possible Andreas Rheinhardt
2022-10-08 3:25 ` [FFmpeg-devel] [PATCH 1/9] avcodec/opus_rc: Remove write-only waste from OpusRangeCoder Lynne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=GV1P250MB0737E8EFA200FE3644150BCE8F5F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git