Compare commits
244 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e72c0a0466 | ||
![]() |
dfddefa13a | ||
![]() |
ce94955b3c | ||
![]() |
dde95268cc | ||
![]() |
d20ac551a8 | ||
![]() |
352b0969e2 | ||
![]() |
b479b42b26 | ||
![]() |
36cab9c408 | ||
![]() |
34592d04fb | ||
![]() |
544accc895 | ||
![]() |
f41622ecb4 | ||
![]() |
fc8eb4c1f9 | ||
![]() |
02bae9f013 | ||
![]() |
5cb2a1c3f0 | ||
![]() |
a221c9bd76 | ||
![]() |
b2583c2b62 | ||
![]() |
bd553941ae | ||
![]() |
e0aa76d38a | ||
![]() |
a014b9614e | ||
![]() |
31c21d2f69 | ||
![]() |
3cd1c8653b | ||
![]() |
194485cfba | ||
![]() |
81cfe39113 | ||
![]() |
ef0c503d37 | ||
![]() |
1103aec1df | ||
![]() |
b40ab81d1f | ||
![]() |
314f055c29 | ||
![]() |
2c566744c4 | ||
![]() |
adad1ba5d8 | ||
![]() |
a80a7131d1 | ||
![]() |
3ab63abbd4 | ||
![]() |
d2c76782e0 | ||
![]() |
4dc8b4d7d0 | ||
![]() |
9ff0467566 | ||
![]() |
4407b38b28 | ||
![]() |
8caaf260a6 | ||
![]() |
e1f51bbd1f | ||
![]() |
4b7c149306 | ||
![]() |
e8919d6522 | ||
![]() |
b017785fa5 | ||
![]() |
01507eb1f8 | ||
![]() |
938ff93710 | ||
![]() |
0c88d539f8 | ||
![]() |
e39a992bd1 | ||
![]() |
72a12f61ef | ||
![]() |
30ae080e9d | ||
![]() |
dca463b728 | ||
![]() |
25b462cab9 | ||
![]() |
7c6a8afa7e | ||
![]() |
b052525f9b | ||
![]() |
90c7bfb9be | ||
![]() |
7bdd348e58 | ||
![]() |
af3d003658 | ||
![]() |
c00beff5e0 | ||
![]() |
57a43142ba | ||
![]() |
99905118a8 | ||
![]() |
dcf560204c | ||
![]() |
5b0e2eb041 | ||
![]() |
d461e077a5 | ||
![]() |
9a884b7b97 | ||
![]() |
9abe0bfb7f | ||
![]() |
13682b48e9 | ||
![]() |
f25e6e0c25 | ||
![]() |
80239a8bb1 | ||
![]() |
26bbc1c242 | ||
![]() |
efe259a27e | ||
![]() |
49f11e12d5 | ||
![]() |
d130fae519 | ||
![]() |
dde996bf99 | ||
![]() |
cad2958fd7 | ||
![]() |
29d61d73b1 | ||
![]() |
9a6a710998 | ||
![]() |
daaef403d1 | ||
![]() |
207f5a138a | ||
![]() |
e9c8a9aaa6 | ||
![]() |
7b7d8b8794 | ||
![]() |
90d6b563fe | ||
![]() |
dce2f820e9 | ||
![]() |
4aab3f868f | ||
![]() |
48609236da | ||
![]() |
d8fe695779 | ||
![]() |
0f42e06651 | ||
![]() |
230c4c6ad9 | ||
![]() |
f4489c9558 | ||
![]() |
0e5d9fe2a7 | ||
![]() |
9ae2aaea50 | ||
![]() |
2513314912 | ||
![]() |
e727cbf0be | ||
![]() |
bcc25353cf | ||
![]() |
6a10263f16 | ||
![]() |
bcc6429c01 | ||
![]() |
bdb219435e | ||
![]() |
a7338ae8ac | ||
![]() |
6776c2c04f | ||
![]() |
facd3dbc6e | ||
![]() |
8796c3b7d3 | ||
![]() |
7430f3064f | ||
![]() |
eac281b06c | ||
![]() |
b5210f4eae | ||
![]() |
10379d50be | ||
![]() |
cd874cf8e6 | ||
![]() |
82a3e469c6 | ||
![]() |
f859fed03d | ||
![]() |
991e6fa35b | ||
![]() |
09dca51066 | ||
![]() |
40de74d0eb | ||
![]() |
e2811c2ede | ||
![]() |
25d14b716a | ||
![]() |
f1de93dec3 | ||
![]() |
738d68de85 | ||
![]() |
00ecce5c8b | ||
![]() |
6ba07e9948 | ||
![]() |
125bea15d1 | ||
![]() |
70e3cc282b | ||
![]() |
242df26b44 | ||
![]() |
46c2dba20e | ||
![]() |
3caa6a5a57 | ||
![]() |
bf08665e2e | ||
![]() |
c4f5f4dbd3 | ||
![]() |
29df24252a | ||
![]() |
b920c1d5ad | ||
![]() |
2b9ee7d5b9 | ||
![]() |
f800cacada | ||
![]() |
5227eac5b0 | ||
![]() |
bb40f8f5e2 | ||
![]() |
ad8bf22086 | ||
![]() |
7f8804296d | ||
![]() |
f67e75b5dc | ||
![]() |
35e63f35b0 | ||
![]() |
3bfb7a2537 | ||
![]() |
4a1e7a6fb7 | ||
![]() |
ff1e982205 | ||
![]() |
bb116e6ba3 | ||
![]() |
ebe356bf1c | ||
![]() |
30099413ec | ||
![]() |
186e0ff067 | ||
![]() |
2642ad9f55 | ||
![]() |
95ddd2227b | ||
![]() |
3faebed6fa | ||
![]() |
3aee1fa5b6 | ||
![]() |
89a9c84ebb | ||
![]() |
0adde39e04 | ||
![]() |
03ae616b19 | ||
![]() |
830c3058ff | ||
![]() |
b12c5cbbb2 | ||
![]() |
82c96b5ad8 | ||
![]() |
3e4b957847 | ||
![]() |
cbabbe8220 | ||
![]() |
80122a3af3 | ||
![]() |
a475755b3a | ||
![]() |
66030e8133 | ||
![]() |
46f8d838b3 | ||
![]() |
bc3648d4b4 | ||
![]() |
27e6b4a3ff | ||
![]() |
b82860caa7 | ||
![]() |
3d05625136 | ||
![]() |
ddd3301bad | ||
![]() |
123981930f | ||
![]() |
3171e2360a | ||
![]() |
3533a850e7 | ||
![]() |
6d56bc9a6d | ||
![]() |
2c5e1d0933 | ||
![]() |
b37b83214a | ||
![]() |
6d7ab09788 | ||
![]() |
227cfc1f10 | ||
![]() |
416847d195 | ||
![]() |
bd4ad1a1d5 | ||
![]() |
6230de03aa | ||
![]() |
45acc228a6 | ||
![]() |
d37fac6dbb | ||
![]() |
7940306a47 | ||
![]() |
eabefe83f4 | ||
![]() |
eaa79b79b2 | ||
![]() |
c761379825 | ||
![]() |
ea3309eba7 | ||
![]() |
1c1e252cd1 | ||
![]() |
ca2c9d6b9b | ||
![]() |
fa6b99d351 | ||
![]() |
d79cb6947e | ||
![]() |
5aa4b29bbe | ||
![]() |
e4cbd0d6e5 | ||
![]() |
0ede7b5344 | ||
![]() |
5b933be089 | ||
![]() |
f2693e98b4 | ||
![]() |
c3861e14ce | ||
![]() |
daa5a988e2 | ||
![]() |
db67b7c31b | ||
![]() |
a643a47d41 | ||
![]() |
23af29e882 | ||
![]() |
7d995cd1b8 | ||
![]() |
72a58c0772 | ||
![]() |
d525423006 | ||
![]() |
4b476e6aa4 | ||
![]() |
124c78fd44 | ||
![]() |
a1ab3300c8 | ||
![]() |
1af235f6b3 | ||
![]() |
82031e41f8 | ||
![]() |
222e7549a7 | ||
![]() |
eb2244ece9 | ||
![]() |
b967c10029 | ||
![]() |
7ff4cd2acc | ||
![]() |
c4149c4d54 | ||
![]() |
8ad2f45964 | ||
![]() |
5df52b0131 | ||
![]() |
596d3e20ae | ||
![]() |
00d5ff6431 | ||
![]() |
437179e9c8 | ||
![]() |
031d3b66c2 | ||
![]() |
b76871d870 | ||
![]() |
15ae305007 | ||
![]() |
3c72204ae0 | ||
![]() |
ba21499648 | ||
![]() |
7933039ade | ||
![]() |
4015829acc | ||
![]() |
39dc4a6bb3 | ||
![]() |
a6a2d8eb8f | ||
![]() |
58556826a8 | ||
![]() |
bc2c9a479a | ||
![]() |
9cc22be032 | ||
![]() |
33e1bca651 | ||
![]() |
9841617b7f | ||
![]() |
2897481f64 | ||
![]() |
646c564de5 | ||
![]() |
cd6281abef | ||
![]() |
697be8173b | ||
![]() |
1853d8bb7a | ||
![]() |
1779cd7695 | ||
![]() |
bb4820727f | ||
![]() |
affc7687d3 | ||
![]() |
3569470693 | ||
![]() |
1d1df82093 | ||
![]() |
de187e3e9e | ||
![]() |
7754d48381 | ||
![]() |
63169474b3 | ||
![]() |
b3f106cb1f | ||
![]() |
9b6ccf0f24 | ||
![]() |
298d66c8de | ||
![]() |
4be1b68d52 | ||
![]() |
92edc13d69 | ||
![]() |
c9f015f1c6 | ||
![]() |
db6b2ca0b3 | ||
![]() |
3503ec8461 | ||
![]() |
ecc5e42d92 | ||
![]() |
f87ce262f6 |
@ -1,9 +1,6 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>
|
||||
|
||||
|
||||
version 2.2:
|
||||
|
||||
- HNM version 4 demuxer and video decoder
|
||||
@ -31,6 +28,7 @@ version 2.2:
|
||||
- Support DNx444
|
||||
- libx265 encoder
|
||||
- dejudder filter
|
||||
- Autodetect VDA like all other hardware accelerations
|
||||
|
||||
|
||||
version 2.1:
|
||||
|
11
configure
vendored
11
configure
vendored
@ -149,7 +149,7 @@ Component options:
|
||||
Hardware accelerators:
|
||||
--disable-dxva2 disable DXVA2 code [autodetect]
|
||||
--disable-vaapi disable VAAPI code [autodetect]
|
||||
--enable-vda enable VDA code
|
||||
--disable-vda disable VDA code [autodetect]
|
||||
--disable-vdpau disable VDPAU code [autodetect]
|
||||
|
||||
Individual component options:
|
||||
@ -2504,7 +2504,7 @@ enable static
|
||||
enable swscale_alpha
|
||||
|
||||
# Enable hwaccels by default.
|
||||
enable dxva2 vaapi vdpau xvmc
|
||||
enable dxva2 vaapi vda vdpau xvmc
|
||||
|
||||
# build settings
|
||||
SHFLAGS='-shared -Wl,-soname,$$(@F)'
|
||||
@ -3324,6 +3324,9 @@ if test -n "$sysroot"; then
|
||||
gcc|llvm_gcc|clang)
|
||||
add_cppflags --sysroot="$sysroot"
|
||||
add_ldflags --sysroot="$sysroot"
|
||||
# On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
|
||||
add_cppflags -isysroot "$sysroot"
|
||||
add_ldflags -isysroot "$sysroot"
|
||||
;;
|
||||
tms470)
|
||||
add_cppflags -I"$sysinclude"
|
||||
@ -3661,6 +3664,10 @@ case "$arch" in
|
||||
check_64bit ppc ppc64 'sizeof(void *) > 4'
|
||||
spic=$shared
|
||||
;;
|
||||
s390)
|
||||
check_64bit s390 s390x 'sizeof(void *) > 4'
|
||||
spic=$shared
|
||||
;;
|
||||
sparc)
|
||||
check_64bit sparc sparc64 'sizeof(void *) > 4'
|
||||
spic=$shared
|
||||
|
@ -15,6 +15,9 @@ libavutil: 2012-10-22
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2014-03-18 - e9c8a9a - lsws 2.5.102
|
||||
Make gray16 full-scale.
|
||||
|
||||
2014-xx-xx - xxxxxxx - lavu 53.05.0 - frame.h
|
||||
Add av_frame_copy() for copying the frame data.
|
||||
|
||||
|
@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER = 2.2.1
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@ -62,7 +62,7 @@ AC-3 audio decoder.
|
||||
This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as
|
||||
the undocumented RealAudio 3 (a.k.a. dnet).
|
||||
|
||||
@subsubsection AC-3 Decoder Options
|
||||
@subsection AC-3 Decoder Options
|
||||
|
||||
@table @option
|
||||
|
||||
|
@ -1271,7 +1271,7 @@ Requires the presence of the libtheora headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libtheora}.
|
||||
|
||||
For more informations about the libtheora project see
|
||||
For more information about the libtheora project see
|
||||
@url{http://www.theora.org/}.
|
||||
|
||||
@subsection Options
|
||||
|
@ -119,8 +119,10 @@ int main(int argc, char *argv[])
|
||||
end:
|
||||
avformat_close_input(&fmt_ctx);
|
||||
/* note: the internal buffer could have changed, and be != avio_ctx_buffer */
|
||||
av_freep(&avio_ctx->buffer);
|
||||
av_freep(&avio_ctx);
|
||||
if (avio_ctx) {
|
||||
av_freep(&avio_ctx->buffer);
|
||||
av_freep(&avio_ctx);
|
||||
}
|
||||
av_file_unmap(buffer, buffer_size);
|
||||
|
||||
if (ret < 0) {
|
||||
|
@ -111,7 +111,7 @@ must be configured in the stream configuration. They are sent to
|
||||
the @command{ffmpeg} encoders.
|
||||
|
||||
The @command{ffmpeg} @option{override_ffserver} commandline option
|
||||
allows to override the encoding parameters set by the server.
|
||||
allows one to override the encoding parameters set by the server.
|
||||
|
||||
Multiple streams can be connected to the same feed.
|
||||
|
||||
|
@ -162,6 +162,27 @@ libzvbi is licensed under the GNU General Public License Version 2 or later
|
||||
you must upgrade FFmpeg's license to GPL in order to use it.
|
||||
@end float
|
||||
|
||||
@section AviSynth
|
||||
|
||||
FFmpeg can read AviSynth scripts as input. To enable support, pass
|
||||
@code{--enable-avisynth} to configure. The correct headers are
|
||||
included in compat/avisynth/, which allows the user to enable support
|
||||
without needing to search for these headers themselves.
|
||||
|
||||
For Windows, supported AviSynth variants are
|
||||
@url{http://avisynth.nl, AviSynth 2.5 or 2.6} for 32-bit builds and
|
||||
@url{http://avs-plus.net, AviSynth+ 0.1} for 32-bit and 64-bit builds.
|
||||
|
||||
For Linux and OS X, the supported AviSynth variant is
|
||||
@url{https://github.com/avxsynth/avxsynth, AvxSynth}.
|
||||
|
||||
@float NOTE
|
||||
AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg
|
||||
with @code{--enable-avisynth}, and the binaries will work regardless of the
|
||||
end user having AviSynth or AvxSynth installed - they'll only need to be
|
||||
installed to use AviSynth scripts (obviously).
|
||||
@end float
|
||||
|
||||
|
||||
@chapter Supported File Formats, Codecs or Features
|
||||
|
||||
|
@ -216,7 +216,7 @@ OpenGL output device.
|
||||
|
||||
To enable this output device you need to configure FFmpeg with @code{--enable-opengl}.
|
||||
|
||||
Device allows to render to OpenGL context.
|
||||
This output device allows one to render to OpenGL context.
|
||||
Context may be provided by application or default SDL window is created.
|
||||
|
||||
When device renders to external context, application must implement handlers for following messages:
|
||||
|
@ -51,8 +51,9 @@ The toolchain provided with Xcode is sufficient to build the basic
|
||||
unacelerated code.
|
||||
|
||||
Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
|
||||
@url{https://github.com/FFmpeg/gas-preprocessor} or
|
||||
@url{http://github.com/yuvi/gas-preprocessor} to build the optimized
|
||||
assembler functions. Just download the Perl script and put it somewhere
|
||||
assembler functions. Put the Perl script somewhere
|
||||
in your PATH, FFmpeg's configure will pick it up automatically.
|
||||
|
||||
Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
|
||||
|
@ -213,7 +213,7 @@ m3u8 files.
|
||||
|
||||
HTTP (Hyper Text Transfer Protocol).
|
||||
|
||||
This protocol accepts the following options.
|
||||
This protocol accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item seekable
|
||||
@ -223,32 +223,33 @@ if set to -1 it will try to autodetect if it is seekable. Default
|
||||
value is -1.
|
||||
|
||||
@item chunked_post
|
||||
If set to 1 use chunked transfer-encoding for posts, default is 1.
|
||||
If set to 1 use chunked Transfer-Encoding for posts, default is 1.
|
||||
|
||||
@item content_type
|
||||
Set a specific content type for the POST messages.
|
||||
|
||||
@item headers
|
||||
Set custom HTTP headers, can override built in default headers. The
|
||||
value must be a string encoding the headers.
|
||||
|
||||
@item content_type
|
||||
Force a content type.
|
||||
|
||||
@item user-agent
|
||||
Override User-Agent header. If not specified the protocol will use a
|
||||
string describing the libavformat build.
|
||||
|
||||
@item multiple_requests
|
||||
Use persistent connections if set to 1. By default it is 0.
|
||||
Use persistent connections if set to 1, default is 0.
|
||||
|
||||
@item post_data
|
||||
Set custom HTTP post data.
|
||||
|
||||
@item user-agent
|
||||
@item user_agent
|
||||
Override the User-Agent header. If not specified the protocol will use a
|
||||
string describing the libavformat build. ("Lavf/<version>")
|
||||
|
||||
@item timeout
|
||||
Set timeout of socket I/O operations used by the underlying low level
|
||||
operation. By default it is set to -1, which means that the timeout is
|
||||
not specified.
|
||||
|
||||
@item mime_type
|
||||
Set MIME type.
|
||||
Export the MIME type.
|
||||
|
||||
@item icy
|
||||
If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
|
||||
@ -257,17 +258,25 @@ the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
|
||||
The default is 0.
|
||||
|
||||
@item icy_metadata_headers
|
||||
If the server supports ICY metadata, this contains the ICY specific HTTP reply
|
||||
headers, separated with newline characters.
|
||||
If the server supports ICY metadata, this contains the ICY-specific HTTP reply
|
||||
headers, separated by newline characters.
|
||||
|
||||
@item icy_metadata_packet
|
||||
If the server supports ICY metadata, and @option{icy} was set to 1, this
|
||||
contains the last non-empty metadata packet sent by the server.
|
||||
contains the last non-empty metadata packet sent by the server. It should be
|
||||
polled in regular intervals by applications interested in mid-stream metadata
|
||||
updates.
|
||||
|
||||
@item cookies
|
||||
Set the cookies to be sent in future requests. The format of each cookie is the
|
||||
same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
|
||||
delimited by a newline character.
|
||||
|
||||
@item offset
|
||||
Set initial byte offset.
|
||||
|
||||
@item end_offset
|
||||
Try to limit the request to bytes preceding this offset.
|
||||
@end table
|
||||
|
||||
@subsection HTTP Cookies
|
||||
|
@ -35,7 +35,7 @@ Select nearest neighbor rescaling algorithm.
|
||||
@item area
|
||||
Select averaging area rescaling algorithm.
|
||||
|
||||
@item bicubiclin
|
||||
@item bicublin
|
||||
Select bicubic scaling algorithm for the luma component, bilinear for
|
||||
chroma components.
|
||||
|
||||
|
@ -327,10 +327,11 @@ die "No filename or title\n" unless defined $fn && defined $tl;
|
||||
$chapters{NAME} = "$fn \- $tl\n";
|
||||
$chapters{FOOTNOTES} .= "=back\n" if exists $chapters{FOOTNOTES};
|
||||
|
||||
# always use utf8
|
||||
print "=encoding utf8\n\n";
|
||||
|
||||
unshift @chapters_sequence, "NAME";
|
||||
for $chapter (@chapters_sequence) {
|
||||
# always use utf8
|
||||
print "=encoding utf8\n";
|
||||
if (exists $chapters{$chapter}) {
|
||||
$head = uc($chapter);
|
||||
print "=head1 $head\n\n";
|
||||
|
2
ffmpeg.c
2
ffmpeg.c
@ -323,7 +323,7 @@ sigterm_handler(int sig)
|
||||
received_nb_signals++;
|
||||
term_exit();
|
||||
if(received_nb_signals > 3)
|
||||
exit_program(123);
|
||||
exit(123);
|
||||
}
|
||||
|
||||
void term_init(void)
|
||||
|
@ -1821,7 +1821,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
|
||||
/* subtitles: pick first */
|
||||
MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
|
||||
if (!o->subtitle_disable && (oc->oformat->subtitle_codec != AV_CODEC_ID_NONE || subtitle_codec_name)) {
|
||||
if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
|
||||
for (i = 0; i < nb_input_streams; i++)
|
||||
if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
new_subtitle_stream(o, oc, i);
|
||||
|
@ -119,7 +119,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
}
|
||||
|
||||
if ((avctx->bits_per_coded_sample & 0x1f) <= 8) {
|
||||
if (avctx->bits_per_coded_sample <= 8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt,
|
||||
AV_PKT_DATA_PALETTE,
|
||||
NULL);
|
||||
|
@ -26,7 +26,6 @@ OBJS = allcodecs.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
raw.o \
|
||||
rawdec.o \
|
||||
resample.o \
|
||||
resample2.o \
|
||||
utils.o \
|
||||
|
@ -471,9 +471,11 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_
|
||||
* @param[out] coded_samples set to the number of samples as coded in the
|
||||
* packet, or 0 if the codec does not encode the
|
||||
* number of samples in each frame.
|
||||
* @param[out] approx_nb_samples set to non-zero if the number of samples
|
||||
* returned is an approximation.
|
||||
*/
|
||||
static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
int buf_size, int *coded_samples)
|
||||
int buf_size, int *coded_samples, int *approx_nb_samples)
|
||||
{
|
||||
ADPCMDecodeContext *s = avctx->priv_data;
|
||||
int nb_samples = 0;
|
||||
@ -482,6 +484,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
int header_size;
|
||||
|
||||
*coded_samples = 0;
|
||||
*approx_nb_samples = 0;
|
||||
|
||||
if(ch <= 0)
|
||||
return 0;
|
||||
@ -552,10 +555,12 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
case AV_CODEC_ID_ADPCM_EA_R2:
|
||||
header_size = 4 + 5 * ch;
|
||||
*coded_samples = bytestream2_get_le32(gb);
|
||||
*approx_nb_samples = 1;
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_EA_R3:
|
||||
header_size = 4 + 5 * ch;
|
||||
*coded_samples = bytestream2_get_be32(gb);
|
||||
*approx_nb_samples = 1;
|
||||
break;
|
||||
}
|
||||
*coded_samples -= *coded_samples % 28;
|
||||
@ -663,11 +668,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int16_t **samples_p;
|
||||
int st; /* stereo */
|
||||
int count1, count2;
|
||||
int nb_samples, coded_samples, ret;
|
||||
int nb_samples, coded_samples, approx_nb_samples, ret;
|
||||
GetByteContext gb;
|
||||
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples);
|
||||
nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples, &approx_nb_samples);
|
||||
if (nb_samples <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@ -683,7 +688,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
/* use coded_samples when applicable */
|
||||
/* it is always <= nb_samples, so the output buffer will be large enough */
|
||||
if (coded_samples) {
|
||||
if (coded_samples != nb_samples)
|
||||
if (!approx_nb_samples && coded_samples != nb_samples)
|
||||
av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n");
|
||||
frame->nb_samples = nb_samples = coded_samples;
|
||||
}
|
||||
@ -917,6 +922,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
*samples++ = c->status[0].predictor + c->status[1].predictor;
|
||||
*samples++ = c->status[0].predictor - c->status[1].predictor;
|
||||
}
|
||||
|
||||
if ((bytestream2_tell(&gb) & 1))
|
||||
bytestream2_skip(&gb, 1);
|
||||
break;
|
||||
}
|
||||
case AV_CODEC_ID_ADPCM_IMA_ISS:
|
||||
|
@ -144,10 +144,11 @@ function ff_put_pixels8_y2_armv6, export=1
|
||||
eor r7, r5, r7
|
||||
uadd8 r10, r10, r6
|
||||
and r7, r7, r12
|
||||
ldr_pre r6, r1, r2
|
||||
ldrc_pre ne, r6, r1, r2
|
||||
uadd8 r11, r11, r7
|
||||
strd_post r8, r9, r0, r2
|
||||
ldr r7, [r1, #4]
|
||||
it ne
|
||||
ldrne r7, [r1, #4]
|
||||
strd_post r10, r11, r0, r2
|
||||
bne 1b
|
||||
|
||||
@ -196,9 +197,10 @@ function ff_put_pixels8_y2_no_rnd_armv6, export=1
|
||||
uhadd8 r9, r5, r7
|
||||
ldr r5, [r1, #4]
|
||||
uhadd8 r12, r4, r6
|
||||
ldr_pre r6, r1, r2
|
||||
ldrc_pre ne, r6, r1, r2
|
||||
uhadd8 r14, r5, r7
|
||||
ldr r7, [r1, #4]
|
||||
it ne
|
||||
ldrne r7, [r1, #4]
|
||||
stm r0, {r8,r9}
|
||||
add r0, r0, r2
|
||||
stm r0, {r12,r14}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
|
||||
void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, int16_t *data);
|
||||
void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const int16_t *data);
|
||||
void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, int16_t *data);
|
||||
|
||||
void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
|
||||
void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);
|
||||
|
@ -1204,7 +1204,7 @@ function ff_put_vp8_\name\size\()_\hv\()_armv6, export=1
|
||||
mov r4, #\size
|
||||
stm r12, {r4, r5}
|
||||
orr r12, r6, r7
|
||||
b vp8_put_\name\()_\hv\()_armv6 + 4
|
||||
b bl_put_\name\()_\hv\()_armv6
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
@ -1300,6 +1300,7 @@ vp8_mc_hv bilin, 4, h, v, 2
|
||||
|
||||
function vp8_put_epel_h6_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_epel_h6_armv6:
|
||||
sub r2, r2, #2
|
||||
movrel lr, sixtap_filters_13245600 - 16
|
||||
add lr, lr, r12, lsl #3
|
||||
@ -1358,6 +1359,7 @@ endfunc
|
||||
|
||||
function vp8_put_epel_v6_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_epel_v6_armv6:
|
||||
movrel lr, sixtap_filters_13245600 - 16
|
||||
add lr, lr, r12, lsl #3
|
||||
str r3, [sp, #48]
|
||||
@ -1437,6 +1439,7 @@ endfunc
|
||||
|
||||
function vp8_put_epel_h4_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_epel_h4_armv6:
|
||||
subs r2, r2, #1
|
||||
movrel lr, fourtap_filters_1324 - 4
|
||||
add lr, lr, r12, lsl #2
|
||||
@ -1483,6 +1486,7 @@ endfunc
|
||||
|
||||
function vp8_put_epel_v4_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_epel_v4_armv6:
|
||||
movrel lr, fourtap_filters_1324 - 4
|
||||
add lr, lr, r12, lsl #2
|
||||
ldm lr, {r5, r6}
|
||||
@ -1544,6 +1548,7 @@ endfunc
|
||||
|
||||
function vp8_put_bilin_h_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_bilin_h_armv6:
|
||||
rsb r5, r12, r12, lsl #16
|
||||
ldr r12, [sp, #44]
|
||||
sub r3, r3, r4
|
||||
@ -1589,6 +1594,7 @@ endfunc
|
||||
|
||||
function vp8_put_bilin_v_armv6
|
||||
push {r1, r4-r11, lr}
|
||||
bl_put_bilin_v_armv6:
|
||||
rsb r5, r12, r12, lsl #16
|
||||
ldr r12, [sp, #44]
|
||||
add r5, r5, #8
|
||||
|
@ -28,6 +28,7 @@
|
||||
#ifndef AVCODEC_DIRAC_ARITH_H
|
||||
#define AVCODEC_DIRAC_ARITH_H
|
||||
|
||||
#include "libavutil/x86/asm.h"
|
||||
#include "bytestream.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
@ -134,7 +135,7 @@ static inline int dirac_get_arith_bit(DiracArith *c, int ctx)
|
||||
|
||||
range_times_prob = (c->range * prob_zero) >> 16;
|
||||
|
||||
#if HAVE_FAST_CMOV && HAVE_INLINE_ASM
|
||||
#if HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_6REGS
|
||||
low -= range_times_prob << 16;
|
||||
range -= range_times_prob;
|
||||
bit = 0;
|
||||
|
@ -166,6 +166,10 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (memcmp(src, fic_header, 7))
|
||||
av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n");
|
||||
|
||||
/* Is it a skip frame? */
|
||||
if (src[17])
|
||||
goto skip;
|
||||
|
||||
nslices = src[13];
|
||||
if (!nslices) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Zero slices found.\n");
|
||||
@ -246,6 +250,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
NULL, nslices, sizeof(ctx->slice_data[0])) < 0)
|
||||
return ret;
|
||||
|
||||
skip:
|
||||
*got_frame = 1;
|
||||
if ((ret = av_frame_ref(data, ctx->frame)) < 0)
|
||||
return ret;
|
||||
|
@ -691,6 +691,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
switch (chunk_type) {
|
||||
case DISPLAY_INFO:
|
||||
got_header =
|
||||
c->got_header = 0;
|
||||
if (chunk_size < 21) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid display info size %d\n",
|
||||
@ -717,7 +718,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Unknown compression method %d\n",
|
||||
c->compression);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto header_fail;
|
||||
}
|
||||
c->tile_width = bytestream2_get_be32(&bc);
|
||||
c->tile_height = bytestream2_get_be32(&bc);
|
||||
@ -737,7 +739,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
(chunk_size - 21) < 16 ) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Display info: missing bitmasks!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto header_fail;
|
||||
}
|
||||
r_mask = bytestream2_get_be32(&bc);
|
||||
g_mask = bytestream2_get_be32(&bc);
|
||||
@ -746,11 +749,13 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid or unsupported bitmasks: R=%X, G=%X, B=%X\n",
|
||||
r_mask, g_mask, b_mask);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto header_fail;
|
||||
}
|
||||
} else {
|
||||
avpriv_request_sample(avctx, "bpp=%d", c->bpp);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto header_fail;
|
||||
}
|
||||
if (g2m_init_buffers(c)) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
|
@ -214,6 +214,18 @@ static inline int get_se_golomb(GetBitContext *gb)
|
||||
}
|
||||
}
|
||||
|
||||
static inline int get_se_golomb_long(GetBitContext *gb)
|
||||
{
|
||||
unsigned int buf = get_ue_golomb_long(gb);
|
||||
|
||||
if (buf & 1)
|
||||
buf = (buf + 1) >> 1;
|
||||
else
|
||||
buf = -(buf >> 1);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static inline int svq3_get_se_golomb(GetBitContext *gb)
|
||||
{
|
||||
unsigned int buf;
|
||||
|
@ -1813,6 +1813,7 @@ static int decode_update_thread_context(AVCodecContext *dst,
|
||||
memset(&h->mb, 0, sizeof(h->mb));
|
||||
memset(&h->mb_luma_dc, 0, sizeof(h->mb_luma_dc));
|
||||
memset(&h->mb_padding, 0, sizeof(h->mb_padding));
|
||||
memset(&h->cur_pic, 0, sizeof(h->cur_pic));
|
||||
|
||||
h->avctx = dst;
|
||||
h->DPB = NULL;
|
||||
@ -3444,6 +3445,17 @@ int ff_set_ref_count(H264Context *h)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
|
||||
{
|
||||
switch (a) {
|
||||
case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
|
||||
case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
|
||||
case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
|
||||
default:
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a slice header.
|
||||
* This will (re)intialize the decoder and call h264_frame_start() as needed.
|
||||
@ -3573,7 +3585,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|| h->mb_width != h->sps.mb_width
|
||||
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
||||
));
|
||||
if (h0->avctx->pix_fmt != get_pixel_format(h0, 0))
|
||||
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
|
||||
must_reinit = 1;
|
||||
|
||||
h->mb_width = h->sps.mb_width;
|
||||
|
@ -175,7 +175,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
goto fail;
|
||||
|
||||
/* prepend only to the first type 5 NAL unit of an IDR picture */
|
||||
if (ctx->first_idr && unit_type == 5) {
|
||||
if (ctx->first_idr && (unit_type == 5 || unit_type == 7 || unit_type == 8)) {
|
||||
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
|
||||
avctx->extradata, avctx->extradata_size,
|
||||
buf, nal_size)) < 0)
|
||||
|
@ -283,7 +283,7 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
|
||||
static int set_sps(HEVCContext *s, const HEVCSPS *sps)
|
||||
{
|
||||
int ret;
|
||||
unsigned num = 0, den = 0;
|
||||
unsigned int num = 0, den = 0;
|
||||
|
||||
pic_arrays_free(s);
|
||||
ret = pic_arrays_init(s, sps);
|
||||
|
@ -461,7 +461,7 @@ typedef struct HEVCSPS {
|
||||
} HEVCSPS;
|
||||
|
||||
typedef struct HEVCPPS {
|
||||
unsigned sps_id; ///< seq_parameter_set_id
|
||||
unsigned int sps_id; ///< seq_parameter_set_id
|
||||
|
||||
uint8_t sign_data_hiding_flag;
|
||||
|
||||
|
@ -611,8 +611,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc;
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
int ret = 0;
|
||||
int sps_id = 0;
|
||||
int ret = 0;
|
||||
unsigned int sps_id = 0;
|
||||
int log2_diff_max_min_transform_block_size;
|
||||
int bit_depth_chroma, start, vui_present, sublayer_ordering_info;
|
||||
int i;
|
||||
@ -993,8 +993,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
int pic_area_in_ctbs, pic_area_in_min_cbs, pic_area_in_min_tbs;
|
||||
int log2_diff_ctb_min_tb_size;
|
||||
int i, j, x, y, ctb_addr_rs, tile_id;
|
||||
int ret = 0;
|
||||
int pps_id = 0;
|
||||
int ret = 0;
|
||||
unsigned int pps_id = 0;
|
||||
|
||||
AVBufferRef *pps_buf;
|
||||
HEVCPPS *pps = av_mallocz(sizeof(*pps));
|
||||
|
@ -35,6 +35,12 @@
|
||||
|
||||
#define FF_SANE_NB_CHANNELS 63U
|
||||
|
||||
#if HAVE_NEON || ARCH_PPC || HAVE_MMX
|
||||
# define STRIDE_ALIGN 16
|
||||
#else
|
||||
# define STRIDE_ALIGN 8
|
||||
#endif
|
||||
|
||||
typedef struct FramePool {
|
||||
/**
|
||||
* Pools for each data plane. For audio all the planes have the same size,
|
||||
|
@ -391,19 +391,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
|
||||
|
||||
OPT_STR("level", x4->level);
|
||||
|
||||
if(x4->x264opts){
|
||||
const char *p= x4->x264opts;
|
||||
while(p){
|
||||
char param[256]={0}, val[256]={0};
|
||||
if(sscanf(p, "%255[^:=]=%255[^:]", param, val) == 1){
|
||||
OPT_STR(param, "1");
|
||||
}else
|
||||
OPT_STR(param, val);
|
||||
p= strchr(p, ':');
|
||||
p+=!!p;
|
||||
}
|
||||
}
|
||||
|
||||
if (avctx->i_quant_factor > 0)
|
||||
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
|
||||
|
||||
@ -589,6 +576,19 @@ static av_cold int X264_init(AVCodecContext *avctx)
|
||||
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
|
||||
x4->params.b_repeat_headers = 0;
|
||||
|
||||
if(x4->x264opts){
|
||||
const char *p= x4->x264opts;
|
||||
while(p){
|
||||
char param[256]={0}, val[256]={0};
|
||||
if(sscanf(p, "%255[^:=]=%255[^:]", param, val) == 1){
|
||||
OPT_STR(param, "1");
|
||||
}else
|
||||
OPT_STR(param, val);
|
||||
p= strchr(p, ':');
|
||||
p+=!!p;
|
||||
}
|
||||
}
|
||||
|
||||
if (x4->x264_params) {
|
||||
AVDictionary *dict = NULL;
|
||||
AVDictionaryEntry *en = NULL;
|
||||
|
@ -190,7 +190,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
||||
for (i = 0; i < nnal; i++)
|
||||
ctx->header_size += nal[i].sizeBytes;
|
||||
|
||||
ctx->header = av_malloc(ctx->header_size);
|
||||
ctx->header = av_malloc(ctx->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!ctx->header) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Cannot allocate HEVC header of size %d.\n", ctx->header_size);
|
||||
@ -204,6 +204,13 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
||||
buf += nal[i].sizeBytes;
|
||||
}
|
||||
|
||||
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
|
||||
avctx->extradata_size = ctx->header_size;
|
||||
avctx->extradata = ctx->header;
|
||||
ctx->header_size = 0;
|
||||
ctx->header = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,17 @@ static void build_basic_mjpeg_vlc(MJpegDecodeContext *s)
|
||||
avpriv_mjpeg_val_ac_chrominance, 251, 0, 0);
|
||||
}
|
||||
|
||||
static void parse_avid(MJpegDecodeContext *s, uint8_t *buf, int len)
|
||||
{
|
||||
s->buggy_avid = 1;
|
||||
if (len > 14 && buf[12] == 1) /* 1 - NTSC */
|
||||
s->interlace_polarity = 1;
|
||||
if (len > 14 && buf[12] == 2) /* 2 - PAL */
|
||||
s->interlace_polarity = 0;
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
av_log(s->avctx, AV_LOG_INFO, "AVID: len:%d %d\n", len, len > 14 ? buf[12] : -1);
|
||||
}
|
||||
|
||||
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MJpegDecodeContext *s = avctx->priv_data;
|
||||
@ -120,7 +131,17 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
||||
if (avctx->field_order == AV_FIELD_BB) { /* quicktime icefloe 019 */
|
||||
s->interlace_polarity = 1; /* bottom field first */
|
||||
av_log(avctx, AV_LOG_DEBUG, "bottom field first\n");
|
||||
} else if (avctx->field_order == AV_FIELD_UNKNOWN) {
|
||||
if (avctx->codec_tag == AV_RL32("MJPG"))
|
||||
s->interlace_polarity = 1;
|
||||
}
|
||||
|
||||
if ( avctx->extradata_size > 8
|
||||
&& AV_RL32(avctx->extradata) == 0x2C
|
||||
&& AV_RL32(avctx->extradata+4) == 0x18) {
|
||||
parse_avid(s, avctx->extradata, avctx->extradata_size);
|
||||
}
|
||||
|
||||
if (avctx->codec->id == AV_CODEC_ID_AMV)
|
||||
s->flipped = 1;
|
||||
|
||||
@ -1694,9 +1715,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
|
||||
|
||||
/* buggy avid, it puts EOI only at every 10th frame */
|
||||
if (!strncmp(cbuf, "AVID", 4)) {
|
||||
s->buggy_avid = 1;
|
||||
if (len > 14 && cbuf[12] == 1) /* 1 - NTSC, 2 - PAL */
|
||||
s->interlace_polarity = 1;
|
||||
parse_avid(s, cbuf, len);
|
||||
} else if (!strcmp(cbuf, "CS=ITU601"))
|
||||
s->cs_itu601 = 1;
|
||||
else if ((!strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) ||
|
||||
|
@ -99,6 +99,7 @@ struct MpegEncContext;
|
||||
*/
|
||||
typedef struct Picture{
|
||||
struct AVFrame f;
|
||||
uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
|
||||
ThreadFrame tf;
|
||||
|
||||
AVBufferRef *qscale_table_buf;
|
||||
@ -195,8 +196,8 @@ typedef struct Picture{
|
||||
int mbaff; ///< h264 1 -> MBAFF frame 0-> not MBAFF
|
||||
int field_picture; ///< whether or not the picture was encoded in separate fields
|
||||
|
||||
int mb_var_sum; ///< sum of MB variance for current frame
|
||||
int mc_mb_var_sum; ///< motion compensated MB variance for current frame
|
||||
int64_t mb_var_sum; ///< sum of MB variance for current frame
|
||||
int64_t mc_mb_var_sum; ///< motion compensated MB variance for current frame
|
||||
|
||||
int b_frame_score;
|
||||
int needs_realloc; ///< Picture needs to be reallocated (eg due to a frame size change)
|
||||
@ -251,8 +252,8 @@ typedef struct MotionEstContext{
|
||||
int stride;
|
||||
int uvstride;
|
||||
/* temp variables for picture complexity calculation */
|
||||
int mc_mb_var_sum_temp;
|
||||
int mb_var_sum_temp;
|
||||
int64_t mc_mb_var_sum_temp;
|
||||
int64_t mb_var_sum_temp;
|
||||
int scene_change_score;
|
||||
/* cmp, chroma_cmp;*/
|
||||
op_pixels_func (*hpel_put)[4];
|
||||
|
@ -1039,6 +1039,10 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
|
||||
direct = 0;
|
||||
if ((s->width & 15) || (s->height & 15))
|
||||
direct = 0;
|
||||
if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1))
|
||||
direct = 0;
|
||||
if (s->linesize & (STRIDE_ALIGN-1))
|
||||
direct = 0;
|
||||
|
||||
av_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
|
||||
pic_arg->linesize[1], s->linesize, s->uvlinesize);
|
||||
@ -3439,7 +3443,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||
s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
|
||||
if(s->msmpeg4_version >= 3)
|
||||
s->no_rounding=1;
|
||||
av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
|
||||
av_dlog(s, "Scene change detected, encoding as I Frame %"PRId64" %"PRId64"\n",
|
||||
s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
switch (avctx->bits_per_coded_sample & 0x1f) {
|
||||
switch (avctx->bits_per_coded_sample) {
|
||||
case 1:
|
||||
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
|
||||
break;
|
||||
@ -116,6 +116,9 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
||||
uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
|
||||
int i, j;
|
||||
|
||||
if (linesize < 0)
|
||||
return linesize;
|
||||
|
||||
for (i = 0; i < avctx->height; i++) {
|
||||
if (avctx->bits_per_coded_sample == 4) {
|
||||
for (j = 0; j < avctx->width - 1; j += 2) {
|
||||
|
@ -317,6 +317,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||
FrameThreadContext *fctx = p->parent;
|
||||
PerThreadContext *prev_thread = fctx->prev_thread;
|
||||
const AVCodec *codec = p->avctx->codec;
|
||||
int ret;
|
||||
|
||||
if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0;
|
||||
|
||||
@ -340,6 +341,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||
}
|
||||
}
|
||||
|
||||
av_packet_free_side_data(&p->avpkt);
|
||||
av_buffer_unref(&p->avpkt.buf);
|
||||
p->avpkt = *avpkt;
|
||||
if (avpkt->buf)
|
||||
@ -354,6 +356,10 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||
memcpy(p->buf, avpkt->data, avpkt->size);
|
||||
memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
if ((ret = av_copy_packet_side_data(&p->avpkt, avpkt)) < 0) {
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
p->state = STATE_SETTING_UP;
|
||||
pthread_cond_signal(&p->input_cond);
|
||||
@ -592,6 +598,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
pthread_cond_destroy(&p->input_cond);
|
||||
pthread_cond_destroy(&p->progress_cond);
|
||||
pthread_cond_destroy(&p->output_cond);
|
||||
av_packet_free_side_data(&p->avpkt);
|
||||
av_buffer_unref(&p->avpkt.buf);
|
||||
av_freep(&p->buf);
|
||||
av_freep(&p->released_buffers);
|
||||
@ -727,8 +734,6 @@ void ff_thread_flush(AVCodecContext *avctx)
|
||||
if (fctx->prev_thread) {
|
||||
if (fctx->prev_thread != &fctx->threads[0])
|
||||
update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0);
|
||||
if (avctx->codec->flush)
|
||||
avctx->codec->flush(fctx->threads[0].avctx);
|
||||
}
|
||||
|
||||
fctx->next_decoding = fctx->next_finished = 0;
|
||||
@ -741,6 +746,9 @@ void ff_thread_flush(AVCodecContext *avctx)
|
||||
av_frame_unref(p->frame);
|
||||
|
||||
release_delayed_buffers(p);
|
||||
|
||||
if (avctx->codec->flush)
|
||||
avctx->codec->flush(p->avctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void ff_write_pass1_stats(MpegEncContext *s)
|
||||
{
|
||||
snprintf(s->avctx->stats_out, 256,
|
||||
"in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
|
||||
"fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d;\n",
|
||||
"fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n",
|
||||
s->current_picture_ptr->f.display_picture_number,
|
||||
s->current_picture_ptr->f.coded_picture_number,
|
||||
s->pict_type,
|
||||
@ -206,7 +206,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
|
||||
assert(picture_number < rcc->num_entries);
|
||||
rce = &rcc->entry[picture_number];
|
||||
|
||||
e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d",
|
||||
e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%"SCNd64" var:%"SCNd64" icount:%d skipcount:%d hbits:%d",
|
||||
&rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits,
|
||||
&rce->mv_bits, &rce->misc_bits,
|
||||
&rce->f_code, &rce->b_code,
|
||||
@ -753,7 +753,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
||||
RateControlEntry local_rce, *rce;
|
||||
double bits;
|
||||
double rate_factor;
|
||||
int var;
|
||||
int64_t var;
|
||||
const int pict_type = s->pict_type;
|
||||
Picture * const pic = &s->current_picture;
|
||||
emms_c();
|
||||
@ -769,8 +769,9 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
||||
fps = get_fps(s->avctx);
|
||||
/* update predictors */
|
||||
if (picture_number > 2 && !dry_run) {
|
||||
const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum
|
||||
: rcc->last_mc_mb_var_sum;
|
||||
const int64_t last_var =
|
||||
s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum
|
||||
: rcc->last_mc_mb_var_sum;
|
||||
av_assert1(s->frame_bits >= s->stuffing_bits);
|
||||
update_predictor(&rcc->pred[s->last_pict_type],
|
||||
rcc->last_qscale,
|
||||
@ -817,7 +818,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
||||
assert(pict_type == rce->new_pict_type);
|
||||
|
||||
q = rce->new_qscale / br_compensation;
|
||||
av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale,
|
||||
av_dlog(s, "%f %f %f last:%d var:%"PRId64" type:%d//\n", q, rce->new_qscale,
|
||||
br_compensation, s->frame_bits, var, pict_type);
|
||||
} else {
|
||||
rce->pict_type =
|
||||
@ -879,7 +880,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
||||
if (s->avctx->debug & FF_DEBUG_RC) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f "
|
||||
"size:%d var:%d/%d br:%d fps:%d\n",
|
||||
"size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n",
|
||||
av_get_picture_type_char(pict_type),
|
||||
qmin, q, qmax, picture_number,
|
||||
(int)wanted_bits / 1000, (int)s->total_bits / 1000,
|
||||
|
@ -49,8 +49,8 @@ typedef struct RateControlEntry{
|
||||
uint64_t expected_bits;
|
||||
int new_pict_type;
|
||||
float new_qscale;
|
||||
int mc_mb_var_sum;
|
||||
int mb_var_sum;
|
||||
int64_t mc_mb_var_sum;
|
||||
int64_t mb_var_sum;
|
||||
int i_count;
|
||||
int skip_count;
|
||||
int f_code;
|
||||
@ -71,8 +71,8 @@ typedef struct RateControlContext{
|
||||
double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init)
|
||||
double last_qscale;
|
||||
double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff
|
||||
int last_mc_mb_var_sum;
|
||||
int last_mb_var_sum;
|
||||
int64_t last_mc_mb_var_sum;
|
||||
int64_t last_mb_var_sum;
|
||||
uint64_t i_cplx_sum[5];
|
||||
uint64_t p_cplx_sum[5];
|
||||
uint64_t mv_bits_sum[5];
|
||||
|
@ -83,17 +83,6 @@ static const PixelFormatTag pix_fmt_bps_mov[] = {
|
||||
{ AV_PIX_FMT_NONE, 0 },
|
||||
};
|
||||
|
||||
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags,
|
||||
unsigned int fourcc)
|
||||
{
|
||||
while (tags->pix_fmt >= 0) {
|
||||
if (tags->fourcc == fourcc)
|
||||
return tags->pix_fmt;
|
||||
tags++;
|
||||
}
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 55
|
||||
enum AVPixelFormat ff_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
|
||||
{
|
||||
@ -109,7 +98,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||
if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|
||||
|| avctx->codec_tag == MKTAG('N','O','1','6'))
|
||||
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
|
||||
avctx->bits_per_coded_sample & 0x1f);
|
||||
avctx->bits_per_coded_sample);
|
||||
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
|
||||
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
|
||||
avctx->bits_per_coded_sample);
|
||||
@ -135,7 +124,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||
memset(context->palette->data, 0, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
if (((avctx->bits_per_coded_sample & 0x1f) == 4 || (avctx->bits_per_coded_sample & 0x1f) == 2) &&
|
||||
if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
|
||||
avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
|
||||
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
|
||||
context->is_2_4_bpp = 1;
|
||||
@ -209,14 +198,14 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int i;
|
||||
uint8_t *dst = frame->buf[0]->data;
|
||||
buf_size = context->frame_size - AVPALETTE_SIZE;
|
||||
if ((avctx->bits_per_coded_sample & 0x1f) == 4) {
|
||||
if (avctx->bits_per_coded_sample == 4) {
|
||||
for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) {
|
||||
dst[2 * i + 0] = buf[i] >> 4;
|
||||
dst[2 * i + 1] = buf[i] & 15;
|
||||
}
|
||||
linesize_align = 8;
|
||||
} else {
|
||||
av_assert0((avctx->bits_per_coded_sample & 0x1f) == 2);
|
||||
av_assert0(avctx->bits_per_coded_sample == 2);
|
||||
for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) {
|
||||
dst[4 * i + 0] = buf[i] >> 6;
|
||||
dst[4 * i + 1] = buf[i] >> 4 & 3;
|
||||
|
@ -730,7 +730,10 @@ static int rv10_decode_frame(AVCodecContext *avctx,
|
||||
offset + FFMAX(size, size2) > buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (rv10_decode_packet(avctx, buf + offset, size, size2) > 8 * size)
|
||||
if ((ret = rv10_decode_packet(avctx, buf + offset, size, size2)) < 0)
|
||||
return ret;
|
||||
|
||||
if (ret > 8 * size)
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -1502,8 +1502,8 @@ static int ratecontrol_1pass(SnowContext *s, AVFrame *pict)
|
||||
}
|
||||
|
||||
/* ugly, ratecontrol just takes a sqrt again */
|
||||
coef_sum = (uint64_t)coef_sum * coef_sum >> 16;
|
||||
av_assert0(coef_sum < INT_MAX);
|
||||
coef_sum = (uint64_t)coef_sum * coef_sum >> 16;
|
||||
|
||||
if(pict->pict_type == AV_PICTURE_TYPE_I){
|
||||
s->m.current_picture.mb_var_sum= coef_sum;
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "thread.h"
|
||||
#include "frame_thread_encoder.h"
|
||||
#include "internal.h"
|
||||
#include "raw.h"
|
||||
#include "bytestream.h"
|
||||
#include "version.h"
|
||||
#include <stdlib.h>
|
||||
@ -274,12 +275,6 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HAVE_NEON || ARCH_PPC || HAVE_MMX
|
||||
# define STRIDE_ALIGN 16
|
||||
#else
|
||||
# define STRIDE_ALIGN 8
|
||||
#endif
|
||||
|
||||
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
int linesize_align[AV_NUM_DATA_POINTERS])
|
||||
{
|
||||
@ -813,6 +808,7 @@ int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
|
||||
typedef struct CompatReleaseBufPriv {
|
||||
AVCodecContext avctx;
|
||||
AVFrame frame;
|
||||
uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
|
||||
} CompatReleaseBufPriv;
|
||||
|
||||
static void compat_free_buffer(void *opaque, uint8_t *data)
|
||||
@ -1076,6 +1072,17 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags,
|
||||
unsigned int fourcc)
|
||||
{
|
||||
while (tags->pix_fmt >= 0) {
|
||||
if (tags->fourcc == fourcc)
|
||||
return tags->pix_fmt;
|
||||
tags++;
|
||||
}
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
||||
@ -1621,7 +1628,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
const AVFrame *frame,
|
||||
int *got_packet_ptr)
|
||||
{
|
||||
AVFrame tmp;
|
||||
AVFrame *extended_frame = NULL;
|
||||
AVFrame *padded_frame = NULL;
|
||||
int ret;
|
||||
AVPacket user_pkt = *avpkt;
|
||||
@ -1646,9 +1653,13 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
}
|
||||
av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n");
|
||||
|
||||
tmp = *frame;
|
||||
tmp.extended_data = tmp.data;
|
||||
frame = &tmp;
|
||||
extended_frame = av_frame_alloc();
|
||||
if (!extended_frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(extended_frame, frame, sizeof(AVFrame));
|
||||
extended_frame->extended_data = extended_frame->data;
|
||||
frame = extended_frame;
|
||||
}
|
||||
|
||||
/* check for valid frame size */
|
||||
@ -1656,14 +1667,15 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
|
||||
if (frame->nb_samples > avctx->frame_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n");
|
||||
return AVERROR(EINVAL);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto end;
|
||||
}
|
||||
} else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
|
||||
if (frame->nb_samples < avctx->frame_size &&
|
||||
!avctx->internal->last_audio_frame) {
|
||||
ret = pad_last_frame(avctx, &padded_frame, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto end;
|
||||
|
||||
frame = padded_frame;
|
||||
avctx->internal->last_audio_frame = 1;
|
||||
@ -1735,6 +1747,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
|
||||
end:
|
||||
av_frame_free(&padded_frame);
|
||||
av_free(extended_frame);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -85,6 +85,11 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
||||
|
||||
++p;
|
||||
|
||||
for (i = p; (bits[i] == 0) && (i < num); ++i)
|
||||
;
|
||||
if (i == num)
|
||||
return 0;
|
||||
|
||||
for (; p < num; ++p) {
|
||||
if (bits[p] > 32)
|
||||
return 1;
|
||||
|
@ -151,7 +151,7 @@ typedef struct vorbis_context_s {
|
||||
uint8_t mode_count;
|
||||
vorbis_mode *modes;
|
||||
uint8_t mode_number; // mode number for the current packet
|
||||
uint8_t previous_window;
|
||||
int8_t previous_window;
|
||||
float *channel_residues;
|
||||
float *saved;
|
||||
} vorbis_context;
|
||||
@ -989,7 +989,7 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
|
||||
if (!vc->channel_residues || !vc->saved)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
vc->previous_window = 0;
|
||||
vc->previous_window = -1;
|
||||
|
||||
ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0);
|
||||
ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0);
|
||||
@ -1548,7 +1548,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
|
||||
{
|
||||
GetBitContext *gb = &vc->gb;
|
||||
FFTContext *mdct;
|
||||
unsigned previous_window = vc->previous_window;
|
||||
int previous_window = vc->previous_window;
|
||||
unsigned mode_number, blockflag, blocksize;
|
||||
int i, j;
|
||||
uint8_t no_residue[255];
|
||||
@ -1581,9 +1581,11 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
|
||||
blocksize = vc->blocksize[blockflag];
|
||||
vlen = blocksize / 2;
|
||||
if (blockflag) {
|
||||
previous_window = get_bits(gb, 1);
|
||||
skip_bits1(gb); // next_window
|
||||
}
|
||||
int code = get_bits(gb, 2);
|
||||
if (previous_window < 0)
|
||||
previous_window = code>>1;
|
||||
} else if (previous_window < 0)
|
||||
previous_window = 0;
|
||||
|
||||
memset(ch_res_ptr, 0, sizeof(float) * vc->audio_channels * vlen); //FIXME can this be removed ?
|
||||
for (i = 0; i < vc->audio_channels; ++i)
|
||||
@ -1812,7 +1814,7 @@ static av_cold void vorbis_decode_flush(AVCodecContext *avctx)
|
||||
memset(vc->saved, 0, (vc->blocksize[1] / 4) * vc->audio_channels *
|
||||
sizeof(*vc->saved));
|
||||
}
|
||||
vc->previous_window = 0;
|
||||
vc->previous_window = -1;
|
||||
}
|
||||
|
||||
AVCodec ff_vorbis_decoder = {
|
||||
|
@ -386,9 +386,9 @@ int ff_wma_end(AVCodecContext *avctx)
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
ff_free_vlc(&s->coef_vlc[i]);
|
||||
av_free(s->run_table[i]);
|
||||
av_free(s->level_table[i]);
|
||||
av_free(s->int_table[i]);
|
||||
av_freep(&s->run_table[i]);
|
||||
av_freep(&s->level_table[i]);
|
||||
av_freep(&s->int_table[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -216,7 +216,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
|
||||
"psubusw "MM"1, "MM"4 \n\t"
|
||||
"packuswb "MM"4, "MM"4 \n\t"
|
||||
#if COMPILE_TEMPLATE_SSE2
|
||||
"packuswb "MM"4, "MM"4 \n\t"
|
||||
"packsswb "MM"4, "MM"4 \n\t"
|
||||
#endif
|
||||
"movd "MM"4, %0 \n\t" // *overflow
|
||||
: "=g" (*overflow)
|
||||
|
@ -102,7 +102,7 @@ static int iec61883_callback(unsigned char *data, int length,
|
||||
DVPacket *packet;
|
||||
int ret;
|
||||
|
||||
#ifdef THREADS
|
||||
#if THREADS
|
||||
pthread_mutex_lock(&dv->mutex);
|
||||
#endif
|
||||
|
||||
@ -139,7 +139,7 @@ static int iec61883_callback(unsigned char *data, int length,
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
#ifdef THREADS
|
||||
#if THREADS
|
||||
pthread_cond_broadcast(&dv->cond);
|
||||
pthread_mutex_unlock(&dv->mutex);
|
||||
#endif
|
||||
@ -151,7 +151,7 @@ static void *iec61883_receive_task(void *opaque)
|
||||
struct iec61883_data *dv = (struct iec61883_data *)opaque;
|
||||
int result;
|
||||
|
||||
#ifdef THREADS
|
||||
#if THREADS
|
||||
while (dv->thread_loop)
|
||||
#endif
|
||||
{
|
||||
@ -168,7 +168,7 @@ static void *iec61883_receive_task(void *opaque)
|
||||
raw1394_loop_iterate(dv->raw1394);
|
||||
} else if (dv->receiving) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No more input data available\n");
|
||||
#ifdef THREADS
|
||||
#if THREADS
|
||||
pthread_mutex_lock(&dv->mutex);
|
||||
dv->eof = 1;
|
||||
pthread_cond_broadcast(&dv->cond);
|
||||
@ -413,7 +413,7 @@ static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
|
||||
* Try to parse frames from queue
|
||||
*/
|
||||
|
||||
#ifdef THREADS
|
||||
#if THREADS
|
||||
pthread_mutex_lock(&dv->mutex);
|
||||
while ((size = dv->parse_queue(dv, pkt)) == -1)
|
||||
if (!dv->eof)
|
||||
|
@ -130,8 +130,15 @@ static int xv_write_header(AVFormatContext *s)
|
||||
xv->image_width = encctx->width;
|
||||
xv->image_height = encctx->height;
|
||||
if (!xv->window_width && !xv->window_height) {
|
||||
AVRational sar = encctx->sample_aspect_ratio;
|
||||
xv->window_width = encctx->width;
|
||||
xv->window_height = encctx->height;
|
||||
if (sar.num) {
|
||||
if (sar.num > sar.den)
|
||||
xv->window_width = av_rescale(xv->window_width, sar.num, sar.den);
|
||||
if (sar.num < sar.den)
|
||||
xv->window_height = av_rescale(xv->window_height, sar.den, sar.num);
|
||||
}
|
||||
}
|
||||
xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display),
|
||||
xv->window_x, xv->window_y,
|
||||
|
@ -1058,11 +1058,11 @@ static int push_samples(ATempoContext *atempo,
|
||||
outlink->time_base);
|
||||
|
||||
ret = ff_filter_frame(outlink, atempo->dst_buffer);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
atempo->dst_buffer = NULL;
|
||||
atempo->dst = NULL;
|
||||
atempo->dst_end = NULL;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
atempo->nsamples_out += n_out;
|
||||
return 0;
|
||||
|
@ -184,7 +184,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
|
||||
s->map[i].out_channel_idx = i;
|
||||
break;
|
||||
case MAP_ONE_STR:
|
||||
if (!get_channel(&mapping, &in_ch, separator)) {
|
||||
if (get_channel(&mapping, &in_ch, separator) < 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, err);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static void *load_sym(AVFilterContext *ctx, const char *sym_name)
|
||||
Frei0rContext *s = ctx->priv;
|
||||
void *sym = dlsym(s->dl_handle, sym_name);
|
||||
if (!sym)
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not find symbol '%s' in loaded module\n", sym_name);
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not find symbol '%s' in loaded module.\n", sym_name);
|
||||
return sym;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ static int set_param(AVFilterContext *ctx, f0r_param_info_t info, int index, cha
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_log(ctx, AV_LOG_ERROR, "Invalid value '%s' for parameter '%s'\n",
|
||||
av_log(ctx, AV_LOG_ERROR, "Invalid value '%s' for parameter '%s'.\n",
|
||||
param, info.name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
@ -202,11 +202,11 @@ static int set_params(AVFilterContext *ctx, const char *params)
|
||||
default: /* F0R_PARAM_STRING */
|
||||
v = s;
|
||||
s->get_param_value(s->instance, v, i);
|
||||
av_log(ctx, AV_LOG_DEBUG, "'%s'\n", s);
|
||||
av_log(ctx, AV_LOG_DEBUG, "'%s'", s);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
av_log(ctx, AV_LOG_VERBOSE, "\n");
|
||||
av_log(ctx, AV_LOG_VERBOSE, ".\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -217,7 +217,7 @@ static int load_path(AVFilterContext *ctx, void **handle_ptr, const char *prefix
|
||||
char *path = av_asprintf("%s%s%s", prefix, name, SLIBSUF);
|
||||
if (!path)
|
||||
return AVERROR(ENOMEM);
|
||||
av_log(ctx, AV_LOG_DEBUG, "Looking for frei0r effect in '%s'\n", path);
|
||||
av_log(ctx, AV_LOG_DEBUG, "Looking for frei0r effect in '%s'.\n", path);
|
||||
*handle_ptr = dlopen(path, RTLD_NOW|RTLD_LOCAL);
|
||||
av_free(path);
|
||||
return 0;
|
||||
@ -288,7 +288,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
|
||||
return ret;
|
||||
}
|
||||
if (!s->dl_handle) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not find module '%s'\n", dl_name);
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not find module '%s'.\n", dl_name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (f0r_init() < 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not init the frei0r module\n");
|
||||
av_log(ctx, AV_LOG_ERROR, "Could not init the frei0r module.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
|
||||
pi = &s->plugin_info;
|
||||
if (pi->plugin_type != type) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Invalid type '%s' for the plugin\n",
|
||||
"Invalid type '%s' for this plugin\n",
|
||||
pi->plugin_type == F0R_PLUGIN_TYPE_FILTER ? "filter" :
|
||||
pi->plugin_type == F0R_PLUGIN_TYPE_SOURCE ? "source" :
|
||||
pi->plugin_type == F0R_PLUGIN_TYPE_MIXER2 ? "mixer2" :
|
||||
@ -359,7 +359,7 @@ static int config_input_props(AVFilterLink *inlink)
|
||||
if (s->destruct && s->instance)
|
||||
s->destruct(s->instance);
|
||||
if (!(s->instance = s->construct(inlink->w, inlink->h))) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance\n");
|
||||
av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -476,7 +476,11 @@ static int source_config_props(AVFilterLink *outlink)
|
||||
if (s->destruct && s->instance)
|
||||
s->destruct(s->instance);
|
||||
if (!(s->instance = s->construct(outlink->w, outlink->h))) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance\n");
|
||||
av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (!s->params) {
|
||||
av_log(ctx, AV_LOG_ERROR, "frei0r filter parameters not set.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -126,20 +126,21 @@ static int alloc_metrics(PullupContext *s, PullupField *f)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_field_queue(PullupField *head, PullupField **last)
|
||||
static void free_field_queue(PullupField *head)
|
||||
{
|
||||
PullupField *f = head;
|
||||
while (f) {
|
||||
do {
|
||||
PullupField *next;
|
||||
if (!f)
|
||||
break;
|
||||
av_free(f->diffs);
|
||||
av_free(f->combs);
|
||||
av_free(f->vars);
|
||||
if (f == *last) {
|
||||
av_freep(last);
|
||||
break;
|
||||
}
|
||||
f = f->next;
|
||||
av_freep(&f->prev);
|
||||
};
|
||||
next = f->next;
|
||||
memset(f, 0, sizeof(*f));
|
||||
av_free(f);
|
||||
f = next;
|
||||
} while (f != head);
|
||||
}
|
||||
|
||||
static PullupField *make_field_queue(PullupContext *s, int len)
|
||||
@ -158,14 +159,14 @@ static PullupField *make_field_queue(PullupContext *s, int len)
|
||||
for (; len > 0; len--) {
|
||||
f->next = av_mallocz(sizeof(*f->next));
|
||||
if (!f->next) {
|
||||
free_field_queue(head, &f);
|
||||
free_field_queue(head);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f->next->prev = f;
|
||||
f = f->next;
|
||||
if (alloc_metrics(s, f) < 0) {
|
||||
free_field_queue(head, &f);
|
||||
free_field_queue(head);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -255,6 +256,8 @@ static int alloc_buffer(PullupContext *s, PullupBuffer *b)
|
||||
for (i = 0; i < s->nb_planes; i++) {
|
||||
b->planes[i] = av_malloc(s->planeheight[i] * s->planewidth[i]);
|
||||
}
|
||||
if (s->nb_planes == 1)
|
||||
b->planes[1] = av_malloc(4*256);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -736,7 +739,8 @@ static av_cold void uninit(AVFilterContext *ctx)
|
||||
PullupContext *s = ctx->priv;
|
||||
int i;
|
||||
|
||||
free_field_queue(s->head, &s->last);
|
||||
free_field_queue(s->head);
|
||||
s->last = NULL;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->buffers); i++) {
|
||||
av_freep(&s->buffers[i].planes[0]);
|
||||
|
@ -50,7 +50,7 @@ OBJS-$(CONFIG_RTPDEC) += rdt.o \
|
||||
rtpdec_xiph.o \
|
||||
srtp.o
|
||||
OBJS-$(CONFIG_RTPENC_CHAIN) += rtpenc_chain.o rtp.o
|
||||
OBJS-$(CONFIG_SHARED) += log2_tab.o
|
||||
OBJS-$(CONFIG_SHARED) += log2_tab.o golomb_tab.o
|
||||
|
||||
# muxers/demuxers
|
||||
OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
|
||||
@ -203,7 +203,7 @@ OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
|
||||
isom.o rmsipr.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \
|
||||
isom.o avc.o \
|
||||
isom.o avc.o hevc.o \
|
||||
flacenc_header.o avlanguage.o wv.o
|
||||
OBJS-$(CONFIG_MD5_MUXER) += md5enc.o
|
||||
OBJS-$(CONFIG_MGSTS_DEMUXER) += mgsts.o
|
||||
@ -217,7 +217,7 @@ OBJS-$(CONFIG_MM_DEMUXER) += mm.o
|
||||
OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o
|
||||
OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o
|
||||
OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \
|
||||
OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o hevc.o \
|
||||
movenchint.o mov_chan.o rtp.o
|
||||
OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
|
||||
OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o
|
||||
|
@ -988,6 +988,13 @@ typedef struct AVStream {
|
||||
int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
|
||||
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
|
||||
|
||||
/**
|
||||
* Internal data to analyze DTS and detect faulty mpeg streams
|
||||
*/
|
||||
int64_t last_dts_for_order_check;
|
||||
uint8_t dts_ordered;
|
||||
uint8_t dts_misordered;
|
||||
|
||||
} AVStream;
|
||||
|
||||
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
||||
|
@ -201,12 +201,14 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
int64_t offset1;
|
||||
int64_t pos;
|
||||
int force = whence & AVSEEK_FORCE;
|
||||
int buffer_size;
|
||||
whence &= ~AVSEEK_FORCE;
|
||||
|
||||
if(!s)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
|
||||
buffer_size = s->buf_end - s->buffer;
|
||||
pos = s->pos - (s->write_flag ? 0 : buffer_size);
|
||||
|
||||
if (whence != SEEK_CUR && whence != SEEK_SET)
|
||||
return AVERROR(EINVAL);
|
||||
@ -219,7 +221,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
}
|
||||
offset1 = offset - pos;
|
||||
if (!s->must_flush && (!s->direct || !s->seek) &&
|
||||
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
|
||||
offset1 >= 0 && offset1 <= buffer_size) {
|
||||
/* can do the seek inside the buffer */
|
||||
s->buf_ptr = s->buffer + offset1;
|
||||
} else if ((!s->seekable ||
|
||||
@ -232,9 +234,20 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
if (s->eof_reached)
|
||||
return AVERROR_EOF;
|
||||
s->buf_ptr = s->buf_end + offset - s->pos;
|
||||
} else {
|
||||
} else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) {
|
||||
int64_t res;
|
||||
|
||||
pos -= FFMIN(buffer_size>>1, pos);
|
||||
if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0)
|
||||
return res;
|
||||
s->buf_end =
|
||||
s->buf_ptr = s->buffer;
|
||||
s->pos = pos;
|
||||
s->eof_reached = 0;
|
||||
fill_buffer(s);
|
||||
return avio_seek(s, offset, SEEK_SET | force);
|
||||
} else {
|
||||
int64_t res;
|
||||
if (s->write_flag) {
|
||||
flush_buffer(s);
|
||||
s->must_flush = 1;
|
||||
|
1
libavformat/golomb_tab.c
Normal file
1
libavformat/golomb_tab.c
Normal file
@ -0,0 +1 @@
|
||||
#include "libavcodec/golomb.c"
|
1140
libavformat/hevc.c
Normal file
1140
libavformat/hevc.c
Normal file
File diff suppressed because it is too large
Load Diff
98
libavformat/hevc.h
Normal file
98
libavformat/hevc.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* internal header for HEVC (de)muxer utilities
|
||||
*/
|
||||
|
||||
#ifndef AVFORMAT_HEVC_H
|
||||
#define AVFORMAT_HEVC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "avio.h"
|
||||
|
||||
/**
|
||||
* Writes Annex B formatted HEVC NAL units to the provided AVIOContext.
|
||||
*
|
||||
* The NAL units are converted to an MP4-compatible format (start code prefixes
|
||||
* are replaced by 4-byte size fields, as per ISO/IEC 14496-15).
|
||||
*
|
||||
* If filter_ps is non-zero, any HEVC parameter sets found in the input will be
|
||||
* discarded, and *ps_count will be set to the number of discarded PS NAL units.
|
||||
*
|
||||
* @param pb address of the AVIOContext where the data shall be written
|
||||
* @param buf_in address of the buffer holding the input data
|
||||
* @param size size (in bytes) of the input buffer
|
||||
* @param filter_ps whether to write parameter set NAL units to the output (0)
|
||||
* or to discard them (non-zero)
|
||||
* @param ps_count address of the variable where the number of discarded
|
||||
* parameter set NAL units shall be written, may be NULL
|
||||
* @return the amount (in bytes) of data written in case of success, a negative
|
||||
* value corresponding to an AVERROR code in case of failure
|
||||
*/
|
||||
int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in,
|
||||
int size, int filter_ps, int *ps_count);
|
||||
|
||||
/**
|
||||
* Writes Annex B formatted HEVC NAL units to a data buffer.
|
||||
*
|
||||
* The NAL units are converted to an MP4-compatible format (start code prefixes
|
||||
* are replaced by 4-byte size fields, as per ISO/IEC 14496-15).
|
||||
*
|
||||
* If filter_ps is non-zero, any HEVC parameter sets found in the input will be
|
||||
* discarded, and *ps_count will be set to the number of discarded PS NAL units.
|
||||
*
|
||||
* On output, *size holds the size (in bytes) of the output data buffer.
|
||||
*
|
||||
* @param buf_in address of the buffer holding the input data
|
||||
* @param size address of the variable holding the size (in bytes) of the input
|
||||
* buffer (on input) and of the output buffer (on output)
|
||||
* @param buf_out address of the variable holding the address of the output
|
||||
* buffer
|
||||
* @param filter_ps whether to write parameter set NAL units to the output (0)
|
||||
* or to discard them (non-zero)
|
||||
* @param ps_count address of the variable where the number of discarded
|
||||
* parameter set NAL units shall be written, may be NULL
|
||||
* @return the amount (in bytes) of data written in case of success, a negative
|
||||
* value corresponding to an AVERROR code in case of failure
|
||||
*/
|
||||
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
|
||||
int *size, int filter_ps, int *ps_count);
|
||||
|
||||
/**
|
||||
* Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the
|
||||
* provided AVIOContext.
|
||||
*
|
||||
* If the extradata is Annex B format, it gets converted to hvcC format before
|
||||
* writing.
|
||||
*
|
||||
* @param pb address of the AVIOContext where the hvcC shall be written
|
||||
* @param data address of the buffer holding the data needed to write the hvcC
|
||||
* @param size size (in bytes) of the data buffer
|
||||
* @param ps_array_completeness whether all parameter sets are in the hvcC (1)
|
||||
* or there may be additional parameter sets in the bitstream (0)
|
||||
* @return >=0 in case of success, a negative value corresponding to an AVERROR
|
||||
* code in case of failure
|
||||
*/
|
||||
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data,
|
||||
int size, int ps_array_completeness);
|
||||
|
||||
#endif /* AVFORMAT_HEVC_H */
|
@ -49,29 +49,37 @@ typedef struct {
|
||||
unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
|
||||
int line_count;
|
||||
int http_code;
|
||||
int64_t chunksize; /**< Used if "Transfer-Encoding: chunked" otherwise -1. */
|
||||
char *content_type;
|
||||
char *user_agent;
|
||||
int64_t off, filesize, req_end_offset;
|
||||
int icy_data_read; ///< how much data was read since last ICY metadata packet
|
||||
int icy_metaint; ///< after how many bytes of read data a new metadata packet will be found
|
||||
/* Used if "Transfer-Encoding: chunked" otherwise -1. */
|
||||
int64_t chunksize;
|
||||
int64_t off, end_off, filesize;
|
||||
char *location;
|
||||
HTTPAuthState auth_state;
|
||||
HTTPAuthState proxy_auth_state;
|
||||
char *headers;
|
||||
int willclose; /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
|
||||
char *mime_type;
|
||||
char *user_agent;
|
||||
char *content_type;
|
||||
/* Set if the server correctly handles Connection: close and will close
|
||||
* the connection after feeding us the content. */
|
||||
int willclose;
|
||||
int seekable; /**< Control seekability, 0 = disable, 1 = enable, -1 = probe. */
|
||||
int chunked_post;
|
||||
int end_chunked_post; /**< A flag which indicates if the end of chunked encoding has been sent. */
|
||||
int end_header; /**< A flag which indicates we have finished to read POST reply. */
|
||||
int multiple_requests; /**< A flag which indicates if we use persistent connections. */
|
||||
/* A flag which indicates if the end of chunked encoding has been sent. */
|
||||
int end_chunked_post;
|
||||
/* A flag which indicates we have finished to read POST reply. */
|
||||
int end_header;
|
||||
/* A flag which indicates if we use persistent connections. */
|
||||
int multiple_requests;
|
||||
uint8_t *post_data;
|
||||
int post_datalen;
|
||||
int is_akamai;
|
||||
int is_mediagateway;
|
||||
char *mime_type;
|
||||
char *cookies; ///< holds newline (\n) delimited Set-Cookie header field values (without the "Set-Cookie: " field name)
|
||||
int icy;
|
||||
/* how much data was read since the last ICY metadata packet */
|
||||
int icy_data_read;
|
||||
/* after how many bytes of read data a new metadata packet will be found */
|
||||
int icy_metaint;
|
||||
char *icy_metadata_headers;
|
||||
char *icy_metadata_packet;
|
||||
#if CONFIG_ZLIB
|
||||
@ -91,22 +99,23 @@ static const AVOption options[] = {
|
||||
{"seekable", "control seekability of connection", OFFSET(seekable), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, D },
|
||||
{"chunked_post", "use chunked transfer-encoding for posts", OFFSET(chunked_post), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
|
||||
{"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
|
||||
{"content_type", "force a content type", OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
|
||||
{"content_type", "set a specific content type for the POST messages", OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
|
||||
{"user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
|
||||
{"user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
|
||||
{"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
|
||||
{"post_data", "set custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
|
||||
{"mime_type", "set MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
|
||||
{"mime_type", "export the MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
|
||||
{"cookies", "set cookies to be sent in applicable future requests, use newline delimited Set-Cookie HTTP field value syntax", OFFSET(cookies), AV_OPT_TYPE_STRING, {0}, 0, 0, D },
|
||||
{"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
|
||||
{"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
|
||||
{"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
|
||||
{"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },
|
||||
{"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },
|
||||
{"auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, {.i64 = HTTP_AUTH_NONE}, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D|E, "auth_type" },
|
||||
{"none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, {.i64 = HTTP_AUTH_NONE}, 0, 0, D|E, "auth_type" },
|
||||
{"basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, {.i64 = HTTP_AUTH_BASIC}, 0, 0, D|E, "auth_type" },
|
||||
{"send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, E },
|
||||
{"location", "The actual location of the data received", OFFSET(location), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
|
||||
{"offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
|
||||
{"end_offset", "try to limit the request to bytes preceding this offset", OFFSET(req_end_offset), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
|
||||
{"end_offset", "try to limit the request to bytes preceding this offset", OFFSET(end_off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
|
||||
{NULL}
|
||||
};
|
||||
#define HTTP_CLASS(flavor)\
|
||||
@ -287,7 +296,7 @@ static int http_getc(HTTPContext *s)
|
||||
if (len < 0) {
|
||||
return len;
|
||||
} else if (len == 0) {
|
||||
return -1;
|
||||
return AVERROR_EOF;
|
||||
} else {
|
||||
s->buf_ptr = s->buffer;
|
||||
s->buf_end = s->buffer + len;
|
||||
@ -320,11 +329,110 @@ static int http_get_line(HTTPContext *s, char *line, int line_size)
|
||||
}
|
||||
}
|
||||
|
||||
static int check_http_code(URLContext *h, int http_code, const char *end)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
/* error codes are 4xx and 5xx, but regard 401 as a success, so we
|
||||
* don't abort until all headers have been parsed. */
|
||||
if (http_code >= 400 && http_code < 600 &&
|
||||
(http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
|
||||
(http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
|
||||
end += strspn(end, SPACE_CHARS);
|
||||
av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", http_code, end);
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_location(HTTPContext *s, const char *p)
|
||||
{
|
||||
char redirected_location[MAX_URL_SIZE], *new_loc;
|
||||
ff_make_absolute_url(redirected_location, sizeof(redirected_location),
|
||||
s->location, p);
|
||||
new_loc = av_strdup(redirected_location);
|
||||
if (!new_loc)
|
||||
return AVERROR(ENOMEM);
|
||||
av_free(s->location);
|
||||
s->location = new_loc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* "bytes $from-$to/$document_size" */
|
||||
static void parse_content_range(URLContext *h, const char *p)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
const char *slash;
|
||||
|
||||
if (!strncmp(p, "bytes ", 6)) {
|
||||
p += 6;
|
||||
s->off = strtoll(p, NULL, 10);
|
||||
if ((slash = strchr(p, '/')) && strlen(slash) > 0)
|
||||
s->filesize = strtoll(slash+1, NULL, 10);
|
||||
}
|
||||
if (s->seekable == -1 && (!s->is_akamai || s->filesize != 2147483647))
|
||||
h->is_streamed = 0; /* we _can_ in fact seek */
|
||||
}
|
||||
|
||||
static int parse_content_encoding(URLContext *h, const char *p)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
|
||||
if (!av_strncasecmp(p, "gzip", 4) ||
|
||||
!av_strncasecmp(p, "deflate", 7)) {
|
||||
#if CONFIG_ZLIB
|
||||
s->compressed = 1;
|
||||
inflateEnd(&s->inflate_stream);
|
||||
if (inflateInit2(&s->inflate_stream, 32 + 15) != Z_OK) {
|
||||
av_log(h, AV_LOG_WARNING, "Error during zlib initialisation: %s\n",
|
||||
s->inflate_stream.msg);
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
if (zlibCompileFlags() & (1 << 17)) {
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
"Your zlib was compiled without gzip support.\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
#else
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
"Compressed (%s) content, need zlib with gzip support\n", p);
|
||||
return AVERROR(ENOSYS);
|
||||
#endif
|
||||
} else if (!av_strncasecmp(p, "identity", 8)) {
|
||||
// The normal, no-encoding case (although servers shouldn't include
|
||||
// the header at all if this is the case).
|
||||
} else {
|
||||
av_log(h, AV_LOG_WARNING, "Unknown content coding: %s\n", p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Concat all Icy- header lines
|
||||
static int parse_icy(HTTPContext *s, const char *tag, const char *p)
|
||||
{
|
||||
int len = 4 + strlen(p) + strlen(tag);
|
||||
int is_first = !s->icy_metadata_headers;
|
||||
int ret;
|
||||
|
||||
if (s->icy_metadata_headers)
|
||||
len += strlen(s->icy_metadata_headers);
|
||||
|
||||
if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
|
||||
return ret;
|
||||
|
||||
if (is_first)
|
||||
*s->icy_metadata_headers = '\0';
|
||||
|
||||
av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int process_line(URLContext *h, char *line, int line_count,
|
||||
int *new_location)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
char *tag, *p, *end;
|
||||
int ret;
|
||||
|
||||
/* end of header */
|
||||
if (line[0] == '\0') {
|
||||
@ -342,16 +450,8 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
|
||||
av_log(h, AV_LOG_DEBUG, "http_code=%d\n", s->http_code);
|
||||
|
||||
/* error codes are 4xx and 5xx, but regard 401 as a success, so we
|
||||
* don't abort until all headers have been parsed. */
|
||||
if (s->http_code >= 400 && s->http_code < 600 && (s->http_code != 401
|
||||
|| s->auth_state.auth_type != HTTP_AUTH_NONE) &&
|
||||
(s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) {
|
||||
end += strspn(end, SPACE_CHARS);
|
||||
av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
|
||||
s->http_code, end);
|
||||
return -1;
|
||||
}
|
||||
if ((ret = check_http_code(h, s->http_code, end)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
while (*p != '\0' && *p != ':')
|
||||
p++;
|
||||
@ -364,40 +464,28 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
while (av_isspace(*p))
|
||||
p++;
|
||||
if (!av_strcasecmp(tag, "Location")) {
|
||||
char redirected_location[MAX_URL_SIZE], *new_loc;
|
||||
ff_make_absolute_url(redirected_location, sizeof(redirected_location),
|
||||
s->location, p);
|
||||
new_loc = av_strdup(redirected_location);
|
||||
if (!new_loc)
|
||||
return AVERROR(ENOMEM);
|
||||
av_free(s->location);
|
||||
s->location = new_loc;
|
||||
if ((ret = parse_location(s, p)) < 0)
|
||||
return ret;
|
||||
*new_location = 1;
|
||||
} else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) {
|
||||
} else if (!av_strcasecmp(tag, "Content-Length") && s->filesize == -1) {
|
||||
s->filesize = strtoll(p, NULL, 10);
|
||||
} else if (!av_strcasecmp (tag, "Content-Range")) {
|
||||
/* "bytes $from-$to/$document_size" */
|
||||
const char *slash;
|
||||
if (!strncmp (p, "bytes ", 6)) {
|
||||
p += 6;
|
||||
s->off = strtoll(p, NULL, 10);
|
||||
if ((slash = strchr(p, '/')) && strlen(slash) > 0)
|
||||
s->filesize = strtoll(slash+1, NULL, 10);
|
||||
}
|
||||
if (s->seekable == -1 && (!s->is_akamai || s->filesize != 2147483647))
|
||||
h->is_streamed = 0; /* we _can_ in fact seek */
|
||||
} else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5) && s->seekable == -1) {
|
||||
} else if (!av_strcasecmp(tag, "Content-Range")) {
|
||||
parse_content_range(h, p);
|
||||
} else if (!av_strcasecmp(tag, "Accept-Ranges") &&
|
||||
!strncmp(p, "bytes", 5) &&
|
||||
s->seekable == -1) {
|
||||
h->is_streamed = 0;
|
||||
} else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) {
|
||||
} else if (!av_strcasecmp(tag, "Transfer-Encoding") &&
|
||||
!av_strncasecmp(p, "chunked", 7)) {
|
||||
s->filesize = -1;
|
||||
s->chunksize = 0;
|
||||
} else if (!av_strcasecmp (tag, "WWW-Authenticate")) {
|
||||
} else if (!av_strcasecmp(tag, "WWW-Authenticate")) {
|
||||
ff_http_auth_handle_header(&s->auth_state, tag, p);
|
||||
} else if (!av_strcasecmp (tag, "Authentication-Info")) {
|
||||
} else if (!av_strcasecmp(tag, "Authentication-Info")) {
|
||||
ff_http_auth_handle_header(&s->auth_state, tag, p);
|
||||
} else if (!av_strcasecmp (tag, "Proxy-Authenticate")) {
|
||||
} else if (!av_strcasecmp(tag, "Proxy-Authenticate")) {
|
||||
ff_http_auth_handle_header(&s->proxy_auth_state, tag, p);
|
||||
} else if (!av_strcasecmp (tag, "Connection")) {
|
||||
} else if (!av_strcasecmp(tag, "Connection")) {
|
||||
if (!strcmp(p, "close"))
|
||||
s->willclose = 1;
|
||||
} else if (!av_strcasecmp (tag, "Server")) {
|
||||
@ -407,7 +495,8 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
s->is_mediagateway = 1;
|
||||
}
|
||||
} else if (!av_strcasecmp (tag, "Content-Type")) {
|
||||
av_free(s->mime_type); s->mime_type = av_strdup(p);
|
||||
av_free(s->mime_type);
|
||||
s->mime_type = av_strdup(p);
|
||||
} else if (!av_strcasecmp (tag, "Set-Cookie")) {
|
||||
if (!s->cookies) {
|
||||
if (!(s->cookies = av_strdup(p)))
|
||||
@ -425,37 +514,11 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
} else if (!av_strcasecmp (tag, "Icy-MetaInt")) {
|
||||
s->icy_metaint = strtoll(p, NULL, 10);
|
||||
} else if (!av_strncasecmp(tag, "Icy-", 4)) {
|
||||
// Concat all Icy- header lines
|
||||
char *buf = av_asprintf("%s%s: %s\n",
|
||||
s->icy_metadata_headers ? s->icy_metadata_headers : "", tag, p);
|
||||
if (!buf)
|
||||
return AVERROR(ENOMEM);
|
||||
av_freep(&s->icy_metadata_headers);
|
||||
s->icy_metadata_headers = buf;
|
||||
} else if (!av_strcasecmp (tag, "Content-Encoding")) {
|
||||
if (!av_strncasecmp(p, "gzip", 4) || !av_strncasecmp(p, "deflate", 7)) {
|
||||
#if CONFIG_ZLIB
|
||||
s->compressed = 1;
|
||||
inflateEnd(&s->inflate_stream);
|
||||
if (inflateInit2(&s->inflate_stream, 32 + 15) != Z_OK) {
|
||||
av_log(h, AV_LOG_WARNING, "Error during zlib initialisation: %s\n",
|
||||
s->inflate_stream.msg);
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
if (zlibCompileFlags() & (1 << 17)) {
|
||||
av_log(h, AV_LOG_WARNING, "Your zlib was compiled without gzip support.\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
#else
|
||||
av_log(h, AV_LOG_WARNING, "Compressed (%s) content, need zlib with gzip support\n", p);
|
||||
return AVERROR(ENOSYS);
|
||||
#endif
|
||||
} else if (!av_strncasecmp(p, "identity", 8)) {
|
||||
// The normal, no-encoding case (although servers shouldn't include
|
||||
// the header at all if this is the case).
|
||||
} else {
|
||||
av_log(h, AV_LOG_WARNING, "Unknown content coding: %s\n", p);
|
||||
}
|
||||
if ((ret = parse_icy(s, tag, p)) < 0)
|
||||
return ret;
|
||||
} else if (!av_strcasecmp(tag, "Content-Encoding")) {
|
||||
if ((ret = parse_content_encoding(h, p)) < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -648,12 +711,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
|
||||
// Note: we send this on purpose even when s->off is 0 when we're probing,
|
||||
// since it allows us to detect more reliably if a (non-conforming)
|
||||
// server supports seeking by analysing the reply headers.
|
||||
if (!has_header(s->headers, "\r\nRange: ") && !post && (s->off > 0 || s->req_end_offset || s->seekable == -1)) {
|
||||
if (!has_header(s->headers, "\r\nRange: ") && !post && (s->off > 0 || s->end_off || s->seekable == -1)) {
|
||||
len += av_strlcatf(headers + len, sizeof(headers) - len,
|
||||
"Range: bytes=%"PRId64"-", s->off);
|
||||
if (s->req_end_offset)
|
||||
if (s->end_off)
|
||||
len += av_strlcatf(headers + len, sizeof(headers) - len,
|
||||
"%"PRId64, s->req_end_offset - 1);
|
||||
"%"PRId64, s->end_off - 1);
|
||||
len += av_strlcpy(headers + len, "\r\n",
|
||||
sizeof(headers) - len);
|
||||
}
|
||||
@ -677,6 +740,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
|
||||
if (!has_header(s->headers, "\r\nContent-Length: ") && s->post_data)
|
||||
len += av_strlcatf(headers + len, sizeof(headers) - len,
|
||||
"Content-Length: %d\r\n", s->post_datalen);
|
||||
|
||||
if (!has_header(s->headers, "\r\nContent-Type: ") && s->content_type)
|
||||
len += av_strlcatf(headers + len, sizeof(headers) - len,
|
||||
"Content-Type: %s\r\n", s->content_type);
|
||||
@ -768,7 +832,6 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
|
||||
}
|
||||
if (len > 0) {
|
||||
s->off += len;
|
||||
s->icy_data_read += len;
|
||||
if (s->chunksize > 0)
|
||||
s->chunksize -= len;
|
||||
}
|
||||
@ -807,7 +870,7 @@ static int http_buf_read_compressed(URLContext *h, uint8_t *buf, int size)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int http_read(URLContext *h, uint8_t *buf, int size)
|
||||
static int http_read_stream(URLContext *h, uint8_t *buf, int size)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
int err, new_location;
|
||||
@ -842,32 +905,6 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
|
||||
}
|
||||
size = FFMIN(size, s->chunksize);
|
||||
}
|
||||
if (s->icy_metaint > 0) {
|
||||
int remaining = s->icy_metaint - s->icy_data_read; /* until next metadata packet */
|
||||
if (!remaining) {
|
||||
// The metadata packet is variable sized. It has a 1 byte header
|
||||
// which sets the length of the packet (divided by 16). If it's 0,
|
||||
// the metadata doesn't change. After the packet, icy_metaint bytes
|
||||
// of normal data follow.
|
||||
int ch = http_getc(s);
|
||||
if (ch < 0)
|
||||
return ch;
|
||||
if (ch > 0) {
|
||||
char data[255 * 16 + 1];
|
||||
int n;
|
||||
int ret;
|
||||
ch *= 16;
|
||||
for (n = 0; n < ch; n++)
|
||||
data[n] = http_getc(s);
|
||||
data[ch + 1] = 0;
|
||||
if ((ret = av_opt_set(s, "icy_metadata_packet", data, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
s->icy_data_read = 0;
|
||||
remaining = s->icy_metaint;
|
||||
}
|
||||
size = FFMIN(size, remaining);
|
||||
}
|
||||
#if CONFIG_ZLIB
|
||||
if (s->compressed)
|
||||
return http_buf_read_compressed(h, buf, size);
|
||||
@ -875,6 +912,72 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
|
||||
return http_buf_read(h, buf, size);
|
||||
}
|
||||
|
||||
// Like http_read_stream(), but no short reads.
|
||||
// Assumes partial reads are an error.
|
||||
static int http_read_stream_all(URLContext *h, uint8_t *buf, int size)
|
||||
{
|
||||
int pos = 0;
|
||||
while (pos < size) {
|
||||
int len = http_read_stream(h, buf + pos, size - pos);
|
||||
if (len < 0)
|
||||
return len;
|
||||
pos += len;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int store_icy(URLContext *h, int size)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
/* until next metadata packet */
|
||||
int remaining = s->icy_metaint - s->icy_data_read;
|
||||
|
||||
if (remaining < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!remaining) {
|
||||
// The metadata packet is variable sized. It has a 1 byte header
|
||||
// which sets the length of the packet (divided by 16). If it's 0,
|
||||
// the metadata doesn't change. After the packet, icy_metaint bytes
|
||||
// of normal data follow.
|
||||
uint8_t ch;
|
||||
int len = http_read_stream_all(h, &ch, 1);
|
||||
if (len < 0)
|
||||
return len;
|
||||
if (ch > 0) {
|
||||
char data[255 * 16 + 1];
|
||||
int ret;
|
||||
len = ch * 16;
|
||||
ret = http_read_stream_all(h, data, len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
data[len + 1] = 0;
|
||||
if ((ret = av_opt_set(s, "icy_metadata_packet", data, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
s->icy_data_read = 0;
|
||||
remaining = s->icy_metaint;
|
||||
}
|
||||
|
||||
return FFMIN(size, remaining);
|
||||
}
|
||||
|
||||
static int http_read(URLContext *h, uint8_t *buf, int size)
|
||||
{
|
||||
HTTPContext *s = h->priv_data;
|
||||
|
||||
if (s->icy_metaint > 0) {
|
||||
size = store_icy(h, size);
|
||||
if (size < 0)
|
||||
return size;
|
||||
}
|
||||
|
||||
size = http_read_stream(h, buf, size);
|
||||
if (size > 0)
|
||||
s->icy_data_read += size;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* used only when posting data */
|
||||
static int http_write(URLContext *h, const uint8_t *buf, int size)
|
||||
{
|
||||
@ -945,15 +1048,16 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
|
||||
URLContext *old_hd = s->hd;
|
||||
int64_t old_off = s->off;
|
||||
uint8_t old_buf[BUFFER_SIZE];
|
||||
int old_buf_size;
|
||||
int old_buf_size, ret;
|
||||
AVDictionary *options = NULL;
|
||||
|
||||
if (whence == AVSEEK_SIZE)
|
||||
return s->filesize;
|
||||
else if ((whence == SEEK_CUR && off == 0) || (whence == SEEK_SET && off == s->off))
|
||||
else if ((whence == SEEK_CUR && off == 0) ||
|
||||
(whence == SEEK_SET && off == s->off))
|
||||
return s->off;
|
||||
else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
|
||||
return -1;
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
/* we save the old context in case the seek fails */
|
||||
old_buf_size = s->buf_end - s->buf_ptr;
|
||||
@ -967,14 +1071,14 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
|
||||
|
||||
/* if it fails, continue on old connection */
|
||||
av_dict_copy(&options, s->chained_options, 0);
|
||||
if (http_open_cnx(h, &options) < 0) {
|
||||
if ((ret = http_open_cnx(h, &options)) < 0) {
|
||||
av_dict_free(&options);
|
||||
memcpy(s->buffer, old_buf, old_buf_size);
|
||||
s->buf_ptr = s->buffer;
|
||||
s->buf_end = s->buffer + old_buf_size;
|
||||
s->hd = old_hd;
|
||||
s->off = old_off;
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
av_dict_free(&options);
|
||||
ffurl_close(old_hd);
|
||||
|
@ -33,6 +33,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
|
||||
{ AV_CODEC_ID_MOV_TEXT , 0x08 },
|
||||
{ AV_CODEC_ID_MPEG4 , 0x20 },
|
||||
{ AV_CODEC_ID_H264 , 0x21 },
|
||||
{ AV_CODEC_ID_HEVC , 0x23 },
|
||||
{ AV_CODEC_ID_AAC , 0x40 },
|
||||
{ AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
|
||||
{ AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG2 Main */
|
||||
@ -151,8 +152,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
|
||||
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') },
|
||||
|
||||
{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
|
||||
{ AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which indicates parameter sets may be in ES */
|
||||
{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
|
||||
|
||||
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
|
||||
{ AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */
|
||||
|
@ -22,6 +22,7 @@
|
||||
* @todo better probing than extensions matching
|
||||
*/
|
||||
|
||||
#define MODPLUG_STATIC
|
||||
#include <libmodplug/modplug.h>
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/eval.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avc.h"
|
||||
#include "hevc.h"
|
||||
#include "avformat.h"
|
||||
#include "avio_internal.h"
|
||||
#include "avlanguage.h"
|
||||
@ -532,6 +533,8 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
|
||||
ret = put_wv_codecpriv(dyn_cp, codec);
|
||||
else if (codec->codec_id == AV_CODEC_ID_H264)
|
||||
ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size);
|
||||
else if (codec->codec_id == AV_CODEC_ID_HEVC)
|
||||
ret = ff_isom_write_hvcc(dyn_cp, codec->extradata, codec->extradata_size, 0);
|
||||
else if (codec->codec_id == AV_CODEC_ID_ALAC) {
|
||||
if (codec->extradata_size < 36) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
@ -942,7 +945,9 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme
|
||||
end_ebml_master(s->pb, targets);
|
||||
|
||||
while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
|
||||
if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode"))
|
||||
if (av_strcasecmp(t->key, "title") &&
|
||||
av_strcasecmp(t->key, "stereo_mode") &&
|
||||
av_strcasecmp(t->key, "encoding_tool"))
|
||||
mkv_write_simpletag(s->pb, t);
|
||||
|
||||
end_ebml_master(s->pb, tag);
|
||||
@ -1147,7 +1152,10 @@ static int mkv_write_header(AVFormatContext *s)
|
||||
segment_uid[i] = av_lfg_get(&lfg);
|
||||
|
||||
put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);
|
||||
put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
|
||||
if ((tag = av_dict_get(s->metadata, "encoding_tool", NULL, 0)))
|
||||
put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, tag->value);
|
||||
else
|
||||
put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
|
||||
put_ebml_binary(pb, MATROSKA_ID_SEGMENTUID, segment_uid, 16);
|
||||
} else {
|
||||
const char *ident = "Lavf";
|
||||
@ -1363,6 +1371,10 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
|
||||
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
|
||||
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
|
||||
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
|
||||
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
|
||||
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
|
||||
/* extradata is Annex B, assume the bitstream is too and convert it */
|
||||
ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
|
||||
else if (codec->codec_id == AV_CODEC_ID_WAVPACK) {
|
||||
int ret = mkv_strip_wavpack(pkt->data, &data, &size);
|
||||
if (ret < 0) {
|
||||
|
@ -1330,6 +1330,7 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
|
||||
if (color_greyscale) {
|
||||
int color_index, color_dec;
|
||||
/* compute the greyscale palette */
|
||||
st->codec->bits_per_coded_sample = color_depth;
|
||||
color_count = 1 << color_depth;
|
||||
color_index = 255;
|
||||
color_dec = 256 / (color_count - 1);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "hevc.h"
|
||||
#include "rtpenc.h"
|
||||
#include "mov_chan.h"
|
||||
|
||||
@ -66,6 +67,7 @@ static const AVOption options[] = {
|
||||
{ "ism_lookahead", "Number of lookahead entries for ISM files", offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
|
||||
{ "use_editlist", "use edit list", offsetof(MOVMuxContext, use_editlist), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM},
|
||||
{ "video_track_timescale", "set timescale of all video tracks", offsetof(MOVMuxContext, video_track_timescale), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
|
||||
{ "brand", "Override major brand", offsetof(MOVMuxContext, major_brand), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
@ -772,6 +774,16 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_wb32(pb, 0);
|
||||
ffio_wfourcc(pb, "hvcC");
|
||||
ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
/* also used by all avid codecs (dv, imx, meridien) and their variants */
|
||||
static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
@ -828,6 +840,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||
return 0;
|
||||
|
||||
if (track->enc->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1');
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_HEVC) tag = MKTAG('h','e','v','1');
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_AC3) tag = MKTAG('a','c','-','3');
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g');
|
||||
@ -906,11 +919,14 @@ static AVRational find_fps(AVFormatContext *s, AVStream *st)
|
||||
|
||||
static int mov_get_mpeg2_xdcam_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||
{
|
||||
int tag = MKTAG('m', '2', 'v', '1'); //fallback tag
|
||||
int tag = track->enc->codec_tag;
|
||||
int interlaced = track->enc->field_order > AV_FIELD_PROGRESSIVE;
|
||||
AVStream *st = track->st;
|
||||
int rate = av_q2d(find_fps(s, st));
|
||||
|
||||
if (!tag)
|
||||
tag = MKTAG('m', '2', 'v', '1'); //fallback tag
|
||||
|
||||
if (track->enc->pix_fmt == AV_PIX_FMT_YUV420P) {
|
||||
if (track->enc->width == 1280 && track->enc->height == 720) {
|
||||
if (!interlaced) {
|
||||
@ -1226,6 +1242,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
|
||||
avio_wb32(pb, 0);
|
||||
} else if (track->enc->codec_id == AV_CODEC_ID_DNXHD)
|
||||
mov_write_avid_tag(pb, track);
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_HEVC)
|
||||
mov_write_hvcc_tag(pb, track);
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_H264) {
|
||||
mov_write_avcc_tag(pb, track);
|
||||
if (track->mode == MODE_IPOD)
|
||||
@ -2208,7 +2226,8 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||
mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1);
|
||||
mov_write_string_metadata(s, pb, "\251alb", "album" , 1);
|
||||
mov_write_string_metadata(s, pb, "\251day", "date" , 1);
|
||||
mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
|
||||
if (!mov_write_string_metadata(s, pb, "\251too", "encoding_tool", 1))
|
||||
mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
|
||||
mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1);
|
||||
mov_write_string_metadata(s, pb, "\251gen", "genre" , 1);
|
||||
mov_write_string_metadata(s, pb, "\251cpy", "copyright", 1);
|
||||
@ -2942,7 +2961,9 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "ftyp");
|
||||
|
||||
if (mov->mode == MODE_3GP) {
|
||||
if (mov->major_brand && strlen(mov->major_brand) >= 4)
|
||||
ffio_wfourcc(pb, mov->major_brand);
|
||||
else if (mov->mode == MODE_3GP) {
|
||||
ffio_wfourcc(pb, has_h264 ? "3gp6" : "3gp4");
|
||||
minor = has_h264 ? 0x100 : 0x200;
|
||||
} else if (mov->mode & MODE_3G2) {
|
||||
@ -3337,6 +3358,15 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
} else {
|
||||
size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
|
||||
}
|
||||
} else if (enc->codec_id == AV_CODEC_ID_HEVC && trk->vos_len > 6 &&
|
||||
(AV_RB24(trk->vos_data) == 1 || AV_RB32(trk->vos_data) == 1)) {
|
||||
/* extradata is Annex B, assume the bitstream is too and convert it */
|
||||
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) {
|
||||
ff_hevc_annexb2mp4_buf(pkt->data, &reformatted_data, &size, 0, NULL);
|
||||
avio_write(pb, reformatted_data, size);
|
||||
} else {
|
||||
size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, 0, NULL);
|
||||
}
|
||||
} else {
|
||||
avio_write(pb, pkt->data, size);
|
||||
}
|
||||
|
@ -173,6 +173,8 @@ typedef struct MOVMuxContext {
|
||||
|
||||
int reserved_moov_size; ///< 0 for disabled, -1 for automatic, size otherwise
|
||||
int64_t reserved_moov_pos;
|
||||
|
||||
char *major_brand;
|
||||
} MOVMuxContext;
|
||||
|
||||
#define FF_MOV_FLAG_RTP_HINT 1
|
||||
|
@ -318,6 +318,8 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dir < 0)
|
||||
avio_seek(s->pb, FFMAX(ie->pos - 4096, 0), SEEK_SET);
|
||||
ret = avio_seek(s->pb, ie->pos, SEEK_SET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -417,14 +417,14 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (mp3->pics_to_write) {
|
||||
/* buffer audio packets until we get all the pictures */
|
||||
AVPacketList *pktl = av_mallocz(sizeof(*pktl));
|
||||
int ret;
|
||||
if (!pktl)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
pktl->pkt = *pkt;
|
||||
pktl->pkt.buf = av_buffer_ref(pkt->buf);
|
||||
if (!pktl->pkt.buf) {
|
||||
ret = av_copy_packet(&pktl->pkt, pkt);
|
||||
if (ret < 0) {
|
||||
av_freep(&pktl);
|
||||
return AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (mp3->queue_end)
|
||||
|
@ -996,10 +996,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
||||
pes->pts = AV_NOPTS_VALUE;
|
||||
pes->dts = AV_NOPTS_VALUE;
|
||||
if ((flags & 0xc0) == 0x80) {
|
||||
pes->pts = ff_parse_pes_pts(r);
|
||||
/* video pts is not monotonic, can't be used for dts */
|
||||
if (pes->st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
pes->dts = pes->pts;
|
||||
pes->dts = pes->pts = ff_parse_pes_pts(r);
|
||||
r += 5;
|
||||
} else if ((flags & 0xc0) == 0xc0) {
|
||||
pes->pts = ff_parse_pes_pts(r);
|
||||
|
@ -384,7 +384,7 @@ static int vorbis_packet(AVFormatContext *s, int idx)
|
||||
* here we parse the duration of each packet in the first page and compare
|
||||
* the total duration to the page granule to find the encoder delay and
|
||||
* set the first timestamp */
|
||||
if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {
|
||||
if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS) && (int64_t)os->granule>=0) {
|
||||
int seg, d;
|
||||
uint8_t *last_pkt = os->buf + os->pstart;
|
||||
uint8_t *next_pkt = last_pkt;
|
||||
|
@ -448,7 +448,7 @@ static int oma_read_probe(AVProbeData *p)
|
||||
/* This check cannot overflow as tag_len has at most 28 bits */
|
||||
if (p->buf_size < tag_len + 5)
|
||||
/* EA3 header comes late, might be outside of the probe buffer */
|
||||
return tag_len ? AVPROBE_SCORE_EXTENSION : 0;
|
||||
return tag_len ? AVPROBE_SCORE_EXTENSION/2 : 0;
|
||||
|
||||
buf += tag_len;
|
||||
|
||||
|
@ -1120,6 +1120,28 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
|
||||
if (s->flags & AVFMT_FLAG_NOFILLIN)
|
||||
return;
|
||||
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pkt->dts != AV_NOPTS_VALUE) {
|
||||
if (pkt->dts == pkt->pts && st->last_dts_for_order_check != AV_NOPTS_VALUE) {
|
||||
if (st->last_dts_for_order_check <= pkt->dts) {
|
||||
st->dts_ordered++;
|
||||
} else {
|
||||
av_log(s, st->dts_misordered ? AV_LOG_DEBUG : AV_LOG_WARNING,
|
||||
"DTS %"PRIi64" < %"PRIi64" out of order\n",
|
||||
pkt->dts,
|
||||
st->last_dts_for_order_check);
|
||||
st->dts_misordered++;
|
||||
}
|
||||
if (st->dts_ordered + st->dts_misordered > 250) {
|
||||
st->dts_ordered >>= 1;
|
||||
st->dts_misordered >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
st->last_dts_for_order_check = pkt->dts;
|
||||
if (st->dts_ordered < 8*st->dts_misordered && pkt->dts == pkt->pts)
|
||||
pkt->dts = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
if ((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
|
||||
pkt->dts = AV_NOPTS_VALUE;
|
||||
|
||||
@ -1664,6 +1686,7 @@ void ff_read_frame_flush(AVFormatContext *s)
|
||||
st->parser = NULL;
|
||||
}
|
||||
st->last_IP_pts = AV_NOPTS_VALUE;
|
||||
st->last_dts_for_order_check = AV_NOPTS_VALUE;
|
||||
if (st->first_dts == AV_NOPTS_VALUE)
|
||||
st->cur_dts = RELATIVE_TS_BASE;
|
||||
else
|
||||
@ -2488,6 +2511,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
||||
st = ic->streams[i];
|
||||
st->cur_dts = st->first_dts;
|
||||
st->last_IP_pts = AV_NOPTS_VALUE;
|
||||
st->last_dts_for_order_check = AV_NOPTS_VALUE;
|
||||
for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
|
||||
st->pts_buffer[j] = AV_NOPTS_VALUE;
|
||||
}
|
||||
@ -3623,6 +3647,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
|
||||
/* default pts setting is MPEG-like */
|
||||
avpriv_set_pts_info(st, 33, 1, 90000);
|
||||
st->last_IP_pts = AV_NOPTS_VALUE;
|
||||
st->last_dts_for_order_check = AV_NOPTS_VALUE;
|
||||
for (i = 0; i < MAX_REORDER_DELAY + 1; i++)
|
||||
st->pts_buffer[i] = AV_NOPTS_VALUE;
|
||||
|
||||
|
@ -216,6 +216,13 @@ T ldr \rt, [\rn]
|
||||
T add \rn, \rn, \rm
|
||||
.endm
|
||||
|
||||
.macro ldrc_pre cc, rt, rn, rm:vararg
|
||||
A ldr\cc \rt, [\rn, \rm]!
|
||||
T itt \cc
|
||||
T add\cc \rn, \rn, \rm
|
||||
T ldr\cc \rt, [\rn]
|
||||
.endm
|
||||
|
||||
.macro ldrd_reg rt, rt2, rn, rm
|
||||
A ldrd \rt, \rt2, [\rn, \rm]
|
||||
T add \rt, \rn, \rm
|
||||
|
@ -117,35 +117,6 @@ void av_buffer_unref(AVBufferRef **buf)
|
||||
}
|
||||
}
|
||||
|
||||
int av_buffer_release(AVBufferRef **buf, uint8_t **data)
|
||||
{
|
||||
AVBuffer *b;
|
||||
int ret = 0;
|
||||
|
||||
if (data)
|
||||
*data = NULL;
|
||||
if (!buf || !*buf)
|
||||
return 0;
|
||||
b = (*buf)->buffer;
|
||||
av_freep(buf);
|
||||
|
||||
if (data && avpriv_atomic_int_get(&b->refcount) > 1) {
|
||||
*data = av_memdup(b->data, b->size);
|
||||
if (!*data)
|
||||
ret = AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (!avpriv_atomic_int_add_and_fetch(&b->refcount, -1)) {
|
||||
if (data && !*data) {
|
||||
ret = 0;
|
||||
*data = b->data;
|
||||
} else
|
||||
b->free(b->opaque, b->data);
|
||||
av_freep(&b);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int av_buffer_is_writable(const AVBufferRef *buf)
|
||||
{
|
||||
if (buf->buffer->flags & AV_BUFFER_FLAG_READONLY)
|
||||
|
@ -154,18 +154,6 @@ AVBufferRef *av_buffer_ref(AVBufferRef *buf);
|
||||
*/
|
||||
void av_buffer_unref(AVBufferRef **buf);
|
||||
|
||||
/**
|
||||
* Free a given reference and pass underlaying data to user provided pointer.
|
||||
* If there is more than one reference then data is copied.
|
||||
*
|
||||
* @param buf the reference to be released. The pointer is set to NULL on return.
|
||||
* @param data pointer to be passed with underlaying data.
|
||||
* @return 0 on success, a negative AVERROR on failure.
|
||||
*
|
||||
* @note on error buffer is properly released and *data is set to NULL.
|
||||
*/
|
||||
int av_buffer_release(AVBufferRef **buf, uint8_t **data);
|
||||
|
||||
/**
|
||||
* @return 1 if the caller may write to the data referred to by buf (which is
|
||||
* true if and only if buf is the only reference to the underlying AVBuffer).
|
||||
|
@ -113,7 +113,7 @@ typedef struct AVFloatDSPContext {
|
||||
* constraints: 32-byte aligned
|
||||
* @param src1 second input vector
|
||||
* constraints: 32-byte aligned
|
||||
* @param src1 third input vector
|
||||
* @param src2 third input vector
|
||||
* constraints: 32-byte aligned
|
||||
* @param len number of elements in the input
|
||||
* constraints: multiple of 16
|
||||
@ -132,8 +132,6 @@ typedef struct AVFloatDSPContext {
|
||||
* constraints: 32-byte aligned
|
||||
* @param src1 second input vector
|
||||
* constraints: 32-byte aligned
|
||||
* @param src1 third input vector
|
||||
* constraints: 32-byte aligned
|
||||
* @param len number of elements in the input
|
||||
* constraints: multiple of 16
|
||||
*/
|
||||
|
@ -596,7 +596,7 @@ AVFrame *av_frame_alloc(void);
|
||||
void av_frame_free(AVFrame **frame);
|
||||
|
||||
/**
|
||||
* Setup a new reference to the data described by a given frame.
|
||||
* Set up a new reference to the data described by the source frame.
|
||||
*
|
||||
* Copy frame properties from src to dst and create a new reference for each
|
||||
* AVBufferRef from src.
|
||||
|
@ -1599,8 +1599,10 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp)
|
||||
|
||||
for (i = 0; i < ranges->nb_ranges; i++) {
|
||||
AVOptionRange *range = ranges->range[i];
|
||||
av_freep(&range->str);
|
||||
av_freep(&ranges->range[i]);
|
||||
if (range) {
|
||||
av_freep(&range->str);
|
||||
av_freep(&ranges->range[i]);
|
||||
}
|
||||
}
|
||||
av_freep(&ranges->range);
|
||||
av_freep(rangesp);
|
||||
|
@ -26,6 +26,10 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
|
||||
#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
#define AV_TS_MAX_STRING_SIZE 32
|
||||
|
||||
/**
|
||||
|
@ -143,7 +143,7 @@ int ff_get_cpu_flags_x86(void)
|
||||
if (max_std_level >= 7) {
|
||||
cpuid(7, eax, ebx, ecx, edx);
|
||||
#if HAVE_AVX2
|
||||
if (ebx & 0x00000020)
|
||||
if ((rval & AV_CPU_FLAG_AVX) && (ebx & 0x00000020))
|
||||
rval |= AV_CPU_FLAG_AVX2;
|
||||
#endif /* HAVE_AVX2 */
|
||||
/* BMI1/2 don't need OS support */
|
||||
|
@ -26,7 +26,7 @@
|
||||
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) {
|
||||
double scale = s->dither.noise_scale;
|
||||
#define TMP_EXTRA 2
|
||||
double *tmp = av_malloc((len + TMP_EXTRA) * sizeof(double));
|
||||
double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double));
|
||||
int i;
|
||||
|
||||
for(i=0; i<len + TMP_EXTRA; i++){
|
||||
|
@ -95,7 +95,7 @@ static int build_filter(ResampleContext *c, void *filter, double factor, int tap
|
||||
int filter_type, int kaiser_beta){
|
||||
int ph, i;
|
||||
double x, y, w;
|
||||
double *tab = av_malloc(tap_count * sizeof(*tab));
|
||||
double *tab = av_malloc_array(tap_count, sizeof(*tab));
|
||||
const int center= (tap_count-1)/2;
|
||||
|
||||
if (!tab)
|
||||
@ -229,6 +229,11 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r
|
||||
av_assert0(0);
|
||||
}
|
||||
|
||||
if (filter_size/factor > INT32_MAX/256) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Filter length too large\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
c->phase_shift = phase_shift;
|
||||
c->phase_mask = phase_count - 1;
|
||||
c->linear = linear;
|
||||
|
@ -208,8 +208,9 @@ static void lumRangeToJpeg16_c(int16_t *_dst, int width)
|
||||
{
|
||||
int i;
|
||||
int32_t *dst = (int32_t *) _dst;
|
||||
for (i = 0; i < width; i++)
|
||||
dst[i] = (FFMIN(dst[i], 30189 << 4) * 4769 - (39057361 << 2)) >> 12;
|
||||
for (i = 0; i < width; i++) {
|
||||
dst[i] = ((int)(FFMIN(dst[i], 30189 << 4) * 4769U - (39057361 << 2))) >> 12;
|
||||
}
|
||||
}
|
||||
|
||||
static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
|
||||
|
@ -367,7 +367,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
|
||||
int sizeFactor = -1;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(scale_algorithms); i++) {
|
||||
if (flags & scale_algorithms[i].flag) {
|
||||
if (flags & scale_algorithms[i].flag && scale_algorithms[i].size_factor > 0) {
|
||||
sizeFactor = scale_algorithms[i].size_factor;
|
||||
break;
|
||||
}
|
||||
@ -1055,6 +1055,8 @@ static int handle_jpeg(enum AVPixelFormat *format)
|
||||
*format = AV_PIX_FMT_YUV440P;
|
||||
return 1;
|
||||
case AV_PIX_FMT_GRAY8:
|
||||
case AV_PIX_FMT_GRAY16LE:
|
||||
case AV_PIX_FMT_GRAY16BE:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define LIBSWSCALE_VERSION_MAJOR 2
|
||||
#define LIBSWSCALE_VERSION_MINOR 5
|
||||
#define LIBSWSCALE_VERSION_MICRO 101
|
||||
#define LIBSWSCALE_VERSION_MICRO 102
|
||||
|
||||
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
|
||||
LIBSWSCALE_VERSION_MINOR, \
|
||||
|
@ -266,7 +266,8 @@ static void yuv2yuvX_sse3(const int16_t *filter, int filterSize,
|
||||
"jb 1b \n\t"\
|
||||
:: "g" (filter),
|
||||
"r" (dest-offset), "g" ((x86_reg)(dstW+offset)), "m" (offset)
|
||||
: "%"REG_d, "%"REG_S, "%"REG_c
|
||||
: XMM_CLOBBERS("%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , "%xmm4" , "%xmm5" , "%xmm7" ,)
|
||||
"%"REG_d, "%"REG_S, "%"REG_c
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
@ -332,7 +332,7 @@ static void RENAME(yuv2yuvX)(const int16_t *filter, int filterSize,
|
||||
MOVNTQ( q3, 24(dst, index, 4))\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
#define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
|
||||
|
||||
@ -358,13 +358,13 @@ static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter,
|
||||
"psraw $3, %%mm1 \n\t"
|
||||
"psraw $3, %%mm7 \n\t"
|
||||
"packuswb %%mm7, %%mm1 \n\t"
|
||||
WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
|
||||
WRITEBGR32(%4, "%5", %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
} else {
|
||||
YSCALEYUV2PACKEDX_ACCURATE
|
||||
YSCALEYUV2RGBX
|
||||
"pcmpeqd %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
}
|
||||
@ -387,13 +387,13 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"psraw $3, %%mm1 \n\t"
|
||||
"psraw $3, %%mm7 \n\t"
|
||||
"packuswb %%mm7, %%mm1 \n\t"
|
||||
WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
} else {
|
||||
YSCALEYUV2PACKEDX
|
||||
YSCALEYUV2RGBX
|
||||
"pcmpeqd %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
}
|
||||
@ -422,7 +422,7 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
MOVNTQ(%%mm1, 8(dst, index, 2))\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
#define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index)
|
||||
|
||||
@ -446,7 +446,7 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter,
|
||||
"paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
|
||||
"paddusb "RED_DITHER"(%0), %%mm5\n\t"
|
||||
#endif
|
||||
WRITERGB16(%4, %5, %%REGa)
|
||||
WRITERGB16(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%0), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB16(%4, %5, %%REGa)
|
||||
WRITERGB16(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
MOVNTQ(%%mm1, 8(dst, index, 2))\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
#define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index)
|
||||
|
||||
@ -523,7 +523,7 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter,
|
||||
"paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
|
||||
"paddusb "RED_DITHER"(%0), %%mm5\n\t"
|
||||
#endif
|
||||
WRITERGB15(%4, %5, %%REGa)
|
||||
WRITERGB15(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%0), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB15(%4, %5, %%REGa)
|
||||
WRITERGB15(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"add $24, "#dst" \n\t"\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
|
||||
#define WRITEBGR24MMXEXT(dst, dstw, index) \
|
||||
@ -649,7 +649,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"add $24, "#dst" \n\t"\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
|
||||
#if COMPILE_TEMPLATE_MMXEXT
|
||||
@ -676,7 +676,7 @@ static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter,
|
||||
"pxor %%mm7, %%mm7 \n\t"
|
||||
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
|
||||
"add %4, %%"REG_c" \n\t"
|
||||
WRITEBGR24(%%REGc, %5, %%REGa)
|
||||
WRITEBGR24(%%REGc, "%5", %%REGa)
|
||||
:: "r" (&c->redDither),
|
||||
"m" (dummy), "m" (dummy), "m" (dummy),
|
||||
"r" (dest), "m" (dstW_reg), "m"(uv_off)
|
||||
@ -700,7 +700,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"pxor %%mm7, %%mm7 \n\t"
|
||||
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize
|
||||
"add %4, %%"REG_c" \n\t"
|
||||
WRITEBGR24(%%REGc, %5, %%REGa)
|
||||
WRITEBGR24(%%REGc, "%5", %%REGa)
|
||||
:: "r" (&c->redDither),
|
||||
"m" (dummy), "m" (dummy), "m" (dummy),
|
||||
"r" (dest), "m" (dstW_reg), "m"(uv_off)
|
||||
@ -721,7 +721,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
MOVNTQ(%%mm7, 8(dst, index, 2))\
|
||||
\
|
||||
"add $8, "#index" \n\t"\
|
||||
"cmp "#dstw", "#index" \n\t"\
|
||||
"cmp "dstw", "#index" \n\t"\
|
||||
" jb 1b \n\t"
|
||||
#define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index)
|
||||
|
||||
@ -742,7 +742,7 @@ static void RENAME(yuv2yuyv422_X_ar)(SwsContext *c, const int16_t *lumFilter,
|
||||
"psraw $3, %%mm4 \n\t"
|
||||
"psraw $3, %%mm1 \n\t"
|
||||
"psraw $3, %%mm7 \n\t"
|
||||
WRITEYUY2(%4, %5, %%REGa)
|
||||
WRITEYUY2(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -763,7 +763,7 @@ static void RENAME(yuv2yuyv422_X)(SwsContext *c, const int16_t *lumFilter,
|
||||
"psraw $3, %%mm4 \n\t"
|
||||
"psraw $3, %%mm1 \n\t"
|
||||
"psraw $3, %%mm7 \n\t"
|
||||
WRITEYUY2(%4, %5, %%REGa)
|
||||
WRITEYUY2(%4, "%5", %%REGa)
|
||||
YSCALEYUV2PACKEDX_END
|
||||
}
|
||||
|
||||
@ -864,7 +864,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2],
|
||||
"psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
|
||||
"psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
|
||||
"packuswb %%mm7, %%mm1 \n\t"
|
||||
WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
WRITEBGR32(%4, DSTW_OFFSET"(%5)", %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest),
|
||||
"a" (&c->redDither),
|
||||
"r" (abuf0), "r" (abuf1)
|
||||
@ -888,7 +888,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2],
|
||||
"packuswb %%mm7, %%mm1 \n\t"
|
||||
"pop %1 \n\t"
|
||||
"pop %0 \n\t"
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -902,7 +902,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2],
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB(%%REGBP, %5)
|
||||
"pcmpeqd %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -919,14 +919,13 @@ static void RENAME(yuv2bgr24_2)(SwsContext *c, const int16_t *buf[2],
|
||||
const int16_t *buf0 = buf[0], *buf1 = buf[1],
|
||||
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
|
||||
|
||||
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
|
||||
__asm__ volatile(
|
||||
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB(%%REGBP, %5)
|
||||
"pxor %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -942,7 +941,6 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2],
|
||||
const int16_t *buf0 = buf[0], *buf1 = buf[1],
|
||||
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
|
||||
|
||||
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
|
||||
__asm__ volatile(
|
||||
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
@ -955,7 +953,7 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2],
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -971,7 +969,6 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2],
|
||||
const int16_t *buf0 = buf[0], *buf1 = buf[1],
|
||||
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
|
||||
|
||||
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
|
||||
__asm__ volatile(
|
||||
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
@ -984,7 +981,7 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2],
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB16(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1040,13 +1037,12 @@ static void RENAME(yuv2yuyv422_2)(SwsContext *c, const int16_t *buf[2],
|
||||
const int16_t *buf0 = buf[0], *buf1 = buf[1],
|
||||
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
|
||||
|
||||
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
|
||||
__asm__ volatile(
|
||||
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2PACKED(%%REGBP, %5)
|
||||
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1189,7 +1185,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1(%%REGBP, %5)
|
||||
YSCALEYUV2RGB1_ALPHA(%%REGBP)
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1202,7 +1198,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1(%%REGBP, %5)
|
||||
"pcmpeqd %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1218,7 +1214,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1b(%%REGBP, %5)
|
||||
YSCALEYUV2RGB1_ALPHA(%%REGBP)
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1231,7 +1227,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1b(%%REGBP, %5)
|
||||
"pcmpeqd %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1257,7 +1253,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1(%%REGBP, %5)
|
||||
"pxor %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1271,7 +1267,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0,
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2RGB1b(%%REGBP, %5)
|
||||
"pxor %%mm7, %%mm7 \n\t"
|
||||
WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1302,7 +1298,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1322,7 +1318,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1353,7 +1349,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB16(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1373,7 +1369,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
|
||||
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
|
||||
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
|
||||
#endif
|
||||
WRITERGB16(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1434,7 +1430,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2PACKED1(%%REGBP, %5)
|
||||
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
@ -1447,7 +1443,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
|
||||
"mov %4, %%"REG_b" \n\t"
|
||||
"push %%"REG_BP" \n\t"
|
||||
YSCALEYUV2PACKED1b(%%REGBP, %5)
|
||||
WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
|
||||
WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP)
|
||||
"pop %%"REG_BP" \n\t"
|
||||
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
|
||||
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 937ff1dd9f498b39f9e882316e371fbf
|
||||
gbrp9be c76ab5850c9bc72bbbf36caa6d1c5ac7
|
||||
gbrp9le 5ad363dc9570187ad3e3f2344fbb30cf
|
||||
gray 2ee2ea2340d0ecf2dfa6f90f87384799
|
||||
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
|
||||
gray16le a1f912941247e45b394b9cf4f0e81130
|
||||
gray16be a61507aec1088f5692036e1aabdb4f41
|
||||
gray16le 171fbdd46e3737bc865d0185a0006e1c
|
||||
monob 309b5785a36bd988d17e15d88f4ffad1
|
||||
monow 8809a02bc69b58d1114b09ca79ebffad
|
||||
nv12 75e90c54d858b993e99f4ee6d2a2a38f
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 937ff1dd9f498b39f9e882316e371fbf
|
||||
gbrp9be c76ab5850c9bc72bbbf36caa6d1c5ac7
|
||||
gbrp9le 5ad363dc9570187ad3e3f2344fbb30cf
|
||||
gray 2ee2ea2340d0ecf2dfa6f90f87384799
|
||||
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
|
||||
gray16le a1f912941247e45b394b9cf4f0e81130
|
||||
gray16be a61507aec1088f5692036e1aabdb4f41
|
||||
gray16le 171fbdd46e3737bc865d0185a0006e1c
|
||||
monob 309b5785a36bd988d17e15d88f4ffad1
|
||||
monow 8809a02bc69b58d1114b09ca79ebffad
|
||||
nv12 75e90c54d858b993e99f4ee6d2a2a38f
|
||||
|
@ -26,8 +26,8 @@ gbrp14le d1465f7280f35aa0a70709e5a7bee1a4
|
||||
gbrp9be f17b7ba66ba35ed0fcbbb5c32c7e0f56
|
||||
gbrp9le fc11219debfbe8dd8c3d6f0ef92c4d50
|
||||
gray 6d34024704f862c75db3ba6989a4a039
|
||||
gray16be 02ac848ad4e28c06938599563ba81ff7
|
||||
gray16le 672aebfeb8a0f4067b3c6064340056e4
|
||||
gray16be 27cfdb4b211cad34f66a664cabd754b4
|
||||
gray16le 91cb081d457100a60c2d0f54110f064f
|
||||
nv12 923a313a7013fb0e87608155ef6aa9a4
|
||||
nv21 21e6b9273bb74203beabeb9edb9cf95c
|
||||
pal8 e1fd50b8a8a67fb5abd8b44abc778bbb
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 775b50257b848007c4ef3441ba772db1
|
||||
gbrp9be c293422f1395bfddc788282eef139ed6
|
||||
gbrp9le 0d2bb77c25d84611ec6222f3dffe11c0
|
||||
gray 42a0ad7625a0481183e375e38679d8d3
|
||||
gray16be a447af6482b922c9997ac02e5d3535f1
|
||||
gray16le c1dd0db327295898ff282d07f48c105d
|
||||
gray16be e10bc0a8b015fdb0776eca402ffe5eff
|
||||
gray16le 2eb159fb4af25c3b4f033e6414fef63e
|
||||
monob 1b7fb7e69a913a0a1c0dffc54e5899ea
|
||||
monow b5d3778a054fc73d515d36f8a6bc693b
|
||||
nv12 b3829e9ae2a15349432b7efac4236068
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 7baa94cd296e6ec8e41446bca95151e4
|
||||
gbrp9be a6eb7cde03f19a25bf13627d731a2c9a
|
||||
gbrp9le 1b6d228b97a370ec76707ed2dcc15a66
|
||||
gray 3258910ef8c6f0c4a331368e7af87507
|
||||
gray16be 50cc8a29e8e81e174676542347804a4f
|
||||
gray16le fb93e8aa2deed734dfd1ca6a5c48cf18
|
||||
gray16be 9a4c7e731ce572ad86985b56a653b5c3
|
||||
gray16le d10df57cf0de14206c8e354e8f6b732b
|
||||
rgb0 5f8f8076e2b9a2422cac25a4f0459d79
|
||||
rgb24 66ca89ced3ade4c239ad6c5a79a6b8cd
|
||||
rgb444be 7197a09137ab5630a26226396bb7e313
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 297e71281660b905711330a86eca8a71
|
||||
gbrp9be 8268b9a1e9f4d6a42e57db9c81d82fa5
|
||||
gbrp9le b3a09bba825e16e6d160328706a9f62f
|
||||
gray aaa9c2fe3c2a2a43a4b35226ea689b3c
|
||||
gray16be d206a080739d89cb7dc0009ad4082ed4
|
||||
gray16le 7ebcfd9401ba85e584230de8fc02986d
|
||||
gray16be 5be35a44f0ba85eb8c55b4f062fdb80f
|
||||
gray16le d9e73f7c4f53d795192ab87649270241
|
||||
nv12 719adbc47fa74e92f83150921917483f
|
||||
nv21 9c833b3ce53539d270e1f21e4319797b
|
||||
pal8 19c8735b23feeed18ec2d37913a5f3f8
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 778c97b5ed06b9f1a230840a15771bac
|
||||
gbrp9be b9fc10ab1ddad0e7945d6b047725d078
|
||||
gbrp9le ef3d6bc8069b95cae31100908a7fa967
|
||||
gray 2cadbaed81ee12181bda9f4aa87ddbc0
|
||||
gray16be cd9c1367dabd2f1858ae4f31693e622f
|
||||
gray16le 4ef774c282280d7ed4780690df6e5cb4
|
||||
gray16be 34cd1af8bbdd4266d5f7985ef22cfc9f
|
||||
gray16le 0eec98b32e4a2a57d9f51aac9ac3cf8d
|
||||
monob 07cffe7f5f25f39c3aa38866303791c6
|
||||
monow f2d1bdb939813a49abd6348ecfbb2703
|
||||
nv12 6847b3f7141ca1e3c40d3a494f0e13cb
|
||||
|
@ -26,8 +26,8 @@ gbrp14le 937ff1dd9f498b39f9e882316e371fbf
|
||||
gbrp9be c76ab5850c9bc72bbbf36caa6d1c5ac7
|
||||
gbrp9le 5ad363dc9570187ad3e3f2344fbb30cf
|
||||
gray 2ee2ea2340d0ecf2dfa6f90f87384799
|
||||
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
|
||||
gray16le a1f912941247e45b394b9cf4f0e81130
|
||||
gray16be a61507aec1088f5692036e1aabdb4f41
|
||||
gray16le 171fbdd46e3737bc865d0185a0006e1c
|
||||
monob 309b5785a36bd988d17e15d88f4ffad1
|
||||
monow 8809a02bc69b58d1114b09ca79ebffad
|
||||
nv12 75e90c54d858b993e99f4ee6d2a2a38f
|
||||
|
@ -26,8 +26,8 @@ gbrp14le eb6cb4555edb175d807fe1b5382d2fc7
|
||||
gbrp9be 2c9adb80abc16546cac69b4872aaf557
|
||||
gbrp9le fcfa1684553e3e185179462bca347649
|
||||
gray c45dcee08887f43dc463f79d7ecd7d68
|
||||
gray16be 70064f9acdc5e3935ccda67e765bf2fb
|
||||
gray16le 578241fb43029e5ae841a3c94d940dce
|
||||
gray16be 52a6ff8ba7fe11032f370c0888d87fc4
|
||||
gray16le e78f07e83698651639743f2f8501c51c
|
||||
monob 91ec2a25b13f6ca34d42da778b217de0
|
||||
monow a991455fda8f60f373aeb744456996b9
|
||||
nv12 0617f1e13ae4a43d4cb49282b9c02f71
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user