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
e7eb86a6
Commit
e7eb86a6
authored
Sep 09, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use i_visible_ dimensions to initialize encoders
parent
e0bf2bb3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
35 deletions
+43
-35
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.c
+10
-2
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+6
-6
modules/codec/dirac.c
modules/codec/dirac.c
+6
-6
modules/codec/dmo/dmo.c
modules/codec/dmo/dmo.c
+8
-8
modules/codec/qsv.c
modules/codec/qsv.c
+3
-3
modules/codec/schroedinger.c
modules/codec/schroedinger.c
+3
-3
modules/codec/theora.c
modules/codec/theora.c
+5
-5
modules/codec/x264.c
modules/codec/x264.c
+2
-2
No files found.
modules/codec/avcodec/avcodec.c
View file @
e7eb86a6
...
...
@@ -397,8 +397,16 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
}
if
(
p_dec
->
fmt_in
.
i_cat
==
VIDEO_ES
)
{
p_sys
->
p_context
->
width
=
p_dec
->
fmt_in
.
video
.
i_width
;
p_sys
->
p_context
->
height
=
p_dec
->
fmt_in
.
video
.
i_height
;
p_sys
->
p_context
->
width
=
p_dec
->
fmt_in
.
video
.
i_visible_width
;
p_sys
->
p_context
->
height
=
p_dec
->
fmt_in
.
video
.
i_visible_height
;
if
(
p_sys
->
p_context
->
width
==
0
)
p_sys
->
p_context
->
width
=
p_dec
->
fmt_in
.
video
.
i_width
;
else
if
(
p_sys
->
p_context
->
width
!=
p_dec
->
fmt_in
.
video
.
i_width
)
p_sys
->
p_context
->
coded_width
=
p_dec
->
fmt_in
.
video
.
i_width
;
if
(
p_sys
->
p_context
->
height
==
0
)
p_sys
->
p_context
->
height
=
p_dec
->
fmt_in
.
video
.
i_height
;
else
if
(
p_sys
->
p_context
->
height
!=
p_dec
->
fmt_in
.
video
.
i_height
)
p_sys
->
p_context
->
coded_height
=
p_dec
->
fmt_in
.
video
.
i_height
;
p_sys
->
p_context
->
bits_per_coded_sample
=
p_dec
->
fmt_in
.
video
.
i_bits_per_pixel
;
}
else
if
(
p_dec
->
fmt_in
.
i_cat
==
AUDIO_ES
)
...
...
modules/codec/avcodec/encoder.c
View file @
e7eb86a6
...
...
@@ -421,18 +421,18 @@ int OpenEncoder( vlc_object_t *p_this )
if
(
p_enc
->
fmt_in
.
i_cat
==
VIDEO_ES
)
{
if
(
!
p_enc
->
fmt_in
.
video
.
i_
width
||
!
p_enc
->
fmt_in
.
video
.
i
_height
)
if
(
!
p_enc
->
fmt_in
.
video
.
i_
visible_width
||
!
p_enc
->
fmt_in
.
video
.
i_visible
_height
)
{
msg_Warn
(
p_enc
,
"invalid size %ix%i"
,
p_enc
->
fmt_in
.
video
.
i_width
,
p_enc
->
fmt_in
.
video
.
i_height
);
msg_Warn
(
p_enc
,
"invalid size %ix%i"
,
p_enc
->
fmt_in
.
video
.
i_
visible_
width
,
p_enc
->
fmt_in
.
video
.
i_
visible_
height
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
p_context
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
p_context
->
width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_context
->
height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_context
->
width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_context
->
height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_context
->
time_base
.
num
=
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
;
p_context
->
time_base
.
den
=
p_enc
->
fmt_in
.
video
.
i_frame_rate
;
...
...
@@ -686,7 +686,7 @@ int OpenEncoder( vlc_object_t *p_this )
//p_context->rc_max_rate = 24 * 1000 * 1000; //24M
//p_context->rc_min_rate = 40 * 1000; // 40k
/* seems that FFmpeg presets have 720p as divider for buffers */
if
(
p_enc
->
fmt_out
.
video
.
i_height
>=
720
)
if
(
p_enc
->
fmt_out
.
video
.
i_
visible_
height
>=
720
)
{
/* Check that we don't overrun users qmin/qmax values */
if
(
!
var_GetInteger
(
p_enc
,
ENC_CFG_PREFIX
"qmin"
)
)
...
...
modules/codec/dirac.c
View file @
e7eb86a6
...
...
@@ -448,7 +448,7 @@ static int OpenEncoder( vlc_object_t *p_this )
}
if
(
!
p_enc
->
fmt_in
.
video
.
i_frame_rate
||
!
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
||
!
p_enc
->
fmt_in
.
video
.
i_
height
||
!
p_enc
->
fmt_in
.
video
.
i
_width
)
!
p_enc
->
fmt_in
.
video
.
i_
visible_height
||
!
p_enc
->
fmt_in
.
video
.
i_visible
_width
)
{
msg_Err
(
p_enc
,
"Framerate and picture dimensions must be non-zero"
);
return
VLC_EGENERIC
;
...
...
@@ -499,8 +499,8 @@ static int OpenEncoder( vlc_object_t *p_this )
dirac_encoder_context_init
(
&
p_sys
->
ctx
,
guessed_video_fmt
);
/* constants set from the input video format */
p_sys
->
ctx
.
src_params
.
width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_sys
->
ctx
.
src_params
.
height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_sys
->
ctx
.
src_params
.
width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_sys
->
ctx
.
src_params
.
height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_sys
->
ctx
.
src_params
.
frame_rate
.
numerator
=
p_enc
->
fmt_in
.
video
.
i_frame_rate
;
p_sys
->
ctx
.
src_params
.
frame_rate
.
denominator
=
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
;
unsigned
u_asr_num
,
u_asr_den
;
...
...
@@ -519,19 +519,19 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_I420
;
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
=
12
;
p_sys
->
ctx
.
src_params
.
chroma
=
format420
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
width
*
p_enc
->
fmt_in
.
video
.
i
_height
*
3
/
2
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
visible_width
*
p_enc
->
fmt_in
.
video
.
i_visible
_height
*
3
/
2
;
}
else
if
(
!
strcmp
(
psz_tmp
,
"422"
)
)
{
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_I422
;
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
=
16
;
p_sys
->
ctx
.
src_params
.
chroma
=
format422
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
width
*
p_enc
->
fmt_in
.
video
.
i
_height
*
2
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
visible_width
*
p_enc
->
fmt_in
.
video
.
i_visible
_height
*
2
;
}
else
if
(
!
strcmp
(
psz_tmp
,
"444"
)
)
{
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_I444
;
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
=
24
;
p_sys
->
ctx
.
src_params
.
chroma
=
format444
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
width
*
p_enc
->
fmt_in
.
video
.
i
_height
*
3
;
p_sys
->
i_buffer_in
=
p_enc
->
fmt_in
.
video
.
i_
visible_width
*
p_enc
->
fmt_in
.
video
.
i_visible
_height
*
3
;
}
else
{
msg_Err
(
p_enc
,
"Invalid chroma format: %s"
,
psz_tmp
);
...
...
modules/codec/dmo/dmo.c
View file @
e7eb86a6
...
...
@@ -1108,17 +1108,17 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
p_bih
=
&
vih
.
bmiHeader
;
p_bih
->
biCompression
=
VLC_CODEC_I420
;
p_bih
->
biWidth
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_bih
->
biHeight
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_bih
->
biWidth
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_bih
->
biHeight
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_bih
->
biBitCount
=
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
;
p_bih
->
biSizeImage
=
p_enc
->
fmt_in
.
video
.
i_width
*
p_enc
->
fmt_in
.
video
.
i_height
*
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
/
8
;
p_bih
->
biSizeImage
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
*
p_enc
->
fmt_in
.
video
.
i_
visible_
height
*
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
/
8
;
p_bih
->
biPlanes
=
3
;
p_bih
->
biSize
=
sizeof
(
VLC_BITMAPINFOHEADER
);
vih
.
rcSource
.
left
=
vih
.
rcSource
.
top
=
0
;
vih
.
rcSource
.
right
=
p_enc
->
fmt_in
.
video
.
i_width
;
vih
.
rcSource
.
bottom
=
p_enc
->
fmt_in
.
video
.
i_height
;
vih
.
rcSource
.
right
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
vih
.
rcSource
.
bottom
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
vih
.
rcTarget
=
vih
.
rcSource
;
vih
.
AvgTimePerFrame
=
INT64_C
(
10000000
)
/
25
;
//FIXME
...
...
@@ -1477,8 +1477,8 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
picture_t
*
p_pic
=
(
picture_t
*
)
p_data
;
uint8_t
*
p_dst
;
int
i_buffer
=
p_enc
->
fmt_in
.
video
.
i_width
*
p_enc
->
fmt_in
.
video
.
i_height
*
int
i_buffer
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
*
p_enc
->
fmt_in
.
video
.
i_
visible_
height
*
p_enc
->
fmt_in
.
video
.
i_bits_per_pixel
/
8
;
p_block_in
=
block_Alloc
(
i_buffer
);
...
...
modules/codec/qsv.c
View file @
e7eb86a6
...
...
@@ -413,7 +413,7 @@ static int Open(vlc_object_t *this)
enc
->
fmt_out
.
i_codec
!=
VLC_CODEC_MPGV
&&
!
enc
->
b_force
)
return
VLC_EGENERIC
;
if
(
!
enc
->
fmt_in
.
video
.
i_
height
||
!
enc
->
fmt_in
.
video
.
i
_width
||
if
(
!
enc
->
fmt_in
.
video
.
i_
visible_height
||
!
enc
->
fmt_in
.
video
.
i_visible
_width
||
!
enc
->
fmt_in
.
video
.
i_frame_rate
||
!
enc
->
fmt_in
.
video
.
i_frame_rate_base
)
{
msg_Err
(
enc
,
"Framerate and picture dimensions must be non-zero"
);
return
VLC_EGENERIC
;
...
...
@@ -458,8 +458,8 @@ static int Open(vlc_object_t *this)
sys
->
params
.
mfx
.
FrameInfo
.
ChromaFormat
=
MFX_CHROMAFORMAT_YUV420
;
sys
->
params
.
mfx
.
FrameInfo
.
Width
=
QSV_ALIGN
(
16
,
enc
->
fmt_in
.
video
.
i_width
);
sys
->
params
.
mfx
.
FrameInfo
.
Height
=
QSV_ALIGN
(
32
,
enc
->
fmt_in
.
video
.
i_height
);
sys
->
params
.
mfx
.
FrameInfo
.
CropW
=
enc
->
fmt_in
.
video
.
i_width
;
sys
->
params
.
mfx
.
FrameInfo
.
CropH
=
enc
->
fmt_in
.
video
.
i_height
;
sys
->
params
.
mfx
.
FrameInfo
.
CropW
=
enc
->
fmt_in
.
video
.
i_
visible_
width
;
sys
->
params
.
mfx
.
FrameInfo
.
CropH
=
enc
->
fmt_in
.
video
.
i_
visible_
height
;
sys
->
params
.
mfx
.
FrameInfo
.
PicStruct
=
MFX_PICSTRUCT_UNKNOWN
;
/* Parsing options common to all RC methods and codecs */
...
...
modules/codec/schroedinger.c
View file @
e7eb86a6
...
...
@@ -1072,7 +1072,7 @@ static int OpenEncoder( vlc_object_t *p_this )
}
if
(
!
p_enc
->
fmt_in
.
video
.
i_frame_rate
||
!
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
||
!
p_enc
->
fmt_in
.
video
.
i_
height
||
!
p_enc
->
fmt_in
.
video
.
i
_width
)
!
p_enc
->
fmt_in
.
video
.
i_
visible_height
||
!
p_enc
->
fmt_in
.
video
.
i_visible
_width
)
{
msg_Err
(
p_enc
,
"Framerate and picture dimensions must be non-zero"
);
return
VLC_EGENERIC
;
...
...
@@ -1138,8 +1138,8 @@ static int OpenEncoder( vlc_object_t *p_this )
schro_video_format_set_std_video_format
(
p_sys
->
p_format
,
guessed_video_fmt
);
/* constants set from the input video format */
p_sys
->
p_format
->
width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_sys
->
p_format
->
height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_sys
->
p_format
->
width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_sys
->
p_format
->
height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_sys
->
p_format
->
frame_rate_numerator
=
p_enc
->
fmt_in
.
video
.
i_frame_rate
;
p_sys
->
p_format
->
frame_rate_denominator
=
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
;
unsigned
u_asr_num
,
u_asr_den
;
...
...
modules/codec/theora.c
View file @
e7eb86a6
...
...
@@ -659,8 +659,8 @@ static int OpenEncoder( vlc_object_t *p_this )
th_info_init
(
&
p_sys
->
ti
);
p_sys
->
ti
.
frame_width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_sys
->
ti
.
frame_height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_sys
->
ti
.
frame_width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_sys
->
ti
.
frame_height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
if
(
p_sys
->
ti
.
frame_width
%
16
||
p_sys
->
ti
.
frame_height
%
16
)
{
...
...
@@ -670,12 +670,12 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys
->
ti
.
frame_height
=
(
p_sys
->
ti
.
frame_height
+
15
)
>>
4
<<
4
;
msg_Dbg
(
p_enc
,
"padding video from %dx%d to %dx%d"
,
p_enc
->
fmt_in
.
video
.
i_
width
,
p_enc
->
fmt_in
.
video
.
i
_height
,
p_enc
->
fmt_in
.
video
.
i_
visible_width
,
p_enc
->
fmt_in
.
video
.
i_visible
_height
,
p_sys
->
ti
.
frame_width
,
p_sys
->
ti
.
frame_height
);
}
p_sys
->
ti
.
pic_width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_sys
->
ti
.
pic_height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_sys
->
ti
.
pic_width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_sys
->
ti
.
pic_height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_sys
->
ti
.
pic_x
=
0
/*frame_x_offset*/
;
p_sys
->
ti
.
pic_y
=
0
/*frame_y_offset*/
;
...
...
modules/codec/x264.c
View file @
e7eb86a6
...
...
@@ -885,8 +885,8 @@ static int Open ( vlc_object_t *p_this )
free
(
psz_preset
);
free
(
psz_tune
);
p_sys
->
param
.
i_csp
=
p_sys
->
i_colorspace
;
p_sys
->
param
.
i_width
=
p_enc
->
fmt_in
.
video
.
i_width
;
p_sys
->
param
.
i_height
=
p_enc
->
fmt_in
.
video
.
i_height
;
p_sys
->
param
.
i_width
=
p_enc
->
fmt_in
.
video
.
i_
visible_
width
;
p_sys
->
param
.
i_height
=
p_enc
->
fmt_in
.
video
.
i_
visible_
height
;
p_sys
->
param
.
vui
.
b_fullrange
=
fullrange
;
if
(
fabs
(
var_GetFloat
(
p_enc
,
SOUT_CFG_PREFIX
"qcomp"
)
-
0
.
60
)
>
0
.
005
)
...
...
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