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] avcodec/adpcmenc: Add ADPCM IMA Xbox encoder
@ 2026-01-04 19:39 Azamat H. Hackimov via ffmpeg-devel
  2026-01-06  7:50 ` [FFmpeg-devel] " Peter Ross via ffmpeg-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Azamat H. Hackimov via ffmpeg-devel @ 2026-01-04 19:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Azamat H. Hackimov

adpcm_ima_xbox is pretty similar to standard ADPCM IMA encoder, difference is only frame_size and block_align settings of ADPCM encoder.

Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
---
 Changelog                 |  1 +
 doc/general_contents.texi |  2 +-
 libavcodec/Makefile       |  1 +
 libavcodec/adpcmenc.c     | 33 ++++++++++++++++++++-------------
 libavcodec/allcodecs.c    |  1 +
 libavcodec/version.h      |  2 +-
 6 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/Changelog b/Changelog
index 2f97b280cb..e1a628ffce 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version <next>:
 - JPEG-XS decoder and encoder through libsvtjpegxs
 - JPEG-XS raw bitstream muxer and demuxer
 - IAMF Projection mode Ambisonic Audio Elements muxing and demuxing
+- ADPCM IMA Xbox encoder
 
 
 version 8.0:
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 47ac1989f2..f7b5d46738 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -1255,7 +1255,7 @@ following image formats are supported:
 @item ADPCM IMA Duck DK4     @tab     @tab  X
     @tab Used in some Sega Saturn console games.
 @item ADPCM IMA Radical      @tab     @tab  X
-@item ADPCM IMA Xbox         @tab     @tab  X
+@item ADPCM IMA Xbox         @tab  X  @tab  X
 @item ADPCM Microsoft        @tab  X  @tab  X
 @item ADPCM MS IMA           @tab  X  @tab  X
 @item ADPCM Nintendo Gamecube AFC  @tab     @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3d60347a19..383fd2592c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1013,6 +1013,7 @@ OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)      += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)       += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WS_ENCODER)       += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_XBOX_DECODER)     += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_XBOX_ENCODER)     += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_MS_DECODER)           += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_MS_ENCODER)           += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_MTAF_DECODER)         += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 96a053351d..69d49f1c33 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -136,6 +136,10 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
         avctx->block_align = s->block_size;
         avctx->bits_per_coded_sample = 4;
         ) /* End of CASE */
+    CASE(ADPCM_IMA_XBOX,
+        avctx->frame_size = 65;
+        avctx->block_align = 36 * channels;
+        ) /* End of CASE */
     CASE(ADPCM_IMA_QT,
         avctx->frame_size  = 64;
         avctx->block_align = 34 * channels;
@@ -623,7 +627,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     dst = avpkt->data;
 
     switch(avctx->codec->id) {
-    CASE(ADPCM_IMA_WAV,
+    case AV_CODEC_ID_ADPCM_IMA_WAV:
+    case AV_CODEC_ID_ADPCM_IMA_XBOX: {
         int blocks = (frame->nb_samples - 1) / 8;
 
         for (int ch = 0; ch < channels; ch++) {
@@ -667,7 +672,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
                 }
             }
         }
-        ) /* End of CASE */
+    }
+    break;
     CASE(ADPCM_IMA_QT,
         PutBitContext pb;
         init_put_bits(&pb, dst, pkt_size);
@@ -1021,14 +1027,15 @@ const FFCodec ff_ ## name_ ## _encoder = {                                 \
     ADPCM_ENCODER_3(CONFIG_ ## codec ## _ENCODER, AV_CODEC_ID_ ## codec, \
                     name, sample_fmts, capabilities, long_name)
 
-ADPCM_ENCODER(ADPCM_ARGO,    adpcm_argo,    sample_fmts_p, 0,                             "ADPCM Argonaut Games")
-ADPCM_ENCODER(ADPCM_IMA_AMV, adpcm_ima_amv, sample_fmts,   0,                             "ADPCM IMA AMV")
-ADPCM_ENCODER(ADPCM_IMA_APM, adpcm_ima_apm, sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Ubisoft APM")
-ADPCM_ENCODER(ADPCM_IMA_ALP, adpcm_ima_alp, sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA High Voltage Software ALP")
-ADPCM_ENCODER(ADPCM_IMA_QT,  adpcm_ima_qt,  sample_fmts_p, 0,                             "ADPCM IMA QuickTime")
-ADPCM_ENCODER(ADPCM_IMA_SSI, adpcm_ima_ssi, sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Simon & Schuster Interactive")
-ADPCM_ENCODER(ADPCM_IMA_WAV, adpcm_ima_wav, sample_fmts_p, 0,                             "ADPCM IMA WAV")
-ADPCM_ENCODER(ADPCM_IMA_WS,  adpcm_ima_ws,  sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Westwood")
-ADPCM_ENCODER(ADPCM_MS,      adpcm_ms,      sample_fmts,   0,                             "ADPCM Microsoft")
-ADPCM_ENCODER(ADPCM_SWF,     adpcm_swf,     sample_fmts,   0,                             "ADPCM Shockwave Flash")
-ADPCM_ENCODER(ADPCM_YAMAHA,  adpcm_yamaha,  sample_fmts,   0,                             "ADPCM Yamaha")
+ADPCM_ENCODER(ADPCM_ARGO,     adpcm_argo,     sample_fmts_p, 0,                             "ADPCM Argonaut Games")
+ADPCM_ENCODER(ADPCM_IMA_AMV,  adpcm_ima_amv,  sample_fmts,   0,                             "ADPCM IMA AMV")
+ADPCM_ENCODER(ADPCM_IMA_APM,  adpcm_ima_apm,  sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Ubisoft APM")
+ADPCM_ENCODER(ADPCM_IMA_ALP,  adpcm_ima_alp,  sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA High Voltage Software ALP")
+ADPCM_ENCODER(ADPCM_IMA_QT,   adpcm_ima_qt,   sample_fmts_p, 0,                             "ADPCM IMA QuickTime")
+ADPCM_ENCODER(ADPCM_IMA_SSI,  adpcm_ima_ssi,  sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Simon & Schuster Interactive")
+ADPCM_ENCODER(ADPCM_IMA_WAV,  adpcm_ima_wav,  sample_fmts_p, 0,                             "ADPCM IMA WAV")
+ADPCM_ENCODER(ADPCM_IMA_WS,   adpcm_ima_ws,   sample_fmts,   AV_CODEC_CAP_SMALL_LAST_FRAME, "ADPCM IMA Westwood")
+ADPCM_ENCODER(ADPCM_IMA_XBOX, adpcm_ima_xbox, sample_fmts_p, 0,                             "ADPCM IMA Xbox")
+ADPCM_ENCODER(ADPCM_MS,       adpcm_ms,       sample_fmts,   0,                             "ADPCM Microsoft")
+ADPCM_ENCODER(ADPCM_SWF,      adpcm_swf,      sample_fmts,   0,                             "ADPCM Shockwave Flash")
+ADPCM_ENCODER(ADPCM_YAMAHA,   adpcm_yamaha,   sample_fmts,   0,                             "ADPCM Yamaha")
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 042b07c895..6ccf53f1a0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -699,6 +699,7 @@ extern const FFCodec ff_adpcm_ima_wav_encoder;
 extern const FFCodec ff_adpcm_ima_wav_decoder;
 extern const FFCodec ff_adpcm_ima_ws_encoder;
 extern const FFCodec ff_adpcm_ima_ws_decoder;
+extern const FFCodec ff_adpcm_ima_xbox_encoder;
 extern const FFCodec ff_adpcm_ima_xbox_decoder;
 extern const FFCodec ff_adpcm_ms_encoder;
 extern const FFCodec ff_adpcm_ms_decoder;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 9d910cf848..8a10a7db97 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  23
+#define LIBAVCODEC_VERSION_MINOR  24
 #define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.51.2

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

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

* [FFmpeg-devel] Re: [PATCH] avcodec/adpcmenc: Add ADPCM IMA Xbox encoder
  2026-01-04 19:39 [FFmpeg-devel] [PATCH] avcodec/adpcmenc: Add ADPCM IMA Xbox encoder Azamat H. Hackimov via ffmpeg-devel
@ 2026-01-06  7:50 ` Peter Ross via ffmpeg-devel
  2026-01-06 12:30   ` Azamat Hackimov via ffmpeg-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Ross via ffmpeg-devel @ 2026-01-06  7:50 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Peter Ross


[-- Attachment #1.1: Type: text/plain, Size: 1131 bytes --]

On Sun, Jan 04, 2026 at 10:39:56PM +0300, Azamat H. Hackimov via ffmpeg-devel wrote:
> adpcm_ima_xbox is pretty similar to standard ADPCM IMA encoder, difference is only frame_size and block_align settings of ADPCM encoder.
> 
> Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>

Hi. Looks good. Can you create a pull request on FFmpeg forgejo? https://code.ffmpeg.org/

> ---
>  Changelog                 |  1 +
>  doc/general_contents.texi |  2 +-
>  libavcodec/Makefile       |  1 +
>  libavcodec/adpcmenc.c     | 33 ++++++++++++++++++++-------------
>  libavcodec/allcodecs.c    |  1 +
>  libavcodec/version.h      |  2 +-
>  6 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/Changelog b/Changelog
> index 2f97b280cb..e1a628ffce 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -19,6 +19,7 @@ version <next>:
>  - JPEG-XS decoder and encoder through libsvtjpegxs
>  - JPEG-XS raw bitstream muxer and demuxer
>  - IAMF Projection mode Ambisonic Audio Elements muxing and demuxing
> +- ADPCM IMA Xbox encoder

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 163 bytes --]

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

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

* [FFmpeg-devel] Re: [PATCH] avcodec/adpcmenc: Add ADPCM IMA Xbox encoder
  2026-01-06  7:50 ` [FFmpeg-devel] " Peter Ross via ffmpeg-devel
