M4VSS3GPP_InternalConfig.h revision 7c9d8018755adf1857571125ba1b3598c96ea506
1/*
2 * Copyright (C) 2004-2011 NXP Software
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef __M4VSS3GPP_INTERNALCONFIG_H__
19#define __M4VSS3GPP_INTERNALCONFIG_H__
20
21/**
22 ******************************************************************************
23 * @file    M4VSS3GPP_InternalConfig.h
24 * @brief    This file contains some magical and configuration parameters.
25 ******************************************************************************
26*/
27
28/***********************/
29/* VideoEdition config */
30/***********************/
31
32#define M4VSS3GPP_MINIMAL_TRANSITION_DURATION            100    /**< 100 milliseconds */
33#define M4VSS3GPP_NB_AU_PREFETCH                        4        /**< prefect 4 AUs */
34#define M4VSS3GPP_NO_STSS_JUMP_POINT                    40000 /**< If 3gp file does not contain
35                                                                   an STSS table (no rap frames),
36                                                                   jump backward 40 s maximum */
37
38/*****************/
39/* Writer config */
40/*****************/
41
42#define M4VSS3GPP_WRITER_AUDIO_STREAM_ID                1
43#define M4VSS3GPP_WRITER_VIDEO_STREAM_ID                2
44
45/**< Max AU size will be 0.8 times the YUV4:2:0 frame size */
46#define M4VSS3GPP_VIDEO_MIN_COMPRESSION_RATIO            0.9F
47/**< Max chunk size will be 1.2 times the max AU size */
48#define M4VSS3GPP_VIDEO_AU_SIZE_TO_CHUNCK_SIZE_RATIO    1.2F
49
50/** READ CAREFULLY IN CASE OF REPORTED RUNNING TROUBLES
51The max AU size is used to pre-set max size of AU that can be written in the 3GP writer
52For audio standard with variable AU size, there could be some encoding settings leading to AU size
53exceeding this limit.
54For AAC streams for instance the average AU size is given by:
55av AU size = (av bitrate * 1024)/(sampling freq)
56If VSS returns the message:
57>> ERROR: audio AU size (XXXX) to copy larger than allocated one (YYYY) => abort
58>> PLEASE CONTACT SUPPORT TO EXTEND MAX AU SIZE IN THE PRODUCT LIBRARY
59Error is most likely to happen when mixing with audio full replacement
60 */
61/**< AAC max AU size - READ EXPLANATION ABOVE */
62#define M4VSS3GPP_AUDIO_MAX_AU_SIZE                        2048
63/**< set to x4 max AU size per chunk */
64#define M4VSS3GPP_AUDIO_MAX_CHUNCK_SIZE                    8192
65
66
67/***********************/
68/* H263 / MPEG4 config */
69/***********************/
70
71#define    M4VSS3GPP_EDIT_H263_MODULO_TIME            255
72
73#ifdef BIG_ENDIAN
74/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/
75#define    M4VSS3GPP_EDIT_GOV_HEADER            0x000001b3
76#else
77/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/
78#define    M4VSS3GPP_EDIT_GOV_HEADER            0xb3010000
79#endif
80
81/**************/
82/* AMR config */
83/**************/
84
85#define M4VSS3GPP_WRITTEN_AMR_TRACK_TIME_SCALE            8000
86#define M4VSS3GPP_AMR_DECODED_PCM_SAMPLE_NUMBER            160        /**< 20ms at 8000hz -->
87                                                                     20x8=160 samples */
88#define M4VSS3GPP_AMR_DEFAULT_BITRATE                   12200   /**< 12.2 kbps */
89
90/**************/
91/* EVRC config */
92/**************/
93
94#define M4VSS3GPP_EVRC_DEFAULT_BITRATE                  9200   /**< 9.2 kbps */
95
96/**************/
97/* MP3 config */
98/**************/
99
100/** Macro to make a jump on the MP3 track on several steps
101    To avoid to block the system with an long MP3 jump, this process
102    is divided on several steps.
103 */
104#define M4VSS3GPP_MP3_JUMPED_AU_NUMBER_MAX 100
105
106/** Macro to define the number of read AU to analyse the bitrate
107    So the process will read the first n AU of the MP3 stream to get
108    the average bitrate. n is defined by this define.
109 */
110#define M4VSS3GPP_MP3_AU_NUMBER_MAX 500
111
112/*****************************/
113/* define AMR silence frames */
114/*****************************/
115
116#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE     13
117#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_DURATION 160
118
119#ifdef M4VSS3GPP_SILENCE_FRAMES
120const M4OSA_UInt8 M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE] =
121{
122    0x04, 0xFF, 0x18, 0xC7, 0xF0, 0x0D, 0x04, 0x33,
123    0xFF, 0xE0, 0x00, 0x00, 0x00
124};
125#else
126extern const M4OSA_UInt8 \
127              M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE];
128#endif
129
130/*****************************/
131/* define AAC silence frames */
132/*****************************/
133
134#define M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE      4
135
136#ifdef M4VSS3GPP_SILENCE_FRAMES
137const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE] =
138{
139    0x00, 0xC8, 0x20, 0x07
140};
141#else
142extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE];
143#endif
144
145#define M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE        6
146
147#ifdef M4VSS3GPP_SILENCE_FRAMES
148const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE] =
149{
150    0x21, 0x10, 0x03, 0x20, 0x54, 0x1C
151};
152#else
153extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE];
154#endif
155
156#endif /* __M4VSS3GPP_INTERNALCONFIG_H__ */
157
158