Compare commits
158 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c2eb668617 | |||
| c9c223ba00 | |||
| 9d0ff6436e | |||
| 02b7b125b5 | |||
| 5643668308 | |||
| 2d18e7f3ef | |||
| f1b5830182 | |||
| c588316555 | |||
| afd1f61944 | |||
| 16a9c5ea9e | |||
| 83fb31a76d | |||
| fc5b32877a | |||
| 10e023c4fa | |||
| 27a3a59428 | |||
| 8ab849cddc | |||
| 5191b00155 | |||
| 1131e7a1a4 | |||
| 26becbcd2a | |||
| 366cdd3548 | |||
| e3b08b3ad4 | |||
| fa16440659 | |||
| c36fd16aaa | |||
| 8c5897632a | |||
| b34fce9c54 | |||
| 742f9aa879 | |||
| 79041d92ee | |||
| 82cebc0e05 | |||
| 09abca6802 | |||
| 43d64829e6 | |||
| 4a479fd3e6 | |||
| 4f41717d01 | |||
| 6896dcbf5f | |||
| 14404170b9 | |||
| e9e42beed2 | |||
| abd6decd55 | |||
| 0385c824f1 | |||
| c4e764aa69 | |||
| 9d02e38d3f | |||
| 30cf47c6f0 | |||
| b45cd17d29 | |||
| 26b6d70c72 | |||
| 32919db4fb | |||
| 56f44c26f0 | |||
| fe87a40de6 | |||
| 0f6e309b97 | |||
| 96e13c9897 | |||
| 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 | |||
| b920c1d5ad |
@@ -28,6 +28,7 @@ version 2.2:
|
||||
- Support DNx444
|
||||
- libx265 encoder
|
||||
- dejudder filter
|
||||
- Autodetect VDA like all other hardware accelerations
|
||||
|
||||
|
||||
version 2.1:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
+1
-1
@@ -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 = 2.2-rc2
|
||||
PROJECT_NUMBER = 2.2.2
|
||||
|
||||
# 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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+23
-14
@@ -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
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -514,6 +514,8 @@ static void ffmpeg_cleanup(int ret)
|
||||
if (received_sigterm) {
|
||||
av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n",
|
||||
(int) received_sigterm);
|
||||
} else if (ret) {
|
||||
av_log(NULL, AV_LOG_INFO, "Conversion failed!\n");
|
||||
}
|
||||
term_exit();
|
||||
}
|
||||
|
||||
+6
-3
@@ -44,12 +44,15 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFo
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
|
||||
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
|
||||
enum AVPixelFormat best= AV_PIX_FMT_NONE;
|
||||
const enum AVPixelFormat mjpeg_formats[] = { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE };
|
||||
const enum AVPixelFormat ljpeg_formats[] = { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE };
|
||||
|
||||
if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
|
||||
if (st->codec->codec_id == AV_CODEC_ID_MJPEG) {
|
||||
p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE };
|
||||
p = mjpeg_formats;
|
||||
} else if (st->codec->codec_id == AV_CODEC_ID_LJPEG) {
|
||||
p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE };
|
||||
p =ljpeg_formats;
|
||||
}
|
||||
}
|
||||
for (; *p != AV_PIX_FMT_NONE; p++) {
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -246,6 +246,7 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
|
||||
vald /= pow(10, index * 3);
|
||||
prefix_string = decimal_unit_prefixes[index];
|
||||
}
|
||||
vali = vald;
|
||||
}
|
||||
|
||||
if (show_float || (use_value_prefix && vald != (long long int)vald))
|
||||
@@ -336,7 +337,7 @@ static const AVOption writer_options[] = {
|
||||
{ "replace", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_REPLACE}, .unit = "sv" },
|
||||
{ "fail", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_FAIL}, .unit = "sv" },
|
||||
{ "string_validation_replacement", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str=""}},
|
||||
{ "svr", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str=""}},
|
||||
{ "svr", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str="\xEF\xBF\xBD"}},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ OBJS = allcodecs.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
raw.o \
|
||||
rawdec.o \
|
||||
resample.o \
|
||||
resample2.o \
|
||||
utils.o \
|
||||
|
||||
+12
-4
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -1370,7 +1370,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
* Decode VQ encoded high frequencies
|
||||
*/
|
||||
if (s->subband_activity[k] > s->vq_start_subband[k]) {
|
||||
if (!s->debug_flag & 0x01) {
|
||||
if (!(s->debug_flag & 0x01)) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"Stream with high frequencies VQ coding\n");
|
||||
s->debug_flag |= 0x01;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1355,8 +1355,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
|
||||
motion_y >>= s->chroma_y_shift;
|
||||
}
|
||||
|
||||
mx = motion_x & ~(-1 << s->mv_precision);
|
||||
my = motion_y & ~(-1 << s->mv_precision);
|
||||
mx = motion_x & ~(-1U << s->mv_precision);
|
||||
my = motion_y & ~(-1U << s->mv_precision);
|
||||
motion_x >>= s->mv_precision;
|
||||
motion_y >>= s->mv_precision;
|
||||
/* normalize subpel coordinates to epel */
|
||||
|
||||
+2
-2
@@ -246,8 +246,8 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
ctx->slice_data[slice].y_off = y_off;
|
||||
}
|
||||
|
||||
if (ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
|
||||
NULL, nslices, sizeof(ctx->slice_data[0])) < 0)
|
||||
if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
|
||||
NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
|
||||
return ret;
|
||||
|
||||
skip:
|
||||
|
||||
+9
-4
@@ -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);
|
||||
|
||||
+2
-1
@@ -2285,7 +2285,8 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size)
|
||||
if (p->cur_rate == RATE_6300) {
|
||||
info_bits = 0;
|
||||
put_bits(&pb, 2, info_bits);
|
||||
}
|
||||
}else
|
||||
av_assert0(0);
|
||||
|
||||
put_bits(&pb, 8, p->lsp_index[2]);
|
||||
put_bits(&pb, 8, p->lsp_index[1]);
|
||||
|
||||
+2
-2
@@ -219,9 +219,9 @@ static inline int get_se_golomb_long(GetBitContext *gb)
|
||||
unsigned int buf = get_ue_golomb_long(gb);
|
||||
|
||||
if (buf & 1)
|
||||
buf = -(buf >> 1);
|
||||
buf = (buf + 1) >> 1;
|
||||
else
|
||||
buf = (buf >> 1);
|
||||
buf = -(buf >> 1);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
+13
-1
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
+13
-13
@@ -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;
|
||||
|
||||
@@ -81,6 +81,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
||||
libx265Context *ctx = avctx->priv_data;
|
||||
x265_nal *nal;
|
||||
uint8_t *buf;
|
||||
char sar[10];
|
||||
int sar_num, sar_den;
|
||||
int nnal;
|
||||
int ret;
|
||||
@@ -121,11 +122,11 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
||||
av_reduce(&sar_num, &sar_den,
|
||||
avctx->sample_aspect_ratio.num,
|
||||
avctx->sample_aspect_ratio.den, 4096);
|
||||
ctx->params->bEnableVuiParametersPresentFlag = 1;
|
||||
ctx->params->bEnableAspectRatioIdc = 1;
|
||||
ctx->params->aspectRatioIdc = 255;
|
||||
ctx->params->sarWidth = sar_num;
|
||||
ctx->params->sarHeight = sar_den;
|
||||
snprintf(sar, sizeof(sar), "%d:%d", sar_num, sar_den);
|
||||
if (x265_param_parse(ctx->params, "sar", sar) == X265_PARAM_BAD_VALUE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid SAR: %d:%d.\n", sar_num, sar_den);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (x265_max_bit_depth == 8)
|
||||
ctx->params->internalBitDepth = 8;
|
||||
|
||||
+23
-4
@@ -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;
|
||||
|
||||
@@ -1230,7 +1251,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
}
|
||||
|
||||
if (!Al) {
|
||||
s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
|
||||
s->coefs_finished[c] |= (2LL << se) - (1LL << ss);
|
||||
last_scan = !~s->coefs_finished[c];
|
||||
}
|
||||
|
||||
@@ -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)) ||
|
||||
|
||||
@@ -487,7 +487,7 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
|
||||
put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
|
||||
}
|
||||
|
||||
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64])
|
||||
{
|
||||
int i;
|
||||
if (s->chroma_format == CHROMA_444) {
|
||||
|
||||
@@ -61,6 +61,6 @@ void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]);
|
||||
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
||||
uint8_t *huff_size, uint16_t *huff_code);
|
||||
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]);
|
||||
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64]);
|
||||
|
||||
#endif /* AVCODEC_MJPEGENC_H */
|
||||
|
||||
@@ -1774,7 +1774,7 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!avctx->hwaccel) {
|
||||
if (!avctx->hwaccel && !(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)) {
|
||||
for(i=0; i<avctx->height; i++)
|
||||
memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i,
|
||||
0x80, avctx->width);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
+25
-12
@@ -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;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1912,9 +1912,10 @@ static void vc1_interp_mc(VC1Context *v)
|
||||
uvmx = (mx + ((mx & 3) == 3)) >> 1;
|
||||
uvmy = (my + ((my & 3) == 3)) >> 1;
|
||||
if (v->field_mode) {
|
||||
if (v->cur_field_type != v->ref_field_type[1])
|
||||
if (v->cur_field_type != v->ref_field_type[1]) {
|
||||
my = my - 2 + 4 * v->cur_field_type;
|
||||
uvmy = uvmy - 2 + 4 * v->cur_field_type;
|
||||
}
|
||||
}
|
||||
if (v->fastuvmc) {
|
||||
uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1));
|
||||
|
||||
@@ -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;
|
||||
|
||||
+26
-11
@@ -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;
|
||||
@@ -701,8 +701,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
|
||||
res_setup->partition_size = get_bits(gb, 24) + 1;
|
||||
/* Validations to prevent a buffer overflow later. */
|
||||
if (res_setup->begin>res_setup->end ||
|
||||
res_setup->end > (res_setup->type == 2 ? vc->audio_channels : 1) * vc->blocksize[1] / 2 ||
|
||||
(res_setup->end-res_setup->begin) / res_setup->partition_size > V_MAX_PARTITIONS) {
|
||||
(res_setup->end-res_setup->begin) / res_setup->partition_size > FFMIN(V_MAX_PARTITIONS, 65535)) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
"partition out of bounds: type, begin, end, size, blocksize: %"PRIu16", %"PRIu32", %"PRIu32", %u, %"PRIu32"\n",
|
||||
res_setup->type, res_setup->begin, res_setup->end,
|
||||
@@ -989,7 +988,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);
|
||||
@@ -1372,6 +1371,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
unsigned pass, ch_used, i, j, k, l;
|
||||
unsigned max_output = (ch - 1) * vlen;
|
||||
int ptns_to_read = vr->ptns_to_read;
|
||||
int libvorbis_bug = 0;
|
||||
|
||||
if (vr_type == 2) {
|
||||
for (j = 1; j < ch; ++j)
|
||||
@@ -1386,8 +1386,13 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
}
|
||||
|
||||
if (max_output > ch_left * vlen) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR, "Insufficient output buffer\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (max_output <= ch_left * vlen + vr->partition_size*ch_used/ch) {
|
||||
ptns_to_read--;
|
||||
libvorbis_bug = 1;
|
||||
} else {
|
||||
av_log(vc->avctx, AV_LOG_ERROR, "Insufficient output buffer\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c);
|
||||
@@ -1496,6 +1501,14 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
voffset += vr->partition_size;
|
||||
}
|
||||
}
|
||||
if (libvorbis_bug && !pass) {
|
||||
for (j = 0; j < ch_used; ++j) {
|
||||
if (!do_not_decode[j]) {
|
||||
get_vlc2(&vc->gb, vc->codebooks[vr->classbook].vlc.table,
|
||||
vc->codebooks[vr->classbook].nb_bits, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1548,7 +1561,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 +1594,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 +1827,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 = {
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
@@ -343,7 +343,7 @@ DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] = {
|
||||
"movdqa %%xmm6, 4*16("dct") \n\t" \
|
||||
"movdqa "SREG2", 7*16("dct") \n\t"
|
||||
|
||||
inline void ff_idct_xvid_sse2(short *block)
|
||||
av_extern_inline void ff_idct_xvid_sse2(short *block)
|
||||
{
|
||||
__asm__ volatile(
|
||||
"movq "MANGLE(m127)", %%mm0 \n\t"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1204,6 +1204,8 @@ static int opengl_draw(AVFormatContext *h, void *input, int repaint, int is_pkt)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (!repaint) {
|
||||
if (is_pkt)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
LOAD_TEXTURE_DATA(0, 0)
|
||||
if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {
|
||||
LOAD_TEXTURE_DATA(1, 1)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
|
||||
p2 += 8 * linesize;
|
||||
}
|
||||
emms_c();
|
||||
mafd = nb_sad ? sad / nb_sad : 0;
|
||||
mafd = nb_sad ? (double)sad / nb_sad : 0;
|
||||
diff = fabs(mafd - select->prev_mafd);
|
||||
ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
|
||||
select->prev_mafd = mafd;
|
||||
|
||||
@@ -38,7 +38,7 @@ static void print_formats(AVFilterContext *filter_ctx)
|
||||
for (j = 0; j < fmts->nb_formats; j++) \
|
||||
if(av_get_pix_fmt_name(fmts->formats[j])) \
|
||||
printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
|
||||
i, filter_ctx->filter->inout##puts[i].name, \
|
||||
i, filter_ctx->inout##put_pads[i].name, \
|
||||
av_get_pix_fmt_name(fmts->formats[j])); \
|
||||
} else if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_AUDIO) { \
|
||||
AVFilterFormats *fmts; \
|
||||
@@ -47,7 +47,7 @@ static void print_formats(AVFilterContext *filter_ctx)
|
||||
fmts = filter_ctx->inout##puts[i]->outin##_formats; \
|
||||
for (j = 0; j < fmts->nb_formats; j++) \
|
||||
printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
|
||||
i, filter_ctx->filter->inout##puts[i].name, \
|
||||
i, filter_ctx->inout##put_pads[i].name, \
|
||||
av_get_sample_fmt_name(fmts->formats[j])); \
|
||||
\
|
||||
layouts = filter_ctx->inout##puts[i]->outin##_channel_layouts; \
|
||||
@@ -56,7 +56,7 @@ static void print_formats(AVFilterContext *filter_ctx)
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1, \
|
||||
layouts->channel_layouts[j]); \
|
||||
printf(#INOUT "PUT[%d] %s: chlayout:%s\n", \
|
||||
i, filter_ctx->filter->inout##puts[i].name, buf); \
|
||||
i, filter_ctx->inout##put_pads[i].name, buf); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
@@ -113,12 +113,12 @@ int main(int argc, char **argv)
|
||||
/* create a link for each of the input pads */
|
||||
for (i = 0; i < filter_ctx->nb_inputs; i++) {
|
||||
AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
|
||||
link->type = filter_ctx->filter->inputs[i].type;
|
||||
link->type = filter_ctx->input_pads[i].type;
|
||||
filter_ctx->inputs[i] = link;
|
||||
}
|
||||
for (i = 0; i < filter_ctx->nb_outputs; i++) {
|
||||
AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
|
||||
link->type = filter_ctx->filter->outputs[i].type;
|
||||
link->type = filter_ctx->output_pads[i].type;
|
||||
filter_ctx->outputs[i] = link;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,10 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link)
|
||||
{
|
||||
char *format;
|
||||
char layout[64];
|
||||
AVBPrint dummy_buffer = { 0 };
|
||||
|
||||
if (!buf)
|
||||
buf = &(AVBPrint){ 0 }; /* dummy buffer */
|
||||
buf = &dummy_buffer;
|
||||
switch (link->type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
format = av_x_if_null(av_get_pix_fmt_name(link->format), "?");
|
||||
|
||||
@@ -306,8 +306,8 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
|
||||
//av_log(NULL, AV_LOG_ERROR, "\n");
|
||||
}
|
||||
|
||||
p_x = (center_x - width / 2);
|
||||
p_y = (center_y - height / 2);
|
||||
p_x = (center_x - width / 2.0);
|
||||
p_y = (center_y - height / 2.0);
|
||||
t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y;
|
||||
t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y;
|
||||
|
||||
|
||||
+16
-12
@@ -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]);
|
||||
|
||||
@@ -84,7 +84,7 @@ OBJS-$(CONFIG_AST_MUXER) += ast.o astenc.o
|
||||
OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o
|
||||
OBJS-$(CONFIG_AU_MUXER) += au.o rawenc.o
|
||||
OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o
|
||||
OBJS-$(CONFIG_AVI_MUXER) += avienc.o
|
||||
OBJS-$(CONFIG_AVI_MUXER) += avienc.o avlanguage.o
|
||||
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
|
||||
OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o swf.o
|
||||
OBJS-$(CONFIG_AVR_DEMUXER) += avr.o pcm.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
|
||||
|
||||
@@ -237,7 +237,7 @@ static int aiff_read_header(AVFormatContext *s)
|
||||
break;
|
||||
case MKTAG('I', 'D', '3', ' '):
|
||||
position = avio_tell(pb);
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, size);
|
||||
if (id3v2_extra_meta)
|
||||
if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) {
|
||||
ff_id3v2_free_extra_meta(&id3v2_extra_meta);
|
||||
|
||||
@@ -266,7 +266,7 @@ static void get_id3_tag(AVFormatContext *s, int len)
|
||||
{
|
||||
ID3v2ExtraMeta *id3v2_extra_meta = NULL;
|
||||
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, len);
|
||||
if (id3v2_extra_meta)
|
||||
ff_id3v2_parse_apic(s, &id3v2_extra_meta);
|
||||
ff_id3v2_free_extra_meta(&id3v2_extra_meta);
|
||||
|
||||
@@ -611,6 +611,7 @@ static int asf_write_header(AVFormatContext *s)
|
||||
ASFContext *asf = s->priv_data;
|
||||
|
||||
s->packet_size = PACKET_SIZE;
|
||||
s->max_interleave_delta = 0;
|
||||
asf->nb_packets = 0;
|
||||
|
||||
asf->index_ptr = av_malloc(sizeof(ASFIndex) * ASF_INDEX_BLOCK);
|
||||
|
||||
@@ -844,6 +844,12 @@ typedef struct AVStream {
|
||||
double (*duration_error)[2][MAX_STD_TIMEBASES];
|
||||
int64_t codec_info_duration;
|
||||
int64_t codec_info_duration_fields;
|
||||
|
||||
/**
|
||||
* 0 -> decoder has not been searched for yet.
|
||||
* >0 -> decoder found
|
||||
* <0 -> decoder with codec_id == -found_decoder has not been found
|
||||
*/
|
||||
int found_decoder;
|
||||
|
||||
int64_t last_duration;
|
||||
@@ -988,6 +994,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);
|
||||
|
||||
@@ -1315,7 +1315,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
AVIndexEntry *e;
|
||||
int index;
|
||||
|
||||
index = av_index_search_timestamp(st, ast->frame_offset, 0);
|
||||
index = av_index_search_timestamp(st, ast->frame_offset, AVSEEK_FLAG_ANY);
|
||||
e = &st->index_entries[index];
|
||||
|
||||
if (index >= 0 && e->timestamp == ast->frame_offset) {
|
||||
|
||||
+16
-3
@@ -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;
|
||||
|
||||
@@ -35,7 +35,7 @@ static int h263_probe(AVProbeData *p)
|
||||
for(i=0; i<p->buf_size; i++){
|
||||
code = (code<<8) + p->buf[i];
|
||||
if ((code & 0xfffffc0000) == 0x800000) {
|
||||
src_fmt= (code>>2)&3;
|
||||
src_fmt= (code>>2)&7;
|
||||
if( src_fmt != last_src_fmt
|
||||
&& last_src_fmt>0 && last_src_fmt<6
|
||||
&& src_fmt<6)
|
||||
|
||||
+225
-121
@@ -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);
|
||||
|
||||
+16
-5
@@ -878,16 +878,25 @@ error:
|
||||
|
||||
static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
|
||||
AVFormatContext *s, const char *magic,
|
||||
ID3v2ExtraMeta **extra_meta)
|
||||
ID3v2ExtraMeta **extra_meta, int64_t max_search_size)
|
||||
{
|
||||
int len, ret;
|
||||
uint8_t buf[ID3v2_HEADER_SIZE];
|
||||
int found_header;
|
||||
int64_t off;
|
||||
int64_t start, off;
|
||||
|
||||
if (max_search_size && max_search_size < ID3v2_HEADER_SIZE)
|
||||
return;
|
||||
|
||||
start = avio_tell(pb);
|
||||
do {
|
||||
/* save the current offset in case there's nothing to read/skip */
|
||||
off = avio_tell(pb);
|
||||
if (max_search_size && off - start >= max_search_size - ID3v2_HEADER_SIZE) {
|
||||
avio_seek(pb, off, SEEK_SET);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
|
||||
if (ret != ID3v2_HEADER_SIZE) {
|
||||
avio_seek(pb, off, SEEK_SET);
|
||||
@@ -914,13 +923,13 @@ static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
|
||||
void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata,
|
||||
const char *magic, ID3v2ExtraMeta **extra_meta)
|
||||
{
|
||||
id3v2_read_internal(pb, metadata, NULL, magic, extra_meta);
|
||||
id3v2_read_internal(pb, metadata, NULL, magic, extra_meta, 0);
|
||||
}
|
||||
|
||||
void ff_id3v2_read(AVFormatContext *s, const char *magic,
|
||||
ID3v2ExtraMeta **extra_meta)
|
||||
ID3v2ExtraMeta **extra_meta, unsigned int max_search_size)
|
||||
{
|
||||
id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta);
|
||||
id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta, max_search_size);
|
||||
}
|
||||
|
||||
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
|
||||
@@ -935,6 +944,8 @@ void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
|
||||
av_freep(¤t);
|
||||
current = next;
|
||||
}
|
||||
|
||||
*extra_meta = NULL;
|
||||
}
|
||||
|
||||
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
|
||||
|
||||
+3
-1
@@ -112,8 +112,10 @@ void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *ma
|
||||
*
|
||||
* @param extra_meta If not NULL, extra metadata is parsed into a list of
|
||||
* ID3v2ExtraMeta structs and *extra_meta points to the head of the list
|
||||
* @param[opt] max_search_search restrict ID3 magic number search (bytes from start)
|
||||
*/
|
||||
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta);
|
||||
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta,
|
||||
unsigned int max_search_size);
|
||||
|
||||
/**
|
||||
* Initialize an ID3v2 tag.
|
||||
|
||||
@@ -35,7 +35,7 @@ const CodecTags ff_mkv_codec_tags[]={
|
||||
{"A_MPEG/L2" , AV_CODEC_ID_MP2},
|
||||
{"A_MPEG/L1" , AV_CODEC_ID_MP2},
|
||||
{"A_MPEG/L3" , AV_CODEC_ID_MP3},
|
||||
{"A_OPUS", AV_CODEC_ID_OPUS},
|
||||
{"A_OPUS" , AV_CODEC_ID_OPUS},
|
||||
{"A_OPUS/EXPERIMENTAL",AV_CODEC_ID_OPUS},
|
||||
{"A_PCM/FLOAT/IEEE" , AV_CODEC_ID_PCM_F32LE},
|
||||
{"A_PCM/FLOAT/IEEE" , AV_CODEC_ID_PCM_F64LE},
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/lzo.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/dict.h"
|
||||
#if CONFIG_ZLIB
|
||||
#include <zlib.h>
|
||||
@@ -164,12 +165,12 @@ typedef struct {
|
||||
uint64_t default_duration;
|
||||
uint64_t flag_default;
|
||||
uint64_t flag_forced;
|
||||
uint64_t codec_delay;
|
||||
uint64_t seek_preroll;
|
||||
MatroskaTrackVideo video;
|
||||
MatroskaTrackAudio audio;
|
||||
MatroskaTrackOperation operation;
|
||||
EbmlList encodings;
|
||||
uint64_t codec_delay;
|
||||
|
||||
AVStream *stream;
|
||||
int64_t end_timecode;
|
||||
@@ -404,6 +405,7 @@ static EbmlSyntax matroska_track[] = {
|
||||
{ MATROSKA_ID_TRACKTYPE, EBML_UINT, 0, offsetof(MatroskaTrack,type) },
|
||||
{ MATROSKA_ID_CODECID, EBML_STR, 0, offsetof(MatroskaTrack,codec_id) },
|
||||
{ MATROSKA_ID_CODECPRIVATE, EBML_BIN, 0, offsetof(MatroskaTrack,codec_priv) },
|
||||
{ MATROSKA_ID_CODECDELAY, EBML_UINT, 0, offsetof(MatroskaTrack,codec_delay) },
|
||||
{ MATROSKA_ID_TRACKLANGUAGE, EBML_UTF8, 0, offsetof(MatroskaTrack,language), {.s="eng"} },
|
||||
{ MATROSKA_ID_TRACKDEFAULTDURATION, EBML_UINT, 0, offsetof(MatroskaTrack,default_duration) },
|
||||
{ MATROSKA_ID_TRACKTIMECODESCALE, EBML_FLOAT,0, offsetof(MatroskaTrack,time_scale), {.f=1.0} },
|
||||
@@ -414,7 +416,6 @@ static EbmlSyntax matroska_track[] = {
|
||||
{ MATROSKA_ID_TRACKOPERATION, EBML_NEST, 0, offsetof(MatroskaTrack,operation), {.n=matroska_track_operation} },
|
||||
{ MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
|
||||
{ MATROSKA_ID_TRACKMAXBLKADDID, EBML_UINT, 0, offsetof(MatroskaTrack,max_block_additional_id) },
|
||||
{ MATROSKA_ID_CODECDELAY, EBML_UINT, 0, offsetof(MatroskaTrack,codec_delay) },
|
||||
{ MATROSKA_ID_SEEKPREROLL, EBML_UINT, 0, offsetof(MatroskaTrack,seek_preroll) },
|
||||
{ MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
|
||||
{ MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
|
||||
@@ -1852,6 +1853,11 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
track->time_scale = 1.0;
|
||||
avpriv_set_pts_info(st, 64, matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts in ns */
|
||||
|
||||
/* convert the delay from ns to the track timebase */
|
||||
track->codec_delay = av_rescale_q(track->codec_delay,
|
||||
(AVRational){ 1, 1000000000 },
|
||||
st->time_base);
|
||||
|
||||
st->codec->codec_id = codec_id;
|
||||
|
||||
if (strcmp(track->language, "und"))
|
||||
@@ -1934,7 +1940,7 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
if (track->codec_delay > 0) {
|
||||
st->codec->delay = av_rescale_q(track->codec_delay,
|
||||
(AVRational){1, 1000000000},
|
||||
st->time_base,
|
||||
(AVRational){1, st->codec->sample_rate});
|
||||
}
|
||||
if (track->seek_preroll > 0) {
|
||||
@@ -2615,7 +2621,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
|
||||
|
||||
if (cluster_time != (uint64_t)-1
|
||||
&& (block_time >= 0 || cluster_time >= -block_time)) {
|
||||
timecode = cluster_time + block_time;
|
||||
timecode = cluster_time + block_time - track->codec_delay;
|
||||
if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE
|
||||
&& timecode < track->end_timecode)
|
||||
is_keyframe = 0; /* overlapping subtitles are not key frame */
|
||||
|
||||
@@ -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,
|
||||
@@ -1368,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) {
|
||||
|
||||
@@ -67,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 },
|
||||
};
|
||||
|
||||
@@ -2960,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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+37
-34
@@ -116,15 +116,16 @@ static int mp3_write_xing(AVFormatContext *s)
|
||||
{
|
||||
MP3Context *mp3 = s->priv_data;
|
||||
AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec;
|
||||
int bitrate_idx;
|
||||
int best_bitrate_idx = -1;
|
||||
int best_bitrate_error= INT_MAX;
|
||||
int xing_offset;
|
||||
int32_t header, mask;
|
||||
MPADecodeHeader c;
|
||||
int srate_idx, ver = 0, i, channels;
|
||||
int needed;
|
||||
const char *vendor = (codec->flags & CODEC_FLAG_BITEXACT) ? "Lavf" : LIBAVFORMAT_IDENT;
|
||||
int32_t header;
|
||||
MPADecodeHeader mpah;
|
||||
int srate_idx, i, channels;
|
||||
int bitrate_idx;
|
||||
int best_bitrate_idx = -1;
|
||||
int best_bitrate_error = INT_MAX;
|
||||
int xing_offset;
|
||||
int ver = 0;
|
||||
int bytes_needed, lsf;
|
||||
const char *vendor = (codec->flags & CODEC_FLAG_BITEXACT) ? "Lavf" : LIBAVFORMAT_IDENT;
|
||||
|
||||
if (!s->pb->seekable || !mp3->write_xing)
|
||||
return 0;
|
||||
@@ -156,28 +157,29 @@ static int mp3_write_xing(AVFormatContext *s)
|
||||
/* dummy MPEG audio header */
|
||||
header = 0xffU << 24; // sync
|
||||
header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16; // sync/audio-version/layer 3/no crc*/
|
||||
header |= (srate_idx << 2) << 8;
|
||||
header |= (srate_idx << 2) << 8;
|
||||
header |= channels << 6;
|
||||
|
||||
for (bitrate_idx=1; bitrate_idx<15; bitrate_idx++) {
|
||||
int error;
|
||||
avpriv_mpegaudio_decode_header(&c, header | (bitrate_idx << (4+8)));
|
||||
error= FFABS(c.bit_rate - codec->bit_rate);
|
||||
if(error < best_bitrate_error){
|
||||
best_bitrate_error= error;
|
||||
best_bitrate_idx = bitrate_idx;
|
||||
for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) {
|
||||
int bit_rate = 1000 * avpriv_mpa_bitrate_tab[lsf][3 - 1][bitrate_idx];
|
||||
int error = FFABS(bit_rate - codec->bit_rate);
|
||||
|
||||
if (error < best_bitrate_error) {
|
||||
best_bitrate_error = error;
|
||||
best_bitrate_idx = bitrate_idx;
|
||||
}
|
||||
}
|
||||
av_assert0(best_bitrate_idx >= 0);
|
||||
|
||||
for (bitrate_idx= best_bitrate_idx;; bitrate_idx++) {
|
||||
for (bitrate_idx = best_bitrate_idx; ; bitrate_idx++) {
|
||||
int32_t mask = bitrate_idx << (4 + 8);
|
||||
if (15 == bitrate_idx)
|
||||
return -1;
|
||||
mask = bitrate_idx << (4+8);
|
||||
header |= mask;
|
||||
avpriv_mpegaudio_decode_header(&c, header);
|
||||
xing_offset=xing_offtbl[c.lsf == 1][c.nb_channels == 1];
|
||||
needed = 4 // header
|
||||
|
||||
avpriv_mpegaudio_decode_header(&mpah, header);
|
||||
xing_offset=xing_offtbl[mpah.lsf == 1][mpah.nb_channels == 1];
|
||||
bytes_needed = 4 // header
|
||||
+ xing_offset
|
||||
+ 4 // xing tag
|
||||
+ 4 // frames/size/toc flags
|
||||
@@ -187,8 +189,9 @@ static int mp3_write_xing(AVFormatContext *s)
|
||||
+ 24
|
||||
;
|
||||
|
||||
if (needed <= c.frame_size)
|
||||
if (bytes_needed <= mpah.frame_size)
|
||||
break;
|
||||
|
||||
header &= ~mask;
|
||||
}
|
||||
|
||||
@@ -199,7 +202,7 @@ static int mp3_write_xing(AVFormatContext *s)
|
||||
ffio_wfourcc(s->pb, "Xing");
|
||||
avio_wb32(s->pb, 0x01 | 0x02 | 0x04); // frames / size / TOC
|
||||
|
||||
mp3->size = c.frame_size;
|
||||
mp3->size = mpah.frame_size;
|
||||
mp3->want=1;
|
||||
mp3->seen=0;
|
||||
mp3->pos=0;
|
||||
@@ -217,7 +220,7 @@ static int mp3_write_xing(AVFormatContext *s)
|
||||
avio_w8(s->pb, 0);
|
||||
avio_wb24(s->pb, FFMAX(codec->delay - 528 - 1, 0)<<12);
|
||||
|
||||
ffio_fill(s->pb, 0, c.frame_size - needed);
|
||||
ffio_fill(s->pb, 0, mpah.frame_size - bytes_needed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -257,7 +260,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
MP3Context *mp3 = s->priv_data;
|
||||
|
||||
if (pkt->data && pkt->size >= 4) {
|
||||
MPADecodeHeader c;
|
||||
MPADecodeHeader mpah;
|
||||
int av_unused base;
|
||||
uint32_t head = AV_RB32(pkt->data);
|
||||
|
||||
@@ -266,16 +269,16 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
"is invalid, writing it anyway.\n", pkt->size, head);
|
||||
return ff_raw_write_packet(s, pkt);
|
||||
}
|
||||
avpriv_mpegaudio_decode_header(&c, head);
|
||||
avpriv_mpegaudio_decode_header(&mpah, head);
|
||||
|
||||
if (!mp3->initial_bitrate)
|
||||
mp3->initial_bitrate = c.bit_rate;
|
||||
if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))
|
||||
mp3->initial_bitrate = mpah.bit_rate;
|
||||
if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
|
||||
mp3->has_variable_bitrate = 1;
|
||||
|
||||
#ifdef FILTER_VBR_HEADERS
|
||||
/* filter out XING and INFO headers. */
|
||||
base = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];
|
||||
base = 4 + xing_offtbl[mpah.lsf == 1][mpah.nb_channels == 1];
|
||||
|
||||
if (base + 4 <= pkt->size) {
|
||||
uint32_t v = AV_RB32(pkt->data + base);
|
||||
@@ -417,14 +420,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);
|
||||
@@ -1373,7 +1370,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, int section_le
|
||||
AVStream *st;
|
||||
if (ts->pids[pid]->es_id != mp4_descr[i].es_id)
|
||||
continue;
|
||||
if (!(ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES)) {
|
||||
if (ts->pids[pid]->type != MPEGTS_PES) {
|
||||
av_log(s, AV_LOG_ERROR, "pid %x is not PES\n", pid);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -435,6 +435,12 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||
av_dlog(s, "compute_pkt_fields2: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n",
|
||||
av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index);
|
||||
|
||||
if (pkt->duration < 0 && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) {
|
||||
av_log(s, AV_LOG_WARNING, "Packet with invalid duration %d in stream %d\n",
|
||||
pkt->duration, pkt->stream_index);
|
||||
pkt->duration = 0;
|
||||
}
|
||||
|
||||
/* duration field */
|
||||
if (pkt->duration == 0) {
|
||||
ff_compute_frame_duration(&num, &den, st, NULL, pkt);
|
||||
|
||||
@@ -293,7 +293,7 @@ static int oma_read_header(AVFormatContext *s)
|
||||
ID3v2ExtraMeta *extra_meta = NULL;
|
||||
OMAContext *oc = s->priv_data;
|
||||
|
||||
ff_id3v2_read(s, ID3v2_EA3_MAGIC, &extra_meta);
|
||||
ff_id3v2_read(s, ID3v2_EA3_MAGIC, &extra_meta, 0);
|
||||
ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
|
||||
if (ret < EA3_HEADER_SIZE)
|
||||
return -1;
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -160,10 +160,6 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]);
|
||||
if (ret >= 0) {
|
||||
ret = 0;
|
||||
// FIXME: this is a hack that should be removed once
|
||||
// compute_pkt_fields() can handle timestamps properly
|
||||
if (pmp->cur_stream == 0)
|
||||
pkt->dts = s->streams[0]->cur_dts++;
|
||||
pkt->stream_index = pmp->cur_stream;
|
||||
}
|
||||
if (pmp->current_packet % pmp->audio_packets == 0)
|
||||
|
||||
+14
-1
@@ -150,6 +150,8 @@ static const uint8_t rtmp_server_key[] = {
|
||||
0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
|
||||
};
|
||||
|
||||
static int handle_chunk_size(URLContext *s, RTMPPacket *pkt);
|
||||
|
||||
static int add_tracked_method(RTMPContext *rt, const char *name, int id)
|
||||
{
|
||||
int err;
|
||||
@@ -408,6 +410,17 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
|
||||
&rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
|
||||
return ret;
|
||||
|
||||
if (pkt.type == RTMP_PT_CHUNK_SIZE) {
|
||||
if ((ret = handle_chunk_size(s, &pkt)) < 0)
|
||||
return ret;
|
||||
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
|
||||
&rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
cp = pkt.data;
|
||||
bytestream2_init(&gbc, cp, pkt.size);
|
||||
if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {
|
||||
@@ -2556,7 +2569,7 @@ reconnect:
|
||||
if ((ret = gen_connect(s, rt)) < 0)
|
||||
goto fail;
|
||||
} else {
|
||||
if (read_connect(s, s->priv_data) < 0)
|
||||
if ((ret = read_connect(s, s->priv_data)) < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
+31
-4
@@ -564,7 +564,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
|
||||
|
||||
/* e.g. AVFMT_NOFILE formats will not have a AVIOContext */
|
||||
if (s->pb)
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
|
||||
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, 0);
|
||||
|
||||
if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)
|
||||
if ((ret = s->iformat->read_header(s)) < 0)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -2599,13 +2623,15 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt,
|
||||
if (!frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
|
||||
if (!avcodec_is_open(st->codec) &&
|
||||
st->info->found_decoder <= 0 &&
|
||||
(st->codec->codec_id != -st->info->found_decoder || !st->codec->codec_id)) {
|
||||
AVDictionary *thread_opt = NULL;
|
||||
|
||||
codec = find_decoder(s, st, st->codec->codec_id);
|
||||
|
||||
if (!codec) {
|
||||
st->info->found_decoder = -1;
|
||||
st->info->found_decoder = -st->codec->codec_id;
|
||||
ret = -1;
|
||||
goto fail;
|
||||
}
|
||||
@@ -2617,7 +2643,7 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt,
|
||||
if (!options)
|
||||
av_dict_free(&thread_opt);
|
||||
if (ret < 0) {
|
||||
st->info->found_decoder = -1;
|
||||
st->info->found_decoder = -st->codec->codec_id;
|
||||
goto fail;
|
||||
}
|
||||
st->info->found_decoder = 1;
|
||||
@@ -3623,6 +3649,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;
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ int avresample_open(AVAudioResampleContext *avr)
|
||||
}
|
||||
if (avr->resample_needed) {
|
||||
avr->resample_out_buffer = ff_audio_data_alloc(avr->out_channels,
|
||||
0, avr->internal_sample_fmt,
|
||||
1024, avr->internal_sample_fmt,
|
||||
"resample_out_buffer");
|
||||
if (!avr->resample_out_buffer) {
|
||||
ret = AVERROR(EINVAL);
|
||||
|
||||
@@ -331,15 +331,15 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
|
||||
while (code & top) {
|
||||
int tmp;
|
||||
if (p >= buf_end) {
|
||||
ret = AVERROR(EILSEQ); /* incomplete sequence */
|
||||
goto end;
|
||||
(*bufp) ++;
|
||||
return AVERROR(EILSEQ); /* incomplete sequence */
|
||||
}
|
||||
|
||||
/* we assume the byte to be in the form 10xx-xxxx */
|
||||
tmp = *p++ - 128; /* strip leading 1 */
|
||||
if (tmp>>6) {
|
||||
ret = AVERROR(EILSEQ);
|
||||
goto end;
|
||||
(*bufp) ++;
|
||||
return AVERROR(EILSEQ);
|
||||
}
|
||||
code = (code<<6) + tmp;
|
||||
top <<= 5;
|
||||
|
||||
+4
-2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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++){
|
||||
|
||||
@@ -127,6 +127,11 @@ av_cold static int auto_matrix(SwrContext *s)
|
||||
)
|
||||
out_ch_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
if( in_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX
|
||||
&& (out_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0
|
||||
)
|
||||
in_ch_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
if(!sane_layout(in_ch_layout)){
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout);
|
||||
av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf);
|
||||
|
||||
@@ -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)
|
||||
@@ -921,7 +922,7 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
|
||||
uint8_t *dst2[4];
|
||||
uint8_t *rgb0_tmp = NULL;
|
||||
|
||||
if (!srcSlice || !dstStride || !dst || !srcSlice) {
|
||||
if (!srcStride || !dstStride || !dst || !srcSlice) {
|
||||
av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
|
||||
c->swscale = ff_yuv2rgb_get_func_ptr(c);
|
||||
}
|
||||
|
||||
if (srcFormat == AV_PIX_FMT_YUV410P &&
|
||||
if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) &&
|
||||
(dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) &&
|
||||
!(flags & SWS_BITEXACT)) {
|
||||
c->swscale = yvu9ToYv12Wrapper;
|
||||
|
||||
+3
-1
@@ -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),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
pkt_pts=1620|tag:lavfi.scene_score=1.000000
|
||||
pkt_pts=4140|tag:lavfi.scene_score=0.880000
|
||||
pkt_pts=4140|tag:lavfi.scene_score=0.876043
|
||||
pkt_pts=5800|tag:lavfi.scene_score=1.000000
|
||||
pkt_pts=6720|tag:lavfi.scene_score=0.460000
|
||||
pkt_pts=6720|tag:lavfi.scene_score=0.463259
|
||||
pkt_pts=8160|tag:lavfi.scene_score=1.000000
|
||||
pkt_pts=9760|tag:lavfi.scene_score=1.000000
|
||||
pkt_pts=14080|tag:lavfi.scene_score=0.840000
|
||||
pkt_pts=14080|tag:lavfi.scene_score=0.841420
|
||||
pkt_pts=15700|tag:lavfi.scene_score=1.000000
|
||||
pkt_pts=18500|tag:lavfi.scene_score=0.470000
|
||||
pkt_pts=18500|tag:lavfi.scene_score=0.471738
|
||||
pkt_pts=21760|tag:lavfi.scene_score=1.000000
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user