FFmpeg  4.3
dcadec.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 foo86
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVCODEC_DCADEC_H
22 #define AVCODEC_DCADEC_H
23 
24 #include "libavutil/common.h"
25 #include "libavutil/crc.h"
26 #include "libavutil/float_dsp.h"
27 
28 #include "avcodec.h"
29 #include "get_bits.h"
30 #include "dca.h"
31 #include "dcadsp.h"
32 #include "dca_core.h"
33 #include "dca_exss.h"
34 #include "dca_xll.h"
35 #include "dca_lbr.h"
36 
37 #define DCA_PACKET_CORE 0x01
38 #define DCA_PACKET_EXSS 0x02
39 #define DCA_PACKET_XLL 0x04
40 #define DCA_PACKET_LBR 0x08
41 #define DCA_PACKET_MASK 0x0f
42 
43 #define DCA_PACKET_RECOVERY 0x10 ///< Sync error recovery flag
44 #define DCA_PACKET_RESIDUAL 0x20 ///< Core valid for residual decoding
45 
46 typedef struct DCAContext {
47  const AVClass *class; ///< class for AVOptions
49 
50  DCACoreDecoder core; ///< Core decoder context
51  DCAExssParser exss; ///< EXSS parser context
52  DCAXllDecoder xll; ///< XLL decoder context
53  DCALbrDecoder lbr; ///< LBR decoder context
54 
56 
57  const AVCRC *crctab;
58 
59  uint8_t *buffer; ///< Packet buffer
60  unsigned int buffer_size;
61 
62  int packet; ///< Packet flags
63 
64  int request_channel_layout; ///< Converted from avctx.request_channel_layout
65  int core_only; ///< Core only decoding flag
66 } DCAContext;
67 
68 int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask);
69 
71  int *coeff_l, int nsamples, int ch_mask);
73  int *coeff_l, int nsamples, int ch_mask);
74 
75 static inline int ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s,
76  int p1, int p2)
77 {
78  DCAContext *dca = avctx->priv_data;
79 
80  if (!(avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_CAREFUL)))
81  return 0;
82  if (((p1 | p2) & 7) || p1 < 0 || p2 > s->size_in_bits || p2 - p1 < 16)
83  return -1;
84  if (av_crc(dca->crctab, 0xffff, s->buffer + p1 / 8, (p2 - p1) / 8))
85  return -1;
86  return 0;
87 }
88 
89 static inline int ff_dca_seek_bits(GetBitContext *s, int p)
90 {
91  if (p < get_bits_count(s) || p > s->size_in_bits)
92  return -1;
94  return 0;
95 }
96 
97 #endif
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:291
DCAContext::crctab
const AVCRC * crctab
Definition: dcadec.h:57
dca.h
AVCRC
uint32_t AVCRC
Definition: crc.h:47
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1655
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
DCAContext::request_channel_layout
int request_channel_layout
Converted from avctx.request_channel_layout.
Definition: dcadec.h:64
DCAExssParser
Definition: dca_exss.h:71
ff_dca_seek_bits
static int ff_dca_seek_bits(GetBitContext *s, int p)
Definition: dcadec.h:89
samples
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new samples
Definition: fate.txt:139
ff_dca_check_crc
static int ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s, int p1, int p2)
Definition: dcadec.h:75
crc.h
DCAContext::core_only
int core_only
Core only decoding flag.
Definition: dcadec.h:65
GetBitContext
Definition: get_bits.h:61
dca_core.h
DCACoreDecoder
Definition: dca_core.h:101
DCAContext::lbr
DCALbrDecoder lbr
LBR decoder context.
Definition: dcadec.h:53
DCAContext::exss
DCAExssParser exss
EXSS parser context.
Definition: dcadec.h:51
DCAContext::dcadsp
DCADSPContext dcadsp
Definition: dcadec.h:55
DCAContext::packet
int packet
Packet flags.
Definition: dcadec.h:62
s
#define s(width, name)
Definition: cbs_vp9.c:257
DCAContext::buffer
uint8_t * buffer
Packet buffer.
Definition: dcadec.h:59
get_bits.h
dca_exss.h
DCALbrDecoder
Definition: dca_lbr.h:58
int32_t
int32_t
Definition: audio_convert.c:194
ff_dca_downmix_to_stereo_fixed
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:79
DCAContext::avctx
AVCodecContext * avctx
Definition: dcadec.h:48
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
DCAContext::xll
DCAXllDecoder xll
XLL decoder context.
Definition: dcadec.h:52
ff_dca_set_channel_layout
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
Definition: dcadec.c:32
DCADSPContext
Definition: dcadsp.h:30
float_dsp.h
AV_EF_CAREFUL
#define AV_EF_CAREFUL
consider things that violate the spec, are fast to calculate and have not been seen in the wild as er...
Definition: avcodec.h:1669
AVFloatDSPContext
Definition: float_dsp.h:24
dcadsp.h
DCAContext
Definition: dcadec.h:46
common.h
uint8_t
uint8_t
Definition: audio_convert.c:194
avcodec.h
DCAXllDecoder
Definition: dca_xll.h:105
AV_EF_CRCCHECK
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
Definition: avcodec.h:1663
AVCodecContext
main external API structure.
Definition: avcodec.h:526
dca_xll.h
av_crc
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
Definition: crc.c:392
DCAContext::buffer_size
unsigned int buffer_size
Definition: dcadec.h:60
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:553
DCAContext::core
DCACoreDecoder core
Core decoder context.
Definition: dcadec.h:50
dca_lbr.h
ff_dca_downmix_to_stereo_float
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:110