Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
bb255df4
Commit
bb255df4
authored
Aug 25, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile the transrate module (untested ... but now it compiles).
parent
b9004867
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
45 deletions
+62
-45
modules/stream_out/transrate/Modules.am
modules/stream_out/transrate/Modules.am
+2
-0
modules/stream_out/transrate/block.c
modules/stream_out/transrate/block.c
+2
-2
modules/stream_out/transrate/putvlc.h
modules/stream_out/transrate/putvlc.h
+7
-7
modules/stream_out/transrate/transrate.c
modules/stream_out/transrate/transrate.c
+43
-32
modules/video_filter/canvas.c
modules/video_filter/canvas.c
+8
-4
No files found.
modules/stream_out/transrate/Modules.am
View file @
bb255df4
SOURCES_stream_out_transrate = transrate.c transrate.h frame.c block.c getvlc.h putvlc.h
SOURCES_stream_out_transrate = transrate.c transrate.h frame.c block.c getvlc.h putvlc.h
libvlc_LTLIBRARIES += libstream_out_transrate_plugin.la
modules/stream_out/transrate/block.c
View file @
bb255df4
...
@@ -149,7 +149,7 @@ static const uint8_t map_non_linear_mquant[113] =
...
@@ -149,7 +149,7 @@ static const uint8_t map_non_linear_mquant[113] =
int
scale_quant
(
transrate_t
*
tr
,
double
qrate
)
int
scale_quant
(
transrate_t
*
tr
,
double
qrate
)
{
{
int
i_quant
=
(
int
)
floor
(
tr
->
quantizer_scale
*
qrate
+
0
.
5
);
int
i_quant
=
floor
(
tr
->
quantizer_scale
*
qrate
+
0
.
5
);
if
(
tr
->
q_scale_type
)
if
(
tr
->
q_scale_type
)
{
{
...
@@ -171,7 +171,7 @@ int scale_quant( transrate_t *tr, double qrate )
...
@@ -171,7 +171,7 @@ int scale_quant( transrate_t *tr, double qrate )
return
i_quant
;
return
i_quant
;
}
}
int
increment_quant
(
transrate_t
*
tr
,
int
i_quant
)
static
int
increment_quant
(
transrate_t
*
tr
,
int
i_quant
)
{
{
if
(
tr
->
q_scale_type
)
if
(
tr
->
q_scale_type
)
{
{
...
...
modules/stream_out/transrate/putvlc.h
View file @
bb255df4
...
@@ -51,7 +51,7 @@ typedef struct
...
@@ -51,7 +51,7 @@ typedef struct
* 'macroblock_escape' is treated elsewhere
* 'macroblock_escape' is treated elsewhere
*/
*/
const
static
VLCtable
addrinctab
[
33
]
=
static
const
VLCtable
addrinctab
[
33
]
=
{
{
{
0x01
,
1
},
{
0x03
,
3
},
{
0x02
,
3
},
{
0x03
,
4
},
{
0x01
,
1
},
{
0x03
,
3
},
{
0x02
,
3
},
{
0x03
,
4
},
{
0x02
,
4
},
{
0x03
,
5
},
{
0x02
,
5
},
{
0x07
,
7
},
{
0x02
,
4
},
{
0x03
,
5
},
{
0x02
,
5
},
{
0x07
,
7
},
...
@@ -70,7 +70,7 @@ const static VLCtable addrinctab[33]=
...
@@ -70,7 +70,7 @@ const static VLCtable addrinctab[33]=
* indexed by [macroblock_type]
* indexed by [macroblock_type]
*/
*/
const
static
VLCtable
mbtypetab
[
3
][
32
]
=
static
const
VLCtable
mbtypetab
[
3
][
32
]
=
{
{
/* I */
/* I */
{
{
...
@@ -107,7 +107,7 @@ const static VLCtable mbtypetab[3][32]=
...
@@ -107,7 +107,7 @@ const static VLCtable mbtypetab[3][32]=
* indexed by [coded_block_pattern]
* indexed by [coded_block_pattern]
*/
*/
const
static
VLCtable
cbptable
[
64
]
=
static
const
VLCtable
cbptable
[
64
]
=
{
{
{
0x01
,
9
},
{
0x0b
,
5
},
{
0x09
,
5
},
{
0x0d
,
6
},
{
0x01
,
9
},
{
0x0b
,
5
},
{
0x09
,
5
},
{
0x0d
,
6
},
{
0x0d
,
4
},
{
0x17
,
7
},
{
0x13
,
7
},
{
0x1f
,
8
},
{
0x0d
,
4
},
{
0x17
,
7
},
{
0x13
,
7
},
{
0x1f
,
8
},
...
@@ -136,7 +136,7 @@ const static VLCtable cbptable[64]=
...
@@ -136,7 +136,7 @@ const static VLCtable cbptable[64]=
* codes do not include s (sign bit)
* codes do not include s (sign bit)
*/
*/
const
static
VLCtable
dct_code_tab1
[
2
][
40
]
=
static
const
VLCtable
dct_code_tab1
[
2
][
40
]
=
{
{
/* run = 0, level = 1...40 */
/* run = 0, level = 1...40 */
{
{
...
@@ -166,7 +166,7 @@ const static VLCtable dct_code_tab1[2][40]=
...
@@ -166,7 +166,7 @@ const static VLCtable dct_code_tab1[2][40]=
}
}
};
};
const
static
VLCtable
dct_code_tab2
[
30
][
5
]
=
static
const
VLCtable
dct_code_tab2
[
30
][
5
]
=
{
{
/* run = 2...31, level = 1...5 */
/* run = 2...31, level = 1...5 */
{{
0x05
,
4
},
{
0x04
,
7
},
{
0x0b
,
10
},
{
0x14
,
12
},
{
0x14
,
13
}},
{{
0x05
,
4
},
{
0x04
,
7
},
{
0x0b
,
10
},
{
0x14
,
12
},
{
0x14
,
13
}},
...
@@ -210,7 +210,7 @@ const static VLCtable dct_code_tab2[30][5]=
...
@@ -210,7 +210,7 @@ const static VLCtable dct_code_tab2[30][5]=
* codes do not include s (sign bit)
* codes do not include s (sign bit)
*/
*/
const
static
VLCtable
dct_code_tab1a
[
2
][
40
]
=
static
const
VLCtable
dct_code_tab1a
[
2
][
40
]
=
{
{
/* run = 0, level = 1...40 */
/* run = 0, level = 1...40 */
{
{
...
@@ -240,7 +240,7 @@ const static VLCtable dct_code_tab1a[2][40]=
...
@@ -240,7 +240,7 @@ const static VLCtable dct_code_tab1a[2][40]=
}
}
};
};
const
static
VLCtable
dct_code_tab2a
[
30
][
5
]
=
static
const
VLCtable
dct_code_tab2a
[
30
][
5
]
=
{
{
/* run = 2...31, level = 1...5 */
/* run = 2...31, level = 1...5 */
{{
0x05
,
5
},
{
0x07
,
7
},
{
0xfc
,
8
},
{
0x0c
,
10
},
{
0x14
,
13
}},
{{
0x05
,
5
},
{
0x07
,
7
},
{
0xfc
,
8
},
{
0x0c
,
10
},
{
0x14
,
13
}},
...
...
modules/stream_out/transrate/transrate.c
View file @
bb255df4
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_sout.h>
#include <vlc_input.h>
#include <vlc_input.h>
#include <vlc_block.h>
#include "transrate.h"
#include "transrate.h"
...
@@ -55,6 +56,21 @@ static int transrate_video_process( sout_stream_t *, sout_stream_id_t *, block_
...
@@ -55,6 +56,21 @@ static int transrate_video_process( sout_stream_t *, sout_stream_id_t *, block_
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
#define VB_TEXT N_("Video bitrate")
#define VB_LONGTEXT N_( \
"... FIXME ..." )
#define SHAPING_TEXT N_("Shaping delay")
#define SHAPING_LONGTEXT N_( \
"... FIXME ..." )
#define MPEG4_MATRIX_TEXT N_("Use MPEG4 matrix")
#define MPEG4_MATRIX_LONGTEXT N_( \
"... FIXME ..." )
#define SOUT_CFG_PREFIX "sout-transrate-"
vlc_module_begin
();
vlc_module_begin
();
set_category
(
CAT_SOUT
);
set_category
(
CAT_SOUT
);
set_subcategory
(
SUBCAT_SOUT_STREAM
);
set_subcategory
(
SUBCAT_SOUT_STREAM
);
...
@@ -62,8 +78,19 @@ vlc_module_begin();
...
@@ -62,8 +78,19 @@ vlc_module_begin();
set_capability
(
"sout stream"
,
50
);
set_capability
(
"sout stream"
,
50
);
add_shortcut
(
"transrate"
);
add_shortcut
(
"transrate"
);
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
add_integer
(
SOUT_CFG_PREFIX
"vb"
,
3
*
100
*
1000
,
NULL
,
VB_TEXT
,
VB_LONGTEXT
,
false
);
add_integer
(
SOUT_CFG_PREFIX
"shaping"
,
500
,
NULL
,
SHAPING_TEXT
,
SHAPING_LONGTEXT
,
false
);
add_bool
(
SOUT_CFG_PREFIX
"mpeg4-matrix"
,
false
,
NULL
,
MPEG4_MATRIX_TEXT
,
MPEG4_MATRIX_LONGTEXT
,
false
);
vlc_module_end
();
vlc_module_end
();
static
const
char
*
const
ppsz_sout_options
[]
=
{
"vb"
,
"shaping"
,
"mpeg4-matrix"
,
NULL
};
struct
sout_stream_sys_t
struct
sout_stream_sys_t
{
{
sout_stream_t
*
p_out
;
sout_stream_t
*
p_out
;
...
@@ -82,44 +109,28 @@ static int Open( vlc_object_t *p_this )
...
@@ -82,44 +109,28 @@ static int Open( vlc_object_t *p_this )
{
{
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_sys_t
*
p_sys
;
sout_stream_sys_t
*
p_sys
;
char
*
val
;
p_sys
=
malloc
(
sizeof
(
sout_stream_sys_t
)
);
p_sys
=
malloc
(
sizeof
(
sout_stream_sys_t
)
);
p_sys
->
p_out
=
sout_StreamNew
(
p_stream
->
p_sout
,
p_stream
->
psz_next
);
p_sys
->
p_out
=
sout_StreamNew
(
p_stream
->
p_sout
,
p_stream
->
psz_next
);
p_sys
->
i_vbitrate
=
0
;
config_ChainParse
(
p_stream
,
SOUT_CFG_PREFIX
,
ppsz_sout_options
,
p_stream
->
p_cfg
);
if
(
(
val
=
sout_cfg_find_value
(
p_stream
->
p_cfg
,
"vb"
)
)
)
p_sys
->
i_vbitrate
=
var_CreateGetInteger
(
p_stream
,
SOUT_CFG_PREFIX
"vb"
);
{
if
(
p_sys
->
i_vbitrate
<
16000
)
p_sys
->
i_vbitrate
=
atoi
(
val
);
p_sys
->
i_vbitrate
*=
1000
;
if
(
p_sys
->
i_vbitrate
<
16000
)
{
p_sys
->
i_vbitrate
*=
1000
;
}
}
else
{
p_sys
->
i_vbitrate
=
3000000
;
}
p_sys
->
i_shaping_delay
=
500000
;
p_sys
->
i_shaping_delay
=
var_CreateGetInteger
(
p_stream
,
if
(
(
val
=
sout_cfg_find_value
(
p_stream
->
p_cfg
,
"shaping"
)
)
)
SOUT_CFG_PREFIX
"shaping"
)
*
1000
;
if
(
p_sys
->
i_shaping_delay
<=
0
)
{
{
p_sys
->
i_shaping_delay
=
(
int64_t
)
atoi
(
val
)
*
1000
;
msg_Err
(
p_stream
,
if
(
p_sys
->
i_shaping_delay
<=
0
)
"invalid shaping (%"
PRId64
"ms) reseting to 500ms"
,
{
p_sys
->
i_shaping_delay
/
1000
);
msg_Err
(
p_stream
,
p_sys
->
i_shaping_delay
=
500000
;
"invalid shaping (%"
PRId64
"ms) reseting to 500ms"
,
p_sys
->
i_shaping_delay
/
1000
);
p_sys
->
i_shaping_delay
=
500000
;
}
}
}
p_sys
->
b_mpeg4_matrix
=
0
;
p_sys
->
b_mpeg4_matrix
=
var_CreateGetBool
(
p_stream
,
if
(
sout_cfg_find
(
p_stream
->
p_cfg
,
"mpeg4-matrix"
)
)
SOUT_CFG_PREFIX
"mpeg4-matrix"
);
{
p_sys
->
b_mpeg4_matrix
=
1
;
}
msg_Dbg
(
p_stream
,
"codec video %dkb/s max gop=%"
PRId64
"us"
,
msg_Dbg
(
p_stream
,
"codec video %dkb/s max gop=%"
PRId64
"us"
,
p_sys
->
i_vbitrate
/
1024
,
p_sys
->
i_shaping_delay
);
p_sys
->
i_vbitrate
/
1024
,
p_sys
->
i_shaping_delay
);
...
@@ -308,11 +319,11 @@ static int transrate_video_process( sout_stream_t *p_stream,
...
@@ -308,11 +319,11 @@ static int transrate_video_process( sout_stream_t *p_stream,
i_new_bitrate
=
(
mtime_t
)
tr
->
i_current_output
*
8000
i_new_bitrate
=
(
mtime_t
)
tr
->
i_current_output
*
8000
/
(
id
->
i_next_gop_duration
/
1000
);
/
(
id
->
i_next_gop_duration
/
1000
);
if
(
i_new_bitrate
>
p_stream
->
p_sys
->
i_vbitrate
+
300000
)
if
(
i_new_bitrate
>
p_stream
->
p_sys
->
i_vbitrate
+
300000
)
msg_Err
(
p_stream
,
"%
lld -> %lld d=%lld"
,
msg_Err
(
p_stream
,
"%
"
PRId64
" -> %"
PRId64
" d=%"
PRId64
,
i_bitrate
,
i_new_bitrate
,
i_bitrate
,
i_new_bitrate
,
id
->
i_next_gop_duration
);
id
->
i_next_gop_duration
);
else
else
msg_Dbg
(
p_stream
,
"%
lld -> %lld d=%lld"
,
msg_Dbg
(
p_stream
,
"%
"
PRId64
" -> %"
PRId64
" d=%"
PRId64
,
i_bitrate
,
i_new_bitrate
,
i_bitrate
,
i_new_bitrate
,
id
->
i_next_gop_duration
);
id
->
i_next_gop_duration
);
}
}
...
...
modules/video_filter/canvas.c
View file @
bb255df4
...
@@ -162,13 +162,17 @@ static int Activate( vlc_object_t *p_this )
...
@@ -162,13 +162,17 @@ static int Activate( vlc_object_t *p_this )
es_format_Copy
(
&
fmt
,
&
p_filter
->
fmt_in
);
es_format_Copy
(
&
fmt
,
&
p_filter
->
fmt_in
);
fmt
.
video
.
i_width
=
i_width
;
fmt
.
video
.
i_width
=
i_width
;
fmt
.
video
.
i_height
=
(
p_filter
->
fmt_in
.
video
.
i_height
*
i_width
)
fmt
.
video
.
i_height
=
(
p_filter
->
fmt_in
.
video
.
i_height
*
i_width
*
/
p_filter
->
fmt_in
.
video
.
i_width
;
VOUT_ASPECT_FACTOR
)
/
(
p_filter
->
fmt_in
.
video
.
i_width
*
p_filter
->
fmt_in
.
video
.
i_aspect
);
if
(
fmt
.
video
.
i_height
>
i_height
)
if
(
fmt
.
video
.
i_height
>
i_height
)
{
{
fmt
.
video
.
i_height
=
i_height
;
fmt
.
video
.
i_height
=
i_height
;
fmt
.
video
.
i_width
=
(
p_filter
->
fmt_in
.
video
.
i_width
*
i_height
)
fmt
.
video
.
i_width
=
(
p_filter
->
fmt_in
.
video
.
i_width
*
i_height
*
/
p_filter
->
fmt_in
.
video
.
i_height
;
p_filter
->
fmt_in
.
video
.
i_aspect
)
/
(
p_filter
->
fmt_in
.
video
.
i_height
*
VOUT_ASPECT_FACTOR
);
if
(
fmt
.
video
.
i_width
&
1
)
fmt
.
video
.
i_width
-=
1
;
if
(
fmt
.
video
.
i_width
&
1
)
fmt
.
video
.
i_width
-=
1
;
i_padd
=
i_width
-
fmt
.
video
.
i_width
;
i_padd
=
i_width
-
fmt
.
video
.
i_width
;
/* Gruik */
/* Gruik */
...
...
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