summaryrefslogtreecommitdiffstats
path: root/libavcodec/dcaadpcm.h
blob: 23bfa79636610fa3b00464662ced90fa3381d3e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * DCA ADPCM engine
 * Copyright (C) 2017 Daniil Cherednik
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVCODEC_DCAADPCM_H
#define AVCODEC_DCAADPCM_H

#include "dcamath.h"
#include "dcadata.h"
#include "dcaenc.h"

typedef struct DCAADPCMEncContext {
    void *private_data;
} DCAADPCMEncContext;

static inline int64_t ff_dcaadpcm_predict(int pred_vq_index, const int32_t *input)
{
    int i;
    const int16_t *coeff = ff_dca_adpcm_vb[pred_vq_index];
    int64_t pred = 0;
    for (i = 0; i < DCA_ADPCM_COEFFS; i++)
        pred += (int64_t)input[DCA_ADPCM_COEFFS - 1 - i] * coeff[i];

    return clip23(norm13(pred));
}

int ff_dcaadpcm_subband_analysis(const DCAADPCMEncContext *s, const int32_t *input, int len, int *diff);

int ff_dcaadpcm_do_real(int pred_vq_index,
                        softfloat quant, int32_t scale_factor, int32_t step_size,
                        const int32_t *prev_hist, const int32_t *in, int32_t *next_hist, int32_t *out,
                        int len, int32_t peak);

av_cold int ff_dcaadpcm_init(DCAADPCMEncContext *s);
av_cold void ff_dcaadpcm_free(DCAADPCMEncContext *s);

#endif /* AVCODEC_DCAADPCM_H */
OpenPOWER on IntegriCloud