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
02e90c97
Commit
02e90c97
authored
Dec 10, 2009
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davinci encoder: cleanup
parent
a2fa9288
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
64 deletions
+75
-64
modules/codec/davinci/encoder.c
modules/codec/davinci/encoder.c
+75
-64
No files found.
modules/codec/davinci/encoder.c
View file @
02e90c97
...
...
@@ -64,7 +64,6 @@ struct encoder_sys_t
/*****************************************************************************
*
*****************************************************************************/
int
OpenVideoEncoder
(
vlc_object_t
*
p_this
)
{
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
...
...
@@ -239,79 +238,91 @@ static inline void davinci_CopyPictureToXDM( encoder_t *p_enc, XDM_BufDesc *p_bu
}
}
static
int
davinci_InitBuffers
(
encoder_t
*
p_enc
)
{
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
int
i_ret
=
VLC_SUCCESS
;
VIDENC_DynamicParams
dparams
;
VIDENC_Status
status
;
dparams
.
size
=
sizeof
(
dparams
);
memset
(
&
status
,
0
,
sizeof
(
status
)
);
status
.
size
=
sizeof
(
status
);
/* Configue the encoder */
dparams
.
inputHeight
=
p_enc
->
fmt_in
.
video
.
i_height
;
dparams
.
inputWidth
=
p_enc
->
fmt_in
.
video
.
i_width
;
dparams
.
refFrameRate
=
p_enc
->
fmt_out
.
video
.
i_frame_rate_base
?
p_enc
->
fmt_out
.
video
.
i_frame_rate
*
1000
/
p_enc
->
fmt_out
.
video
.
i_frame_rate_base
:
p_enc
->
i_iframes
*
1000
;
/* Frames per 1000 seconds */
dparams
.
targetFrameRate
=
dparams
.
refFrameRate
;
/* input fps = output fps */
dparams
.
targetBitRate
=
p_enc
->
fmt_out
.
i_bitrate
;
dparams
.
intraFrameInterval
=
p_enc
->
i_iframes
;
dparams
.
generateHeader
=
XDM_ENCODE_AU
;
/* don't encode only the header */
dparams
.
captureWidth
=
0
;
dparams
.
forceIFrame
=
0
;
if
(
VIDENC_control
(
p_sys
->
c
,
XDM_SETPARAMS
,
&
dparams
,
&
status
)
!=
VIDENC_EOK
)
{
msg_Err
(
p_enc
,
"Failed to set encoder parameters: %dx%d @%d fps, "
"%d kBps, I-frame interval %d"
,
(
int
)
dparams
.
inputWidth
,
(
int
)
dparams
.
inputHeight
,
(
int
)
dparams
.
refFrameRate
/
1000
,
(
int
)
dparams
.
targetBitRate
>>
13
/* / (1024 * 8) */
,
(
int
)
dparams
.
intraFrameInterval
);
return
VLC_EGENERIC
;
}
msg_Info
(
p_enc
,
"using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)
\n
"
,
(
int
)
dparams
.
inputWidth
,
(
int
)
dparams
.
inputHeight
,
((
float
)
dparams
.
targetFrameRate
)
/
1000
.,
((
int
)
dparams
.
targetBitRate
)
>>
13
/* / (8*1024)*/
,
(
int
)
dparams
.
intraFrameInterval
);
/* Configure buffers */
if
(
VIDENC_control
(
p_sys
->
c
,
XDM_GETBUFINFO
,
&
dparams
,
&
status
)
!=
VIDENC_EOK
)
{
msg_Err
(
p_enc
,
"Failed to get buffer info"
);
return
VLC_EGENERIC
;
}
/* Allocate input buffer(s) */
if
(
i_ret
=
AllocateBuffer
(
p_enc
,
status
.
bufInfo
.
minNumInBufs
,
status
.
bufInfo
.
minInBufSize
,
&
p_sys
->
in
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_enc
,
"Failed to allocate input buffers"
);
return
i_ret
;
}
/* Allocate output buffer */
if
(
i_ret
=
AllocateBuffer
(
p_enc
,
status
.
bufInfo
.
minNumOutBufs
,
status
.
bufInfo
.
minOutBufSize
,
&
p_sys
->
out
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_enc
,
"Failed to allocate input buffers"
);
return
i_ret
;
}
return
i_ret
;
}
static
block_t
*
EncodeVideo
(
encoder_t
*
p_enc
,
picture_t
*
p_pic
)
{
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
block_t
*
p_block
;
int
i
;
VIDENC_InArgs
in_args
;
VIDENC_OutArgs
out_args
;
int
i
;
if
(
p_sys
->
in
.
numBufs
==
0
||
p_sys
->
out
.
numBufs
==
0
)
{
VIDENC_DynamicParams
dparams
;
VIDENC_Status
status
;
dparams
.
size
=
sizeof
(
dparams
);
memset
(
&
status
,
0
,
sizeof
(
status
)
);
status
.
size
=
sizeof
(
status
);
/* Configue the encoder */
dparams
.
inputHeight
=
p_enc
->
fmt_in
.
video
.
i_height
;
dparams
.
inputWidth
=
p_enc
->
fmt_in
.
video
.
i_width
;
dparams
.
refFrameRate
=
p_enc
->
fmt_out
.
video
.
i_frame_rate_base
?
p_enc
->
fmt_out
.
video
.
i_frame_rate
*
1000
/
p_enc
->
fmt_out
.
video
.
i_frame_rate_base
:
p_enc
->
i_iframes
*
1000
;
/* Frames per 1000 seconds */
dparams
.
targetFrameRate
=
dparams
.
refFrameRate
;
/* input fps = output fps */
dparams
.
targetBitRate
=
p_enc
->
fmt_out
.
i_bitrate
;
dparams
.
intraFrameInterval
=
p_enc
->
i_iframes
;
dparams
.
generateHeader
=
XDM_ENCODE_AU
;
/* don't encode only the header */
dparams
.
captureWidth
=
0
;
dparams
.
forceIFrame
=
0
;
if
(
VIDENC_control
(
p_sys
->
c
,
XDM_SETPARAMS
,
&
dparams
,
&
status
)
!=
VIDENC_EOK
)
{
msg_Err
(
p_enc
,
"Failed to set encoder parameters: %dx%d @%d fps, "
"%d kBps, I-frame interval %d"
,
(
int
)
dparams
.
inputWidth
,
(
int
)
dparams
.
inputHeight
,
(
int
)
dparams
.
refFrameRate
/
1000
,
(
int
)
dparams
.
targetBitRate
>>
13
/* / (1024 * 8) */
,
(
int
)
dparams
.
intraFrameInterval
);
return
NULL
;
}
msg_Info
(
p_enc
,
"using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)
\n
"
,
(
int
)
dparams
.
inputWidth
,
(
int
)
dparams
.
inputHeight
,
((
float
)
dparams
.
targetFrameRate
)
/
1000
.,
((
int
)
dparams
.
targetBitRate
)
>>
13
/* / (8*1024)*/
,
(
int
)
dparams
.
intraFrameInterval
);
/* Configure buffers */
if
(
VIDENC_control
(
p_sys
->
c
,
XDM_GETBUFINFO
,
&
dparams
,
&
status
)
!=
VIDENC_EOK
)
{
msg_Err
(
p_enc
,
"Failed to get buffer info"
);
return
NULL
;
}
/* Allocate input buffer(s) */
if
(
AllocateBuffer
(
p_enc
,
status
.
bufInfo
.
minNumInBufs
,
status
.
bufInfo
.
minInBufSize
,
&
p_sys
->
in
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_enc
,
"Failed to allocate input buffers"
);
return
NULL
;
}
/* Allocate output buffer */
if
(
AllocateBuffer
(
p_enc
,
status
.
bufInfo
.
minNumOutBufs
,
status
.
bufInfo
.
minOutBufSize
,
&
p_sys
->
out
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_enc
,
"Failed to allocate input buffers"
);
if
(
davinci_InitBuffers
(
p_enc
)
!=
VLC_SUCCESS
)
return
NULL
;
}
}
davinci_CopyPictureToXDM
(
p_enc
,
&
p_sys
->
in
,
p_pic
);
...
...
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