From: Paul B Mahol <onemda@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH] avcodec: add CBD2 DPCM decoder Date: Tue, 24 Jan 2023 16:59:20 +0100 Message-ID: <CAPYw7P5-_5L-j3bFeB-97p37tGz=1G_EXD7EYqqfe8=Fo5TOFw@mail.gmail.com> (raw) [-- Attachment #1: Type: text/plain, Size: 21 bytes --] Hi, Patch attached. [-- Attachment #2: 0001-avcodec-add-CBD2-DPCM-decoder.patch --] [-- Type: text/x-patch, Size: 5305 bytes --] From 0c4254ed685660fe1bb714a32ea378ddbb23e64e Mon Sep 17 00:00:00 2001 From: Paul B Mahol <onemda@gmail.com> Date: Tue, 24 Jan 2023 16:14:25 +0100 Subject: [PATCH] avcodec: add CBD2 DPCM decoder Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/codec_desc.c | 7 +++++++ libavcodec/codec_id.h | 1 + libavcodec/dpcm.c | 10 ++++++++++ libavformat/aiff.c | 1 + libavformat/aiffdec.c | 1 + 7 files changed, 22 insertions(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index bfa8132580..e691c8d180 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -277,6 +277,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o OBJS-$(CONFIG_C93_DECODER) += c93.o OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ cavsdata.o +OBJS-$(CONFIG_CBD2_DECODER) += dpcm.o OBJS-$(CONFIG_CCAPTION_DECODER) += ccaption_dec.o ass.o OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CDTOONS_DECODER) += cdtoons.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index a5ab0cb4fe..74e1b00e96 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -621,6 +621,7 @@ extern const FFCodec ff_pcm_vidc_encoder; extern const FFCodec ff_pcm_vidc_decoder; /* DPCM codecs */ +extern const FFCodec ff_cbd2_dpcm_decoder; extern const FFCodec ff_derf_dpcm_decoder; extern const FFCodec ff_gremlin_dpcm_decoder; extern const FFCodec ff_interplay_dpcm_decoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index f4cbdf744b..6ecdf1002b 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2626,6 +2626,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("DPCM Marble WADY"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_CBD2_DPCM, + .type = AVMEDIA_TYPE_AUDIO, + .name = "cbd2_dpcm", + .long_name = NULL_IF_CONFIG_SMALL("DPCM Cuberoot-Delta-Exact"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, /* audio codecs */ { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index 60e36cc8a9..ba3b432387 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -431,6 +431,7 @@ enum AVCodecID { AV_CODEC_ID_GREMLIN_DPCM, AV_CODEC_ID_DERF_DPCM, AV_CODEC_ID_WADY_DPCM, + AV_CODEC_ID_CBD2_DPCM, /* audio codecs */ AV_CODEC_ID_MP2 = 0x15000, diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 86cb9134f8..6ea9e2c065 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -194,6 +194,13 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) } break; + case AV_CODEC_ID_CBD2_DPCM: + for (i = -128; i < 128; i++) { + int16_t cube = (i * i * i) / 64; + s->array[i+128] = cube; + } + break; + case AV_CODEC_ID_GREMLIN_DPCM: { int delta = 0; int code = 64; @@ -265,6 +272,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, case AV_CODEC_ID_WADY_DPCM: case AV_CODEC_ID_DERF_DPCM: case AV_CODEC_ID_GREMLIN_DPCM: + case AV_CODEC_ID_CBD2_DPCM: case AV_CODEC_ID_SDX2_DPCM: out = buf_size; break; @@ -386,6 +394,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, } break; + case AV_CODEC_ID_CBD2_DPCM: case AV_CODEC_ID_SDX2_DPCM: while (output_samples < samples_end) { int8_t n = bytestream2_get_byteu(&gb); @@ -468,6 +477,7 @@ const FFCodec ff_ ## name_ ## _decoder = { \ FF_CODEC_DECODE_CB(dpcm_decode_frame), \ } +DPCM_DECODER(AV_CODEC_ID_CBD2_DPCM, cbd2_dpcm, "DPCM Cuberoot-Delta-Exact"); DPCM_DECODER(AV_CODEC_ID_DERF_DPCM, derf_dpcm, "DPCM Xilam DERF"); DPCM_DECODER(AV_CODEC_ID_GREMLIN_DPCM, gremlin_dpcm, "DPCM Gremlin"); DPCM_DECODER(AV_CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay"); diff --git a/libavformat/aiff.c b/libavformat/aiff.c index 0f25b436bd..1ceac69a70 100644 --- a/libavformat/aiff.c +++ b/libavformat/aiff.c @@ -46,6 +46,7 @@ const AVCodecTag ff_codec_aiff_tags[] = { { AV_CODEC_ID_QDMC, MKTAG('Q','D','M','C') }, { AV_CODEC_ID_QDM2, MKTAG('Q','D','M','2') }, { AV_CODEC_ID_QCELP, MKTAG('Q','c','l','p') }, + { AV_CODEC_ID_CBD2_DPCM, MKTAG('C','B','D','2') }, { AV_CODEC_ID_SDX2_DPCM, MKTAG('S','D','X','2') }, { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A','D','P','4') }, { AV_CODEC_ID_NONE, 0 }, diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 80733e5801..1cde12c193 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -164,6 +164,7 @@ static int get_aiff_header(AVFormatContext *s, int64_t size, case AV_CODEC_ID_ADPCM_IMA_WS: case AV_CODEC_ID_ADPCM_G722: case AV_CODEC_ID_MACE6: + case AV_CODEC_ID_CBD2_DPCM: case AV_CODEC_ID_SDX2_DPCM: par->block_align = 1 * channels; break; -- 2.39.1 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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 reply other threads:[~2023-01-24 15:59 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-24 15:59 Paul B Mahol [this message] 2023-01-27 17:36 ` Paul B Mahol
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='CAPYw7P5-_5L-j3bFeB-97p37tGz=1G_EXD7EYqqfe8=Fo5TOFw@mail.gmail.com' \ --to=onemda@gmail.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