Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
352e95ad
Commit
352e95ad
authored
Apr 19, 2010
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davinci: XDM 1.0 HEAAC DSP encoder
parent
a8c5af18
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
563 additions
and
102 deletions
+563
-102
modules/codec/davinci/audio1_encoder.c
modules/codec/davinci/audio1_encoder.c
+462
-76
modules/codec/davinci/audio_encoder.c
modules/codec/davinci/audio_encoder.c
+66
-15
modules/codec/davinci/davinci.c
modules/codec/davinci/davinci.c
+22
-5
modules/codec/davinci/encoder.c
modules/codec/davinci/encoder.c
+10
-5
modules/codec/davinci/fourcc.c
modules/codec/davinci/fourcc.c
+1
-1
modules/codec/davinci/video_encoder.c
modules/codec/davinci/video_encoder.c
+2
-0
No files found.
modules/codec/davinci/audio1_encoder.c
View file @
352e95ad
This diff is collapsed.
Click to expand it.
modules/codec/davinci/audio_encoder.c
View file @
352e95ad
...
@@ -63,6 +63,11 @@ struct xdm_sys_t
...
@@ -63,6 +63,11 @@ struct xdm_sys_t
XDM_BufDesc
in
;
XDM_BufDesc
in
;
XDM_BufDesc
out
;
XDM_BufDesc
out
;
/* remainder buffer management */
uint8_t
p_buffer
[
4096
];
/* FIXME: assume buffer is 4096 */
mtime_t
i_pts
;
size_t
i_size
;
};
};
/*****************************************************************************
/*****************************************************************************
...
@@ -80,6 +85,8 @@ int OpenEncoderAudio( encoder_t *p_enc )
...
@@ -80,6 +85,8 @@ int OpenEncoderAudio( encoder_t *p_enc )
xdm
=
p_sys
->
xdm
;
xdm
=
p_sys
->
xdm
;
xdm
->
params
.
size
=
sizeof
(
xdm
->
params
);
xdm
->
params
.
size
=
sizeof
(
xdm
->
params
);
xdm
->
dparams
.
size
=
sizeof
(
xdm
->
dparams
);
switch
(
var_CreateGetInteger
(
p_enc
,
ENC_CFG_PREFIX
"quality"
)
)
switch
(
var_CreateGetInteger
(
p_enc
,
ENC_CFG_PREFIX
"quality"
)
)
{
{
case
1
:
xdm
->
params
.
encodingPreset
=
XDM_HIGH_QUALITY
;
break
;
case
1
:
xdm
->
params
.
encodingPreset
=
XDM_HIGH_QUALITY
;
break
;
...
@@ -118,6 +125,8 @@ void CloseEncoderAudio( encoder_t *p_enc )
...
@@ -118,6 +125,8 @@ void CloseEncoderAudio( encoder_t *p_enc )
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
if
(
!
xdm
)
return
;
/* Delete audio encoder */
/* Delete audio encoder */
if
(
p_enc
->
fmt_out
.
i_cat
==
AUDIO_ES
)
if
(
p_enc
->
fmt_out
.
i_cat
==
AUDIO_ES
)
AUDENC_delete
(
xdm
->
handle
);
AUDENC_delete
(
xdm
->
handle
);
...
@@ -133,15 +142,12 @@ void CloseEncoderAudio( encoder_t *p_enc )
...
@@ -133,15 +142,12 @@ void CloseEncoderAudio( encoder_t *p_enc )
/*****************************************************************************
/*****************************************************************************
* Audio Encoder: XDM 0.9
* Audio Encoder: XDM 0.9
*****************************************************************************/
*****************************************************************************/
static
inline
int
davinci_
InitAudioBuffer
s
(
encoder_t
*
p_enc
)
static
inline
int
davinci_
SetDynamicParam
s
(
encoder_t
*
p_enc
)
{
{
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
int
i_ret
=
VLC_SUCCESS
;
AUDENC_Status
status
;
AUDENC_Status
status
;
xdm
->
dparams
.
size
=
sizeof
(
xdm
->
dparams
);
memset
(
&
status
,
0
,
sizeof
(
status
)
);
memset
(
&
status
,
0
,
sizeof
(
status
)
);
status
.
size
=
sizeof
(
status
);
status
.
size
=
sizeof
(
status
);
...
@@ -172,14 +178,6 @@ static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
...
@@ -172,14 +178,6 @@ static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
xdm
->
dparams
.
numLFEChannels
=
0
;
/* FIXME: What to fill in here?
xdm
->
dparams
.
numLFEChannels
=
0
;
/* FIXME: What to fill in here?
* Number of LFE (Low Frequency Effects) channels in the stream. */
* Number of LFE (Low Frequency Effects) channels in the stream. */
xdm
->
dparams
.
inputBitsPerSample
=
p_enc
->
fmt_out
.
audio
.
i_bitspersample
;
xdm
->
dparams
.
inputBitsPerSample
=
p_enc
->
fmt_out
.
audio
.
i_bitspersample
;
//p_enc->fmt_in.i_codec == AOUT_FMT_S16_NE) ? 16: 32;
msg_Info
(
p_enc
,
"using %d channels at %d Hz samplerate (bitrate %d kBps, "
"%d bits per sample)
\n
"
,
p_enc
->
fmt_out
.
audio
.
i_channels
,
(
int
)
xdm
->
dparams
.
sampleRate
,
((
int
)
xdm
->
dparams
.
bitRate
)
>>
13
/* / (8*1024)*/
,
(
int
)
xdm
->
dparams
.
inputBitsPerSample
);
if
(
AUDENC_control
(
xdm
->
handle
,
XDM_SETPARAMS
,
&
xdm
->
dparams
,
&
status
)
if
(
AUDENC_control
(
xdm
->
handle
,
XDM_SETPARAMS
,
&
xdm
->
dparams
,
&
status
)
!=
AUDENC_EOK
)
!=
AUDENC_EOK
)
...
@@ -188,6 +186,20 @@ static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
...
@@ -188,6 +186,20 @@ static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
return
VLC_SUCCESS
;
}
static
inline
int
davinci_InitAudioBuffers
(
encoder_t
*
p_enc
)
{
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
int
i_ret
=
VLC_SUCCESS
;
AUDENC_Status
status
;
memset
(
&
status
,
0
,
sizeof
(
status
)
);
status
.
size
=
sizeof
(
status
);
/* Configure buffers */
/* Configure buffers */
if
(
AUDENC_control
(
xdm
->
handle
,
XDM_GETBUFINFO
,
&
xdm
->
dparams
,
&
status
)
if
(
AUDENC_control
(
xdm
->
handle
,
XDM_GETBUFINFO
,
&
xdm
->
dparams
,
&
status
)
!=
AUDENC_EOK
)
!=
AUDENC_EOK
)
...
@@ -226,19 +238,58 @@ static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_buffer )
...
@@ -226,19 +238,58 @@ static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_buffer )
block_t
*
p_block
;
block_t
*
p_block
;
int
i_ret
;
int
i_ret
;
if
(
davinci_SetDynamicParams
(
p_enc
)
!=
VLC_SUCCESS
)
{
msg_Warn
(
p_enc
,
"Failed setting dynamic params."
);
}
if
(
xdm
->
in
.
numBufs
==
0
||
xdm
->
out
.
numBufs
==
0
)
if
(
xdm
->
in
.
numBufs
==
0
||
xdm
->
out
.
numBufs
==
0
)
{
{
msg_Info
(
p_enc
,
"using %d channels at %d Hz samplerate (bitrate %d kBps, "
"%d bits per sample)
\n
"
,
p_enc
->
fmt_out
.
audio
.
i_channels
,
(
int
)
xdm
->
dparams
.
sampleRate
,
((
int
)
xdm
->
dparams
.
bitRate
)
>>
13
/* / (8*1024)*/
,
(
int
)
xdm
->
dparams
.
inputBitsPerSample
);
if
(
davinci_InitAudioBuffers
(
p_enc
)
!=
VLC_SUCCESS
)
if
(
davinci_InitAudioBuffers
(
p_enc
)
!=
VLC_SUCCESS
)
return
NULL
;
return
NULL
;
}
}
/* NOTE: assume interleaved channels */
if
(
xdm
->
i_size
==
0
)
{
/* buffer is filled in one go */
memcpy
(
xdm
->
in
.
bufs
[
0
],
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_bytes
);
if
(
p_buffer
->
i_nb_bytes
<
(
uint32_t
)
xdm
->
in
.
bufSizes
[
0
]
)
{
xdm
->
i_size
=
p_buffer
->
i_nb_bytes
;
xdm
->
i_pts
=
p_buffer
->
start_date
;
return
NULL
;
/* wait till buffer is filled */
}
xdm
->
i_pts
=
0
;
}
else
{
/* there is a remainder */
size_t
i_remainder
=
(
uint32_t
)
xdm
->
in
.
bufSizes
[
0
]
-
xdm
->
i_size
;
if
(
i_remainder
>
p_buffer
->
i_nb_bytes
)
i_remainder
=
p_buffer
->
i_nb_bytes
;
if
(
xdm
->
i_size
>
0
)
memcpy
(
xdm
->
in
.
bufs
[
0
],
xdm
->
p_buffer
,
xdm
->
i_size
);
memcpy
(
xdm
->
in
.
bufs
[
0
]
+
xdm
->
i_size
,
p_buffer
->
p_buffer
,
i_remainder
);
/* keep remainder part of buffer */
if
(
i_remainder
<
(
size_t
)
xdm
->
in
.
bufSizes
[
0
]
)
{
memcpy
(
xdm
->
p_buffer
,
p_buffer
->
p_buffer
+
i_remainder
,
p_buffer
->
i_nb_bytes
-
i_remainder
);
xdm
->
i_size
=
(
p_buffer
->
i_nb_bytes
-
i_remainder
);
}
}
/* Configure input */
/* Configure input */
memset
(
&
in_args
,
0
,
sizeof
(
in_args
)
);
memset
(
&
in_args
,
0
,
sizeof
(
in_args
)
);
in_args
.
size
=
sizeof
(
in_args
);
in_args
.
size
=
sizeof
(
in_args
);
/* NOTE: assume interleaved channels */
memcpy
(
xdm
->
in
.
bufs
[
0
],
p_buffer
->
p_buffer
,
p_buffer
->
i_nb_bytes
);
/* Configure output */
/* Configure output */
memset
(
&
out_args
,
0
,
sizeof
(
out_args
)
);
memset
(
&
out_args
,
0
,
sizeof
(
out_args
)
);
out_args
.
size
=
sizeof
(
out_args
);
out_args
.
size
=
sizeof
(
out_args
);
...
...
modules/codec/davinci/davinci.c
View file @
352e95ad
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
* Encoder
* Encoder
*/
*/
/* video settings */
#define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
#define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
#define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
#define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
"that will be coded for one key frame." )
"that will be coded for one key frame." )
...
@@ -85,6 +86,19 @@
...
@@ -85,6 +86,19 @@
#define ENC_CBR_LONGTEXT N_( "Use constant bitrate encoding. If disabled, " \
#define ENC_CBR_LONGTEXT N_( "Use constant bitrate encoding. If disabled, " \
"then variable bitrate encoding is used resulting in higher bandwidth savings." )
"then variable bitrate encoding is used resulting in higher bandwidth savings." )
/* audio settings */
#define ENC_PROFILE_TEXT N_( "Specify AAC audio profile to use" )
#define ENC_PROFILE_LONGTEXT N_( "Specify the AAC audio profile to use " \
"for encoding the audio bitstream. It takes the following options: " \
"low (LC), sbr (HE) and ps (HEv2) (default: low)" )
/* */
#ifdef ENABLE_SOUT
static
const
char
*
const
enc_aac_profile_list
[]
=
{
"low"
,
"sbr"
,
"ps"
};
static
const
char
*
const
enc_aac_profile_list_text
[]
=
{
N_
(
"low"
),
N_
(
"sbr"
),
N_
(
"ps"
)
};
#endif
/* */
/* */
#define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders" \
#define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders" \
"delivered by TI Davinci library. This includes MPEG4, H264, VC-1, "\
"delivered by TI Davinci library. This includes MPEG4, H264, VC-1, "\
...
@@ -125,25 +139,28 @@ vlc_module_begin()
...
@@ -125,25 +139,28 @@ vlc_module_begin()
/* encoder settings - XDM 0.9 only */
/* encoder settings - XDM 0.9 only */
add_integer
(
ENC_CFG_PREFIX
"quality"
,
0
,
NULL
,
ENC_QUALITY_TEXT
,
add_integer
(
ENC_CFG_PREFIX
"quality"
,
0
,
NULL
,
ENC_QUALITY_TEXT
,
ENC_QUALITY_LONGTEXT
,
tru
e
)
ENC_QUALITY_LONGTEXT
,
fals
e
)
change_integer_range
(
0
,
3
)
change_integer_range
(
0
,
3
)
/* encoder settings - XDM 1.0 only */
/* encoder settings - XDM 1.0 only */
add_bool
(
ENC_CFG_PREFIX
"cbr"
,
true
,
NULL
,
ENC_CBR_TEXT
,
add_bool
(
ENC_CFG_PREFIX
"cbr"
,
true
,
NULL
,
ENC_CBR_TEXT
,
ENC_CBR_LONGTEXT
,
tru
e
)
ENC_CBR_LONGTEXT
,
fals
e
)
/* video encoder settings - XDM all versions */
/* video encoder settings - XDM all versions */
add_integer
(
ENC_CFG_PREFIX
"keyint"
,
0
,
NULL
,
ENC_KEYINT_TEXT
,
add_integer
(
ENC_CFG_PREFIX
"keyint"
,
0
,
NULL
,
ENC_KEYINT_TEXT
,
ENC_KEYINT_LONGTEXT
,
false
)
ENC_KEYINT_LONGTEXT
,
false
)
add_bool
(
ENC_CFG_PREFIX
"interlace"
,
false
,
NULL
,
ENC_INTERLACE_TEXT
,
add_bool
(
ENC_CFG_PREFIX
"interlace"
,
false
,
NULL
,
ENC_INTERLACE_TEXT
,
ENC_INTERLACE_LONGTEXT
,
tru
e
)
ENC_INTERLACE_LONGTEXT
,
fals
e
)
add_integer
(
ENC_CFG_PREFIX
"rc"
,
1
,
NULL
,
ENC_RC_TEXT
,
add_integer
(
ENC_CFG_PREFIX
"rc"
,
1
,
NULL
,
ENC_RC_TEXT
,
ENC_RC_LONGTEXT
,
tru
e
)
ENC_RC_LONGTEXT
,
fals
e
)
change_integer_range
(
0
,
5
)
change_integer_range
(
0
,
5
)
add_integer
(
ENC_CFG_PREFIX
"tolerance"
,
0
,
NULL
,
ENC_VT_TEXT
,
add_integer
(
ENC_CFG_PREFIX
"tolerance"
,
0
,
NULL
,
ENC_VT_TEXT
,
ENC_VT_LONGTEXT
,
tru
e
)
ENC_VT_LONGTEXT
,
fals
e
)
/* audio encoder settings */
/* audio encoder settings */
add_string
(
ENC_CFG_PREFIX
"aac-profile"
,
"low"
,
NULL
,
ENC_PROFILE_TEXT
,
ENC_PROFILE_LONGTEXT
,
false
)
change_string_list
(
enc_aac_profile_list
,
enc_aac_profile_list_text
,
0
)
#endif
#endif
#if 0
#if 0
...
...
modules/codec/davinci/encoder.c
View file @
352e95ad
...
@@ -44,7 +44,11 @@
...
@@ -44,7 +44,11 @@
/*****************************************************************************
/*****************************************************************************
* Encoder
* Encoder
*****************************************************************************/
*****************************************************************************/
static
const
char
*
const
ppsz_enc_options
[]
=
{
"aac-profile"
,
"cbr"
,
"engine"
,
"fourcc"
,
"keyint"
,
"interlace"
,
"quality"
,
"rc"
,
"tolerance"
,
NULL
};
/*****************************************************************************
/*****************************************************************************
*
*
...
@@ -97,6 +101,8 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -97,6 +101,8 @@ int OpenEncoder( vlc_object_t *p_this )
davinci_PrintAvailableAlgorithms
(
p_this
,
p_sys
->
psz_ti_engine
);
davinci_PrintAvailableAlgorithms
(
p_this
,
p_sys
->
psz_ti_engine
);
config_ChainParse
(
p_enc
,
ENC_CFG_PREFIX
,
ppsz_enc_options
,
p_enc
->
p_cfg
);
/* Initialize random stuff */
/* Initialize random stuff */
switch
(
i_cat
)
switch
(
i_cat
)
{
{
...
@@ -134,9 +140,7 @@ error:
...
@@ -134,9 +140,7 @@ error:
(
i_cat
==
AUDIO_ES
)
?
"audio"
:
"other"
,
(
i_cat
==
AUDIO_ES
)
?
"audio"
:
"other"
,
p_sys
->
psz_codec
,
psz_namecodec
);
p_sys
->
psz_codec
,
psz_namecodec
);
if
(
p_sys
->
engine
)
Engine_close
(
p_sys
->
engine
);
CloseEncoder
(
p_this
);
free
(
p_sys
->
psz_ti_engine
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -179,7 +183,8 @@ void CloseEncoder( vlc_object_t *p_this )
...
@@ -179,7 +183,8 @@ void CloseEncoder( vlc_object_t *p_this )
Engine_close
(
p_sys
->
engine
);
Engine_close
(
p_sys
->
engine
);
/* Exit the codec engine */
/* Exit the codec engine */
CERuntime_exit
();
/* FIXME: Should this be done only once (if we have encoder + decoder runing) */
/* FIXME: Should this be done only once (if we have encoder + decoder runing) */
CERuntime_exit
();
free
(
p_sys
->
psz_ti_engine
);
free
(
p_sys
->
psz_ti_engine
);
free
(
p_sys
);
free
(
p_sys
);
...
...
modules/codec/davinci/fourcc.c
View file @
352e95ad
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
#define DAVINCI_ENC_H264 "h264enc"
#define DAVINCI_ENC_H264 "h264enc"
#define DAVINCI_ENC_VC1 "vc1enc"
#define DAVINCI_ENC_VC1 "vc1enc"
#define DAVINCI_ENC_AAC "aac
lc
enc"
#define DAVINCI_ENC_AAC "aac
he
enc"
#define DAVINCI_ENC_G711 "g711enc"
#define DAVINCI_ENC_G711 "g711enc"
#define DAVINCI_NONE ""
#define DAVINCI_NONE ""
...
...
modules/codec/davinci/video_encoder.c
View file @
352e95ad
...
@@ -93,6 +93,8 @@ void CloseEncoderVideo( encoder_t *p_enc )
...
@@ -93,6 +93,8 @@ void CloseEncoderVideo( encoder_t *p_enc )
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
xdm_sys_t
*
xdm
=
p_sys
->
xdm
;
if
(
!
xdm
)
return
;
/* Delete video encoder */
/* Delete video encoder */
if
(
p_enc
->
fmt_out
.
i_cat
==
VIDEO_ES
)
if
(
p_enc
->
fmt_out
.
i_cat
==
VIDEO_ES
)
VIDENC_delete
(
xdm
->
handle
);
VIDENC_delete
(
xdm
->
handle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment