Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] Added new celt with opus 1.5.2 (PR #20716)
@ 2025-10-18 17:26 Jamaika1 via ffmpeg-devel
  2025-10-19 13:26 ` [FFmpeg-devel] " Nicolas George via ffmpeg-devel
  0 siblings, 1 reply; 2+ messages in thread
From: Jamaika1 via ffmpeg-devel @ 2025-10-18 17:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Jamaika1

PR #20716 opened by Jamaika1
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20716
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20716.patch


>From f1276fe5217d07fda6d7dba77d0740a32d4fdc15 Mon Sep 17 00:00:00 2001
From: Jamaika1 <lukaszcz18@wp.pl>
Date: Sat, 18 Oct 2025 17:26:10 +0000
Subject: [PATCH] Added new celt with opus 1.5.2

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

diff --git a/libavcodec/libcelt_dec.c b/libavcodec/libcelt_dec.c
index fcd4fc7736..bdaf89e3de 100644
--- a/libavcodec/libcelt_dec.c
+++ b/libavcodec/libcelt_dec.c
@@ -1,6 +1,6 @@
 /*
- * Xiph CELT decoder using libcelt
- * Copyright (c) 2011 Nicolas George
+ * Xiph OPUS decoder using libcelt
+ * Copyright (c) 2023 Nicolas George
  *
  * This file is part of FFmpeg.
  *
@@ -21,6 +21,7 @@
 
 #include <celt/celt.h>
 #include <celt/celt_header.h>
+#include <opus_custom.h>
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "decode.h"
@@ -35,17 +36,17 @@ struct libcelt_context {
 static int ff_celt_error_to_averror(int err)
 {
     switch (err) {
-        case CELT_BAD_ARG:          return AVERROR(EINVAL);
+        case OPUS_BAD_ARG:          return AVERROR(EINVAL);
 #ifdef CELT_BUFFER_TOO_SMALL
-        case CELT_BUFFER_TOO_SMALL: return AVERROR(ENOBUFS);
+        case OPUS_BUFFER_TOO_SMALL: return AVERROR(ENOBUFS);
 #endif
-        case CELT_INTERNAL_ERROR:   return AVERROR(EFAULT);
-        case CELT_CORRUPTED_DATA:   return AVERROR_INVALIDDATA;
-        case CELT_UNIMPLEMENTED:    return AVERROR(ENOSYS);
+        case OPUS_INTERNAL_ERROR:   return AVERROR(EFAULT);
+        //case OPUS_CORRUPTED_DATA:   return AVERROR_INVALIDDATA;
+        case OPUS_UNIMPLEMENTED:    return AVERROR(ENOSYS);
 #ifdef ENOTRECOVERABLE
-        case CELT_INVALID_STATE:    return AVERROR(ENOTRECOVERABLE);
+        case OPUS_INVALID_STATE:    return AVERROR(ENOTRECOVERABLE);
 #endif
-        case CELT_ALLOC_FAIL:       return AVERROR(ENOMEM);
+        case OPUS_ALLOC_FAIL:       return AVERROR(ENOMEM);
         default:                    return AVERROR(EINVAL);
     }
 }
@@ -65,12 +66,12 @@ static av_cold int libcelt_dec_init(AVCodecContext *c)
     if (!c->ch_layout.nb_channels || !c->frame_size ||
         c->frame_size > INT_MAX / sizeof(int16_t) / c->ch_layout.nb_channels)
         return AVERROR(EINVAL);
-    celt->mode = celt_mode_create(c->sample_rate, c->frame_size, &err);
+    celt->mode = opus_custom_mode_create(c->sample_rate, c->frame_size, &err);
     if (!celt->mode)
         return ff_celt_error_to_averror(err);
-    celt->dec = celt_decoder_create_custom(celt->mode, c->ch_layout.nb_channels, &err);
+    celt->dec = opus_custom_decoder_create(celt->mode, c->ch_layout.nb_channels, &err);
     if (!celt->dec) {
-        celt_mode_destroy(celt->mode);
+        opus_custom_mode_destroy(celt->mode);
         return ff_celt_error_to_averror(err);
     }
     if (c->extradata_size >= 4) {
@@ -98,8 +99,8 @@ static av_cold int libcelt_dec_close(AVCodecContext *c)
 {
     struct libcelt_context *celt = c->priv_data;
 
-    celt_decoder_destroy(celt->dec);
-    celt_mode_destroy(celt->mode);
+    opus_custom_decoder_destroy(celt->dec);
+    opus_custom_mode_destroy(celt->mode);
     return 0;
 }
 
@@ -114,7 +115,7 @@ static int libcelt_dec_decode(AVCodecContext *c, AVFrame *frame,
     if ((err = ff_get_buffer(c, frame, 0)) < 0)
         return err;
     pcm = (int16_t *)frame->data[0];
-    err = celt_decode(celt->dec, pkt->data, pkt->size, pcm, c->frame_size);
+    err = opus_custom_decode(celt->dec, pkt->data, pkt->size, pcm, c->frame_size);
     if (err < 0)
         return ff_celt_error_to_averror(err);
     if (celt->discard) {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-19 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-18 17:26 [FFmpeg-devel] [PATCH] Added new celt with opus 1.5.2 (PR #20716) Jamaika1 via ffmpeg-devel
2025-10-19 13:26 ` [FFmpeg-devel] " Nicolas George via ffmpeg-devel

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