@ 2026-01-06 12:30   ` Azamat Hackimov via ffmpeg-devel
  0 siblings, 0 replies; 3+ messages in thread
From: Azamat Hackimov via ffmpeg-devel @ 2026-01-06 12:30 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Azamat Hackimov

Hello.
Created PR https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21391

вт, 6 янв. 2026 г. в 10:51, Peter Ross via ffmpeg-devel
<ffmpeg-devel@ffmpeg.org>:
>
> On Sun, Jan 04, 2026 at 10:39:56PM +0300, Azamat H. Hackimov via ffmpeg-devel wrote:
> > adpcm_ima_xbox is pretty similar to standard ADPCM IMA encoder, difference is only frame_size and block_align settings of ADPCM encoder.
> >
> > Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
>
> Hi. Looks good. Can you create a pull request on FFmpeg forgejo? https://code.ffmpeg.org/
>
> > ---
> >  Changelog                 |  1 +
> >  doc/general_contents.texi |  2 +-
> >  libavcodec/Makefile       |  1 +
> >  libavcodec/adpcmenc.c     | 33 ++++++++++++++++++++-------------
> >  libavcodec/allcodecs.c    |  1 +
> >  libavcodec/version.h      |  2 +-
> >  6 files changed, 25 insertions(+), 15 deletions(-)
> >
> > diff --git a/Changelog b/Changelog
> > index 2f97b280cb..e1a628ffce 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -19,6 +19,7 @@ version <next>:
> >  - JPEG-XS decoder and encoder through libsvtjpegxs
> >  - JPEG-XS raw bitstream muxer and demuxer
> >  - IAMF Projection mode Ambisonic Audio Elements muxing and demuxing
> > +- ADPCM IMA Xbox encoder
>
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
> _______________________________________________
> ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
> To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org



-- 
From Siberia with Love!
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

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

end of thread, other threads:[~2026-01-06 12:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-04 19:39 [FFmpeg-devel] [PATCH] avcodec/adpcmenc: Add ADPCM IMA Xbox encoder Azamat H. Hackimov via ffmpeg-devel
2026-01-06  7:50 ` [FFmpeg-devel] " Peter Ross via ffmpeg-devel
2026-01-06 12:30   ` Azamat Hackimov 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