aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@gmail.com>2025-08-16 10:24:34 +0200
committerManuel Lauss <manuel.lauss@gmail.com>2025-08-20 11:20:11 +0200
commit1e95f1b269e25dd8907ac65f2963de54d2b73142 (patch)
treee2558bb667f1f70f14f98eab5fe630471abfadc3
parent4c3f94f2651ce4d6834fbef10e5c287f25720ac9 (diff)
downloadffmpeg-1e95f1b269e25dd8907ac65f2963de54d2b73142.tar.gz
avcodec/adpcm: export ff_adpcm_ima_qt_expand_nibble
For use in the LucasArts VIMA decoder, where it is used as a subvariant. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
-rw-r--r--libavcodec/adpcm.c18
-rw-r--r--libavcodec/adpcm.h1
2 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 83ef7c780a..4c15be6207 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -518,7 +518,7 @@ static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitC
return (int16_t)c->predictor;
}
-static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble)
+int16_t ff_adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble)
{
int step_index;
int predictor;
@@ -1335,8 +1335,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
for (int m = 0; m < 64; m += 2) {
int byte = bytestream2_get_byteu(&gb);
- samples[m ] = adpcm_ima_qt_expand_nibble(cs, byte & 0x0F);
- samples[m + 1] = adpcm_ima_qt_expand_nibble(cs, byte >> 4 );
+ samples[m ] = ff_adpcm_ima_qt_expand_nibble(cs, byte & 0x0F);
+ samples[m + 1] = ff_adpcm_ima_qt_expand_nibble(cs, byte >> 4 );
}
}
) /* End of CASE */
@@ -1689,16 +1689,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
CASE(ADPCM_IMA_SSI,
for (int n = nb_samples >> (1 - st); n > 0; n--) {
int v = bytestream2_get_byteu(&gb);
- *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0], v >> 4 );
- *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F);
+ *samples++ = ff_adpcm_ima_qt_expand_nibble(&c->status[0], v >> 4 );
+ *samples++ = ff_adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F);
}
) /* End of CASE */
CASE(ADPCM_IMA_APM,
for (int n = nb_samples / 2; n > 0; n--) {
for (int channel = 0; channel < channels; channel++) {
int v = bytestream2_get_byteu(&gb);
- *samples++ = adpcm_ima_qt_expand_nibble(&c->status[channel], v >> 4 );
- samples[st] = adpcm_ima_qt_expand_nibble(&c->status[channel], v & 0x0F);
+ *samples++ = ff_adpcm_ima_qt_expand_nibble(&c->status[channel], v >> 4 );
+ samples[st] = ff_adpcm_ima_qt_expand_nibble(&c->status[channel], v & 0x0F);
}
samples += channels;
}
@@ -2154,8 +2154,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
for (int n = nb_samples >> (1 - st); n > 0; n--) {
int v = bytestream2_get_byteu(&gb);
- *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0 ], v >> 4 );
- *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0xf);
+ *samples++ = ff_adpcm_ima_qt_expand_nibble(&c->status[0 ], v >> 4 );
+ *samples++ = ff_adpcm_ima_qt_expand_nibble(&c->status[st], v & 0xf);
}
) /* End of CASE */
CASE(ADPCM_CT,
diff --git a/libavcodec/adpcm.h b/libavcodec/adpcm.h
index 0ffc3da1d0..ff70e62078 100644
--- a/libavcodec/adpcm.h
+++ b/libavcodec/adpcm.h
@@ -44,5 +44,6 @@ typedef struct ADPCMChannelStatus {
} ADPCMChannelStatus;
int16_t ff_adpcm_argo_expand_nibble(ADPCMChannelStatus *cs, int nibble, int shift, int flag);
+int16_t ff_adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble);
#endif /* AVCODEC_ADPCM_H */