Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
avcodec/metasound_data: Split file into metasound-only and shared stuff
Currently, lavc/metasound_data.c contains two types of data:
TwinVQModeTabs that are only used by the metasound decoder
and some arrays of floats that are used both by MetaSound
and TwinVQ. This commit changes this: The MetaSound-only
data is moved into metasound_data.h which is now directly
included into metasound.c (the TwinVQModeTabs are made static).
The rest is moved into a new file, metasound_twinvq_data.h
which is directly included into twinvq.c (the common file
of the MetaSound and TwinVQ decoders).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
  • Loading branch information
mkver committed Oct 18, 2022
1 parent f5b76ed commit 7ad0785
Show file tree
Hide file tree
Showing 8 changed files with 14,753 additions and 14,771 deletions.
5 changes: 2 additions & 3 deletions libavcodec/Makefile
Expand Up @@ -470,8 +470,7 @@ OBJS-$(CONFIG_MAGICYUV_DECODER) += magicyuv.o
OBJS-$(CONFIG_MAGICYUV_ENCODER) += magicyuvenc.o
OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MEDIA100_DECODER) += media100.o
OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o metasound_data.o \
twinvq.o
OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o twinvq.o
OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o
OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
OBJS-$(CONFIG_MISC4_DECODER) += misc4.o
Expand Down Expand Up @@ -703,7 +702,7 @@ OBJS-$(CONFIG_TSCC2_DECODER) += tscc2.o
OBJS-$(CONFIG_TTA_DECODER) += tta.o ttadata.o ttadsp.o
OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o
OBJS-$(CONFIG_TTML_ENCODER) += ttmlenc.o ass_split.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o metasound_data.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideodsp.o
Expand Down
26 changes: 13 additions & 13 deletions libavcodec/metasound.c
Expand Up @@ -314,46 +314,46 @@ static av_cold int metasound_decode_init(AVCodecContext *avctx)

switch ((channels << 16) + (isampf << 8) + ibps) {
case (1 << 16) + ( 8 << 8) + 6:
tctx->mtab = &ff_metasound_mode0806;
tctx->mtab = &metasound_mode0806;
break;
case (2 << 16) + ( 8 << 8) + 6:
tctx->mtab = &ff_metasound_mode0806s;
tctx->mtab = &metasound_mode0806s;
break;
case (1 << 16) + ( 8 << 8) + 8:
tctx->mtab = &ff_metasound_mode0808;
tctx->mtab = &metasound_mode0808;
break;
case (2 << 16) + ( 8 << 8) + 8:
tctx->mtab = &ff_metasound_mode0808s;
tctx->mtab = &metasound_mode0808s;
break;
case (1 << 16) + (11 << 8) + 10:
tctx->mtab = &ff_metasound_mode1110;
tctx->mtab = &metasound_mode1110;
break;
case (2 << 16) + (11 << 8) + 10:
tctx->mtab = &ff_metasound_mode1110s;
tctx->mtab = &metasound_mode1110s;
break;
case (1 << 16) + (16 << 8) + 16:
tctx->mtab = &ff_metasound_mode1616;
tctx->mtab = &metasound_mode1616;
break;
case (2 << 16) + (16 << 8) + 16:
tctx->mtab = &ff_metasound_mode1616s;
tctx->mtab = &metasound_mode1616s;
break;
case (1 << 16) + (22 << 8) + 24:
tctx->mtab = &ff_metasound_mode2224;
tctx->mtab = &metasound_mode2224;
break;
case (2 << 16) + (22 << 8) + 24:
tctx->mtab = &ff_metasound_mode2224s;
tctx->mtab = &metasound_mode2224s;
break;
case (1 << 16) + (44 << 8) + 32:
case (2 << 16) + (44 << 8) + 32:
tctx->mtab = &ff_metasound_mode4432;
tctx->mtab = &metasound_mode4432;
break;
case (1 << 16) + (44 << 8) + 40:
case (2 << 16) + (44 << 8) + 40:
tctx->mtab = &ff_metasound_mode4440;
tctx->mtab = &metasound_mode4440;
break;
case (1 << 16) + (44 << 8) + 48:
case (2 << 16) + (44 << 8) + 48:
tctx->mtab = &ff_metasound_mode4448;
tctx->mtab = &metasound_mode4448;
break;
default:
av_log(avctx, AV_LOG_ERROR,
Expand Down
14,730 changes: 0 additions & 14,730 deletions libavcodec/metasound_data.c

This file was deleted.

13,938 changes: 13,914 additions & 24 deletions libavcodec/metasound_data.h

Large diffs are not rendered by default.

814 changes: 814 additions & 0 deletions libavcodec/metasound_twinvq_data.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions libavcodec/twinvq.c
Expand Up @@ -28,6 +28,7 @@
#include "decode.h"
#include "fft.h"
#include "lsp.h"
#include "metasound_twinvq_data.h"
#include "sinewin.h"
#include "twinvq.h"

Expand Down
9 changes: 9 additions & 0 deletions libavcodec/twinvq.h
Expand Up @@ -25,6 +25,7 @@
#include <math.h>
#include <stdint.h>

#include "libavutil/attributes_internal.h"
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "avcodec.h"
Expand Down Expand Up @@ -179,8 +180,15 @@ typedef struct TwinVQContext {
const float *shape, float *speech);
} TwinVQContext;

FF_VISIBILITY_PUSH_HIDDEN
extern const enum TwinVQFrameType ff_twinvq_wtype_to_ftype_table[];

extern const float ff_metasound_lsp8[];
extern const float ff_metasound_lsp11[];
extern const float ff_metasound_lsp16[];
extern const float ff_metasound_lsp22[];
extern const float ff_metasound_lsp44[];

/** @note not speed critical, hence not optimized */
static inline void twinvq_memset_float(float *buf, float val, int size)
{
Expand All @@ -199,5 +207,6 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int ff_twinvq_decode_close(AVCodecContext *avctx);
/** Requires the caller to call ff_twinvq_decode_close() upon failure. */
int ff_twinvq_decode_init(AVCodecContext *avctx);
FF_VISIBILITY_POP_HIDDEN

#endif /* AVCODEC_TWINVQ_H */
1 change: 0 additions & 1 deletion libavcodec/twinvqdec.c
Expand Up @@ -27,7 +27,6 @@
#include "codec_internal.h"
#include "get_bits.h"
#include "twinvq.h"
#include "metasound_data.h"
#include "twinvq_data.h"

static const TwinVQModeTab mode_08_08 = {
Expand Down

0 comments on commit 7ad0785

Please sign in to comment.