mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-09 14:14:39 +02:00
dca: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
This commit is contained in:
parent
9030c58a78
commit
45ff7c93dd
@ -26,8 +26,7 @@
|
|||||||
#include "dca.h"
|
#include "dca.h"
|
||||||
#include "put_bits.h"
|
#include "put_bits.h"
|
||||||
|
|
||||||
const uint32_t avpriv_dca_sample_rates[16] =
|
const uint32_t avpriv_dca_sample_rates[16] = {
|
||||||
{
|
|
||||||
0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
|
0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
|
||||||
12000, 24000, 48000, 96000, 192000
|
12000, 24000, 48000, 96000, 192000
|
||||||
};
|
};
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "parser.h"
|
|
||||||
#include "dca.h"
|
#include "dca.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
typedef struct DCAParseContext {
|
typedef struct DCAParseContext {
|
||||||
ParseContext pc;
|
ParseContext pc;
|
||||||
@ -35,15 +35,15 @@ typedef struct DCAParseContext {
|
|||||||
} DCAParseContext;
|
} DCAParseContext;
|
||||||
|
|
||||||
#define IS_MARKER(state, i, buf, buf_size) \
|
#define IS_MARKER(state, i, buf, buf_size) \
|
||||||
((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \
|
((state == DCA_MARKER_14B_LE && (i < buf_size - 2) && (buf[i + 1] & 0xF0) == 0xF0 && buf[i + 2] == 0x07) || \
|
||||||
|| (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \
|
(state == DCA_MARKER_14B_BE && (i < buf_size - 2) && buf[i + 1] == 0x07 && (buf[i + 2] & 0xF0) == 0xF0) || \
|
||||||
|| state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
|
state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the end of the current frame in the bitstream.
|
* Find the end of the current frame in the bitstream.
|
||||||
* @return the position of the first byte of the next frame, or -1
|
* @return the position of the first byte of the next frame, or -1
|
||||||
*/
|
*/
|
||||||
static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
|
static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
|
||||||
int buf_size)
|
int buf_size)
|
||||||
{
|
{
|
||||||
int start_found, i;
|
int start_found, i;
|
||||||
@ -51,7 +51,7 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
|
|||||||
ParseContext *pc = &pc1->pc;
|
ParseContext *pc = &pc1->pc;
|
||||||
|
|
||||||
start_found = pc->frame_start_found;
|
start_found = pc->frame_start_found;
|
||||||
state = pc->state;
|
state = pc->state;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!start_found) {
|
if (!start_found) {
|
||||||
@ -63,7 +63,7 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
|
|||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
} else if (!pc1->lastmarker) {
|
} else if (!pc1->lastmarker) {
|
||||||
start_found = 1;
|
start_found = 1;
|
||||||
pc1->lastmarker = state;
|
pc1->lastmarker = state;
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
@ -78,21 +78,21 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
|
|||||||
if (state == DCA_HD_MARKER && !pc1->hd_pos)
|
if (state == DCA_HD_MARKER && !pc1->hd_pos)
|
||||||
pc1->hd_pos = pc1->size;
|
pc1->hd_pos = pc1->size;
|
||||||
if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
|
if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
|
||||||
if(pc1->framesize > pc1->size)
|
if (pc1->framesize > pc1->size)
|
||||||
continue;
|
continue;
|
||||||
pc->frame_start_found = 0;
|
pc->frame_start_found = 0;
|
||||||
pc->state = -1;
|
pc->state = -1;
|
||||||
pc1->size = 0;
|
pc1->size = 0;
|
||||||
return i - 3;
|
return i - 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pc->frame_start_found = start_found;
|
pc->frame_start_found = start_found;
|
||||||
pc->state = state;
|
pc->state = state;
|
||||||
return END_NOT_FOUND;
|
return END_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int dca_parse_init(AVCodecParserContext * s)
|
static av_cold int dca_parse_init(AVCodecParserContext *s)
|
||||||
{
|
{
|
||||||
DCAParseContext *pc1 = s->priv_data;
|
DCAParseContext *pc1 = s->priv_data;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
skip_bits(&gb, 6);
|
skip_bits(&gb, 6);
|
||||||
sr_code = get_bits(&gb, 4);
|
sr_code = get_bits(&gb, 4);
|
||||||
*sample_rate = avpriv_dca_sample_rates[sr_code];
|
*sample_rate = avpriv_dca_sample_rates[sr_code];
|
||||||
if (*sample_rate == 0)
|
if (*sample_rate == 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -134,10 +134,9 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dca_parse(AVCodecParserContext * s,
|
static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||||
AVCodecContext * avctx,
|
const uint8_t **poutbuf, int *poutbuf_size,
|
||||||
const uint8_t ** poutbuf, int *poutbuf_size,
|
const uint8_t *buf, int buf_size)
|
||||||
const uint8_t * buf, int buf_size)
|
|
||||||
{
|
{
|
||||||
DCAParseContext *pc1 = s->priv_data;
|
DCAParseContext *pc1 = s->priv_data;
|
||||||
ParseContext *pc = &pc1->pc;
|
ParseContext *pc = &pc1->pc;
|
||||||
@ -149,7 +148,7 @@ static int dca_parse(AVCodecParserContext * s,
|
|||||||
next = dca_find_frame_end(pc1, buf, buf_size);
|
next = dca_find_frame_end(pc1, buf, buf_size);
|
||||||
|
|
||||||
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
|
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
|
||||||
*poutbuf = NULL;
|
*poutbuf = NULL;
|
||||||
*poutbuf_size = 0;
|
*poutbuf_size = 0;
|
||||||
return buf_size;
|
return buf_size;
|
||||||
}
|
}
|
||||||
@ -157,12 +156,12 @@ static int dca_parse(AVCodecParserContext * s,
|
|||||||
|
|
||||||
/* read the duration and sample rate from the frame header */
|
/* read the duration and sample rate from the frame header */
|
||||||
if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) {
|
if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) {
|
||||||
s->duration = duration;
|
s->duration = duration;
|
||||||
avctx->sample_rate = sample_rate;
|
avctx->sample_rate = sample_rate;
|
||||||
} else
|
} else
|
||||||
s->duration = 0;
|
s->duration = 0;
|
||||||
|
|
||||||
*poutbuf = buf;
|
*poutbuf = buf;
|
||||||
*poutbuf_size = buf_size;
|
*poutbuf_size = buf_size;
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
14684
libavcodec/dcadata.h
14684
libavcodec/dcadata.h
File diff suppressed because it is too large
Load Diff
@ -34,18 +34,19 @@
|
|||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "fft.h"
|
|
||||||
#include "get_bits.h"
|
|
||||||
#include "put_bits.h"
|
|
||||||
#include "dcadata.h"
|
|
||||||
#include "dcahuff.h"
|
|
||||||
#include "dca.h"
|
#include "dca.h"
|
||||||
#include "mathops.h"
|
#include "dcadata.h"
|
||||||
#include "synth_filter.h"
|
|
||||||
#include "dcadsp.h"
|
#include "dcadsp.h"
|
||||||
|
#include "dcahuff.h"
|
||||||
|
#include "fft.h"
|
||||||
#include "fmtconvert.h"
|
#include "fmtconvert.h"
|
||||||
|
#include "get_bits.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "mathops.h"
|
||||||
|
#include "put_bits.h"
|
||||||
|
#include "synth_filter.h"
|
||||||
|
|
||||||
#if ARCH_ARM
|
#if ARCH_ARM
|
||||||
# include "arm/dca.h"
|
# include "arm/dca.h"
|
||||||
@ -173,79 +174,79 @@ static const int8_t dca_lfe_index[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const int8_t dca_channel_reorder_lfe[][9] = {
|
static const int8_t dca_channel_reorder_lfe[][9] = {
|
||||||
{ 0, -1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, -1, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, 4, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, 4, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, 4, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, 5, -1, -1, -1, -1},
|
{ 2, 0, 1, 4, 5, -1, -1, -1, -1 },
|
||||||
{ 3, 4, 0, 1, 5, 6, -1, -1, -1},
|
{ 3, 4, 0, 1, 5, 6, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, 5, 6, -1, -1, -1},
|
{ 2, 0, 1, 4, 5, 6, -1, -1, -1 },
|
||||||
{ 0, 6, 4, 5, 2, 3, -1, -1, -1},
|
{ 0, 6, 4, 5, 2, 3, -1, -1, -1 },
|
||||||
{ 4, 2, 5, 0, 1, 6, 7, -1, -1},
|
{ 4, 2, 5, 0, 1, 6, 7, -1, -1 },
|
||||||
{ 5, 6, 0, 1, 7, 3, 8, 4, -1},
|
{ 5, 6, 0, 1, 7, 3, 8, 4, -1 },
|
||||||
{ 4, 2, 5, 0, 1, 6, 8, 7, -1},
|
{ 4, 2, 5, 0, 1, 6, 8, 7, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int8_t dca_channel_reorder_lfe_xch[][9] = {
|
static const int8_t dca_channel_reorder_lfe_xch[][9] = {
|
||||||
{ 0, 2, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, 4, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, 4, -1, -1, -1, -1, -1},
|
{ 0, 1, 3, 4, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, 5, -1, -1, -1, -1},
|
{ 2, 0, 1, 4, 5, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 4, 5, 3, -1, -1, -1, -1},
|
{ 0, 1, 4, 5, 3, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 5, 6, 4, -1, -1, -1},
|
{ 2, 0, 1, 5, 6, 4, -1, -1, -1 },
|
||||||
{ 3, 4, 0, 1, 6, 7, 5, -1, -1},
|
{ 3, 4, 0, 1, 6, 7, 5, -1, -1 },
|
||||||
{ 2, 0, 1, 4, 5, 6, 7, -1, -1},
|
{ 2, 0, 1, 4, 5, 6, 7, -1, -1 },
|
||||||
{ 0, 6, 4, 5, 2, 3, 7, -1, -1},
|
{ 0, 6, 4, 5, 2, 3, 7, -1, -1 },
|
||||||
{ 4, 2, 5, 0, 1, 7, 8, 6, -1},
|
{ 4, 2, 5, 0, 1, 7, 8, 6, -1 },
|
||||||
{ 5, 6, 0, 1, 8, 3, 9, 4, 7},
|
{ 5, 6, 0, 1, 8, 3, 9, 4, 7 },
|
||||||
{ 4, 2, 5, 0, 1, 6, 9, 8, 7},
|
{ 4, 2, 5, 0, 1, 6, 9, 8, 7 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int8_t dca_channel_reorder_nolfe[][9] = {
|
static const int8_t dca_channel_reorder_nolfe[][9] = {
|
||||||
{ 0, -1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, -1, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 3, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, 3, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, 3, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, 3, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 3, 4, -1, -1, -1, -1},
|
{ 2, 0, 1, 3, 4, -1, -1, -1, -1 },
|
||||||
{ 2, 3, 0, 1, 4, 5, -1, -1, -1},
|
{ 2, 3, 0, 1, 4, 5, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 3, 4, 5, -1, -1, -1},
|
{ 2, 0, 1, 3, 4, 5, -1, -1, -1 },
|
||||||
{ 0, 5, 3, 4, 1, 2, -1, -1, -1},
|
{ 0, 5, 3, 4, 1, 2, -1, -1, -1 },
|
||||||
{ 3, 2, 4, 0, 1, 5, 6, -1, -1},
|
{ 3, 2, 4, 0, 1, 5, 6, -1, -1 },
|
||||||
{ 4, 5, 0, 1, 6, 2, 7, 3, -1},
|
{ 4, 5, 0, 1, 6, 2, 7, 3, -1 },
|
||||||
{ 3, 2, 4, 0, 1, 5, 7, 6, -1},
|
{ 3, 2, 4, 0, 1, 5, 7, 6, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int8_t dca_channel_reorder_nolfe_xch[][9] = {
|
static const int8_t dca_channel_reorder_nolfe_xch[][9] = {
|
||||||
{ 0, 1, -1, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, -1, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, -1, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 3, -1, -1, -1, -1, -1},
|
{ 2, 0, 1, 3, -1, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 2, 3, -1, -1, -1, -1, -1},
|
{ 0, 1, 2, 3, -1, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 3, 4, -1, -1, -1, -1},
|
{ 2, 0, 1, 3, 4, -1, -1, -1, -1 },
|
||||||
{ 0, 1, 3, 4, 2, -1, -1, -1, -1},
|
{ 0, 1, 3, 4, 2, -1, -1, -1, -1 },
|
||||||
{ 2, 0, 1, 4, 5, 3, -1, -1, -1},
|
{ 2, 0, 1, 4, 5, 3, -1, -1, -1 },
|
||||||
{ 2, 3, 0, 1, 5, 6, 4, -1, -1},
|
{ 2, 3, 0, 1, 5, 6, 4, -1, -1 },
|
||||||
{ 2, 0, 1, 3, 4, 5, 6, -1, -1},
|
{ 2, 0, 1, 3, 4, 5, 6, -1, -1 },
|
||||||
{ 0, 5, 3, 4, 1, 2, 6, -1, -1},
|
{ 0, 5, 3, 4, 1, 2, 6, -1, -1 },
|
||||||
{ 3, 2, 4, 0, 1, 6, 7, 5, -1},
|
{ 3, 2, 4, 0, 1, 6, 7, 5, -1 },
|
||||||
{ 4, 5, 0, 1, 7, 2, 8, 3, 6},
|
{ 4, 5, 0, 1, 7, 2, 8, 3, 6 },
|
||||||
{ 3, 2, 4, 0, 1, 5, 8, 7, 6},
|
{ 3, 2, 4, 0, 1, 5, 8, 7, 6 },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DCA_DOLBY 101 /* FIXME */
|
#define DCA_DOLBY 101 /* FIXME */
|
||||||
@ -420,27 +421,27 @@ static av_cold void dca_init_vlcs(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dca_bitalloc_index.offset = 1;
|
dca_bitalloc_index.offset = 1;
|
||||||
dca_bitalloc_index.wrap = 2;
|
dca_bitalloc_index.wrap = 2;
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]];
|
dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]];
|
||||||
dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i];
|
dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i];
|
||||||
init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12,
|
init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12,
|
||||||
bitalloc_12_bits[i], 1, 1,
|
bitalloc_12_bits[i], 1, 1,
|
||||||
bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||||
}
|
}
|
||||||
dca_scalefactor.offset = -64;
|
dca_scalefactor.offset = -64;
|
||||||
dca_scalefactor.wrap = 2;
|
dca_scalefactor.wrap = 2;
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]];
|
dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]];
|
||||||
dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5];
|
dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5];
|
||||||
init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129,
|
init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129,
|
||||||
scales_bits[i], 1, 1,
|
scales_bits[i], 1, 1,
|
||||||
scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||||
}
|
}
|
||||||
dca_tmode.offset = 0;
|
dca_tmode.offset = 0;
|
||||||
dca_tmode.wrap = 1;
|
dca_tmode.wrap = 1;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]];
|
dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]];
|
||||||
dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10];
|
dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10];
|
||||||
init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4,
|
init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4,
|
||||||
tmode_bits[i], 1, 1,
|
tmode_bits[i], 1, 1,
|
||||||
@ -484,7 +485,6 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel)
|
|||||||
if (s->prim_channels > DCA_PRIM_CHANNELS_MAX)
|
if (s->prim_channels > DCA_PRIM_CHANNELS_MAX)
|
||||||
s->prim_channels = DCA_PRIM_CHANNELS_MAX;
|
s->prim_channels = DCA_PRIM_CHANNELS_MAX;
|
||||||
|
|
||||||
|
|
||||||
for (i = base_channel; i < s->prim_channels; i++) {
|
for (i = base_channel; i < s->prim_channels; i++) {
|
||||||
s->subband_activity[i] = get_bits(&s->gb, 5) + 2;
|
s->subband_activity[i] = get_bits(&s->gb, 5) + 2;
|
||||||
if (s->subband_activity[i] > DCA_SUBBANDS)
|
if (s->subband_activity[i] > DCA_SUBBANDS)
|
||||||
@ -650,18 +650,17 @@ static int dca_parse_frame_header(DCAContext *s)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Primary audio coding header */
|
/* Primary audio coding header */
|
||||||
s->subframes = get_bits(&s->gb, 4) + 1;
|
s->subframes = get_bits(&s->gb, 4) + 1;
|
||||||
|
|
||||||
return dca_parse_audio_coding_header(s, 0);
|
return dca_parse_audio_coding_header(s, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int get_scale(GetBitContext *gb, int level, int value, int log2range)
|
static inline int get_scale(GetBitContext *gb, int level, int value, int log2range)
|
||||||
{
|
{
|
||||||
if (level < 5) {
|
if (level < 5) {
|
||||||
/* huffman encoded */
|
/* huffman encoded */
|
||||||
value += get_bitalloc(gb, &dca_scalefactor, level);
|
value += get_bitalloc(gb, &dca_scalefactor, level);
|
||||||
value = av_clip(value, 0, (1 << log2range) - 1);
|
value = av_clip(value, 0, (1 << log2range) - 1);
|
||||||
} else if (level < 8) {
|
} else if (level < 8) {
|
||||||
if (level + 1 > log2range) {
|
if (level + 1 > log2range) {
|
||||||
skip_bits(gb, level + 1 - log2range);
|
skip_bits(gb, level + 1 - log2range);
|
||||||
@ -749,10 +748,10 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
|||||||
|
|
||||||
if (s->scalefactor_huffman[j] == 6) {
|
if (s->scalefactor_huffman[j] == 6) {
|
||||||
scale_table = scale_factor_quant7;
|
scale_table = scale_factor_quant7;
|
||||||
log_size = 7;
|
log_size = 7;
|
||||||
} else {
|
} else {
|
||||||
scale_table = scale_factor_quant6;
|
scale_table = scale_factor_quant6;
|
||||||
log_size = 6;
|
log_size = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When huffman coded, only the difference is encoded */
|
/* When huffman coded, only the difference is encoded */
|
||||||
@ -829,7 +828,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
|||||||
/* Low frequency effect data */
|
/* Low frequency effect data */
|
||||||
if (!base_channel && s->lfe) {
|
if (!base_channel && s->lfe) {
|
||||||
/* LFE samples */
|
/* LFE samples */
|
||||||
int lfe_samples = 2 * s->lfe * (4 + block_index);
|
int lfe_samples = 2 * s->lfe * (4 + block_index);
|
||||||
int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
|
int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
|
||||||
float lfe_scale;
|
float lfe_scale;
|
||||||
|
|
||||||
@ -905,7 +904,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
|||||||
for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
|
for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
|
av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
|
||||||
if (!base_channel && s->lfe) {
|
if (!base_channel && s->lfe) {
|
||||||
int lfe_samples = 2 * s->lfe * (4 + block_index);
|
int lfe_samples = 2 * s->lfe * (4 + block_index);
|
||||||
int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
|
int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
|
||||||
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n");
|
av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n");
|
||||||
@ -959,10 +958,10 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
|||||||
|
|
||||||
/* Select decimation filter */
|
/* Select decimation filter */
|
||||||
if (decimation_select == 1) {
|
if (decimation_select == 1) {
|
||||||
idx = 1;
|
idx = 1;
|
||||||
prCoeff = lfe_fir_128;
|
prCoeff = lfe_fir_128;
|
||||||
} else {
|
} else {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
prCoeff = lfe_fir_64;
|
prCoeff = lfe_fir_64;
|
||||||
}
|
}
|
||||||
/* Interpolation */
|
/* Interpolation */
|
||||||
@ -1048,7 +1047,7 @@ static void dca_downmix(float **samples, int srcfmt, int lfe_present,
|
|||||||
}
|
}
|
||||||
if (lfe_present) {
|
if (lfe_present) {
|
||||||
int lf_buf = dca_lfe_index[srcfmt];
|
int lf_buf = dca_lfe_index[srcfmt];
|
||||||
int lf_idx = dca_channels [srcfmt];
|
int lf_idx = dca_channels[srcfmt];
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0];
|
samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0];
|
||||||
samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1];
|
samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1];
|
||||||
@ -1056,7 +1055,6 @@ static void dca_downmix(float **samples, int srcfmt, int lfe_present,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef decode_blockcodes
|
#ifndef decode_blockcodes
|
||||||
/* Very compact version of the block code decoder that does not use table
|
/* Very compact version of the block code decoder that does not use table
|
||||||
* look-up but is slightly slower */
|
* look-up but is slightly slower */
|
||||||
@ -1068,7 +1066,7 @@ static int decode_blockcode(int code, int levels, int32_t *values)
|
|||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
int div = FASTDIV(code, levels);
|
int div = FASTDIV(code, levels);
|
||||||
values[i] = code - offset - div * levels;
|
values[i] = code - offset - div * levels;
|
||||||
code = div;
|
code = div;
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
@ -1136,7 +1134,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
|||||||
/* Deal with transients */
|
/* Deal with transients */
|
||||||
int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
|
int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
|
||||||
rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] *
|
rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] *
|
||||||
s->scalefactor_adj[k][sel];
|
s->scalefactor_adj[k][sel];
|
||||||
|
|
||||||
if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
|
if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
|
||||||
if (abits <= 7) {
|
if (abits <= 7) {
|
||||||
@ -1148,8 +1146,8 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
|||||||
|
|
||||||
block_code1 = get_bits(&s->gb, size);
|
block_code1 = get_bits(&s->gb, size);
|
||||||
block_code2 = get_bits(&s->gb, size);
|
block_code2 = get_bits(&s->gb, size);
|
||||||
err = decode_blockcodes(block_code1, block_code2,
|
err = decode_blockcodes(block_code1, block_code2,
|
||||||
levels, block + 8 * l);
|
levels, block + 8 * l);
|
||||||
if (err) {
|
if (err) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"ERROR: block code look-up failed\n");
|
"ERROR: block code look-up failed\n");
|
||||||
@ -1164,9 +1162,8 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
|||||||
/* Huffman coded */
|
/* Huffman coded */
|
||||||
for (m = 0; m < 8; m++)
|
for (m = 0; m < 8; m++)
|
||||||
block[8 * l + m] = get_bitalloc(&s->gb,
|
block[8 * l + m] = get_bitalloc(&s->gb,
|
||||||
&dca_smpl_bitalloc[abits], sel);
|
&dca_smpl_bitalloc[abits], sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1274,7 +1271,6 @@ static int dca_filter_channels(DCAContext *s, int block_index)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int dca_subframe_footer(DCAContext *s, int base_channel)
|
static int dca_subframe_footer(DCAContext *s, int base_channel)
|
||||||
{
|
{
|
||||||
int in, out, aux_data_count, aux_data_end, reserved;
|
int in, out, aux_data_count, aux_data_end, reserved;
|
||||||
@ -1361,8 +1357,8 @@ static int dca_subframe_footer(DCAContext *s, int base_channel)
|
|||||||
|
|
||||||
// additional data (reserved, cf. ETSI TS 102 114 V1.4.1)
|
// additional data (reserved, cf. ETSI TS 102 114 V1.4.1)
|
||||||
if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0) {
|
if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"Overread auxiliary data by %d bits\n", -reserved);
|
"Overread auxiliary data by %d bits\n", -reserved);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
} else if (reserved) {
|
} else if (reserved) {
|
||||||
avpriv_request_sample(s->avctx,
|
avpriv_request_sample(s->avctx,
|
||||||
@ -1536,7 +1532,6 @@ static int dca_exss_parse_asset_header(DCAContext *s)
|
|||||||
skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes
|
skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
skip_bits(&s->gb, 3); // representation type
|
skip_bits(&s->gb, 3); // representation type
|
||||||
}
|
}
|
||||||
@ -1579,10 +1574,18 @@ static int dca_exss_parse_asset_header(DCAContext *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (get_bits(&s->gb, 2)) {
|
switch (get_bits(&s->gb, 2)) {
|
||||||
case 0: extensions_mask = get_bits(&s->gb, 12); break;
|
case 0:
|
||||||
case 1: extensions_mask = DCA_EXT_EXSS_XLL; break;
|
extensions_mask = get_bits(&s->gb, 12);
|
||||||
case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
|
break;
|
||||||
case 3: extensions_mask = 0; /* aux coding */ break;
|
case 1:
|
||||||
|
extensions_mask = DCA_EXT_EXSS_XLL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
extensions_mask = DCA_EXT_EXSS_LBR;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
extensions_mask = 0; /* aux coding */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not parsed further, we were only interested in the extensions mask */
|
/* not parsed further, we were only interested in the extensions mask */
|
||||||
@ -1711,7 +1714,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
{
|
{
|
||||||
AVFrame *frame = data;
|
AVFrame *frame = data;
|
||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
|
|
||||||
int lfe_samples;
|
int lfe_samples;
|
||||||
int num_core_channels = 0;
|
int num_core_channels = 0;
|
||||||
@ -1721,7 +1724,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
int channels, full_channels;
|
int channels, full_channels;
|
||||||
int core_ss_end;
|
int core_ss_end;
|
||||||
|
|
||||||
|
|
||||||
s->xch_present = 0;
|
s->xch_present = 0;
|
||||||
|
|
||||||
s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer,
|
s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer,
|
||||||
@ -1732,10 +1734,10 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = dca_parse_frame_header(s)) < 0) {
|
if ((ret = dca_parse_frame_header(s)) < 0) {
|
||||||
//seems like the frame is corrupt, try with the next one
|
// seems like the frame is corrupt, try with the next one
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//set AVCodec values with parsed data
|
// set AVCodec values with parsed data
|
||||||
avctx->sample_rate = s->sample_rate;
|
avctx->sample_rate = s->sample_rate;
|
||||||
avctx->bit_rate = s->bit_rate;
|
avctx->bit_rate = s->bit_rate;
|
||||||
|
|
||||||
@ -1761,7 +1763,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
/* only scan for extensions if ext_descr was unknown or indicated a
|
/* only scan for extensions if ext_descr was unknown or indicated a
|
||||||
* supported XCh extension */
|
* supported XCh extension */
|
||||||
if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {
|
if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {
|
||||||
|
|
||||||
/* if ext_descr was unknown, clear s->core_ext_mask so that the
|
/* if ext_descr was unknown, clear s->core_ext_mask so that the
|
||||||
* extensions scan can fill it up */
|
* extensions scan can fill it up */
|
||||||
s->core_ext_mask = FFMAX(s->core_ext_mask, 0);
|
s->core_ext_mask = FFMAX(s->core_ext_mask, 0);
|
||||||
@ -1792,8 +1793,9 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
/* extension amode(number of channels in extension) should be 1 */
|
/* extension amode(number of channels in extension) should be 1 */
|
||||||
/* AFAIK XCh is not used for more channels */
|
/* AFAIK XCh is not used for more channels */
|
||||||
if ((ext_amode = get_bits(&s->gb, 4)) != 1) {
|
if ((ext_amode = get_bits(&s->gb, 4)) != 1) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not"
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
" supported!\n", ext_amode);
|
"XCh extension amode %d not supported!\n",
|
||||||
|
ext_amode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1883,7 +1885,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
|
s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channels = num_core_channels + !!s->lfe;
|
channels = num_core_channels + !!s->lfe;
|
||||||
s->xch_present = 0; /* disable further xch processing */
|
s->xch_present = 0; /* disable further xch processing */
|
||||||
if (s->lfe) {
|
if (s->lfe) {
|
||||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||||
@ -1898,8 +1900,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
|
|
||||||
if (num_core_channels + !!s->lfe > 2 &&
|
if (num_core_channels + !!s->lfe > 2 &&
|
||||||
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||||
channels = 2;
|
channels = 2;
|
||||||
s->output = s->prim_channels == 2 ? s->amode : DCA_STEREO;
|
s->output = s->prim_channels == 2 ? s->amode : DCA_STEREO;
|
||||||
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||||
|
|
||||||
/* Stereo downmix coefficients
|
/* Stereo downmix coefficients
|
||||||
@ -1954,7 +1956,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
samples_flt = (float **)frame->extended_data;
|
samples_flt = (float **) frame->extended_data;
|
||||||
|
|
||||||
/* allocate buffer for extra channels if downmixing */
|
/* allocate buffer for extra channels if downmixing */
|
||||||
if (avctx->channels < full_channels) {
|
if (avctx->channels < full_channels) {
|
||||||
@ -1969,7 +1971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
if (!s->extra_channels_buffer)
|
if (!s->extra_channels_buffer)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL,
|
ret = av_samples_fill_arrays((uint8_t **) s->extra_channels, NULL,
|
||||||
s->extra_channels_buffer,
|
s->extra_channels_buffer,
|
||||||
full_channels - channels,
|
full_channels - channels,
|
||||||
frame->nb_samples, avctx->sample_fmt, 0);
|
frame->nb_samples, avctx->sample_fmt, 0);
|
||||||
@ -2018,8 +2020,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
return buf_size;
|
return buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DCA initialization
|
* DCA initialization
|
||||||
*
|
*
|
||||||
@ -2073,7 +2073,7 @@ static const AVProfile profiles[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
{ "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_AUDIO_PARAM },
|
{ "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
|
|
||||||
#include "dcadsp.h"
|
#include "dcadsp.h"
|
||||||
|
|
||||||
static void decode_hf_c(float dst[DCA_SUBBANDS][8],
|
static void decode_hf_c(float dst[DCA_SUBBANDS][8],
|
||||||
@ -42,9 +44,8 @@ static void decode_hf_c(float dst[DCA_SUBBANDS][8],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void dca_lfe_fir(float *out, const float *in, const float *coefs,
|
||||||
dca_lfe_fir(float *out, const float *in, const float *coefs,
|
int decifactor)
|
||||||
int decifactor)
|
|
||||||
{
|
{
|
||||||
float *out2 = out + 2 * decifactor - 1;
|
float *out2 = out + 2 * decifactor - 1;
|
||||||
int num_coeffs = 256 / decifactor;
|
int num_coeffs = 256 / decifactor;
|
||||||
@ -55,7 +56,7 @@ dca_lfe_fir(float *out, const float *in, const float *coefs,
|
|||||||
float v0 = 0.0;
|
float v0 = 0.0;
|
||||||
float v1 = 0.0;
|
float v1 = 0.0;
|
||||||
for (j = 0; j < num_coeffs; j++, coefs++) {
|
for (j = 0; j < num_coeffs; j++, coefs++) {
|
||||||
v0 += in[-j] * *coefs;
|
v0 += in[-j] * *coefs;
|
||||||
v1 += in[j + 1 - num_coeffs] * *coefs;
|
v1 += in[j + 1 - num_coeffs] * *coefs;
|
||||||
}
|
}
|
||||||
*out++ = v0;
|
*out++ = v0;
|
||||||
@ -86,7 +87,8 @@ static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act,
|
|||||||
}
|
}
|
||||||
|
|
||||||
synth->synth_filter_float(imdct, synth_buf_ptr, synth_buf_offset,
|
synth->synth_filter_float(imdct, synth_buf_ptr, synth_buf_offset,
|
||||||
synth_buf2, window, samples_out, raXin, scale);
|
synth_buf2, window, samples_out, raXin,
|
||||||
|
scale);
|
||||||
samples_out += 32;
|
samples_out += 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,10 +105,13 @@ static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs)
|
|||||||
|
|
||||||
av_cold void ff_dcadsp_init(DCADSPContext *s)
|
av_cold void ff_dcadsp_init(DCADSPContext *s)
|
||||||
{
|
{
|
||||||
s->lfe_fir[0] = dca_lfe_fir0_c;
|
s->lfe_fir[0] = dca_lfe_fir0_c;
|
||||||
s->lfe_fir[1] = dca_lfe_fir1_c;
|
s->lfe_fir[1] = dca_lfe_fir1_c;
|
||||||
s->qmf_32_subbands = dca_qmf_32_subbands;
|
s->qmf_32_subbands = dca_qmf_32_subbands;
|
||||||
s->decode_hf = decode_hf_c;
|
s->decode_hf = decode_hf_c;
|
||||||
if (ARCH_ARM) ff_dcadsp_init_arm(s);
|
|
||||||
if (ARCH_X86) ff_dcadsp_init_x86(s);
|
if (ARCH_ARM)
|
||||||
|
ff_dcadsp_init_arm(s);
|
||||||
|
if (ARCH_X86)
|
||||||
|
ff_dcadsp_init_x86(s);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user