Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e4e30256
Commit
e4e30256
authored
Dec 25, 2011
by
Janne Grunau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
threads: default to automatic thread count detection
parent
c11b92b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
Changelog
Changelog
+1
-0
options.c
libavcodec/options.c
+1
-1
version.h
libavcodec/version.h
+1
-1
utils.c
libavformat/utils.c
+15
-4
No files found.
Changelog
View file @
e4e30256
...
@@ -6,6 +6,7 @@ version <next>:
...
@@ -6,6 +6,7 @@ version <next>:
- Indeo 4 decoder
- Indeo 4 decoder
- SMJPEG demuxer
- SMJPEG demuxer
- Automatic thread count based on detection number of (available) CPU cores
version 0.8_beta1:
version 0.8_beta1:
...
...
libavcodec/options.c
View file @
e4e30256
...
@@ -370,7 +370,7 @@ static const AVOption options[]={
...
@@ -370,7 +370,7 @@ static const AVOption options[]={
{
"float"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
FF_AA_FLOAT
},
INT_MIN
,
INT_MAX
,
V
|
D
,
"aa"
},
{
"float"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
FF_AA_FLOAT
},
INT_MIN
,
INT_MAX
,
V
|
D
,
"aa"
},
#endif
#endif
{
"qns"
,
"quantizer noise shaping"
,
OFFSET
(
quantizer_noise_shaping
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"qns"
,
"quantizer noise shaping"
,
OFFSET
(
quantizer_noise_shaping
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"threads"
,
NULL
,
OFFSET
(
thread_count
),
AV_OPT_TYPE_INT
,
{.
dbl
=
1
},
0
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"threads"
,
NULL
,
OFFSET
(
thread_count
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"auto"
,
"detect a good number of threads"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"auto"
,
"detect a good number of threads"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
V
|
E
|
D
,
"threads"
},
{
"me_threshold"
,
"motion estimaton threshold"
,
OFFSET
(
me_threshold
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"me_threshold"
,
"motion estimaton threshold"
,
OFFSET
(
me_threshold
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"mb_threshold"
,
"macroblock threshold"
,
OFFSET
(
mb_threshold
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"mb_threshold"
,
"macroblock threshold"
,
OFFSET
(
mb_threshold
),
AV_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
...
...
libavcodec/version.h
View file @
e4e30256
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 32
#define LIBAVCODEC_VERSION_MINOR 32
#define LIBAVCODEC_VERSION_MICRO
0
#define LIBAVCODEC_VERSION_MICRO
1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
LIBAVCODEC_VERSION_MINOR, \
...
...
libavformat/utils.c
View file @
e4e30256
...
@@ -2268,9 +2268,14 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -2268,9 +2268,14 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int
i
,
count
,
ret
,
read_size
,
j
;
int
i
,
count
,
ret
,
read_size
,
j
;
AVStream
*
st
;
AVStream
*
st
;
AVPacket
pkt1
,
*
pkt
;
AVPacket
pkt1
,
*
pkt
;
AVDictionary
*
one_thread_opt
=
NULL
;
int64_t
old_offset
=
avio_tell
(
ic
->
pb
);
int64_t
old_offset
=
avio_tell
(
ic
->
pb
);
int
orig_nb_streams
=
ic
->
nb_streams
;
// new streams might appear, no options for those
int
orig_nb_streams
=
ic
->
nb_streams
;
// new streams might appear, no options for those
/* this function doesn't flush the decoders, so force thread count
* to 1 to fix behavior when thread count > number of frames in the file */
av_dict_set
(
&
one_thread_opt
,
"threads"
,
"1"
,
0
);
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
{
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
{
AVCodec
*
codec
;
AVCodec
*
codec
;
st
=
ic
->
streams
[
i
];
st
=
ic
->
streams
[
i
];
...
@@ -2300,12 +2305,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -2300,12 +2305,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
/* Ensure that subtitle_header is properly set. */
/* Ensure that subtitle_header is properly set. */
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_SUBTITLE
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_SUBTITLE
&&
codec
&&
!
st
->
codec
->
codec
)
&&
codec
&&
!
st
->
codec
->
codec
)
avcodec_open2
(
st
->
codec
,
codec
,
options
?
&
options
[
i
]
:
NULL
);
avcodec_open2
(
st
->
codec
,
codec
,
options
?
&
options
[
i
]
:
&
one_thread_opt
);
//try to just open decoders, in case this is enough to get parameters
//try to just open decoders, in case this is enough to get parameters
if
(
!
has_codec_parameters
(
st
->
codec
)){
if
(
!
has_codec_parameters
(
st
->
codec
)){
if
(
codec
&&
!
st
->
codec
->
codec
)
if
(
codec
&&
!
st
->
codec
->
codec
)
avcodec_open2
(
st
->
codec
,
codec
,
options
?
&
options
[
i
]
:
NULL
);
avcodec_open2
(
st
->
codec
,
codec
,
options
?
&
options
[
i
]
:
&
one_thread_opt
);
}
}
}
}
...
@@ -2444,7 +2450,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -2444,7 +2450,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
least one frame of codec data, this makes sure the codec initializes
least one frame of codec data, this makes sure the codec initializes
the channel configuration and does not only trust the values from the container.
the channel configuration and does not only trust the values from the container.
*/
*/
try_decode_frame
(
st
,
pkt
,
(
options
&&
i
<
orig_nb_streams
)
?
&
options
[
i
]
:
NULL
);
try_decode_frame
(
st
,
pkt
,
(
options
&&
i
<
orig_nb_streams
)
?
&
options
[
i
]
:
&
one_thread_opt
);
st
->
codec_info_nb_frames
++
;
st
->
codec_info_nb_frames
++
;
count
++
;
count
++
;
...
@@ -2549,8 +2556,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
...
@@ -2549,8 +2556,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
#endif
#endif
find_stream_info_err
:
find_stream_info_err
:
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
{
if
(
ic
->
streams
[
i
]
->
codec
)
ic
->
streams
[
i
]
->
codec
->
thread_count
=
0
;
av_freep
(
&
ic
->
streams
[
i
]
->
info
);
av_freep
(
&
ic
->
streams
[
i
]
->
info
);
}
av_dict_free
(
&
one_thread_opt
);
return
ret
;
return
ret
;
}
}
...
...
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