Compare commits
236 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
205e2264c3 | ||
![]() |
4a23765704 | ||
![]() |
083d0b7b2d | ||
![]() |
1e9ae5dbbd | ||
![]() |
01e2dd53a0 | ||
![]() |
b93659db5b | ||
![]() |
b94621ac6b | ||
![]() |
a2b4e38729 | ||
![]() |
9fe7e45030 | ||
![]() |
3c169251ee | ||
![]() |
81a2740919 | ||
![]() |
a144d305dd | ||
![]() |
4965da92ef | ||
![]() |
a83304814c | ||
![]() |
db6f3be941 | ||
![]() |
2f1f407044 | ||
![]() |
bdd2f7c7a7 | ||
![]() |
332777970c | ||
![]() |
62b9c99aec | ||
![]() |
0e18480fc3 | ||
![]() |
99d4d3532f | ||
![]() |
d9d66d2d16 | ||
![]() |
db33fb1c48 | ||
![]() |
0be9a2e9d9 | ||
![]() |
ee282be99b | ||
![]() |
d3bcc9cfa9 | ||
![]() |
eaa6d79105 | ||
![]() |
4d9aad95b5 | ||
![]() |
6882a04706 | ||
![]() |
98805cbac5 | ||
![]() |
66ca450fcb | ||
![]() |
8162b69091 | ||
![]() |
ed38ed3b62 | ||
![]() |
6f6f5f9c8b | ||
![]() |
690a3c4fb7 | ||
![]() |
2ca68b98ba | ||
![]() |
853bbe1aed | ||
![]() |
218c853774 | ||
![]() |
e315549ffa | ||
![]() |
c9ed7a4fc1 | ||
![]() |
1c321b7c31 | ||
![]() |
491e1ec95d | ||
![]() |
5805c0c2b6 | ||
![]() |
c61c66cfb1 | ||
![]() |
5ac53d07a2 | ||
![]() |
02055da69a | ||
![]() |
c7f419efd1 | ||
![]() |
b556432f5a | ||
![]() |
102df43f49 | ||
![]() |
36fc9bff08 | ||
![]() |
3ae71dd33e | ||
![]() |
673f679c8a | ||
![]() |
f65501f80c | ||
![]() |
6387aa94d6 | ||
![]() |
d581567e09 | ||
![]() |
9933e06595 | ||
![]() |
91d024d75d | ||
![]() |
5ee384c4eb | ||
![]() |
9ecd0f34ad | ||
![]() |
7de7bd4f56 | ||
![]() |
e939c7b7f5 | ||
![]() |
612ef09a18 | ||
![]() |
f0ee0fcbfc | ||
![]() |
d41f4e8dc8 | ||
![]() |
bc1c8ec5e6 | ||
![]() |
67b943ad66 | ||
![]() |
5e7e43c33e | ||
![]() |
13ce367368 | ||
![]() |
0962c26b6b | ||
![]() |
33c47d3976 | ||
![]() |
d0d0924947 | ||
![]() |
ca5d6c615e | ||
![]() |
7c17207ab9 | ||
![]() |
9847f02faf | ||
![]() |
dfdeabadca | ||
![]() |
33aa2c5d6b | ||
![]() |
b4552cc9b8 | ||
![]() |
172f929767 | ||
![]() |
66a9edfcf6 | ||
![]() |
a9382fc15c | ||
![]() |
bd9dcb411d | ||
![]() |
ae81a0e32d | ||
![]() |
4f93400db1 | ||
![]() |
0cd61c7f7d | ||
![]() |
28ac4e91dc | ||
![]() |
6b683be641 | ||
![]() |
3a3b5ae4c0 | ||
![]() |
70fcea3b77 | ||
![]() |
b545d11d49 | ||
![]() |
4324d7bade | ||
![]() |
c88bdac460 | ||
![]() |
bdf6e6fff4 | ||
![]() |
83e4aa3e7c | ||
![]() |
fce2cfbdcf | ||
![]() |
72f1907c96 | ||
![]() |
074ebfacf4 | ||
![]() |
47f8497837 | ||
![]() |
93f26b7992 | ||
![]() |
f684bbf224 | ||
![]() |
edca16f1af | ||
![]() |
aeac212fda | ||
![]() |
62f05d6309 | ||
![]() |
bd339d4882 | ||
![]() |
9de71b0eb2 | ||
![]() |
7e73760950 | ||
![]() |
0639e403be | ||
![]() |
5c7d6be5f9 | ||
![]() |
2005887707 | ||
![]() |
cf8462ce00 | ||
![]() |
02c8c064ea | ||
![]() |
9a4acedf31 | ||
![]() |
c2d37e7364 | ||
![]() |
62baf22ec0 | ||
![]() |
8f7d839e15 | ||
![]() |
93716f7bea | ||
![]() |
ff4c53e8b3 | ||
![]() |
9a22d6dd63 | ||
![]() |
beb28bc55d | ||
![]() |
1fa7ad2e20 | ||
![]() |
f514834917 | ||
![]() |
1d0e583728 | ||
![]() |
782331be1e | ||
![]() |
94c7ee4d9e | ||
![]() |
b7154758de | ||
![]() |
cd7d575e90 | ||
![]() |
17d169ce0f | ||
![]() |
fb1fb462e5 | ||
![]() |
7da810e68b | ||
![]() |
6de6d9e2d3 | ||
![]() |
736851264b | ||
![]() |
59431fc841 | ||
![]() |
f581e25a69 | ||
![]() |
9d0bb7fc39 | ||
![]() |
a53fd4b758 | ||
![]() |
b4ccdf5e68 | ||
![]() |
9b02aa2593 | ||
![]() |
f089e67d51 | ||
![]() |
842d7c9b3a | ||
![]() |
187297b871 | ||
![]() |
211ad5042a | ||
![]() |
2b06f5f8f1 | ||
![]() |
0a64b25c77 | ||
![]() |
40e52bbb63 | ||
![]() |
aeec1a6430 | ||
![]() |
ef121a88d5 | ||
![]() |
db99c41567 | ||
![]() |
54bdb5fc86 | ||
![]() |
2fd824b466 | ||
![]() |
005b38f8f1 | ||
![]() |
6911d9e1b0 | ||
![]() |
cecb2b39ce | ||
![]() |
9ebfee7ac0 | ||
![]() |
01b39884c7 | ||
![]() |
c08e8ab715 | ||
![]() |
68ae344b5e | ||
![]() |
5753d780b4 | ||
![]() |
dbb534cea6 | ||
![]() |
414d75b8bc | ||
![]() |
c52a25e03b | ||
![]() |
c7966bf795 | ||
![]() |
0f429392cf | ||
![]() |
2dc6c5d462 | ||
![]() |
dc0403530e | ||
![]() |
59147be24f | ||
![]() |
09bc4be3db | ||
![]() |
aaef59d535 | ||
![]() |
283e070877 | ||
![]() |
4e0c29451b | ||
![]() |
f5ae34250a | ||
![]() |
fc4c29bc6e | ||
![]() |
6158eec53f | ||
![]() |
6c0fef5762 | ||
![]() |
f5a4bd23e9 | ||
![]() |
8e1760f37f | ||
![]() |
1da5ab751f | ||
![]() |
237ef710a1 | ||
![]() |
be47e93134 | ||
![]() |
1821c849da | ||
![]() |
a4522ae516 | ||
![]() |
c7ee4bc016 | ||
![]() |
0cabb95811 | ||
![]() |
a1b32533aa | ||
![]() |
e2eb0d2326 | ||
![]() |
acac6b0d69 | ||
![]() |
deb8d0d6a1 | ||
![]() |
3e817d91ef | ||
![]() |
e231f0fade | ||
![]() |
f0f55e6726 | ||
![]() |
61dc8494d7 | ||
![]() |
423b87d621 | ||
![]() |
8d9568b4a1 | ||
![]() |
acf511de34 | ||
![]() |
fd2951bb53 | ||
![]() |
fa004f4854 | ||
![]() |
1155bdb754 | ||
![]() |
01838c5732 | ||
![]() |
f09f33031b | ||
![]() |
b2a9f64e1b | ||
![]() |
15ea618ef6 | ||
![]() |
ec33423273 | ||
![]() |
d5dd54df69 | ||
![]() |
e7a4c34e7c | ||
![]() |
2881bfbfd6 | ||
![]() |
80fb38153e | ||
![]() |
b79f337f8a | ||
![]() |
f593ac1c21 | ||
![]() |
baf92305a6 | ||
![]() |
d6d168e87b | ||
![]() |
50f9c4acc3 | ||
![]() |
211374e52a | ||
![]() |
1bf2461765 | ||
![]() |
64444cd578 | ||
![]() |
0047a31090 | ||
![]() |
d73ce6cb56 | ||
![]() |
9a6d3eee59 | ||
![]() |
8b221d60fa | ||
![]() |
9da9b36435 | ||
![]() |
09b33f9a82 | ||
![]() |
fa6b6dad3d | ||
![]() |
e0d88cfd18 | ||
![]() |
18043e3d22 | ||
![]() |
ccf470fdb6 | ||
![]() |
8f9bc6f2ce | ||
![]() |
fcab45f39b | ||
![]() |
bc44d06c3d | ||
![]() |
7740e36a89 | ||
![]() |
6127f792f9 | ||
![]() |
fd2cf9c45d | ||
![]() |
fc3dec8b62 | ||
![]() |
a7315116dd | ||
![]() |
37268dcc86 | ||
![]() |
ea28e74205 | ||
![]() |
c1c84f0a55 | ||
![]() |
56bf38859b | ||
![]() |
1cda4aa1e0 | ||
![]() |
9711b52739 |
43
MAINTAINERS
43
MAINTAINERS
@ -46,7 +46,7 @@ Miscellaneous Areas
|
||||
documentation Mike Melanson
|
||||
website Robert Swain, Lou Logan
|
||||
build system (configure,Makefiles) Diego Biurrun, Mans Rullgard
|
||||
project server Árpád Gereöffy, Michael Niedermayer, Reimar Döffinger
|
||||
project server Árpád Gereöffy, Michael Niedermayer, Reimar Döffinger, Alexander Strasser
|
||||
mailinglists Michael Niedermayer, Baptiste Coudurier, Lou Logan
|
||||
presets Robert Swain
|
||||
metadata subsystem Aurelien Jacobs
|
||||
@ -62,13 +62,20 @@ Internal Interfaces:
|
||||
libavutil/common.h Michael Niedermayer
|
||||
|
||||
Other:
|
||||
intfloat* Michael Niedermayer
|
||||
rational.c, rational.h Michael Niedermayer
|
||||
mathematics.c, mathematics.h Michael Niedermayer
|
||||
integer.c, integer.h Michael Niedermayer
|
||||
bprint Nicolas George
|
||||
bswap.h
|
||||
des Reimar Doeffinger
|
||||
float_dsp Loren Merritt
|
||||
hash Reimar Doeffinger
|
||||
intfloat* Michael Niedermayer
|
||||
integer.c, integer.h Michael Niedermayer
|
||||
lzo Reimar Doeffinger
|
||||
mathematics.c, mathematics.h Michael Niedermayer
|
||||
opencl.c, opencl.h Wei Gao
|
||||
rational.c, rational.h Michael Niedermayer
|
||||
rc4 Reimar Doeffinger
|
||||
ripemd.c, ripemd.h James Almer
|
||||
timecode Clément Bœsch
|
||||
|
||||
|
||||
libavcodec
|
||||
@ -131,8 +138,8 @@ Codecs:
|
||||
binkaudio.c Peter Ross
|
||||
bmp.c Mans Rullgard, Kostya Shishkov
|
||||
cavs* Stefan Gehrer
|
||||
celp_filters.* Vitor Sessak
|
||||
cdxl.c Paul B Mahol
|
||||
celp_filters.* Vitor Sessak
|
||||
cinepak.c Roberto Togni
|
||||
cljr Alex Beregszaszi
|
||||
cllc.c Derek Buitenhuis
|
||||
@ -143,8 +150,8 @@ Codecs:
|
||||
dca.c Kostya Shishkov, Benjamin Larsson
|
||||
dnxhd* Baptiste Coudurier
|
||||
dpcm.c Mike Melanson
|
||||
dxa.c Kostya Shishkov
|
||||
dv.c Roman Shaposhnik
|
||||
dxa.c Kostya Shishkov
|
||||
eacmv*, eaidct*, eat* Peter Ross
|
||||
ffv1.c Michael Niedermayer
|
||||
ffwavesynth.c Nicolas George
|
||||
@ -154,9 +161,9 @@ Codecs:
|
||||
g722.c Martin Storsjo
|
||||
g726.c Roman Shaposhnik
|
||||
gifdec.c Baptiste Coudurier
|
||||
h264* Loren Merritt, Michael Niedermayer
|
||||
h261* Michael Niedermayer
|
||||
h263* Michael Niedermayer
|
||||
h264* Loren Merritt, Michael Niedermayer
|
||||
huffyuv.c Michael Niedermayer
|
||||
idcinvideo.c Mike Melanson
|
||||
imc* Benjamin Larsson
|
||||
@ -171,8 +178,8 @@ Codecs:
|
||||
kmvc.c Kostya Shishkov
|
||||
lcl*.c Roberto Togni, Reimar Doeffinger
|
||||
libcelt_dec.c Nicolas George
|
||||
libgsm.c Michel Bardiaux
|
||||
libdirac* David Conrad
|
||||
libgsm.c Michel Bardiaux
|
||||
libopenjpeg.c Jaikrishnan Menon
|
||||
libopenjpegenc.c Michael Bradshaw
|
||||
libschroedinger* David Conrad
|
||||
@ -180,8 +187,8 @@ Codecs:
|
||||
libtheoraenc.c David Conrad
|
||||
libutvideo* Derek Buitenhuis
|
||||
libvorbis.c David Conrad
|
||||
libxavs.c Stefan Gehrer
|
||||
libx264.c Mans Rullgard, Jason Garrett-Glaser
|
||||
libxavs.c Stefan Gehrer
|
||||
loco.c Kostya Shishkov
|
||||
lzo.h, lzo.c Reimar Doeffinger
|
||||
mdec.c Michael Niedermayer
|
||||
@ -243,8 +250,8 @@ Codecs:
|
||||
vda_h264_dec.c Xidorn Quan
|
||||
vima.c Paul B Mahol
|
||||
vmnc.c Kostya Shishkov
|
||||
vorbis_enc.c Oded Shimon
|
||||
vorbis_dec.c Denes Balatoni, David Conrad
|
||||
vorbis_enc.c Oded Shimon
|
||||
vp3* Mike Melanson
|
||||
vp5 Aurelien Jacobs
|
||||
vp6 Aurelien Jacobs
|
||||
@ -278,11 +285,11 @@ libavdevice
|
||||
libavdevice/avdevice.h
|
||||
|
||||
|
||||
dshow.c Roger Pack
|
||||
iec61883.c Georg Lippitsch
|
||||
libdc1394.c Roman Shaposhnik
|
||||
v4l2.c Luca Abeni
|
||||
vfwcap.c Ramiro Polla
|
||||
dshow.c Roger Pack
|
||||
|
||||
libavfilter
|
||||
===========
|
||||
@ -292,11 +299,13 @@ Generic parts:
|
||||
|
||||
Filters:
|
||||
af_amerge.c Nicolas George
|
||||
af_aresample.c Michael Niedermayer
|
||||
af_astreamsync.c Nicolas George
|
||||
af_atempo.c Pavel Koshevoy
|
||||
af_pan.c Nicolas George
|
||||
vf_delogo.c Jean Delvare (CC <khali@linux-fr.org>)
|
||||
vf_drawbox.c/drawgrid Andrey Utkin
|
||||
vf_scale.c Michael Niedermayer
|
||||
vf_yadif.c Michael Niedermayer
|
||||
|
||||
Sources:
|
||||
@ -316,7 +325,8 @@ Muxers/Demuxers:
|
||||
4xm.c Mike Melanson
|
||||
adtsenc.c Robert Swain
|
||||
afc.c Paul B Mahol
|
||||
aiff.c Baptiste Coudurier
|
||||
aiffdec.c Baptiste Coudurier, Matthieu Bouron
|
||||
aiffenc.c Baptiste Coudurier, Matthieu Bouron
|
||||
ape.c Kostya Shishkov
|
||||
ass* Aurelien Jacobs
|
||||
astdec.c Paul B Mahol
|
||||
@ -344,8 +354,8 @@ Muxers/Demuxers:
|
||||
idcin.c Mike Melanson
|
||||
idroqdec.c Mike Melanson
|
||||
iff.c Jaikrishnan Menon
|
||||
ipmovie.c Mike Melanson
|
||||
img2*.c Michael Niedermayer
|
||||
ipmovie.c Mike Melanson
|
||||
ircam* Paul B Mahol
|
||||
iss.c Stefan Gehrer
|
||||
jacosub* Clément Bœsch
|
||||
@ -359,11 +369,11 @@ Muxers/Demuxers:
|
||||
matroskadec.c Aurelien Jacobs
|
||||
matroskaenc.c David Conrad
|
||||
metadata* Aurelien Jacobs
|
||||
microdvd* Aurelien Jacobs
|
||||
mgsts.c Paul B Mahol
|
||||
microdvd* Aurelien Jacobs
|
||||
mm.c Peter Ross
|
||||
mov.c Michael Niedermayer, Baptiste Coudurier
|
||||
movenc.c Michael Niedermayer, Baptiste Coudurier
|
||||
movenc.c Baptiste Coudurier, Matthieu Bouron
|
||||
mpc.c Kostya Shishkov
|
||||
mpeg.c Michael Niedermayer
|
||||
mpegenc.c Michael Niedermayer
|
||||
@ -458,7 +468,6 @@ Releases
|
||||
|
||||
2.0 Michael Niedermayer
|
||||
1.2 Michael Niedermayer
|
||||
1.1 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct SwsContext *sws_opts;
|
||||
AVDictionary *swr_opts;
|
||||
AVDictionary *format_opts, *codec_opts, *resample_opts;
|
||||
|
||||
const int this_year = 2013;
|
||||
const int this_year = 2014;
|
||||
|
||||
static FILE *report_file;
|
||||
|
||||
|
68
compat/avisynth/avisynth_c_25.h
Normal file
68
compat/avisynth/avisynth_c_25.h
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2011 FFmpegSource Project
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
/* these are defines/functions that are used and were changed in the switch to 2.6
|
||||
* and are needed to maintain full compatility with 2.5 */
|
||||
|
||||
enum {
|
||||
AVS_CS_YV12_25 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
|
||||
AVS_CS_I420_25 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
|
||||
};
|
||||
|
||||
AVSC_INLINE int avs_get_height_p_25(const AVS_VideoFrame * p, int plane) {
|
||||
switch (plane)
|
||||
{
|
||||
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||
if (p->pitchUV)
|
||||
return p->height>>1;
|
||||
return 0;
|
||||
}
|
||||
return p->height;}
|
||||
|
||||
AVSC_INLINE int avs_get_row_size_p_25(const AVS_VideoFrame * p, int plane) {
|
||||
int r;
|
||||
switch (plane)
|
||||
{
|
||||
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||
if (p->pitchUV)
|
||||
return p->row_size>>1;
|
||||
else
|
||||
return 0;
|
||||
case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED:
|
||||
if (p->pitchUV)
|
||||
{
|
||||
r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize
|
||||
if (r < p->pitchUV)
|
||||
return r;
|
||||
return p->row_size>>1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
case AVS_PLANAR_Y_ALIGNED:
|
||||
r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
|
||||
if (r <= p->pitch)
|
||||
return r;
|
||||
return p->row_size;
|
||||
}
|
||||
return p->row_size;
|
||||
}
|
||||
|
||||
AVSC_INLINE int avs_is_yv12_25(const AVS_VideoInfo * p)
|
||||
{ return ((p->pixel_type & AVS_CS_YV12_25) == AVS_CS_YV12_25)||((p->pixel_type & AVS_CS_I420_25) == AVS_CS_I420_25); }
|
8
configure
vendored
8
configure
vendored
@ -2801,7 +2801,9 @@ probe_cc(){
|
||||
unset _depflags _DEPCMD _DEPFLAGS
|
||||
_flags_filter=echo
|
||||
|
||||
if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
|
||||
if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
|
||||
true # no-op to avoid reading stdin in following checks
|
||||
elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
|
||||
_type=llvm_gcc
|
||||
gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
|
||||
_ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
|
||||
@ -4134,7 +4136,7 @@ enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_gl
|
||||
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
|
||||
enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
|
||||
enabled libass && require_pkg_config libass ass/ass.h ass_library_init
|
||||
enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
|
||||
enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open
|
||||
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
|
||||
{ check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
|
||||
die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
|
||||
@ -4201,7 +4203,7 @@ enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lO
|
||||
enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
|
||||
check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
|
||||
die "ERROR: opencl not found"; } &&
|
||||
{ enabled_any w32threads os2threads &&
|
||||
{ ! enabled_any w32threads os2threads ||
|
||||
die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
|
||||
{ check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
|
||||
check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
|
||||
|
@ -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.0
|
||||
PROJECT_NUMBER = 2.0.5
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@ -103,8 +103,8 @@ endif
|
||||
uninstall: uninstall-man
|
||||
|
||||
uninstall-man:
|
||||
$(RM) $(addprefix "$(MANDIR)/man1/",$(MANPAGES1))
|
||||
$(RM) $(addprefix "$(MANDIR)/man3/",$(MANPAGES3))
|
||||
$(RM) $(addprefix "$(MANDIR)/man1/",$(PROGS-yes:%=%.1) $(PROGS-yes:%=%-all.1) $(COMPONENTS-yes:%=%.1))
|
||||
$(RM) $(addprefix "$(MANDIR)/man3/",$(LIBRARIES-yes:%=%.3))
|
||||
|
||||
clean:: docclean
|
||||
|
||||
|
@ -14,7 +14,3 @@ accepted. If you are experiencing issues with any formally released version of
|
||||
FFmpeg, please try git master to check if the issue still exists. If it does,
|
||||
make your report against the development code following the usual bug reporting
|
||||
guidelines.
|
||||
|
||||
AVI/AVXSynth
|
||||
--------
|
||||
If you want to use FFmpeg with AVISynth, you need AVISynth 2.6.0 at minimum.
|
||||
|
@ -1,3 +1,4 @@
|
||||
@anchor{codec-options}
|
||||
@chapter Codec Options
|
||||
@c man begin CODEC OPTIONS
|
||||
|
||||
|
@ -25,6 +25,95 @@ enabled encoders.
|
||||
A description of some of the currently available audio encoders
|
||||
follows.
|
||||
|
||||
@anchor{aacenc}
|
||||
@section aac
|
||||
|
||||
Advanced Audio Coding (AAC) encoder.
|
||||
|
||||
This encoder is an experimental FFmpeg-native AAC encoder. Currently only the
|
||||
low complexity (AAC-LC) profile is supported. To use this encoder, you must set
|
||||
@option{strict} option to @samp{experimental} or lower.
|
||||
|
||||
As this encoder is experimental, unexpected behavior may exist from time to
|
||||
time. For a more stable AAC encoder, see @ref{libvo-aacenc}. However, be warned
|
||||
that it has a worse quality reported by some users.
|
||||
|
||||
@c Comment this out until somebody writes the respective documentation.
|
||||
@c See also @ref{libfaac}, @ref{libaacplus}, and @ref{libfdk-aac-enc}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item b
|
||||
Set bit rate in bits/s. Setting this automatically activates constant bit rate
|
||||
(CBR) mode.
|
||||
|
||||
@item q
|
||||
Set quality for variable bit rate (VBR) mode. This option is valid only using
|
||||
the @command{ffmpeg} command-line tool. For library interface users, use
|
||||
@option{global_quality}.
|
||||
|
||||
@item stereo_mode
|
||||
Set stereo encoding mode. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item auto
|
||||
Automatically selected by the encoder.
|
||||
|
||||
@item ms_off
|
||||
Disable middle/side encoding. This is the default.
|
||||
|
||||
@item ms_force
|
||||
Force middle/side encoding.
|
||||
@end table
|
||||
|
||||
@item aac_coder
|
||||
Set AAC encoder coding method. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item 0
|
||||
FAAC-inspired method.
|
||||
|
||||
This method is a simplified reimplementation of the method used in FAAC, which
|
||||
sets thresholds proportional to the band energies, and then decreases all the
|
||||
thresholds with quantizer steps to find the appropriate quantization with
|
||||
distortion below threshold band by band.
|
||||
|
||||
The quality of this method is comparable to the two loop searching method
|
||||
descibed below, but somewhat a little better and slower.
|
||||
|
||||
@item 1
|
||||
Average noise to mask ratio (ANMR) trellis-based solution.
|
||||
|
||||
This has a theoretic best quality out of all the coding methods, but at the
|
||||
cost of the slowest speed.
|
||||
|
||||
@item 2
|
||||
Two loop searching (TLS) method.
|
||||
|
||||
This method first sets quantizers depending on band thresholds and then tries
|
||||
to find an optimal combination by adding or subtracting a specific value from
|
||||
all quantizers and adjusting some individual quantizer a little.
|
||||
|
||||
This method produces similar quality with the FAAC method and is the default.
|
||||
|
||||
@item 3
|
||||
Constant quantizer method.
|
||||
|
||||
This method sets a constant quantizer for all bands. This is the fastest of all
|
||||
the methods, yet produces the worst quality.
|
||||
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Tips and Tricks
|
||||
|
||||
According to some reports
|
||||
(e.g. @url{http://d.hatena.ne.jp/kamedo2/20120729/1343545890}), setting the
|
||||
@option{cutoff} option to 15000 Hz greatly improves the quality of the output
|
||||
quality. As a result, we encourage you to do the same.
|
||||
|
||||
@section ac3 and ac3_fixed
|
||||
|
||||
AC-3 audio encoders.
|
||||
@ -420,26 +509,36 @@ Requires the presence of the libmp3lame headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libmp3lame}.
|
||||
|
||||
@subsection Option Mapping
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libmp3lame wrapper,
|
||||
the LAME-equivalent options follow the FFmpeg ones.
|
||||
The following options are supported by the libmp3lame wrapper. The
|
||||
@command{lame}-equivalent of the options are listed in parentheses.
|
||||
|
||||
@multitable @columnfractions .2 .2
|
||||
@item FFmpeg @tab LAME
|
||||
@item b @tab b
|
||||
Set bitrate expressed in bits/s, LAME @code{bitrate} is expressed in
|
||||
kilobits/s.
|
||||
@item q @tab V
|
||||
Set quality setting for VBR.
|
||||
@item compression_level @tab q
|
||||
Set algorithm quality. Valid arguments are integers in the 0-9 range.
|
||||
@item reservoir @tab N.A.
|
||||
Enable use of bit reservoir. LAME has this enabled by default.
|
||||
@item joint_stereo @tab -m j
|
||||
@table @option
|
||||
@item b (@emph{-b})
|
||||
Set bitrate expressed in bits/s for CBR. LAME @code{bitrate} is
|
||||
expressed in kilobits/s.
|
||||
|
||||
@item q (@emph{-V})
|
||||
Set constant quality setting for VBR. This option is valid only
|
||||
using the @command{ffmpeg} command-line tool. For library interface
|
||||
users, use @option{global_quality}.
|
||||
|
||||
@item compression_level (@emph{-q})
|
||||
Set algorithm quality. Valid arguments are integers in the 0-9 range,
|
||||
with 0 meaning highest quality but slowest, and 9 meaning fastest
|
||||
while producing the worst quality.
|
||||
|
||||
@item reservoir
|
||||
Enable use of bit reservoir when set to 1. Default value is 1. LAME
|
||||
has this enabled by default, but can be overriden by use
|
||||
@option{--nores} option.
|
||||
|
||||
@item joint_stereo (@emph{-m j})
|
||||
Enable the encoder to use (on a frame by frame basis) either L/R
|
||||
stereo or mid/side stereo.
|
||||
@end multitable
|
||||
stereo or mid/side stereo. Default value is 1.
|
||||
|
||||
@end table
|
||||
|
||||
@section libopencore-amrnb
|
||||
|
||||
@ -486,24 +585,26 @@ Requires the presence of the libtwolame headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libtwolame}.
|
||||
|
||||
@subsection Options Mapping
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libtwolame wrapper. The
|
||||
TwoLAME-equivalent options follow the FFmpeg ones and are in
|
||||
@command{twolame}-equivalent options follow the FFmpeg ones and are in
|
||||
parentheses.
|
||||
|
||||
@table @option
|
||||
@item b
|
||||
(b) Set bitrate in bits/s. Note that FFmpeg @code{b} option is
|
||||
expressed in bits/s, twolame @code{b} in kilobits/s. The default
|
||||
value is 128k.
|
||||
@item b (@emph{-b})
|
||||
Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
|
||||
option is expressed in kilobits/s. Default value is 128k.
|
||||
|
||||
@item q
|
||||
(V) Set quality for experimental VBR support. Maximum value range is
|
||||
from -50 to 50, useful range is from -10 to 10.
|
||||
@item q (@emph{-V})
|
||||
Set quality for experimental VBR support. Maximum value range is
|
||||
from -50 to 50, useful range is from -10 to 10. The higher the
|
||||
value, the better the quality. This option is valid only using the
|
||||
@command{ffmpeg} command-line tool. For library interface users,
|
||||
use @option{global_quality}.
|
||||
|
||||
@item mode
|
||||
(mode) Set MPEG mode. Possible values:
|
||||
@item mode (@emph{--mode})
|
||||
Set the mode of the resulting audio. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item auto
|
||||
@ -518,29 +619,30 @@ Dual channel
|
||||
Mono
|
||||
@end table
|
||||
|
||||
@item psymodel
|
||||
(psyc-mode) Set psychoacoustic model to use in encoding. The argument
|
||||
must be an integer between -1 and 4, inclusive. The higher the value,
|
||||
the better the quality. The default value is 3.
|
||||
@item psymodel (@emph{--psyc-mode})
|
||||
Set psychoacoustic model to use in encoding. The argument must be
|
||||
an integer between -1 and 4, inclusive. The higher the value, the
|
||||
better the quality. The default value is 3.
|
||||
|
||||
@item energy_levels
|
||||
(energy) Enable energy levels extensions when set to 1. The default
|
||||
value is 0 (disabled).
|
||||
@item energy_levels (@emph{--energy})
|
||||
Enable energy levels extensions when set to 1. The default value is
|
||||
0 (disabled).
|
||||
|
||||
@item error_protection
|
||||
(protect) Enable CRC error protection when set to 1. The default value
|
||||
is 0 (disabled).
|
||||
@item error_protection (@emph{--protect})
|
||||
Enable CRC error protection when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@item copyright
|
||||
(copyright) Set MPEG audio copyright flag when set to 1. The default
|
||||
value is 0 (disabled).
|
||||
@item copyright (@emph{--copyright})
|
||||
Set MPEG audio copyright flag when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@item original
|
||||
(original) Set MPEG audio original flag when set to 1. The default
|
||||
value is 0 (disabled).
|
||||
@item original (@emph{--original})
|
||||
Set MPEG audio original flag when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@anchor{libvo-aacenc}
|
||||
@section libvo-aacenc
|
||||
|
||||
VisualOn AAC encoder.
|
||||
@ -549,16 +651,19 @@ Requires the presence of the libvo-aacenc headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libvo-aacenc --enable-version3}.
|
||||
|
||||
This encoder is considered to be worse than the
|
||||
@ref{aacenc,,native experimental FFmpeg AAC encoder}, according to
|
||||
multiple sources.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The VisualOn AAC encoder only support encoding AAC-LC and up to 2
|
||||
channels. It is also CBR-only. It is considered to be worse than the
|
||||
native experimental FFmpeg AAC encoder.
|
||||
channels. It is also CBR-only.
|
||||
|
||||
@table @option
|
||||
|
||||
@item b
|
||||
Bitrate.
|
||||
Set bit rate in bits/s.
|
||||
|
||||
@end table
|
||||
|
||||
@ -648,7 +753,7 @@ Set maximum frame size, or duration of a frame in milliseconds. The
|
||||
argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
|
||||
frame sizes achieve lower latency but less quality at a given bitrate.
|
||||
Sizes greater than 20ms are only interesting at fairly low bitrates.
|
||||
The default of FFmpeg is 10ms, but is 20ms in @command{opusenc}.
|
||||
The default is 20ms.
|
||||
|
||||
@item packet_loss (@emph{expect-loss})
|
||||
Set expected packet loss percentage. The default is 0.
|
||||
@ -873,178 +978,318 @@ For more information about libvpx see:
|
||||
|
||||
x264 H.264/MPEG-4 AVC encoder wrapper.
|
||||
|
||||
Requires the presence of the libx264 headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
This encoder requires the presence of the libx264 headers and library
|
||||
during configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libx264}.
|
||||
|
||||
x264 supports an impressive number of features, including 8x8 and 4x4 adaptive
|
||||
spatial transform, adaptive B-frame placement, CAVLC/CABAC entropy coding,
|
||||
interlacing (MBAFF), lossless mode, psy optimizations for detail retention
|
||||
(adaptive quantization, psy-RD, psy-trellis).
|
||||
libx264 supports an impressive number of features, including 8x8 and
|
||||
4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
|
||||
entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
|
||||
for detail retention (adaptive quantization, psy-RD, psy-trellis).
|
||||
|
||||
The FFmpeg wrapper provides a mapping for most of them using global options
|
||||
that match those of the encoders and provides private options for the unique
|
||||
encoder options. Additionally an expert override is provided to directly pass
|
||||
a list of key=value tuples as accepted by x264_param_parse.
|
||||
Many libx264 encoder options are mapped to FFmpeg global codec
|
||||
options, while unique encoder options are provided through private
|
||||
options. Additionally the @option{x264opts} and @option{x264-params}
|
||||
private options allows to pass a list of key=value tuples as accepted
|
||||
by the libx264 @code{x264_param_parse} function.
|
||||
|
||||
@subsection Option Mapping
|
||||
The x264 project website is at
|
||||
@url{http://www.videolan.org/developers/x264.html}.
|
||||
|
||||
The following options are supported by the x264 wrapper, the x264-equivalent
|
||||
options follow the FFmpeg ones.
|
||||
@subsection Options
|
||||
|
||||
@multitable @columnfractions .2 .2
|
||||
@item b @tab bitrate
|
||||
FFmpeg @code{b} option is expressed in bits/s, x264 @code{bitrate} in kilobits/s.
|
||||
@item bf @tab bframes
|
||||
Maximum number of B-frames.
|
||||
@item g @tab keyint
|
||||
Maximum GOP size.
|
||||
@item qmin @tab qpmin
|
||||
@item qmax @tab qpmax
|
||||
@item qdiff @tab qpstep
|
||||
@item qblur @tab qblur
|
||||
@item qcomp @tab qcomp
|
||||
@item refs @tab ref
|
||||
@item sc_threshold @tab scenecut
|
||||
@item trellis @tab trellis
|
||||
@item nr @tab nr
|
||||
Noise reduction.
|
||||
@item me_range @tab merange
|
||||
@item me_method @tab me
|
||||
@item subq @tab subme
|
||||
@item b_strategy @tab b-adapt
|
||||
@item keyint_min @tab keyint-min
|
||||
@item coder @tab cabac
|
||||
Set coder to @code{ac} to use CABAC.
|
||||
@item cmp @tab chroma-me
|
||||
Set to @code{chroma} to use chroma motion estimation.
|
||||
@item threads @tab threads
|
||||
@item thread_type @tab sliced_threads
|
||||
Set to @code{slice} to use sliced threading instead of frame threading.
|
||||
@item flags -cgop @tab open-gop
|
||||
Set @code{-cgop} to use recovery points to close GOPs.
|
||||
@item rc_init_occupancy @tab vbv-init
|
||||
Initial buffer occupancy.
|
||||
@end multitable
|
||||
The following options are supported by the libx264 wrapper. The
|
||||
@command{x264}-equivalent options or values are listed in parentheses
|
||||
for easy migration.
|
||||
|
||||
To reduce the duplication of documentation, only the private options
|
||||
and some others requiring special attention are documented here. For
|
||||
the documentation of the undocumented generic options, see
|
||||
@ref{codec-options,,the Codec Options chapter}.
|
||||
|
||||
To get a more accurate and extensive documentation of the libx264
|
||||
options, invoke the command @command{x264 --full-help} or consult
|
||||
the libx264 documentation.
|
||||
|
||||
@subsection Private Options
|
||||
@table @option
|
||||
@item -preset @var{string}
|
||||
Set the encoding preset (cf. x264 --fullhelp).
|
||||
@item -tune @var{string}
|
||||
Tune the encoding params (cf. x264 --fullhelp).
|
||||
@item -profile @var{string}
|
||||
Set profile restrictions (cf. x264 --fullhelp).
|
||||
@item -fastfirstpass @var{integer}
|
||||
Use fast settings when encoding first pass.
|
||||
@item -crf @var{float}
|
||||
Select the quality for constant quality mode.
|
||||
@item -crf_max @var{float}
|
||||
In CRF mode, prevents VBV from lowering quality beyond this point.
|
||||
@item -qp @var{integer}
|
||||
Constant quantization parameter rate control method.
|
||||
@item -aq-mode @var{integer}
|
||||
AQ method
|
||||
@item b (@emph{bitrate})
|
||||
Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
|
||||
expressed in bits/s, while @command{x264}'s @option{bitrate} is in
|
||||
kilobits/s.
|
||||
|
||||
@item bf (@emph{bframes})
|
||||
|
||||
@item g (@emph{keyint})
|
||||
|
||||
@item qmax (@emph{qpmax})
|
||||
|
||||
@item qmin (@emph{qpmin})
|
||||
|
||||
@item qdiff (@emph{qpstep})
|
||||
|
||||
@item qblur (@emph{qblur})
|
||||
|
||||
@item qcomp (@emph{qcomp})
|
||||
|
||||
@item refs (@emph{ref})
|
||||
|
||||
@item sc_threshold (@emph{scenecut})
|
||||
|
||||
@item trellis (@emph{trellis})
|
||||
|
||||
@item nr (@emph{nr})
|
||||
|
||||
@item me_range (@emph{merange})
|
||||
|
||||
@item me_method (@emph{me})
|
||||
Set motion estimation method. Possible values in the decreasing order
|
||||
of speed:
|
||||
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item none
|
||||
@item dia (@emph{dia})
|
||||
@item epzs (@emph{dia})
|
||||
Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
|
||||
@samp{dia}.
|
||||
@item hex (@emph{hex})
|
||||
Hexagonal search with radius 2.
|
||||
@item umh (@emph{umh})
|
||||
Uneven multi-hexagon search.
|
||||
@item esa (@emph{esa})
|
||||
Exhaustive search.
|
||||
@item tesa (@emph{tesa})
|
||||
Hadamard exhaustive search (slowest).
|
||||
@end table
|
||||
|
||||
@item variance
|
||||
@item subq (@emph{subme})
|
||||
|
||||
@item b_strategy (@emph{b-adapt})
|
||||
|
||||
@item keyint_min (@emph{min-keyint})
|
||||
|
||||
@item coder
|
||||
Set entropy encoder. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item ac
|
||||
Enable CABAC.
|
||||
|
||||
@item vlc
|
||||
Enable CAVLC and disable CABAC. It generates the same effect as
|
||||
@command{x264}'s @option{--no-cabac} option.
|
||||
@end table
|
||||
|
||||
@item cmp
|
||||
Set full pixel motion estimation comparation algorithm. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item chroma
|
||||
Enable chroma in motion estimation.
|
||||
|
||||
@item sad
|
||||
Ignore chroma in motion estimation. It generates the same effect as
|
||||
@command{x264}'s @option{--no-chroma-me} option.
|
||||
@end table
|
||||
|
||||
@item threads (@emph{threads})
|
||||
|
||||
@item thread_type
|
||||
Set multithreading technique. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item slice
|
||||
Slice-based multithreading. It generates the same effect as
|
||||
@command{x264}'s @option{--sliced-threads} option.
|
||||
@item frame
|
||||
Frame-based multithreading.
|
||||
@end table
|
||||
|
||||
@item flags
|
||||
Set encoding flags. It can be used to disable closed GOP and enable
|
||||
open GOP by setting it to @code{-cgop}. The result is similar to
|
||||
the behavior of @command{x264}'s @option{--open-gop} option.
|
||||
|
||||
@item rc_init_occupancy (@emph{vbv-init})
|
||||
|
||||
@item preset (@emph{preset})
|
||||
Set the encoding preset.
|
||||
|
||||
@item tune (@emph{tune})
|
||||
Set tuning of the encoding params.
|
||||
|
||||
@item profile (@emph{profile})
|
||||
Set profile restrictions.
|
||||
|
||||
@item fastfirstpass
|
||||
Enable fast settings when encoding first pass, when set to 1. When set
|
||||
to 0, it has the same effect of @command{x264}'s
|
||||
@option{--slow-firstpass} option.
|
||||
|
||||
@item crf (@emph{crf})
|
||||
Set the quality for constant quality mode.
|
||||
|
||||
@item crf_max (@emph{crf-max})
|
||||
In CRF mode, prevents VBV from lowering quality beyond this point.
|
||||
|
||||
@item qp (@emph{qp})
|
||||
Set constant quantization rate control method parameter.
|
||||
|
||||
@item aq-mode (@emph{aq-mode})
|
||||
Set AQ method. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item none (@emph{0})
|
||||
Disabled.
|
||||
|
||||
@item variance (@emph{1})
|
||||
Variance AQ (complexity mask).
|
||||
@item autovariance
|
||||
|
||||
@item autovariance (@emph{2})
|
||||
Auto-variance AQ (experimental).
|
||||
@end table
|
||||
@item -aq-strength @var{float}
|
||||
AQ strength, reduces blocking and blurring in flat and textured areas.
|
||||
@item -psy @var{integer}
|
||||
Use psychovisual optimizations.
|
||||
@item -psy-rd @var{string}
|
||||
Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.
|
||||
@item -rc-lookahead @var{integer}
|
||||
Number of frames to look ahead for frametype and ratecontrol.
|
||||
@item -weightb @var{integer}
|
||||
Weighted prediction for B-frames.
|
||||
@item -weightp @var{integer}
|
||||
Weighted prediction analysis method.
|
||||
|
||||
Possible values:
|
||||
@item aq-strength (@emph{aq-strength})
|
||||
Set AQ strength, reduce blocking and blurring in flat and textured areas.
|
||||
|
||||
@item psy
|
||||
Use psychovisual optimizations when set to 1. When set to 0, it has the
|
||||
same effect as @command{x264}'s @option{--no-psy} option.
|
||||
|
||||
@item psy-rd (@emph{psy-rd})
|
||||
Set strength of psychovisual optimization, in
|
||||
@var{psy-rd}:@var{psy-trellis} format.
|
||||
|
||||
@item rc-lookahead (@emph{rc-lookahead})
|
||||
Set number of frames to look ahead for frametype and ratecontrol.
|
||||
|
||||
@item weightb
|
||||
Enable weighted prediction for B-frames when set to 1. When set to 0,
|
||||
it has the same effect as @command{x264}'s @option{--no-weightb} option.
|
||||
|
||||
@item weightp (@emph{weightp})
|
||||
Set weighted prediction method for P-frames. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item none
|
||||
|
||||
@item simple
|
||||
|
||||
@item smart
|
||||
|
||||
@item none (@emph{0})
|
||||
Disabled
|
||||
@item simple (@emph{1})
|
||||
Enable only weighted refs
|
||||
@item smart (@emph{2})
|
||||
Enable both weighted refs and duplicates
|
||||
@end table
|
||||
@item -ssim @var{integer}
|
||||
Calculate and print SSIM stats.
|
||||
@item -intra-refresh @var{integer}
|
||||
Use Periodic Intra Refresh instead of IDR frames.
|
||||
@item -b-bias @var{integer}
|
||||
Influences how often B-frames are used.
|
||||
@item -b-pyramid @var{integer}
|
||||
Keep some B-frames as references.
|
||||
|
||||
Possible values:
|
||||
@item ssim (@emph{ssim})
|
||||
Enable calculation and printing SSIM stats after the encoding.
|
||||
|
||||
@item intra-refresh (@emph{intra-refresh})
|
||||
Enable the use of Periodic Intra Refresh instead of IDR frames when set
|
||||
to 1.
|
||||
|
||||
@item b-bias (@emph{b-bias})
|
||||
Set the influence on how often B-frames are used.
|
||||
|
||||
@item b-pyramid (@emph{b-pyramid})
|
||||
Set method for keeping of some B-frames as references. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item none
|
||||
|
||||
@item strict
|
||||
@item none (@emph{none})
|
||||
Disabled.
|
||||
@item strict (@emph{strict})
|
||||
Strictly hierarchical pyramid.
|
||||
@item normal
|
||||
@item normal (@emph{normal})
|
||||
Non-strict (not Blu-ray compatible).
|
||||
@end table
|
||||
@item -mixed-refs @var{integer}
|
||||
One reference per partition, as opposed to one reference per macroblock.
|
||||
@item -8x8dct @var{integer}
|
||||
High profile 8x8 transform.
|
||||
@item -fast-pskip @var{integer}
|
||||
@item -aud @var{integer}
|
||||
Use access unit delimiters.
|
||||
@item -mbtree @var{integer}
|
||||
Use macroblock tree ratecontrol.
|
||||
@item -deblock @var{string}
|
||||
Loop filter parameters, in <alpha:beta> form.
|
||||
@item -cplxblur @var{float}
|
||||
Reduce fluctuations in QP (before curve compression).
|
||||
@item -partitions @var{string}
|
||||
A comma-separated list of partitions to consider, possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all.
|
||||
@item -direct-pred @var{integer}
|
||||
Direct MV prediction mode
|
||||
|
||||
Possible values:
|
||||
@item mixed-refs
|
||||
Enable the use of one reference per partition, as opposed to one
|
||||
reference per macroblock when set to 1. When set to 0, it has the
|
||||
same effect as @command{x264}'s @option{--no-mixed-refs} option.
|
||||
|
||||
@item 8x8dct
|
||||
Enable adaptive spatial transform (high profile 8x8 transform)
|
||||
when set to 1. When set to 0, it has the same effect as
|
||||
@command{x264}'s @option{--no-8x8dct} option.
|
||||
|
||||
@item fast-pskip
|
||||
Enable early SKIP detection on P-frames when set to 1. When set
|
||||
to 0, it has the same effect as @command{x264}'s
|
||||
@option{--no-fast-pskip} option.
|
||||
|
||||
@item aud (@emph{aud})
|
||||
Enable use of access unit delimiters when set to 1.
|
||||
|
||||
@item mbtree
|
||||
Enable use macroblock tree ratecontrol when set to 1. When set
|
||||
to 0, it has the same effect as @command{x264}'s
|
||||
@option{--no-mbtree} option.
|
||||
|
||||
@item deblock (@emph{deblock})
|
||||
Set loop filter parameters, in @var{alpha}:@var{beta} form.
|
||||
|
||||
@item cplxblur (@emph{cplxblur})
|
||||
Set fluctuations reduction in QP (before curve compression).
|
||||
|
||||
@item partitions (@emph{partitions})
|
||||
Set partitions to consider as a comma-separated list of. Possible
|
||||
values in the list:
|
||||
|
||||
@table @samp
|
||||
@item none
|
||||
|
||||
@item spatial
|
||||
|
||||
@item temporal
|
||||
|
||||
@item auto
|
||||
|
||||
@end table
|
||||
@item -slice-max-size @var{integer}
|
||||
Limit the size of each slice in bytes.
|
||||
@item -stats @var{string}
|
||||
Filename for 2 pass stats.
|
||||
@item -nal-hrd @var{integer}
|
||||
Signal HRD information (requires vbv-bufsize; cbr not allowed in .mp4).
|
||||
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item none
|
||||
|
||||
@item vbr
|
||||
|
||||
@item cbr
|
||||
|
||||
@item p8x8
|
||||
8x8 P-frame partition.
|
||||
@item p4x4
|
||||
4x4 P-frame partition.
|
||||
@item b8x8
|
||||
4x4 B-frame partition.
|
||||
@item i8x8
|
||||
8x8 I-frame partition.
|
||||
@item i4x4
|
||||
4x4 I-frame partition.
|
||||
(Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
|
||||
@samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
|
||||
option) to be enabled.)
|
||||
@item none (@emph{none})
|
||||
Do not consider any partitions.
|
||||
@item all (@emph{all})
|
||||
Consider every partition.
|
||||
@end table
|
||||
|
||||
@item x264opts @var{options}
|
||||
Allow to set any x264 option, see @code{x264 --fullhelp} for a list.
|
||||
@item direct-pred (@emph{direct})
|
||||
Set direct MV prediction mode. Possible values:
|
||||
|
||||
@var{options} is a list of @var{key}=@var{value} couples separated by
|
||||
@table @samp
|
||||
@item none (@emph{none})
|
||||
Disable MV prediction.
|
||||
@item spatial (@emph{spatial})
|
||||
Enable spatial predicting.
|
||||
@item temporal (@emph{temporal})
|
||||
Enable temporal predicting.
|
||||
@item auto (@emph{auto})
|
||||
Automatically decided.
|
||||
@end table
|
||||
|
||||
@item slice-max-size (@emph{slice-max-size})
|
||||
Set the limit of the size of each slice in bytes. If not specified
|
||||
but RTP payload size (@option{ps}) is specified, that is used.
|
||||
|
||||
@item stats (@emph{stats})
|
||||
Set the file name for multi-pass stats.
|
||||
|
||||
@item nal-hrd (@emph{nal-hrd})
|
||||
Set signal HRD information (requires @option{vbv-bufsize} to be set).
|
||||
Possible values:
|
||||
|
||||
@table @samp
|
||||
@item none (@emph{none})
|
||||
Disable HRD information signaling.
|
||||
@item vbr (@emph{vbr})
|
||||
Variable bit rate.
|
||||
@item cbr (@emph{cbr})
|
||||
Constant bit rate (not allowed in MP4 container).
|
||||
@end table
|
||||
|
||||
@item x264opts (N.A.)
|
||||
Set any x264 option, see @command{x264 --fullhelp} for a list.
|
||||
|
||||
Argument is a list of @var{key}=@var{value} couples separated by
|
||||
":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
|
||||
themselves, use "," instead. They accept it as well since long ago but this
|
||||
is kept undocumented for some reason.
|
||||
@ -1054,18 +1299,136 @@ For example to specify libx264 encoding options with @command{ffmpeg}:
|
||||
ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
|
||||
@end example
|
||||
|
||||
For more information about libx264 and the supported options see:
|
||||
@url{http://www.videolan.org/developers/x264.html}
|
||||
@item x264-params (N.A.)
|
||||
Override the x264 configuration using a :-separated list of key=value
|
||||
parameters.
|
||||
|
||||
@item -x264-params @var{string}
|
||||
Override the x264 configuration using a :-separated list of key=value parameters.
|
||||
This option is functionally the same as the @option{x264opts}, but is
|
||||
duplicated for compability with the Libav fork.
|
||||
|
||||
For example to specify libx264 encoding options with @command{ffmpeg}:
|
||||
@example
|
||||
-x264-params level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subq=6:8x8dct=0:trellis=0
|
||||
ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
|
||||
cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
|
||||
no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
|
||||
@end example
|
||||
@end table
|
||||
|
||||
Encoding avpresets for common usages are provided so they can be used with the
|
||||
general presets system (e.g. passing the @code{-pre} option).
|
||||
Encoding ffpresets for common usages are provided so they can be used with the
|
||||
general presets system (e.g. passing the @option{pre} option).
|
||||
|
||||
@section libxvid
|
||||
|
||||
Xvid MPEG-4 Part 2 encoder wrapper.
|
||||
|
||||
This encoder requires the presence of the libxvidcore headers and library
|
||||
during configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libxvid --enable-gpl}.
|
||||
|
||||
The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
|
||||
users can encode to this format without this library.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libxvid wrapper. Some of
|
||||
the following options are listed but are not documented, and
|
||||
correspond to shared codec options. See @ref{codec-options,,the Codec
|
||||
Options chapter} for their documentation. The other shared options
|
||||
which are not listed have no effect for the libxvid encoder.
|
||||
|
||||
@table @option
|
||||
@item b
|
||||
|
||||
@item g
|
||||
|
||||
@item qmin
|
||||
|
||||
@item qmax
|
||||
|
||||
@item mpeg_quant
|
||||
|
||||
@item threads
|
||||
|
||||
@item bf
|
||||
|
||||
@item b_qfactor
|
||||
|
||||
@item b_qoffset
|
||||
|
||||
@item flags
|
||||
Set specific encoding flags. Possible values:
|
||||
|
||||
@table @samp
|
||||
|
||||
@item mv4
|
||||
Use four motion vector by macroblock.
|
||||
|
||||
@item aic
|
||||
Enable high quality AC prediction.
|
||||
|
||||
@item gray
|
||||
Only encode grayscale.
|
||||
|
||||
@item gmc
|
||||
Enable the use of global motion compensation (GMC).
|
||||
|
||||
@item qpel
|
||||
Enable quarter-pixel motion compensation.
|
||||
|
||||
@item cgop
|
||||
Enable closed GOP.
|
||||
|
||||
@item global_header
|
||||
Place global headers in extradata instead of every keyframe.
|
||||
|
||||
@end table
|
||||
|
||||
@item trellis
|
||||
|
||||
@item me_method
|
||||
Set motion estimation method. Possible values in decreasing order of
|
||||
speed and increasing order of quality:
|
||||
|
||||
@table @samp
|
||||
@item zero
|
||||
Use no motion estimation (default).
|
||||
|
||||
@item phods
|
||||
@item x1
|
||||
@item log
|
||||
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
|
||||
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
|
||||
@samp{phods}.
|
||||
|
||||
@item epzs
|
||||
Enable all of the things described above, plus advanced diamond zonal
|
||||
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
|
||||
estimation on chroma planes.
|
||||
|
||||
@item full
|
||||
Enable all of the things described above, plus extended 16x16 and 8x8
|
||||
blocks search.
|
||||
@end table
|
||||
|
||||
@item mbd
|
||||
Set macroblock decision algorithm. Possible values in the increasing
|
||||
order of quality:
|
||||
|
||||
@table @samp
|
||||
@item simple
|
||||
Use macroblock comparing function algorithm (default).
|
||||
|
||||
@item bits
|
||||
Enable rate distortion-based half pixel and quarter pixel refinement for
|
||||
16x16 blocks.
|
||||
|
||||
@item rd
|
||||
Enable all of the things described above, plus rate distortion-based
|
||||
half pixel and quarter pixel refinement for 8x8 blocks, and rate
|
||||
distortion-based search using square pattern.
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@section png
|
||||
|
||||
|
@ -57,6 +57,9 @@ Enable RTP MP4A-LATM payload.
|
||||
Reduce the latency introduced by optional buffering
|
||||
@end table
|
||||
|
||||
@item seek2any @var{integer} (@emph{input})
|
||||
Forces seeking to enable seek to any mode if set to 1. Default is 0.
|
||||
|
||||
@item analyzeduration @var{integer} (@emph{input})
|
||||
Specify how many microseconds are analyzed to probe the input. A
|
||||
higher value will allow to detect more accurate information, but will
|
||||
@ -133,6 +136,12 @@ been without shifting.
|
||||
Also note that this affects only leading negative timestamps, and not
|
||||
non-monotonic negative timestamps.
|
||||
|
||||
@item skip_initial_bytes @var{integer} (@emph{input})
|
||||
Set number initial bytes to skip. Default is 0.
|
||||
|
||||
@item correct_ts_overflow @var{integer} (@emph{input})
|
||||
Correct single timestamp overflows if set to 1. Default is 1.
|
||||
|
||||
@item flush_packets @var{integer} (@emph{output})
|
||||
Flush the underlying I/O stream after each packet. Default 1 enables it, and
|
||||
has the effect of reducing the latency; 0 disables it and may slightly
|
||||
|
@ -33,7 +33,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.
|
||||
|
||||
|
2
ffmpeg.c
2
ffmpeg.c
@ -319,7 +319,7 @@ sigterm_handler(int sig)
|
||||
received_nb_signals++;
|
||||
term_exit();
|
||||
if(received_nb_signals > 3)
|
||||
exit_program(123);
|
||||
exit(123);
|
||||
}
|
||||
|
||||
void term_init(void)
|
||||
|
@ -42,12 +42,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++) {
|
||||
@ -92,6 +95,11 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec)
|
||||
|
||||
static char *choose_pix_fmts(OutputStream *ost)
|
||||
{
|
||||
AVDictionaryEntry *strict_dict = av_dict_get(ost->opts, "strict", NULL, 0);
|
||||
if (strict_dict)
|
||||
// used by choose_pixel_fmt() and below
|
||||
av_opt_set(ost->st->codec, "strict", strict_dict->value, 0);
|
||||
|
||||
if (ost->keep_pix_fmt) {
|
||||
if (ost->filter)
|
||||
avfilter_graph_set_auto_convert(ost->filter->graph->graph,
|
||||
|
@ -328,6 +328,14 @@ static AVLFG random_state;
|
||||
|
||||
static FILE *logfile = NULL;
|
||||
|
||||
static void htmlstrip(char *s) {
|
||||
while (s && *s) {
|
||||
s += strspn(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. ");
|
||||
if (*s)
|
||||
*s++ = '?';
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t ffm_read_write_index(int fd)
|
||||
{
|
||||
uint8_t buf[8];
|
||||
@ -1887,6 +1895,7 @@ static int http_parse_request(HTTPContext *c)
|
||||
send_error:
|
||||
c->http_error = 404;
|
||||
q = c->buffer;
|
||||
htmlstrip(msg);
|
||||
snprintf(q, c->buffer_size,
|
||||
"HTTP/1.0 404 Not Found\r\n"
|
||||
"Content-type: text/html\r\n"
|
||||
|
@ -81,7 +81,7 @@ enum BandType {
|
||||
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions.
|
||||
};
|
||||
|
||||
#define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
|
||||
#define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10)
|
||||
|
||||
enum ChannelPosition {
|
||||
AAC_CHANNEL_OFF = 0,
|
||||
|
@ -150,6 +150,7 @@ typedef struct AICContext {
|
||||
int16_t *data_ptr[NUM_BANDS];
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, block)[64];
|
||||
DECLARE_ALIGNED(16, uint8_t, quant_matrix)[64];
|
||||
} AICContext;
|
||||
|
||||
static int aic_decode_header(AICContext *ctx, const uint8_t *src, int size)
|
||||
@ -285,7 +286,7 @@ static void recombine_block_il(int16_t *dst, const uint8_t *scan,
|
||||
}
|
||||
}
|
||||
|
||||
static void unquant_block(int16_t *block, int q)
|
||||
static void unquant_block(int16_t *block, int q, uint8_t *quant_matrix)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -293,7 +294,7 @@ static void unquant_block(int16_t *block, int q)
|
||||
int val = (uint16_t)block[i];
|
||||
int sign = val & 1;
|
||||
|
||||
block[i] = (((val >> 1) ^ -sign) * q * aic_quant_matrix[i] >> 4)
|
||||
block[i] = (((val >> 1) ^ -sign) * q * quant_matrix[i] >> 4)
|
||||
+ sign;
|
||||
}
|
||||
}
|
||||
@ -334,7 +335,7 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
|
||||
else
|
||||
recombine_block_il(ctx->block, ctx->scantable.permutated,
|
||||
&base_y, &ext_y, blk);
|
||||
unquant_block(ctx->block, ctx->quant);
|
||||
unquant_block(ctx->block, ctx->quant, ctx->quant_matrix);
|
||||
ctx->dsp.idct(ctx->block);
|
||||
|
||||
if (!ctx->interlaced) {
|
||||
@ -352,7 +353,7 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
|
||||
for (blk = 0; blk < 2; blk++) {
|
||||
recombine_block(ctx->block, ctx->scantable.permutated,
|
||||
&base_c, &ext_c);
|
||||
unquant_block(ctx->block, ctx->quant);
|
||||
unquant_block(ctx->block, ctx->quant, ctx->quant_matrix);
|
||||
ctx->dsp.idct(ctx->block);
|
||||
ctx->dsp.put_signed_pixels_clamped(ctx->block, C[blk],
|
||||
ctx->frame->linesize[blk + 1]);
|
||||
@ -430,6 +431,8 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
|
||||
for (i = 0; i < 64; i++)
|
||||
scan[i] = i;
|
||||
ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, scan);
|
||||
for (i = 0; i < 64; i++)
|
||||
ctx->quant_matrix[ctx->dsp.idct_permutation[i]] = aic_quant_matrix[i];
|
||||
|
||||
ctx->mb_width = FFALIGN(avctx->width, 16) >> 4;
|
||||
ctx->mb_height = FFALIGN(avctx->height, 16) >> 4;
|
||||
|
@ -280,7 +280,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
GetBitContext gb;
|
||||
uint64_t ht_size;
|
||||
int i, config_offset;
|
||||
MPEG4AudioConfig m4ac;
|
||||
MPEG4AudioConfig m4ac = {0};
|
||||
ALSSpecificConfig *sconf = &ctx->sconf;
|
||||
AVCodecContext *avctx = ctx->avctx;
|
||||
uint32_t als_id, header_size, trailer_size;
|
||||
|
@ -417,7 +417,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
switch(buf[0]) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
if (s->nb_args < MAX_NB_ARGS)
|
||||
if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] < 6553)
|
||||
s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
|
||||
break;
|
||||
case ';':
|
||||
|
@ -41,10 +41,10 @@ function ff_scalarproduct_int16_neon, export=1
|
||||
|
||||
vpadd.s32 d16, d0, d1
|
||||
vpadd.s32 d17, d2, d3
|
||||
vpadd.s32 d10, d4, d5
|
||||
vpadd.s32 d11, d6, d7
|
||||
vpadd.s32 d18, d4, d5
|
||||
vpadd.s32 d19, d6, d7
|
||||
vpadd.s32 d0, d16, d17
|
||||
vpadd.s32 d1, d10, d11
|
||||
vpadd.s32 d1, d18, d19
|
||||
vpadd.s32 d2, d0, d1
|
||||
vpaddl.s32 d3, d2
|
||||
vmov.32 r0, d3[0]
|
||||
@ -81,10 +81,10 @@ function ff_scalarproduct_and_madd_int16_neon, export=1
|
||||
|
||||
vpadd.s32 d16, d0, d1
|
||||
vpadd.s32 d17, d2, d3
|
||||
vpadd.s32 d10, d4, d5
|
||||
vpadd.s32 d11, d6, d7
|
||||
vpadd.s32 d18, d4, d5
|
||||
vpadd.s32 d19, d6, d7
|
||||
vpadd.s32 d0, d16, d17
|
||||
vpadd.s32 d1, d10, d11
|
||||
vpadd.s32 d1, d18, d19
|
||||
vpadd.s32 d2, d0, d1
|
||||
vpaddl.s32 d3, d2
|
||||
vmov.32 r0, d3[0]
|
||||
|
@ -80,9 +80,16 @@ static int ass_encode_frame(AVCodecContext *avctx,
|
||||
* will be "Marked=N" instead of the layer num, so we will
|
||||
* have layer=0, which is fine. */
|
||||
layer = strtol(ass, &p, 10);
|
||||
if (*p) p += strcspn(p, ",") + 1; // skip layer or marked
|
||||
if (*p) p += strcspn(p, ",") + 1; // skip start timestamp
|
||||
if (*p) p += strcspn(p, ",") + 1; // skip end timestamp
|
||||
|
||||
#define SKIP_ENTRY(ptr) do { \
|
||||
char *sep = strchr(ptr, ','); \
|
||||
if (sep) \
|
||||
ptr = sep + 1; \
|
||||
} while (0)
|
||||
|
||||
SKIP_ENTRY(p); // skip layer or marked
|
||||
SKIP_ENTRY(p); // skip start timestamp
|
||||
SKIP_ENTRY(p); // skip end timestamp
|
||||
snprintf(ass_line, sizeof(ass_line), "%d,%ld,%s", ++s->id, layer, p);
|
||||
ass_line[strcspn(ass_line, "\r\n")] = 0;
|
||||
ass = ass_line;
|
||||
|
@ -356,7 +356,7 @@ int av_packet_merge_side_data(AVPacket *pkt){
|
||||
int av_packet_split_side_data(AVPacket *pkt){
|
||||
if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
|
||||
int i;
|
||||
unsigned int size, orig_pktsize = pkt->size;
|
||||
unsigned int size;
|
||||
uint8_t *p;
|
||||
|
||||
p = pkt->data + pkt->size - 8 - 5;
|
||||
@ -377,7 +377,7 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
for (i=0; ; i++){
|
||||
size= AV_RB32(p);
|
||||
av_assert0(size<=INT_MAX && p - pkt->data >= size);
|
||||
pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->side_data[i].size = size;
|
||||
pkt->side_data[i].type = p[4]&127;
|
||||
if (!pkt->side_data[i].data)
|
||||
@ -389,13 +389,6 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p-= size+5;
|
||||
}
|
||||
pkt->size -= 8;
|
||||
/* FFMIN() prevents overflow in case the packet wasn't allocated with
|
||||
* proper padding.
|
||||
* If the side data is smaller than the buffer padding size, the
|
||||
* remaining bytes should have already been filled with zeros by the
|
||||
* original packet allocation anyway. */
|
||||
memset(pkt->data + pkt->size, 0,
|
||||
FFMIN(orig_pktsize - pkt->size, FF_INPUT_BUFFER_PADDING_SIZE));
|
||||
pkt->side_data_elems = i+1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ typedef struct BinkContext {
|
||||
int version; ///< internal Bink file version
|
||||
int has_alpha;
|
||||
int swap_planes;
|
||||
unsigned frame_num;
|
||||
|
||||
Bundle bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types
|
||||
Tree col_high[16]; ///< trees for decoding high nibble in "colours" data type
|
||||
@ -1206,6 +1207,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
if (c->version >= 'i')
|
||||
skip_bits_long(&gb, 32);
|
||||
|
||||
c->frame_num++;
|
||||
|
||||
for (plane = 0; plane < 3; plane++) {
|
||||
plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
|
||||
|
||||
@ -1214,7 +1217,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
return ret;
|
||||
} else {
|
||||
if ((ret = binkb_decode_plane(c, frame, &gb, plane_idx,
|
||||
!avctx->frame_number, !!plane)) < 0)
|
||||
c->frame_num == 1, !!plane)) < 0)
|
||||
return ret;
|
||||
}
|
||||
if (get_bits_count(&gb) >= bits_count)
|
||||
@ -1332,6 +1335,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void flush(AVCodecContext *avctx)
|
||||
{
|
||||
BinkContext * const c = avctx->priv_data;
|
||||
|
||||
c->frame_num = 0;
|
||||
}
|
||||
|
||||
AVCodec ff_bink_decoder = {
|
||||
.name = "binkvideo",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
@ -1341,5 +1351,6 @@ AVCodec ff_bink_decoder = {
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
|
||||
.flush = flush,
|
||||
.capabilities = CODEC_CAP_DR1,
|
||||
};
|
||||
|
@ -306,7 +306,7 @@ STOP_TIMER("get_cabac_bypass")
|
||||
|
||||
for(i=0; i<SIZE; i++){
|
||||
START_TIMER
|
||||
if( (r[i]&1) != get_cabac(&c, state) )
|
||||
if( (r[i]&1) != get_cabac_noinline(&c, state) )
|
||||
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
|
||||
STOP_TIMER("get_cabac")
|
||||
}
|
||||
|
@ -214,6 +214,7 @@ typedef struct AVSContext {
|
||||
int luma_scan[4];
|
||||
int qp;
|
||||
int qp_fixed;
|
||||
int pic_qp_fixed;
|
||||
int cbp;
|
||||
ScanTable scantable;
|
||||
|
||||
|
@ -900,7 +900,7 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb)
|
||||
|
||||
/* mark top macroblocks as unavailable */
|
||||
h->flags &= ~(B_AVAIL | C_AVAIL);
|
||||
if ((h->mby == 0) && (!h->qp_fixed)) {
|
||||
if (!h->pic_qp_fixed) {
|
||||
h->qp_fixed = get_bits1(gb);
|
||||
h->qp = get_bits(gb, 6);
|
||||
}
|
||||
@ -1018,6 +1018,7 @@ static int decode_pic(AVSContext *h)
|
||||
skip_bits1(&h->gb); //advanced_pred_mode_disable
|
||||
skip_bits1(&h->gb); //top_field_first
|
||||
skip_bits1(&h->gb); //repeat_first_field
|
||||
h->pic_qp_fixed =
|
||||
h->qp_fixed = get_bits1(&h->gb);
|
||||
h->qp = get_bits(&h->gb, 6);
|
||||
if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) {
|
||||
|
@ -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;
|
||||
|
@ -201,6 +201,7 @@ typedef struct DiracContext {
|
||||
|
||||
uint16_t *mctmp; /* buffer holding the MC data multipled by OBMC weights */
|
||||
uint8_t *mcscratch;
|
||||
int buffer_stride;
|
||||
|
||||
DECLARE_ALIGNED(16, uint8_t, obmc_weight)[3][MAX_BLOCKSIZE*MAX_BLOCKSIZE];
|
||||
|
||||
@ -343,22 +344,44 @@ static int alloc_sequence_buffers(DiracContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
w = s->source.width;
|
||||
h = s->source.height;
|
||||
|
||||
/* fixme: allocate using real stride here */
|
||||
s->sbsplit = av_malloc(sbwidth * sbheight);
|
||||
s->blmotion = av_malloc(sbwidth * sbheight * 16 * sizeof(*s->blmotion));
|
||||
s->edge_emu_buffer_base = av_malloc((w+64)*MAX_BLOCKSIZE);
|
||||
s->sbsplit = av_malloc_array(sbwidth, sbheight);
|
||||
s->blmotion = av_malloc_array(sbwidth, sbheight * 16 * sizeof(*s->blmotion));
|
||||
|
||||
s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mcscratch = av_malloc((w+64)*MAX_BLOCKSIZE);
|
||||
|
||||
if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch)
|
||||
if (!s->sbsplit || !s->blmotion)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int alloc_buffers(DiracContext *s, int stride)
|
||||
{
|
||||
int w = s->source.width;
|
||||
int h = s->source.height;
|
||||
|
||||
av_assert0(stride >= w);
|
||||
stride += 64;
|
||||
|
||||
if (s->buffer_stride >= stride)
|
||||
return 0;
|
||||
s->buffer_stride = 0;
|
||||
|
||||
av_freep(&s->edge_emu_buffer_base);
|
||||
memset(s->edge_emu_buffer, 0, sizeof(s->edge_emu_buffer));
|
||||
av_freep(&s->mctmp);
|
||||
av_freep(&s->mcscratch);
|
||||
|
||||
s->edge_emu_buffer_base = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mcscratch = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
if (!s->edge_emu_buffer_base || !s->mctmp || !s->mcscratch)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
s->buffer_stride = stride;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_sequence_buffers(DiracContext *s)
|
||||
{
|
||||
int i, j, k;
|
||||
@ -382,6 +405,7 @@ static void free_sequence_buffers(DiracContext *s)
|
||||
av_freep(&s->plane[i].idwt_tmp);
|
||||
}
|
||||
|
||||
s->buffer_stride = 0;
|
||||
av_freep(&s->sbsplit);
|
||||
av_freep(&s->blmotion);
|
||||
av_freep(&s->edge_emu_buffer_base);
|
||||
@ -1343,8 +1367,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 */
|
||||
@ -1818,6 +1842,9 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
|
||||
s->plane[1].stride = pic->avframe.linesize[1];
|
||||
s->plane[2].stride = pic->avframe.linesize[2];
|
||||
|
||||
if (alloc_buffers(s, FFMAX3(FFABS(s->plane[0].stride), FFABS(s->plane[1].stride), FFABS(s->plane[2].stride))) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* [DIRAC_STD] 11.1 Picture parse. picture_parse() */
|
||||
if (dirac_decode_picture_header(s))
|
||||
return -1;
|
||||
|
@ -236,7 +236,7 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
|
||||
|
||||
static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
|
||||
{
|
||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
|
||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail);
|
||||
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
|
||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
|
||||
|
||||
|
@ -1931,7 +1931,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
|
||||
|
||||
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
||||
long i;
|
||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
||||
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||
long a = *(long*)(src+i);
|
||||
long b = *(long*)(dst+i);
|
||||
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
||||
@ -1956,7 +1956,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
|
||||
}
|
||||
}else
|
||||
#endif
|
||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
||||
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||
long a = *(long*)(src1+i);
|
||||
long b = *(long*)(src2+i);
|
||||
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
|
||||
|
@ -762,6 +762,17 @@ void ff_er_frame_start(ERContext *s)
|
||||
s->error_occurred = 0;
|
||||
}
|
||||
|
||||
static int er_supported(ERContext *s)
|
||||
{
|
||||
if(s->avctx->hwaccel ||
|
||||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
|
||||
!s->cur_pic ||
|
||||
s->cur_pic->field_picture
|
||||
)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a slice.
|
||||
* @param endx x component of the last macroblock, can be -1
|
||||
@ -828,7 +839,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
|
||||
s->error_status_table[start_xy] |= VP_START;
|
||||
|
||||
if (start_xy > 0 && !(s->avctx->active_thread_type & FF_THREAD_SLICE) &&
|
||||
s->avctx->skip_top * s->mb_width < start_i) {
|
||||
er_supported(s) && s->avctx->skip_top * s->mb_width < start_i) {
|
||||
int prev_status = s->error_status_table[s->mb_index2xy[start_i - 1]];
|
||||
|
||||
prev_status &= ~ VP_START;
|
||||
@ -853,9 +864,7 @@ void ff_er_frame_end(ERContext *s)
|
||||
* though it should not crash if enabled. */
|
||||
if (!s->avctx->err_recognition || s->error_count == 0 ||
|
||||
s->avctx->lowres ||
|
||||
s->avctx->hwaccel ||
|
||||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
|
||||
!s->cur_pic || s->cur_pic->field_picture ||
|
||||
!er_supported(s) ||
|
||||
s->error_count == 3 * s->mb_width *
|
||||
(s->avctx->skip_top + s->avctx->skip_bottom)) {
|
||||
return;
|
||||
|
@ -483,6 +483,10 @@ static int read_extra_header(FFV1Context *f)
|
||||
ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
|
||||
|
||||
f->version = get_symbol(c, state, 0);
|
||||
if (f->version < 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (f->version > 2) {
|
||||
c->bytestream_end -= 4;
|
||||
f->minor_version = get_symbol(c, state, 0);
|
||||
@ -562,6 +566,7 @@ static int read_header(FFV1Context *f)
|
||||
memset(state, 128, sizeof(state));
|
||||
|
||||
if (f->version < 2) {
|
||||
int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
|
||||
unsigned v= get_symbol(c, state, 0);
|
||||
if (v >= 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v);
|
||||
@ -574,15 +579,32 @@ static int read_header(FFV1Context *f)
|
||||
f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
|
||||
}
|
||||
|
||||
f->colorspace = get_symbol(c, state, 0); //YUV cs type
|
||||
colorspace = get_symbol(c, state, 0); //YUV cs type
|
||||
bits_per_raw_sample = f->version > 0 ? get_symbol(c, state, 0) : f->avctx->bits_per_raw_sample;
|
||||
chroma_planes = get_rac(c, state);
|
||||
chroma_h_shift = get_symbol(c, state, 0);
|
||||
chroma_v_shift = get_symbol(c, state, 0);
|
||||
transparency = get_rac(c, state);
|
||||
|
||||
if (f->version > 0)
|
||||
f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
|
||||
if (f->plane_count) {
|
||||
if ( colorspace != f->colorspace
|
||||
|| bits_per_raw_sample != f->avctx->bits_per_raw_sample
|
||||
|| chroma_planes != f->chroma_planes
|
||||
|| chroma_h_shift!= f->chroma_h_shift
|
||||
|| chroma_v_shift!= f->chroma_v_shift
|
||||
|| transparency != f->transparency) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
f->colorspace = colorspace;
|
||||
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
||||
f->chroma_planes = chroma_planes;
|
||||
f->chroma_h_shift = chroma_h_shift;
|
||||
f->chroma_v_shift = chroma_v_shift;
|
||||
f->transparency = transparency;
|
||||
|
||||
f->chroma_planes = get_rac(c, state);
|
||||
f->chroma_h_shift = get_symbol(c, state, 0);
|
||||
f->chroma_v_shift = get_symbol(c, state, 0);
|
||||
f->transparency = get_rac(c, state);
|
||||
f->plane_count = 2 + f->transparency;
|
||||
}
|
||||
|
||||
@ -600,47 +622,32 @@ static int read_header(FFV1Context *f)
|
||||
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P; break;
|
||||
case 0x20: f->avctx->pix_fmt = AV_PIX_FMT_YUV411P; break;
|
||||
case 0x22: f->avctx->pix_fmt = AV_PIX_FMT_YUV410P; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
} else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency) {
|
||||
switch(16*f->chroma_h_shift + f->chroma_v_shift) {
|
||||
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; break;
|
||||
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P; break;
|
||||
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
} else if (f->avctx->bits_per_raw_sample == 9) {
|
||||
} else if (f->avctx->bits_per_raw_sample == 9 && !f->transparency) {
|
||||
f->packed_at_lsb = 1;
|
||||
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
|
||||
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P9; break;
|
||||
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P9; break;
|
||||
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P9; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
} else if (f->avctx->bits_per_raw_sample == 10) {
|
||||
} else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency) {
|
||||
f->packed_at_lsb = 1;
|
||||
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
|
||||
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P10; break;
|
||||
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P10; break;
|
||||
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P10; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
} else {
|
||||
} else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency){
|
||||
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
|
||||
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; break;
|
||||
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; break;
|
||||
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; break;
|
||||
default:
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
}
|
||||
} else if (f->colorspace == 1) {
|
||||
@ -664,6 +671,10 @@ static int read_header(FFV1Context *f)
|
||||
av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
if (f->avctx->pix_fmt == AV_PIX_FMT_NONE) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
av_dlog(f->avctx, "%d %d %d\n",
|
||||
f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt);
|
||||
@ -899,16 +910,56 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
static int init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
FFV1Context *f = avctx->priv_data;
|
||||
int i, ret;
|
||||
|
||||
f->picture.f = NULL;
|
||||
f->last_picture.f = NULL;
|
||||
f->sample_buffer = NULL;
|
||||
f->quant_table_count = 0;
|
||||
f->slice_count = 0;
|
||||
|
||||
for (i = 0; i < f->quant_table_count; i++) {
|
||||
av_assert0(f->version > 1);
|
||||
f->initial_states[i] = av_memdup(f->initial_states[i],
|
||||
f->context_count[i] * sizeof(*f->initial_states[i]));
|
||||
}
|
||||
|
||||
f->picture.f = av_frame_alloc();
|
||||
f->last_picture.f = av_frame_alloc();
|
||||
|
||||
if ((ret = ffv1_init_slice_contexts(f)) < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
|
||||
{
|
||||
fsdst->version = fsrc->version;
|
||||
fsdst->minor_version = fsrc->minor_version;
|
||||
fsdst->chroma_planes = fsrc->chroma_planes;
|
||||
fsdst->chroma_h_shift = fsrc->chroma_h_shift;
|
||||
fsdst->chroma_v_shift = fsrc->chroma_v_shift;
|
||||
fsdst->transparency = fsrc->transparency;
|
||||
fsdst->plane_count = fsrc->plane_count;
|
||||
fsdst->ac = fsrc->ac;
|
||||
fsdst->colorspace = fsrc->colorspace;
|
||||
|
||||
fsdst->ec = fsrc->ec;
|
||||
fsdst->intra = fsrc->intra;
|
||||
fsdst->slice_damaged = fssrc->slice_damaged;
|
||||
fsdst->key_frame_ok = fsrc->key_frame_ok;
|
||||
|
||||
fsdst->bits_per_raw_sample = fsrc->bits_per_raw_sample;
|
||||
fsdst->packed_at_lsb = fsrc->packed_at_lsb;
|
||||
fsdst->slice_count = fsrc->slice_count;
|
||||
if (fsrc->version<3){
|
||||
fsdst->slice_x = fssrc->slice_x;
|
||||
fsdst->slice_y = fssrc->slice_y;
|
||||
fsdst->slice_width = fssrc->slice_width;
|
||||
fsdst->slice_height = fssrc->slice_height;
|
||||
}
|
||||
}
|
||||
|
||||
static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||
{
|
||||
FFV1Context *fsrc = src->priv_data;
|
||||
@ -918,36 +969,30 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||
if (dst == src)
|
||||
return 0;
|
||||
|
||||
if (!fdst->picture.f) {
|
||||
{
|
||||
FFV1Context bak = *fdst;
|
||||
memcpy(fdst, fsrc, sizeof(*fdst));
|
||||
|
||||
for (i = 0; i < fdst->quant_table_count; i++) {
|
||||
fdst->initial_states[i] = av_malloc(fdst->context_count[i] * sizeof(*fdst->initial_states[i]));
|
||||
memcpy(fdst->initial_states[i], fsrc->initial_states[i], fdst->context_count[i] * sizeof(*fdst->initial_states[i]));
|
||||
memcpy(fdst->initial_states, bak.initial_states, sizeof(fdst->initial_states));
|
||||
memcpy(fdst->slice_context, bak.slice_context , sizeof(fdst->slice_context));
|
||||
fdst->picture = bak.picture;
|
||||
fdst->last_picture = bak.last_picture;
|
||||
for (i = 0; i<fdst->num_h_slices * fdst->num_v_slices; i++) {
|
||||
FFV1Context *fssrc = fsrc->slice_context[i];
|
||||
FFV1Context *fsdst = fdst->slice_context[i];
|
||||
copy_fields(fsdst, fssrc, fsrc);
|
||||
}
|
||||
|
||||
fdst->picture.f = av_frame_alloc();
|
||||
fdst->last_picture.f = av_frame_alloc();
|
||||
|
||||
if ((ret = ffv1_init_slice_contexts(fdst)) < 0)
|
||||
return ret;
|
||||
av_assert0(!fdst->plane[0].state);
|
||||
av_assert0(!fdst->sample_buffer);
|
||||
}
|
||||
|
||||
av_assert1(fdst->slice_count == fsrc->slice_count);
|
||||
|
||||
fdst->key_frame_ok = fsrc->key_frame_ok;
|
||||
|
||||
ff_thread_release_buffer(dst, &fdst->picture);
|
||||
if (fsrc->picture.f->data[0]) {
|
||||
if ((ret = ff_thread_ref_frame(&fdst->picture, &fsrc->picture)) < 0)
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; i < fdst->slice_count; i++) {
|
||||
FFV1Context *fsdst = fdst->slice_context[i];
|
||||
FFV1Context *fssrc = fsrc->slice_context[i];
|
||||
|
||||
fsdst->slice_damaged = fssrc->slice_damaged;
|
||||
}
|
||||
|
||||
fdst->fsrc = fsrc;
|
||||
|
||||
|
@ -275,7 +275,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w,
|
||||
int run_mode = 0;
|
||||
|
||||
if (s->ac) {
|
||||
if (c->bytestream_end - c->bytestream < w * 20) {
|
||||
if (c->bytestream_end - c->bytestream < w * 35) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@ -387,6 +387,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
s->diff_start = get_bits(&gb, 8);
|
||||
s->diff_height = get_bits(&gb, 8);
|
||||
if (s->diff_start + s->diff_height > cur_blk_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
"%dx%d diff start %d height %d\n",
|
||||
i, j, s->diff_start, s->diff_height);
|
||||
|
@ -389,7 +389,7 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
|
||||
return 0;
|
||||
zsize = (src[0] << 8) | src[1]; src += 2;
|
||||
|
||||
if (src_end - src < zsize)
|
||||
if (src_end - src < zsize + (sub_type != 2))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = uncompress(c->kempf_buf, &dlen, src, zsize);
|
||||
@ -411,6 +411,8 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
|
||||
for (i = 0; i < (FFALIGN(height, 16) >> 4); i++) {
|
||||
for (j = 0; j < (FFALIGN(width, 16) >> 4); j++) {
|
||||
if (!bits) {
|
||||
if (src >= src_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bitbuf = *src++;
|
||||
bits = 8;
|
||||
}
|
||||
@ -441,8 +443,8 @@ static int g2m_init_buffers(G2MContext *c)
|
||||
int aligned_height;
|
||||
|
||||
if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {
|
||||
c->framebuf_stride = FFALIGN(c->width * 3, 16);
|
||||
aligned_height = FFALIGN(c->height, 16);
|
||||
c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
|
||||
aligned_height = c->height + 15;
|
||||
av_free(c->framebuf);
|
||||
c->framebuf = av_mallocz(c->framebuf_stride * aligned_height);
|
||||
if (!c->framebuf)
|
||||
@ -451,7 +453,7 @@ static int g2m_init_buffers(G2MContext *c)
|
||||
if (!c->synth_tile || !c->jpeg_tile ||
|
||||
c->old_tile_w < c->tile_width ||
|
||||
c->old_tile_h < c->tile_height) {
|
||||
c->tile_stride = FFALIGN(c->tile_width * 3, 16);
|
||||
c->tile_stride = FFALIGN(c->tile_width, 16) * 3;
|
||||
aligned_height = FFALIGN(c->tile_height, 16);
|
||||
av_free(c->synth_tile);
|
||||
av_free(c->jpeg_tile);
|
||||
|
@ -2286,7 +2286,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]);
|
||||
|
@ -58,7 +58,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define EXTEND(i) (i << 3 | i & 7)
|
||||
#define EXTEND(i) ((i) << 3 | (i) & 7)
|
||||
init_put_bits(&pb, temp, SIZE);
|
||||
for (i = 0; i < COUNT; i++)
|
||||
set_ue_golomb(&pb, EXTEND(i));
|
||||
|
@ -718,10 +718,10 @@ frame_end:
|
||||
}
|
||||
|
||||
if(startcode_found){
|
||||
av_fast_malloc(
|
||||
av_fast_padded_mallocz(
|
||||
&s->bitstream_buffer,
|
||||
&s->allocated_bitstream_buffer_size,
|
||||
buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
buf_size - current_pos);
|
||||
if (!s->bitstream_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
|
||||
|
@ -1682,6 +1682,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;
|
||||
@ -1847,6 +1848,10 @@ static int h264_frame_start(H264Context *h)
|
||||
|
||||
h->cur_pic_ptr = pic;
|
||||
unref_picture(h, &h->cur_pic);
|
||||
if (CONFIG_ERROR_RESILIENCE) {
|
||||
h->er.cur_pic = NULL;
|
||||
}
|
||||
|
||||
if ((ret = ref_picture(h, &h->cur_pic, h->cur_pic_ptr)) < 0)
|
||||
return ret;
|
||||
|
||||
@ -2660,6 +2665,7 @@ static void flush_change(H264Context *h)
|
||||
h->sync= 0;
|
||||
h->list_count = 0;
|
||||
h->current_slice = 0;
|
||||
h->mmco_reset = 1;
|
||||
}
|
||||
|
||||
/* forget old pics after a seek */
|
||||
@ -3434,7 +3440,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
} else {
|
||||
/* Shorten frame num gaps so we don't have to allocate reference
|
||||
* frames just to throw them away */
|
||||
if (h->frame_num != h->prev_frame_num && h->prev_frame_num >= 0) {
|
||||
if (h->frame_num != h->prev_frame_num) {
|
||||
int unwrap_prev_frame_num = h->prev_frame_num;
|
||||
int max_frame_num = 1 << h->sps.log2_max_frame_num;
|
||||
|
||||
@ -3461,7 +3467,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
assert(h0->cur_pic_ptr->reference != DELAYED_PIC_REF);
|
||||
|
||||
/* Mark old field/frame as completed */
|
||||
if (!last_pic_droppable && h0->cur_pic_ptr->tf.owner == h0->avctx) {
|
||||
if (h0->cur_pic_ptr->tf.owner == h0->avctx) {
|
||||
ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX,
|
||||
last_pic_structure == PICT_BOTTOM_FIELD);
|
||||
}
|
||||
@ -3470,7 +3476,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) {
|
||||
/* Previous field is unmatched. Don't display it, but let it
|
||||
* remain for reference if marked as such. */
|
||||
if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
|
||||
if (last_pic_structure != PICT_FRAME) {
|
||||
ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX,
|
||||
last_pic_structure == PICT_TOP_FIELD);
|
||||
}
|
||||
@ -3480,7 +3486,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
* different frame_nums. Consider this field first in
|
||||
* pair. Throw away previous field except for reference
|
||||
* purposes. */
|
||||
if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
|
||||
if (last_pic_structure != PICT_FRAME) {
|
||||
ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX,
|
||||
last_pic_structure == PICT_TOP_FIELD);
|
||||
}
|
||||
@ -3507,7 +3513,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
}
|
||||
}
|
||||
|
||||
while (h->frame_num != h->prev_frame_num && h->prev_frame_num >= 0 && !h0->first_field &&
|
||||
while (h->frame_num != h->prev_frame_num && !h0->first_field &&
|
||||
h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) {
|
||||
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
|
||||
av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
|
||||
@ -3876,6 +3882,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|
||||
if (h->ref_count[0]) h->er.last_pic = &h->ref_list[0][0];
|
||||
if (h->ref_count[1]) h->er.next_pic = &h->ref_list[1][0];
|
||||
h->er.ref_count = h->ref_count[0];
|
||||
|
||||
if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG,
|
||||
@ -4267,7 +4274,6 @@ static void er_add_slice(H264Context *h, int startx, int starty,
|
||||
if (CONFIG_ERROR_RESILIENCE) {
|
||||
ERContext *er = &h->er;
|
||||
|
||||
er->ref_count = h->ref_count[0];
|
||||
ff_er_add_slice(er, startx, starty, endx, endy, status);
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +61,10 @@
|
||||
#define MAX_SLICES 16
|
||||
|
||||
#ifdef ALLOW_INTERLACE
|
||||
#define MB_MBAFF(h) h->mb_mbaff
|
||||
#define MB_FIELD(h) h->mb_field_decoding_flag
|
||||
#define FRAME_MBAFF(h) h->mb_aff_frame
|
||||
#define FIELD_PICTURE(h) (h->picture_structure != PICT_FRAME)
|
||||
#define MB_MBAFF(h) (h)->mb_mbaff
|
||||
#define MB_FIELD(h) (h)->mb_field_decoding_flag
|
||||
#define FRAME_MBAFF(h) (h)->mb_aff_frame
|
||||
#define FIELD_PICTURE(h) ((h)->picture_structure != PICT_FRAME)
|
||||
#define LEFT_MBS 2
|
||||
#define LTOP 0
|
||||
#define LBOT 1
|
||||
@ -84,12 +84,12 @@
|
||||
#define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
|
||||
|
||||
#ifndef CABAC
|
||||
#define CABAC(h) h->pps.cabac
|
||||
#define CABAC(h) (h)->pps.cabac
|
||||
#endif
|
||||
|
||||
#define CHROMA(h) (h->sps.chroma_format_idc)
|
||||
#define CHROMA422(h) (h->sps.chroma_format_idc == 2)
|
||||
#define CHROMA444(h) (h->sps.chroma_format_idc == 3)
|
||||
#define CHROMA(h) ((h)->sps.chroma_format_idc)
|
||||
#define CHROMA422(h) ((h)->sps.chroma_format_idc == 2)
|
||||
#define CHROMA444(h) ((h)->sps.chroma_format_idc == 3)
|
||||
|
||||
#define EXTENDED_SAR 255
|
||||
|
||||
|
@ -172,7 +172,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)
|
||||
|
@ -583,7 +583,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
|
||||
if (mmco[i].opcode != MMCO_SHORT2LONG ||
|
||||
!h->long_ref[mmco[i].long_arg] ||
|
||||
h->long_ref[mmco[i].long_arg]->frame_num != frame_num) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
|
||||
av_log(h->avctx, h->short_ref_count ? AV_LOG_ERROR : AV_LOG_DEBUG, "mmco: unref short failure\n");
|
||||
err = AVERROR_INVALIDDATA;
|
||||
}
|
||||
continue;
|
||||
@ -733,7 +733,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
|
||||
print_short_term(h);
|
||||
print_long_term(h);
|
||||
|
||||
if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){
|
||||
if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=2 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){
|
||||
h->cur_pic_ptr->sync |= 1;
|
||||
if(!h->avctx->has_b_frames)
|
||||
h->sync = 2;
|
||||
|
@ -71,6 +71,9 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int
|
||||
}
|
||||
|
||||
static int get_color_type(const AVPixFmtDescriptor *desc) {
|
||||
if (desc->flags & AV_PIX_FMT_FLAG_PAL)
|
||||
return FF_COLOR_RGB;
|
||||
|
||||
if(desc->nb_components == 1 || desc->nb_components == 2)
|
||||
return FF_COLOR_GRAY;
|
||||
|
||||
|
@ -235,15 +235,15 @@ void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
|
||||
/** butterfly operation for the inverse Haar transform */
|
||||
#define IVI_HAAR_BFLY(s1, s2, o1, o2, t) \
|
||||
t = (s1 - s2) >> 1;\
|
||||
o1 = (s1 + s2) >> 1;\
|
||||
o2 = t;\
|
||||
t = ((s1) - (s2)) >> 1;\
|
||||
o1 = ((s1) + (s2)) >> 1;\
|
||||
o2 = (t);\
|
||||
|
||||
/** inverse 8-point Haar transform */
|
||||
#define INV_HAAR8(s1, s5, s3, s7, s2, s4, s6, s8,\
|
||||
d1, d2, d3, d4, d5, d6, d7, d8,\
|
||||
t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
|
||||
t1 = s1 << 1; t5 = s5 << 1;\
|
||||
t1 = (s1) << 1; t5 = (s5) << 1;\
|
||||
IVI_HAAR_BFLY(t1, t5, t1, t5, t0); IVI_HAAR_BFLY(t1, s3, t1, t3, t0);\
|
||||
IVI_HAAR_BFLY(t5, s7, t5, t7, t0); IVI_HAAR_BFLY(t1, s2, t1, t2, t0);\
|
||||
IVI_HAAR_BFLY(t3, s4, t3, t4, t0); IVI_HAAR_BFLY(t5, s6, t5, t6, t0);\
|
||||
@ -485,21 +485,21 @@ void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
|
||||
|
||||
/** butterfly operation for the inverse slant transform */
|
||||
#define IVI_SLANT_BFLY(s1, s2, o1, o2, t) \
|
||||
t = s1 - s2;\
|
||||
o1 = s1 + s2;\
|
||||
o2 = t;\
|
||||
t = (s1) - (s2);\
|
||||
o1 = (s1) + (s2);\
|
||||
o2 = (t);\
|
||||
|
||||
/** This is a reflection a,b = 1/2, 5/4 for the inverse slant transform */
|
||||
#define IVI_IREFLECT(s1, s2, o1, o2, t) \
|
||||
t = ((s1 + s2*2 + 2) >> 2) + s1;\
|
||||
o2 = ((s1*2 - s2 + 2) >> 2) - s2;\
|
||||
o1 = t;\
|
||||
t = (((s1) + (s2)*2 + 2) >> 2) + (s1);\
|
||||
o2 = (((s1)*2 - (s2) + 2) >> 2) - (s2);\
|
||||
o1 = (t);\
|
||||
|
||||
/** This is a reflection a,b = 1/2, 7/8 for the inverse slant transform */
|
||||
#define IVI_SLANT_PART4(s1, s2, o1, o2, t) \
|
||||
t = s2 + ((s1*4 - s2 + 4) >> 3);\
|
||||
o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\
|
||||
o1 = t;\
|
||||
t = (s2) + (((s1)*4 - (s2) + 4) >> 3);\
|
||||
o2 = (s1) + ((-(s1) - (s2)*4 + 4) >> 3);\
|
||||
o1 = (t);\
|
||||
|
||||
/** inverse slant8 transform */
|
||||
#define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7,\
|
||||
@ -557,7 +557,7 @@ void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, c
|
||||
}
|
||||
#undef COMPENSATE
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
src = tmp;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (!src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) {
|
||||
@ -597,7 +597,7 @@ void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, c
|
||||
}
|
||||
#undef COMPENSATE
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
src = tmp;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (!src[0] && !src[1] && !src[2] && !src[3]) {
|
||||
@ -631,7 +631,7 @@ void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const ui
|
||||
int i;
|
||||
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (!in[0] && !in[1] && !in[2] && !in[3] && !in[4] && !in[5] && !in[6] && !in[7]) {
|
||||
memset(out, 0, 8*sizeof(out[0]));
|
||||
@ -673,7 +673,7 @@ void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const ui
|
||||
row4 = pitch << 2;
|
||||
row8 = pitch << 3;
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (flags[i]) {
|
||||
IVI_INV_SLANT8(in[0], in[8], in[16], in[24], in[32], in[40], in[48], in[56],
|
||||
@ -710,7 +710,7 @@ void ff_ivi_row_slant4(const int32_t *in, int16_t *out, uint32_t pitch, const ui
|
||||
int i;
|
||||
int t0, t1, t2, t3, t4;
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (!in[0] && !in[1] && !in[2] && !in[3]) {
|
||||
memset(out, 0, 4*sizeof(out[0]));
|
||||
@ -732,7 +732,7 @@ void ff_ivi_col_slant4(const int32_t *in, int16_t *out, uint32_t pitch, const ui
|
||||
|
||||
row2 = pitch << 1;
|
||||
|
||||
#define COMPENSATE(x) ((x + 1)>>1)
|
||||
#define COMPENSATE(x) (((x) + 1)>>1)
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (flags[i]) {
|
||||
IVI_INV_SLANT4(in[0], in[4], in[8], in[12],
|
||||
|
@ -802,7 +802,7 @@ static void truncpasses(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
|
||||
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
|
||||
|
||||
cblk->ninclpasses = getcut(cblk, s->lambda,
|
||||
(int64_t)dwt_norms[codsty->transform == FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 16);
|
||||
(int64_t)dwt_norms[codsty->transform == FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -863,7 +863,7 @@ static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno
|
||||
int *ptr = t1.data[y-yy0];
|
||||
for (x = xx0; x < xx1; x++){
|
||||
*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);
|
||||
*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;
|
||||
*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 15 - NMSEDEC_FRACBITS;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
@ -1016,7 +1016,7 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
ff_jpeg2000_init_tier1_luts();
|
||||
|
||||
ff_mqc_init_context_tables();
|
||||
init_luts();
|
||||
|
||||
init_quantization(s);
|
||||
|
@ -272,7 +272,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
reslevel->log2_prec_height) -
|
||||
(reslevel->coord[1][0] >> reslevel->log2_prec_height);
|
||||
|
||||
reslevel->band = av_malloc_array(reslevel->nbands, sizeof(*reslevel->band));
|
||||
reslevel->band = av_calloc(reslevel->nbands, sizeof(*reslevel->band));
|
||||
if (!reslevel->band)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@ -320,7 +320,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
if (!av_codec_is_encoder(avctx->codec))
|
||||
band->f_stepsize *= 0.5;
|
||||
|
||||
band->i_stepsize = band->f_stepsize * (1 << 16);
|
||||
band->i_stepsize = band->f_stepsize * (1 << 15);
|
||||
|
||||
/* computation of tbx_0, tbx_1, tby_0, tby_1
|
||||
* see ISO/IEC 15444-1:2002 B.5 eq. B-15 and tbl B.1
|
||||
@ -368,7 +368,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
for (j = 0; j < 2; j++)
|
||||
band->coord[1][j] = ff_jpeg2000_ceildiv(band->coord[1][j], dy);
|
||||
|
||||
band->prec = av_malloc_array(reslevel->num_precincts_x *
|
||||
band->prec = av_calloc(reslevel->num_precincts_x *
|
||||
(uint64_t)reslevel->num_precincts_y,
|
||||
sizeof(*band->prec));
|
||||
if (!band->prec)
|
||||
@ -509,10 +509,12 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
|
||||
for (bandno = 0; bandno < reslevel->nbands; bandno++) {
|
||||
Jpeg2000Band *band = reslevel->band + bandno;
|
||||
for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) {
|
||||
Jpeg2000Prec *prec = band->prec + precno;
|
||||
av_freep(&prec->zerobits);
|
||||
av_freep(&prec->cblkincl);
|
||||
av_freep(&prec->cblk);
|
||||
if (band->prec) {
|
||||
Jpeg2000Prec *prec = band->prec + precno;
|
||||
av_freep(&prec->zerobits);
|
||||
av_freep(&prec->cblkincl);
|
||||
av_freep(&prec->cblk);
|
||||
}
|
||||
}
|
||||
|
||||
av_freep(&band->prec);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "internal.h"
|
||||
@ -37,6 +38,7 @@
|
||||
#define JP2_SIG_TYPE 0x6A502020
|
||||
#define JP2_SIG_VALUE 0x0D0A870A
|
||||
#define JP2_CODESTREAM 0x6A703263
|
||||
#define JP2_HEADER 0x6A703268
|
||||
|
||||
#define HAD_COC 0x01
|
||||
#define HAD_QCC 0x02
|
||||
@ -72,6 +74,10 @@ typedef struct Jpeg2000DecoderContext {
|
||||
int cdx[4], cdy[4];
|
||||
int precision;
|
||||
int ncomponents;
|
||||
int colour_space;
|
||||
uint32_t palette[256];
|
||||
int8_t pal8;
|
||||
int cdef[4];
|
||||
int tile_width, tile_height;
|
||||
unsigned numXtiles, numYtiles;
|
||||
int maxtilelen;
|
||||
@ -154,12 +160,74 @@ static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
|
||||
return curval;
|
||||
}
|
||||
|
||||
static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components,
|
||||
int bpc, uint32_t log2_chroma_wh, int pal8)
|
||||
{
|
||||
int match = 1;
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
||||
|
||||
if (desc->nb_components != components) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (components) {
|
||||
case 4:
|
||||
match = match && desc->comp[3].depth_minus1 + 1 >= bpc &&
|
||||
(log2_chroma_wh >> 14 & 3) == 0 &&
|
||||
(log2_chroma_wh >> 12 & 3) == 0;
|
||||
case 3:
|
||||
match = match && desc->comp[2].depth_minus1 + 1 >= bpc &&
|
||||
(log2_chroma_wh >> 10 & 3) == desc->log2_chroma_w &&
|
||||
(log2_chroma_wh >> 8 & 3) == desc->log2_chroma_h;
|
||||
case 2:
|
||||
match = match && desc->comp[1].depth_minus1 + 1 >= bpc &&
|
||||
(log2_chroma_wh >> 6 & 3) == desc->log2_chroma_w &&
|
||||
(log2_chroma_wh >> 4 & 3) == desc->log2_chroma_h;
|
||||
|
||||
case 1:
|
||||
match = match && desc->comp[0].depth_minus1 + 1 >= bpc &&
|
||||
(log2_chroma_wh >> 2 & 3) == 0 &&
|
||||
(log2_chroma_wh & 3) == 0 &&
|
||||
(desc->flags & AV_PIX_FMT_FLAG_PAL) == pal8 * AV_PIX_FMT_FLAG_PAL;
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
// pix_fmts with lower bpp have to be listed before
|
||||
// similar pix_fmts with higher bpp.
|
||||
#define RGB_PIXEL_FORMATS AV_PIX_FMT_PAL8,AV_PIX_FMT_RGB24,AV_PIX_FMT_RGBA,AV_PIX_FMT_RGB48,AV_PIX_FMT_RGBA64
|
||||
#define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16
|
||||
#define YUV_PIXEL_FORMATS AV_PIX_FMT_YUV410P,AV_PIX_FMT_YUV411P,AV_PIX_FMT_YUVA420P, \
|
||||
AV_PIX_FMT_YUV420P,AV_PIX_FMT_YUV422P,AV_PIX_FMT_YUVA422P, \
|
||||
AV_PIX_FMT_YUV440P,AV_PIX_FMT_YUV444P,AV_PIX_FMT_YUVA444P, \
|
||||
AV_PIX_FMT_YUV420P9,AV_PIX_FMT_YUV422P9,AV_PIX_FMT_YUV444P9, \
|
||||
AV_PIX_FMT_YUVA420P9,AV_PIX_FMT_YUVA422P9,AV_PIX_FMT_YUVA444P9, \
|
||||
AV_PIX_FMT_YUV420P10,AV_PIX_FMT_YUV422P10,AV_PIX_FMT_YUV444P10, \
|
||||
AV_PIX_FMT_YUVA420P10,AV_PIX_FMT_YUVA422P10,AV_PIX_FMT_YUVA444P10, \
|
||||
AV_PIX_FMT_YUV420P12,AV_PIX_FMT_YUV422P12,AV_PIX_FMT_YUV444P12, \
|
||||
AV_PIX_FMT_YUV420P14,AV_PIX_FMT_YUV422P14,AV_PIX_FMT_YUV444P14, \
|
||||
AV_PIX_FMT_YUV420P16,AV_PIX_FMT_YUV422P16,AV_PIX_FMT_YUV444P16, \
|
||||
AV_PIX_FMT_YUVA420P16,AV_PIX_FMT_YUVA422P16,AV_PIX_FMT_YUVA444P16
|
||||
#define XYZ_PIXEL_FORMATS AV_PIX_FMT_XYZ12
|
||||
|
||||
static const enum AVPixelFormat rgb_pix_fmts[] = {RGB_PIXEL_FORMATS};
|
||||
static const enum AVPixelFormat gray_pix_fmts[] = {GRAY_PIXEL_FORMATS};
|
||||
static const enum AVPixelFormat yuv_pix_fmts[] = {YUV_PIXEL_FORMATS};
|
||||
static const enum AVPixelFormat xyz_pix_fmts[] = {XYZ_PIXEL_FORMATS};
|
||||
static const enum AVPixelFormat all_pix_fmts[] = {RGB_PIXEL_FORMATS,
|
||||
GRAY_PIXEL_FORMATS,
|
||||
YUV_PIXEL_FORMATS,
|
||||
XYZ_PIXEL_FORMATS};
|
||||
|
||||
/* marker segments */
|
||||
/* get sizes and offsets of image, tiles; number of components */
|
||||
static int get_siz(Jpeg2000DecoderContext *s)
|
||||
{
|
||||
int i;
|
||||
int ncomponents;
|
||||
uint32_t log2_chroma_wh = 0;
|
||||
const enum AVPixelFormat *possible_fmts = NULL;
|
||||
int possible_fmts_nb = 0;
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->g) < 36)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@ -175,6 +243,11 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
s->tile_offset_y = bytestream2_get_be32u(&s->g); // YT0Siz
|
||||
ncomponents = bytestream2_get_be16u(&s->g); // CSiz
|
||||
|
||||
if (s->image_offset_x || s->image_offset_y) {
|
||||
avpriv_request_sample(s->avctx, "Support for image offsets");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (ncomponents <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid number of components: %d\n",
|
||||
s->ncomponents);
|
||||
@ -205,13 +278,12 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
s->sgnd[i] = !!(x & 0x80);
|
||||
s->cdx[i] = bytestream2_get_byteu(&s->g);
|
||||
s->cdy[i] = bytestream2_get_byteu(&s->g);
|
||||
if (s->cdx[i] != 1 || s->cdy[i] != 1) {
|
||||
avpriv_request_sample(s->avctx,
|
||||
"CDxy values %d %d for component %d",
|
||||
s->cdx[i], s->cdy[i], i);
|
||||
if (!s->cdx[i] || !s->cdy[i])
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ( !s->cdx[i] || s->cdx[i] == 3 || s->cdx[i] > 4
|
||||
|| !s->cdy[i] || s->cdy[i] == 3 || s->cdy[i] > 4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid sample seperation\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2;
|
||||
}
|
||||
|
||||
s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width);
|
||||
@ -242,35 +314,47 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
|
||||
s->reduction_factor);
|
||||
|
||||
switch (s->ncomponents) {
|
||||
case 1:
|
||||
if (s->precision > 8)
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
|
||||
else
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
|
||||
break;
|
||||
case 3:
|
||||
switch (s->avctx->profile) {
|
||||
case FF_PROFILE_JPEG2000_DCINEMA_2K:
|
||||
case FF_PROFILE_JPEG2000_DCINEMA_4K:
|
||||
/* XYZ color-space for digital cinema profiles */
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_XYZ12;
|
||||
if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K ||
|
||||
s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) {
|
||||
possible_fmts = xyz_pix_fmts;
|
||||
possible_fmts_nb = FF_ARRAY_ELEMS(xyz_pix_fmts);
|
||||
} else {
|
||||
switch (s->colour_space) {
|
||||
case 16:
|
||||
possible_fmts = rgb_pix_fmts;
|
||||
possible_fmts_nb = FF_ARRAY_ELEMS(rgb_pix_fmts);
|
||||
break;
|
||||
case 17:
|
||||
possible_fmts = gray_pix_fmts;
|
||||
possible_fmts_nb = FF_ARRAY_ELEMS(gray_pix_fmts);
|
||||
break;
|
||||
case 18:
|
||||
possible_fmts = yuv_pix_fmts;
|
||||
possible_fmts_nb = FF_ARRAY_ELEMS(yuv_pix_fmts);
|
||||
break;
|
||||
default:
|
||||
if (s->precision > 8)
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_RGB48;
|
||||
else
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
||||
possible_fmts = all_pix_fmts;
|
||||
possible_fmts_nb = FF_ARRAY_ELEMS(all_pix_fmts);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
|
||||
break;
|
||||
default:
|
||||
/* pixel format can not be identified */
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_NONE;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < possible_fmts_nb; ++i) {
|
||||
if (pix_fmt_match(possible_fmts[i], ncomponents, s->precision, log2_chroma_wh, s->pal8)) {
|
||||
s->avctx->pix_fmt = possible_fmts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == possible_fmts_nb) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Unknown pix_fmt, profile: %d, colour_space: %d, "
|
||||
"components: %d, precision: %d, "
|
||||
"cdx[1]: %d, cdy[1]: %d, cdx[2]: %d, cdy[2]: %d\n",
|
||||
s->avctx->profile, s->colour_space, ncomponents, s->precision,
|
||||
ncomponents > 2 ? s->cdx[1] : 0,
|
||||
ncomponents > 2 ? s->cdy[1] : 0,
|
||||
ncomponents > 2 ? s->cdx[2] : 0,
|
||||
ncomponents > 2 ? s->cdy[2] : 0);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -291,11 +375,18 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (c->nreslevels <= s->reduction_factor) {
|
||||
/* we are forced to update reduction_factor as its requested value is
|
||||
not compatible with this bitstream, and as we might have used it
|
||||
already in setup earlier we have to fail this frame until
|
||||
reinitialization is implemented */
|
||||
av_log(s->avctx, AV_LOG_ERROR, "reduction_factor too large for this bitstream, max is %d\n", c->nreslevels - 1);
|
||||
s->reduction_factor = c->nreslevels - 1;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
/* compute number of resolution levels to decode */
|
||||
if (c->nreslevels < s->reduction_factor)
|
||||
c->nreslevels2decode = 1;
|
||||
else
|
||||
c->nreslevels2decode = c->nreslevels - s->reduction_factor;
|
||||
c->nreslevels2decode = c->nreslevels - s->reduction_factor;
|
||||
|
||||
c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width
|
||||
c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height
|
||||
@ -306,6 +397,11 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {
|
||||
avpriv_request_sample(s->avctx, "cblk size > 64");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
c->cblk_style = bytestream2_get_byteu(&s->g);
|
||||
if (c->cblk_style != 0) { // cblk style
|
||||
av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style);
|
||||
@ -789,6 +885,10 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
|
||||
prcx = ff_jpeg2000_ceildivpow2(x, reducedresno) >> rlevel->log2_prec_width;
|
||||
prcy = ff_jpeg2000_ceildivpow2(y, reducedresno) >> rlevel->log2_prec_height;
|
||||
precno = prcx + rlevel->num_precincts_x * prcy;
|
||||
|
||||
if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
|
||||
for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {
|
||||
if ((ret = jpeg2000_decode_packet(s, codsty, rlevel,
|
||||
precno, layno,
|
||||
@ -947,6 +1047,9 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
|
||||
int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS;
|
||||
int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC;
|
||||
|
||||
av_assert0(width <= JPEG2000_MAX_CBLKW);
|
||||
av_assert0(height <= JPEG2000_MAX_CBLKH);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
memset(t1->data[y], 0, width * sizeof(**t1->data));
|
||||
|
||||
@ -1024,7 +1127,7 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,
|
||||
int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
|
||||
int *src = t1->data[j];
|
||||
for (i = 0; i < w; ++i)
|
||||
datap[i] = (src[i] * band->i_stepsize + (1 << 15)) >> 16;
|
||||
datap[i] = (src[i] * band->i_stepsize + (1 << 14)) >> 15;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1049,6 +1152,12 @@ static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
|
||||
int32_t *src[3], i0, i1, i2;
|
||||
float *srcf[3], i0f, i1f, i2f;
|
||||
|
||||
for (i = 1; i < 3; i++)
|
||||
if (tile->codsty[0].transform != tile->codsty[i].transform) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (tile->codsty[0].transform == FF_DWT97)
|
||||
srcf[i] = tile->comp[i].f_data;
|
||||
@ -1157,6 +1266,13 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
if (tile->codsty[0].mct)
|
||||
mct_decode(s, tile);
|
||||
|
||||
if (s->cdef[0] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++)
|
||||
s->cdef[x] = x + 1;
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
}
|
||||
|
||||
if (s->precision <= 8) {
|
||||
for (compno = 0; compno < s->ncomponents; compno++) {
|
||||
Jpeg2000Component *comp = tile->comp + compno;
|
||||
@ -1165,14 +1281,21 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
int32_t *i_datap = comp->i_data;
|
||||
int cbps = s->cbps[compno];
|
||||
int w = tile->comp[compno].coord[0][1] - s->image_offset_x;
|
||||
int planar = !!picture->data[2];
|
||||
int pixelsize = planar ? 1 : s->ncomponents;
|
||||
int plane = 0;
|
||||
|
||||
if (planar)
|
||||
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);
|
||||
|
||||
|
||||
y = tile->comp[compno].coord[1][0] - s->image_offset_y;
|
||||
line = picture->data[0] + y * picture->linesize[0];
|
||||
line = picture->data[plane] + y / s->cdy[compno] * picture->linesize[plane];
|
||||
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
|
||||
uint8_t *dst;
|
||||
|
||||
x = tile->comp[compno].coord[0][0] - s->image_offset_x;
|
||||
dst = line + x * s->ncomponents + compno;
|
||||
dst = line + x / s->cdx[compno] * pixelsize + compno*!planar;
|
||||
|
||||
if (codsty->transform == FF_DWT97) {
|
||||
for (; x < w; x += s->cdx[compno]) {
|
||||
@ -1181,7 +1304,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
val = av_clip(val, 0, (1 << cbps) - 1);
|
||||
*dst = val << (8 - cbps);
|
||||
datap++;
|
||||
dst += s->ncomponents;
|
||||
dst += pixelsize;
|
||||
}
|
||||
} else {
|
||||
for (; x < w; x += s->cdx[compno]) {
|
||||
@ -1190,10 +1313,10 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
val = av_clip(val, 0, (1 << cbps) - 1);
|
||||
*dst = val << (8 - cbps);
|
||||
i_datap++;
|
||||
dst += s->ncomponents;
|
||||
dst += pixelsize;
|
||||
}
|
||||
}
|
||||
line += picture->linesize[0];
|
||||
line += picture->linesize[plane];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1205,14 +1328,20 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
uint16_t *linel;
|
||||
int cbps = s->cbps[compno];
|
||||
int w = tile->comp[compno].coord[0][1] - s->image_offset_x;
|
||||
int planar = !!picture->data[2];
|
||||
int pixelsize = planar ? 1 : s->ncomponents;
|
||||
int plane = 0;
|
||||
|
||||
if (planar)
|
||||
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);
|
||||
|
||||
y = tile->comp[compno].coord[1][0] - s->image_offset_y;
|
||||
linel = (uint16_t *)picture->data[0] + y * (picture->linesize[0] >> 1);
|
||||
linel = (uint16_t *)picture->data[plane] + y / s->cdy[compno] * (picture->linesize[plane] >> 1);
|
||||
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {
|
||||
uint16_t *dst;
|
||||
|
||||
x = tile->comp[compno].coord[0][0] - s->image_offset_x;
|
||||
dst = linel + (x * s->ncomponents + compno);
|
||||
dst = linel + (x / s->cdx[compno] * pixelsize + compno*!planar);
|
||||
if (codsty->transform == FF_DWT97) {
|
||||
for (; x < w; x += s-> cdx[compno]) {
|
||||
int val = lrintf(*datap) + (1 << (cbps - 1));
|
||||
@ -1221,7 +1350,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
/* align 12 bit values in little-endian mode */
|
||||
*dst = val << (16 - cbps);
|
||||
datap++;
|
||||
dst += s->ncomponents;
|
||||
dst += pixelsize;
|
||||
}
|
||||
} else {
|
||||
for (; x < w; x += s-> cdx[compno]) {
|
||||
@ -1231,10 +1360,10 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
/* align 12 bit values in little-endian mode */
|
||||
*dst = val << (16 - cbps);
|
||||
i_datap++;
|
||||
dst += s->ncomponents;
|
||||
dst += pixelsize;
|
||||
}
|
||||
}
|
||||
linel += picture->linesize[0] >> 1;
|
||||
linel += picture->linesize[plane] >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1386,6 +1515,104 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
|
||||
atom = bytestream2_get_be32u(&s->g);
|
||||
if (atom == JP2_CODESTREAM) {
|
||||
found_codestream = 1;
|
||||
} else if (atom == JP2_HEADER &&
|
||||
bytestream2_get_bytes_left(&s->g) >= atom_size &&
|
||||
atom_size >= 16) {
|
||||
uint32_t atom2_size, atom2;
|
||||
atom_size -= 8;
|
||||
do {
|
||||
atom2_size = bytestream2_get_be32u(&s->g);
|
||||
atom2 = bytestream2_get_be32u(&s->g);
|
||||
atom_size -= 8;
|
||||
if (atom2_size < 8 || atom2_size - 8 > atom_size)
|
||||
break;
|
||||
atom2_size -= 8;
|
||||
if (atom2 == JP2_CODESTREAM) {
|
||||
return 1;
|
||||
} else if (atom2 == MKBETAG('c','o','l','r') && atom2_size >= 7) {
|
||||
int method = bytestream2_get_byteu(&s->g);
|
||||
bytestream2_skipu(&s->g, 2);
|
||||
atom_size -= 3;
|
||||
atom2_size -= 3;
|
||||
if (method == 1) {
|
||||
s->colour_space = bytestream2_get_be32u(&s->g);
|
||||
atom_size -= 4;
|
||||
atom2_size -= 4;
|
||||
}
|
||||
bytestream2_skipu(&s->g, atom2_size);
|
||||
atom_size -= atom2_size;
|
||||
} else if (atom2 == MKBETAG('p','c','l','r') && atom2_size >= 6) {
|
||||
int i, size, colour_count, colour_channels, colour_depth[3];
|
||||
uint32_t r, g, b;
|
||||
colour_count = bytestream2_get_be16u(&s->g);
|
||||
colour_channels = bytestream2_get_byteu(&s->g);
|
||||
// FIXME: Do not ignore channel_sign
|
||||
colour_depth[0] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;
|
||||
colour_depth[1] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;
|
||||
colour_depth[2] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;
|
||||
atom_size -= 6;
|
||||
atom2_size -= 6;
|
||||
size = (colour_depth[0] + 7 >> 3) * colour_count +
|
||||
(colour_depth[1] + 7 >> 3) * colour_count +
|
||||
(colour_depth[2] + 7 >> 3) * colour_count;
|
||||
if (colour_count > 256 ||
|
||||
colour_channels != 3 ||
|
||||
colour_depth[0] > 16 ||
|
||||
colour_depth[1] > 16 ||
|
||||
colour_depth[2] > 16 ||
|
||||
atom2_size < size) {
|
||||
avpriv_request_sample(s->avctx, "Unknown palette");
|
||||
bytestream2_skipu(&s->g, atom2_size);
|
||||
atom_size -= atom2_size;
|
||||
continue;
|
||||
}
|
||||
s->pal8 = 1;
|
||||
for (i = 0; i < colour_count; i++) {
|
||||
if (colour_depth[0] <= 8) {
|
||||
r = bytestream2_get_byteu(&s->g) << 8 - colour_depth[0];
|
||||
r |= r >> colour_depth[0];
|
||||
} else {
|
||||
r = bytestream2_get_be16u(&s->g) >> colour_depth[0] - 8;
|
||||
}
|
||||
if (colour_depth[1] <= 8) {
|
||||
g = bytestream2_get_byteu(&s->g) << 8 - colour_depth[1];
|
||||
r |= r >> colour_depth[1];
|
||||
} else {
|
||||
g = bytestream2_get_be16u(&s->g) >> colour_depth[1] - 8;
|
||||
}
|
||||
if (colour_depth[2] <= 8) {
|
||||
b = bytestream2_get_byteu(&s->g) << 8 - colour_depth[2];
|
||||
r |= r >> colour_depth[2];
|
||||
} else {
|
||||
b = bytestream2_get_be16u(&s->g) >> colour_depth[2] - 8;
|
||||
}
|
||||
s->palette[i] = 0xffu << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
atom_size -= size;
|
||||
atom2_size -= size;
|
||||
bytestream2_skipu(&s->g, atom2_size);
|
||||
atom_size -= atom2_size;
|
||||
} else if (atom2 == MKBETAG('c','d','e','f') && atom2_size >= 2 &&
|
||||
bytestream2_get_bytes_left(&s->g) >= atom2_size) {
|
||||
int n = bytestream2_get_be16u(&s->g);
|
||||
atom_size -= 2;
|
||||
atom2_size -= 2;
|
||||
for (; n>0; n--) {
|
||||
int cn = bytestream2_get_be16(&s->g);
|
||||
int av_unused typ = bytestream2_get_be16(&s->g);
|
||||
int asoc = bytestream2_get_be16(&s->g);
|
||||
if (cn < 4 || asoc < 4)
|
||||
s->cdef[cn] = asoc;
|
||||
atom_size -= 6;
|
||||
atom2_size -= 6;
|
||||
}
|
||||
bytestream2_skipu(&s->g, atom2_size);
|
||||
} else {
|
||||
bytestream2_skipu(&s->g, atom2_size);
|
||||
atom_size -= atom2_size;
|
||||
}
|
||||
} while (atom_size >= 8);
|
||||
bytestream2_skipu(&s->g, atom_size);
|
||||
} else {
|
||||
if (bytestream2_get_bytes_left(&s->g) < atom_size - 8)
|
||||
return 0;
|
||||
@ -1410,6 +1637,7 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
|
||||
s->avctx = avctx;
|
||||
bytestream2_init(&s->g, avpkt->data, avpkt->size);
|
||||
s->curtileno = -1;
|
||||
memset(s->cdef, -1, sizeof(s->cdef));
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->g) < 2) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
@ -1456,6 +1684,9 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
*got_frame = 1;
|
||||
|
||||
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
|
||||
memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t));
|
||||
|
||||
return bytestream2_tell(&s->g);
|
||||
|
||||
end:
|
||||
@ -1466,6 +1697,7 @@ end:
|
||||
static void jpeg2000_init_static_data(AVCodec *codec)
|
||||
{
|
||||
ff_jpeg2000_init_tier1_luts();
|
||||
ff_mqc_init_context_tables();
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
|
||||
|
@ -148,6 +148,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state,
|
||||
ret = ret >> 1;
|
||||
}
|
||||
|
||||
if(FFABS(ret) > 0xFFFF)
|
||||
return -0x10000;
|
||||
/* update state */
|
||||
state->A[Q] += FFABS(ret) - RItype;
|
||||
ret *= state->twonear;
|
||||
|
@ -107,7 +107,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = val & 0xF;
|
||||
my = val >> 4;
|
||||
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 316*196) {
|
||||
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -132,7 +132,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = val & 0xF;
|
||||
my = val >> 4;
|
||||
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 318*198) {
|
||||
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -207,7 +207,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = (val & 0xF) - 8;
|
||||
my = (val >> 4) - 8;
|
||||
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 318*198) {
|
||||
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -232,7 +232,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = (val & 0xF) - 8;
|
||||
my = (val >> 4) - 8;
|
||||
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 318*198) {
|
||||
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ static const AVOption libopus_options[] = {
|
||||
{ "voip", "Favor improved speech intelligibility", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_VOIP }, 0, 0, FLAGS, "application" },
|
||||
{ "audio", "Favor faithfulness to the input", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0, FLAGS, "application" },
|
||||
{ "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" },
|
||||
{ "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 10.0 }, 2.5, 60.0, FLAGS },
|
||||
{ "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 60.0, FLAGS },
|
||||
{ "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
|
||||
{ "vbr", "Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 2, FLAGS, "vbr" },
|
||||
{ "off", "Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" },
|
||||
|
@ -351,7 +351,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
avctx->delay = duration;
|
||||
av_assert0(!s->afq.remaining_delay);
|
||||
s->afq.frames->duration += duration;
|
||||
s->afq.frames->pts -= duration;
|
||||
if (s->afq.frames->pts != AV_NOPTS_VALUE)
|
||||
s->afq.frames->pts -= duration;
|
||||
s->afq.remaining_samples += duration;
|
||||
}
|
||||
ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration);
|
||||
|
@ -343,19 +343,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);
|
||||
|
||||
@ -525,6 +512,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;
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/lls.h"
|
||||
#include "libavutil/lls2.h"
|
||||
|
||||
#define LPC_USE_DOUBLE
|
||||
#include "lpc.h"
|
||||
@ -208,7 +208,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
}
|
||||
|
||||
if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
||||
LLSModel m[2];
|
||||
LLSModel2 m[2];
|
||||
LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
|
||||
double av_uninit(weight);
|
||||
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
|
||||
@ -217,7 +217,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
|
||||
|
||||
for(; pass<lpc_passes; pass++){
|
||||
avpriv_init_lls(&m[pass&1], max_order);
|
||||
avpriv_init_lls2(&m[pass&1], max_order);
|
||||
|
||||
weight=0;
|
||||
for(i=max_order; i<blocksize; i++){
|
||||
@ -238,7 +238,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
|
||||
m[pass&1].update_lls(&m[pass&1], var);
|
||||
}
|
||||
avpriv_solve_lls(&m[pass&1], 0.001, 0);
|
||||
avpriv_solve_lls2(&m[pass&1], 0.001, 0);
|
||||
}
|
||||
|
||||
for(i=0; i<max_order; i++){
|
||||
|
@ -780,6 +780,12 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
int resync_mb_y = 0;
|
||||
int resync_mb_x = 0;
|
||||
|
||||
if (s->nb_components != 3 && s->nb_components != 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
s->restart_count = s->restart_interval;
|
||||
|
||||
av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
|
||||
@ -1088,7 +1094,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
s->dsp.clear_block(s->block);
|
||||
if (decode_block(s, s->block, i,
|
||||
s->dc_index[i], s->ac_index[i],
|
||||
s->quant_matrixes[s->quant_index[c]]) < 0) {
|
||||
s->quant_matrixes[s->quant_sindex[i]]) < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"error y=%d x=%d\n", mb_y, mb_x);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@ -1101,9 +1107,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
int16_t *block = s->blocks[c][block_idx];
|
||||
if (Ah)
|
||||
block[0] += get_bits1(&s->gb) *
|
||||
s->quant_matrixes[s->quant_index[c]][0] << Al;
|
||||
s->quant_matrixes[s->quant_sindex[i]][0] << Al;
|
||||
else if (decode_dc_progressive(s, block, i, s->dc_index[i],
|
||||
s->quant_matrixes[s->quant_index[c]],
|
||||
s->quant_matrixes[s->quant_sindex[i]],
|
||||
Al) < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"error y=%d x=%d\n", mb_y, mb_x);
|
||||
@ -1136,7 +1142,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
uint8_t *data = s->picture.data[c];
|
||||
int linesize = s->linesize[c];
|
||||
int last_scan = 0;
|
||||
int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]];
|
||||
int16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]];
|
||||
|
||||
av_assert0(ss>=0 && Ah>=0 && Al>=0);
|
||||
if (se < ss || se > 63) {
|
||||
@ -1145,7 +1151,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];
|
||||
}
|
||||
|
||||
@ -1231,6 +1237,11 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
|
||||
&& nb_components == 3 && s->nb_components == 3 && i)
|
||||
index = 3 - i;
|
||||
|
||||
s->quant_sindex[i] = s->quant_index[index];
|
||||
s->nb_blocks[i] = s->h_count[index] * s->v_count[index];
|
||||
s->h_scount[i] = s->h_count[index];
|
||||
s->v_scount[i] = s->v_count[index];
|
||||
|
||||
if(nb_components == 3 && s->nb_components == 3 && s->avctx->pix_fmt == AV_PIX_FMT_GBR24P)
|
||||
index = (i+2)%3;
|
||||
if(nb_components == 1 && s->nb_components == 3 && s->avctx->pix_fmt == AV_PIX_FMT_GBR24P)
|
||||
@ -1238,10 +1249,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
|
||||
|
||||
s->comp_index[i] = index;
|
||||
|
||||
s->nb_blocks[i] = s->h_count[index] * s->v_count[index];
|
||||
s->h_scount[i] = s->h_count[index];
|
||||
s->v_scount[i] = s->v_count[index];
|
||||
|
||||
s->dc_index[i] = get_bits(&s->gb, 4);
|
||||
s->ac_index[i] = get_bits(&s->gb, 4);
|
||||
|
||||
|
@ -84,6 +84,7 @@ typedef struct MJpegDecodeContext {
|
||||
int nb_blocks[MAX_COMPONENTS];
|
||||
int h_scount[MAX_COMPONENTS];
|
||||
int v_scount[MAX_COMPONENTS];
|
||||
int quant_sindex[MAX_COMPONENTS];
|
||||
int h_max, v_max; /* maximum h and v counts */
|
||||
int quant_index[4]; /* quant table index for each component */
|
||||
int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
|
||||
|
@ -454,7 +454,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) {
|
||||
|
@ -56,6 +56,6 @@ void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
|
||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||
void ff_mjpeg_encode_dc(MpegEncContext *s, 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 */
|
||||
|
@ -815,7 +815,7 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MSB_MASK(bits) (-1u << bits)
|
||||
#define MSB_MASK(bits) (-1u << (bits))
|
||||
|
||||
/** Generate PCM samples using the prediction filters and residual values
|
||||
* read from the data stream, and update the filter state. */
|
||||
|
@ -2038,7 +2038,6 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
|
||||
if (s->codec_tag == AV_RL32("BW10")) {
|
||||
s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
|
||||
} else {
|
||||
exchange_uv(s); // common init reset pblocks, so we swap them here
|
||||
s->swap_uv = 1; // in case of xvmc we need to swap uv for each MB
|
||||
s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
|
||||
}
|
||||
@ -2130,7 +2129,8 @@ static int decode_chunks(AVCodecContext *avctx,
|
||||
buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &start_code);
|
||||
if (start_code > 0x1ff) {
|
||||
if (!skip_frame) {
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
|
||||
!avctx->hwaccel) {
|
||||
int i;
|
||||
av_assert0(avctx->thread_count > 1);
|
||||
|
||||
@ -2194,7 +2194,8 @@ static int decode_chunks(AVCodecContext *avctx,
|
||||
s2->intra_dc_precision= 3;
|
||||
s2->intra_matrix[0]= 1;
|
||||
}
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) && s->slice_count) {
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
|
||||
!avctx->hwaccel && s->slice_count) {
|
||||
int i;
|
||||
|
||||
avctx->execute(avctx, slice_decode_thread,
|
||||
@ -2369,7 +2370,8 @@ static int decode_chunks(AVCodecContext *avctx,
|
||||
break;
|
||||
}
|
||||
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
|
||||
!avctx->hwaccel) {
|
||||
int threshold = (s2->mb_height * s->slice_count +
|
||||
s2->slice_context_count / 2) /
|
||||
s2->slice_context_count;
|
||||
|
@ -537,6 +537,15 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void exchange_uv(MpegEncContext *s)
|
||||
{
|
||||
int16_t (*tmp)[64];
|
||||
|
||||
tmp = s->pblocks[4];
|
||||
s->pblocks[4] = s->pblocks[5];
|
||||
s->pblocks[5] = tmp;
|
||||
}
|
||||
|
||||
static int init_duplicate_context(MpegEncContext *s)
|
||||
{
|
||||
int y_size = s->b8_stride * (2 * s->mb_height + 1);
|
||||
@ -567,6 +576,8 @@ static int init_duplicate_context(MpegEncContext *s)
|
||||
for (i = 0; i < 12; i++) {
|
||||
s->pblocks[i] = &s->block[i];
|
||||
}
|
||||
if (s->avctx->codec_tag == AV_RL32("VCR2"))
|
||||
exchange_uv(s);
|
||||
|
||||
if (s->out_format == FMT_H263) {
|
||||
/* ac values */
|
||||
@ -641,6 +652,8 @@ int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
|
||||
for (i = 0; i < 12; i++) {
|
||||
dst->pblocks[i] = &dst->block[i];
|
||||
}
|
||||
if (dst->avctx->codec_tag == AV_RL32("VCR2"))
|
||||
exchange_uv(dst);
|
||||
if (!dst->edge_emu_buffer &&
|
||||
(ret = ff_mpv_frame_size_alloc(dst, dst->linesize)) < 0) {
|
||||
av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context "
|
||||
|
@ -96,6 +96,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;
|
||||
|
@ -92,14 +92,9 @@ uint16_t ff_mqc_qe [2 * 47];
|
||||
uint8_t ff_mqc_nlps[2 * 47];
|
||||
uint8_t ff_mqc_nmps[2 * 47];
|
||||
|
||||
void ff_mqc_init_contexts(MqcState *mqc)
|
||||
void ff_mqc_init_context_tables(void)
|
||||
{
|
||||
int i;
|
||||
memset(mqc->cx_states, 0, sizeof(mqc->cx_states));
|
||||
mqc->cx_states[MQC_CX_UNI] = 2 * 46;
|
||||
mqc->cx_states[MQC_CX_RL] = 2 * 3;
|
||||
mqc->cx_states[0] = 2 * 4;
|
||||
|
||||
for (i = 0; i < 47; i++) {
|
||||
ff_mqc_qe[2 * i] =
|
||||
ff_mqc_qe[2 * i + 1] = cx_states[i].qe;
|
||||
@ -110,3 +105,11 @@ void ff_mqc_init_contexts(MqcState *mqc)
|
||||
ff_mqc_nmps[2 * i + 1] = 2 * cx_states[i].nmps + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void ff_mqc_init_contexts(MqcState *mqc)
|
||||
{
|
||||
memset(mqc->cx_states, 0, sizeof(mqc->cx_states));
|
||||
mqc->cx_states[MQC_CX_UNI] = 2 * 46;
|
||||
mqc->cx_states[MQC_CX_RL] = 2 * 3;
|
||||
mqc->cx_states[0] = 2 * 4;
|
||||
}
|
||||
|
@ -78,6 +78,11 @@ int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate);
|
||||
|
||||
/* common */
|
||||
|
||||
/**
|
||||
* MQ-coder Initialize context tables (QE, NLPS, NMPS)
|
||||
*/
|
||||
void ff_mqc_init_context_tables(void);
|
||||
|
||||
/**
|
||||
* MQ-coder context initialisations.
|
||||
* @param mqc MQ-coder context
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
#include "msrledec.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
typedef struct MsrleContext {
|
||||
AVCodecContext *avctx;
|
||||
@ -108,11 +109,14 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
/* FIXME how to correctly detect RLE ??? */
|
||||
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
|
||||
int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
|
||||
int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
|
||||
uint8_t *ptr = s->frame.data[0];
|
||||
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) {
|
||||
|
@ -84,8 +84,8 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma)
|
||||
blk[6 * step] = (-(t3 + t7) + t8 + tA) >> shift; \
|
||||
blk[7 * step] = (-(t1 + t6) + t9 + tB) >> shift; \
|
||||
|
||||
#define SOP_ROW(a) ((a) << 16) + 0x2000
|
||||
#define SOP_COL(a) ((a + 32) << 16)
|
||||
#define SOP_ROW(a) (((a) << 16) + 0x2000)
|
||||
#define SOP_COL(a) (((a) + 32) << 16)
|
||||
|
||||
void ff_mss34_dct_put(uint8_t *dst, int stride, int *block)
|
||||
{
|
||||
|
@ -364,7 +364,7 @@ static int get_value_cached(GetBitContext *gb, int vec_pos, uint8_t *vec,
|
||||
return prev[component];
|
||||
}
|
||||
|
||||
#define MKVAL(vals) (vals[0] | (vals[1] << 3) | (vals[2] << 6))
|
||||
#define MKVAL(vals) ((vals)[0] | ((vals)[1] << 3) | ((vals)[2] << 6))
|
||||
|
||||
/* Image mode - the hardest to comprehend MSS4 coding mode.
|
||||
*
|
||||
|
@ -237,8 +237,10 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
if(next == END_NOT_FOUND){
|
||||
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
if(!new_buffer)
|
||||
if(!new_buffer) {
|
||||
pc->index = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
pc->buffer = new_buffer;
|
||||
memcpy(&pc->buffer[pc->index], *buf, *buf_size);
|
||||
pc->index += *buf_size;
|
||||
@ -251,9 +253,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
/* append to buffer */
|
||||
if(pc->index){
|
||||
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
if(!new_buffer)
|
||||
if(!new_buffer) {
|
||||
pc->overread_index =
|
||||
pc->index = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
pc->buffer = new_buffer;
|
||||
if (next > -FF_INPUT_BUFFER_PADDING_SIZE)
|
||||
memcpy(&pc->buffer[pc->index], *buf,
|
||||
|
@ -31,7 +31,7 @@
|
||||
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
|
||||
{
|
||||
long i;
|
||||
for (i = 0; i <= w - sizeof(long); i += sizeof(long)) {
|
||||
for (i = 0; i <= w - (int)sizeof(long); i += sizeof(long)) {
|
||||
long a = *(long *)(src1 + i);
|
||||
long b = *(long *)(src2 + i);
|
||||
*(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80);
|
||||
|
@ -163,6 +163,8 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||
if (s->maxval >= 256) {
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
|
||||
if (s->maxval != 65535)
|
||||
avctx->pix_fmt = AV_PIX_FMT_GRAY16;
|
||||
} else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
|
||||
} else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {
|
||||
|
@ -819,7 +819,8 @@ static int synthfilt_build_sb_samples(QDM2Context *q, GetBitContext *gb,
|
||||
int type34_first;
|
||||
float type34_div = 0;
|
||||
float type34_predictor;
|
||||
float samples[10], sign_bits[16];
|
||||
float samples[10];
|
||||
int sign_bits[16] = {0};
|
||||
|
||||
if (length == 0) {
|
||||
// If no data use noise
|
||||
|
@ -85,7 +85,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
unsigned short *pixels = (unsigned short *)s->frame.data[0];
|
||||
|
||||
int row_ptr = 0;
|
||||
int pixel_ptr = 0;
|
||||
int pixel_ptr = -4;
|
||||
int block_ptr;
|
||||
int pixel_x, pixel_y;
|
||||
int total_blocks;
|
||||
@ -141,6 +141,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
colorA = AV_RB16 (&s->buf[stream_ptr]);
|
||||
stream_ptr += 2;
|
||||
while (n_blocks--) {
|
||||
ADVANCE_BLOCK()
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||
@ -149,7 +150,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -188,6 +188,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
if (s->size - stream_ptr < n_blocks * 4)
|
||||
return;
|
||||
while (n_blocks--) {
|
||||
ADVANCE_BLOCK();
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
index = s->buf[stream_ptr++];
|
||||
@ -198,7 +199,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -206,6 +206,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
case 0x00:
|
||||
if (s->size - stream_ptr < 16)
|
||||
return;
|
||||
ADVANCE_BLOCK();
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||
@ -219,7 +220,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
break;
|
||||
|
||||
/* Unknown opcode */
|
||||
|
@ -58,7 +58,8 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
|
||||
}
|
||||
|
||||
/* Check for buffer overflow. */
|
||||
if(out_buf + pixelstride * (count-1) >= out_end) return -1;
|
||||
if (out_end - out_buf <= pixelstride * (count - 1))
|
||||
return -1;
|
||||
|
||||
if (pixel & 0x80) {
|
||||
while (count--) {
|
||||
|
@ -317,7 +317,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
|
||||
if(!sliced && !offset_dst)
|
||||
dst -= src_x;
|
||||
src_x=0;
|
||||
}else if(src_x + b_w > w){
|
||||
}
|
||||
if(src_x + b_w > w){
|
||||
b_w = w - src_x;
|
||||
}
|
||||
if(src_y<0){
|
||||
@ -326,7 +327,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
|
||||
if(!sliced && !offset_dst)
|
||||
dst -= src_y*dst_stride;
|
||||
src_y=0;
|
||||
}else if(src_y + b_h> h){
|
||||
}
|
||||
if(src_y + b_h> h){
|
||||
b_h = h - src_y;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,8 @@ static const char *read_ts(const char *buf, int *ts_start, int *ts_end,
|
||||
"%*[ ]X1:%u X2:%u Y1:%u Y2:%u",
|
||||
&hs, &ms, &ss, ts_start, &he, &me, &se, ts_end,
|
||||
x1, x2, y1, y2);
|
||||
buf += strcspn(buf, "\n") + 1;
|
||||
buf += strcspn(buf, "\n");
|
||||
buf += !!*buf;
|
||||
if (c >= 8) {
|
||||
*ts_start = 100*(ss + 60*(ms + 60*hs)) + *ts_start/10;
|
||||
*ts_end = 100*(se + 60*(me + 60*he)) + *ts_end /10;
|
||||
|
@ -721,11 +721,9 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->ti.bps != avctx->bits_per_raw_sample) {
|
||||
avctx->bits_per_raw_sample = s->ti.bps;
|
||||
if ((ret = set_bps_params(avctx)) < 0)
|
||||
return ret;
|
||||
}
|
||||
avctx->bits_per_raw_sample = s->ti.bps;
|
||||
if ((ret = set_bps_params(avctx)) < 0)
|
||||
return ret;
|
||||
if (s->ti.sample_rate != avctx->sample_rate) {
|
||||
avctx->sample_rate = s->ti.sample_rate;
|
||||
set_sample_rate_params(avctx);
|
||||
|
@ -945,14 +945,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (!l->Y1_base || !l->Y2_base || !l->U1_base ||
|
||||
!l->V1_base || !l->U2_base || !l->V2_base ||
|
||||
!l->last || !l->clast) {
|
||||
av_freep(l->Y1_base);
|
||||
av_freep(l->Y2_base);
|
||||
av_freep(l->U1_base);
|
||||
av_freep(l->U2_base);
|
||||
av_freep(l->V1_base);
|
||||
av_freep(l->V2_base);
|
||||
av_freep(l->last);
|
||||
av_freep(l->clast);
|
||||
av_freep(&l->Y1_base);
|
||||
av_freep(&l->Y2_base);
|
||||
av_freep(&l->U1_base);
|
||||
av_freep(&l->U2_base);
|
||||
av_freep(&l->V1_base);
|
||||
av_freep(&l->V2_base);
|
||||
av_freep(&l->last);
|
||||
av_freep(&l->clast);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
l->Y1 = l->Y1_base + l->y_stride * 4 + 4;
|
||||
|
@ -116,7 +116,7 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
PutBitContext pb;
|
||||
int ret, i, out_bytes, cur_chan = 0, res = 0, samples = 0;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, frame->nb_samples * 2 * s->bps)) < 0)
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, frame->nb_samples * 2 * avctx->channels * s->bps)) < 0)
|
||||
return ret;
|
||||
init_put_bits(&pb, avpkt->data, avpkt->size);
|
||||
|
||||
|
@ -163,7 +163,8 @@ av_cold void avcodec_register(AVCodec *codec)
|
||||
avcodec_init();
|
||||
p = &first_avcodec;
|
||||
codec->next = NULL;
|
||||
while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, codec))
|
||||
|
||||
while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, codec))
|
||||
p = &(*p)->next;
|
||||
|
||||
if (codec->init_static_data)
|
||||
@ -639,8 +640,7 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
frame->width = FFMAX(avctx->width, FF_CEIL_RSHIFT(avctx->coded_width, avctx->lowres));
|
||||
frame->height = FFMAX(avctx->height, FF_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
|
||||
if (frame->format < 0)
|
||||
frame->format = avctx->pix_fmt;
|
||||
frame->format = avctx->pix_fmt;
|
||||
if (!frame->sample_aspect_ratio.num)
|
||||
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
||||
break;
|
||||
@ -682,6 +682,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)
|
||||
@ -1491,7 +1492,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;
|
||||
@ -1516,9 +1517,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 */
|
||||
@ -1526,14 +1531,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;
|
||||
@ -1605,6 +1611,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
|
||||
end:
|
||||
av_frame_free(&padded_frame);
|
||||
av_free(extended_frame);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1899,10 +1906,17 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
|
||||
if (!side_metadata)
|
||||
goto end;
|
||||
end = side_metadata + size;
|
||||
if (size && end[-1])
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (side_metadata < end) {
|
||||
const uint8_t *key = side_metadata;
|
||||
const uint8_t *val = side_metadata + strlen(key) + 1;
|
||||
int ret = av_dict_set(avpriv_frame_get_metadatap(frame), key, val, 0);
|
||||
int ret;
|
||||
|
||||
if (val >= end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = av_dict_set(avpriv_frame_get_metadatap(frame), key, val, 0);
|
||||
if (ret < 0)
|
||||
break;
|
||||
side_metadata = val + strlen(val) + 1;
|
||||
@ -2271,6 +2285,16 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
||||
int did_split = av_packet_split_side_data(&tmp);
|
||||
//apply_param_change(avctx, &tmp);
|
||||
|
||||
if (did_split) {
|
||||
/* FFMIN() prevents overflow in case the packet wasn't allocated with
|
||||
* proper padding.
|
||||
* If the side data is smaller than the buffer padding size, the
|
||||
* remaining bytes should have already been filled with zeros by the
|
||||
* original packet allocation anyway. */
|
||||
memset(tmp.data + tmp.size, 0,
|
||||
FFMIN(avpkt->size - tmp.size, FF_INPUT_BUFFER_PADDING_SIZE));
|
||||
}
|
||||
|
||||
pkt_recoded = tmp;
|
||||
ret = recode_subtitle(avctx, &pkt_recoded, &tmp);
|
||||
if (ret < 0) {
|
||||
@ -2996,7 +3020,7 @@ void av_register_hwaccel(AVHWAccel *hwaccel)
|
||||
{
|
||||
AVHWAccel **p = &first_hwaccel;
|
||||
hwaccel->next = NULL;
|
||||
while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, hwaccel))
|
||||
while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, hwaccel))
|
||||
p = &(*p)->next;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
* get the offset in bits and convert to bytes.
|
||||
*/
|
||||
offset += write_huff_codes(dst + sstart * width, c->slice_bits,
|
||||
width * (send - sstart), width,
|
||||
width * height + 4, width,
|
||||
send - sstart, he) >> 3;
|
||||
|
||||
slice_len = offset - slice_len;
|
||||
@ -525,8 +525,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
bytestream2_init_writer(&pb, dst, pkt->size);
|
||||
|
||||
av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
|
||||
width * height + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
av_fast_padded_malloc(&c->slice_bits, &c->slice_bits_size, width * height + 4);
|
||||
|
||||
if (!c->slice_bits) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 2.\n");
|
||||
|
@ -621,12 +621,18 @@ static void rotate_luts(VC1Context *v)
|
||||
INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
|
||||
INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
|
||||
v->curr_use_ic = 0;
|
||||
if (v->curr_luty == v->next_luty) {
|
||||
// If we just initialized next_lut, clear next_use_ic to match.
|
||||
v->next_use_ic = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
||||
{
|
||||
int pqindex, lowquant, status;
|
||||
|
||||
v->field_mode = 0;
|
||||
v->fcm = 0;
|
||||
if (v->finterpflag)
|
||||
v->interpfrm = get_bits1(gb);
|
||||
if (!v->s.avctx->codec)
|
||||
|
@ -1909,9 +1909,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));
|
||||
|
@ -277,6 +277,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
|
||||
}
|
||||
xy = *src++;
|
||||
wh = *src++;
|
||||
if ( (xy >> 4) + (wh >> 4) + 1 > w - i
|
||||
|| (xy & 0xF) + (wh & 0xF)+1 > h - j) {
|
||||
av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -512,6 +512,10 @@ static int wma_decode_block(WMACodecContext *s)
|
||||
coef escape coding */
|
||||
total_gain = 1;
|
||||
for(;;) {
|
||||
if (get_bits_left(&s->gb) < 7) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
a = get_bits(&s->gb, 7);
|
||||
total_gain += a;
|
||||
if (a != 127)
|
||||
|
@ -127,8 +127,8 @@ typedef struct WmallDecodeCtx {
|
||||
|
||||
int8_t mclms_order;
|
||||
int8_t mclms_scaling;
|
||||
int16_t mclms_coeffs[128];
|
||||
int16_t mclms_coeffs_cur[4];
|
||||
int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32];
|
||||
int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS];
|
||||
int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
|
||||
int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
|
||||
int mclms_recent;
|
||||
|
@ -1045,9 +1045,10 @@ static void aw_parse_coords(WMAVoiceContext *s, GetBitContext *gb,
|
||||
* @param gb bit I/O context
|
||||
* @param block_idx block index in frame [0, 1]
|
||||
* @param fcb structure containing fixed codebook vector info
|
||||
* @return -1 on error, 0 otherwise
|
||||
*/
|
||||
static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
|
||||
int block_idx, AMRFixed *fcb)
|
||||
static int aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
|
||||
int block_idx, AMRFixed *fcb)
|
||||
{
|
||||
uint16_t use_mask_mem[9]; // only 5 are used, rest is padding
|
||||
uint16_t *use_mask = use_mask_mem + 2;
|
||||
@ -1109,7 +1110,7 @@ static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
|
||||
else if (use_mask[2]) idx = 0x2F;
|
||||
else if (use_mask[3]) idx = 0x3F;
|
||||
else if (use_mask[4]) idx = 0x4F;
|
||||
else return;
|
||||
else return -1;
|
||||
idx -= av_log2_16bit(use_mask[idx >> 4]);
|
||||
}
|
||||
if (use_mask[idx >> 4] & (0x8000 >> (idx & 15))) {
|
||||
@ -1126,6 +1127,7 @@ static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
|
||||
/* set offset for next block, relative to start of that block */
|
||||
n = (MAX_FRAMESIZE / 2 - start_off) % fcb->pitch_lag;
|
||||
s->aw_next_pulse_off_cache = n ? fcb->pitch_lag - n : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1288,7 +1290,18 @@ static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,
|
||||
* (fixed) codebook pulses of the speech signal. */
|
||||
if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
|
||||
aw_pulse_set1(s, gb, block_idx, &fcb);
|
||||
aw_pulse_set2(s, gb, block_idx, &fcb);
|
||||
if (aw_pulse_set2(s, gb, block_idx, &fcb)) {
|
||||
/* Conceal the block with silence and return.
|
||||
* Skip the correct amount of bits to read the next
|
||||
* block from the correct offset. */
|
||||
int r_idx = pRNG(s->frame_cntr, block_idx, size);
|
||||
|
||||
for (n = 0; n < size; n++)
|
||||
excitation[n] =
|
||||
wmavoice_std_codebook[r_idx + n] * s->silence_gain;
|
||||
skip_bits(gb, 7 + 1);
|
||||
return;
|
||||
}
|
||||
} else /* FCB_TYPE_EXC_PULSES */ {
|
||||
int offset_nbits = 5 - frame_desc->log_n_blocks;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -248,6 +248,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
|
||||
ret = av_opt_set_int_list(sink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
ret = av_opt_set_int(sink, "all_channel_counts", 1,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
lavfi->sinks[i] = sink;
|
||||
|
@ -685,6 +685,10 @@ static int v4l2_set_parameters(AVFormatContext *s1)
|
||||
standard.index = i;
|
||||
if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
|
||||
ret = AVERROR(errno);
|
||||
if (ret == AVERROR(EINVAL)) {
|
||||
tpf = &streamparm.parm.capture.timeperframe;
|
||||
break;
|
||||
}
|
||||
av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
@ -929,6 +933,9 @@ static int v4l2_read_header(AVFormatContext *s1)
|
||||
if (codec_id == AV_CODEC_ID_RAWVIDEO)
|
||||
st->codec->codec_tag =
|
||||
avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
|
||||
else if (codec_id == AV_CODEC_ID_H264) {
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
}
|
||||
if (desired_format == V4L2_PIX_FMT_YVU420)
|
||||
st->codec->codec_tag = MKTAG('Y', 'V', '1', '2');
|
||||
else if (desired_format == V4L2_PIX_FMT_YVU410)
|
||||
|
@ -25,42 +25,48 @@
|
||||
* sample format and channel layout conversion audio filter
|
||||
*/
|
||||
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libswresample/swresample.h"
|
||||
#include "avfilter.h"
|
||||
#include "audio.h"
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct {
|
||||
const AVClass *class;
|
||||
enum AVSampleFormat out_sample_fmt;
|
||||
int64_t out_chlayout;
|
||||
struct SwrContext *swr;
|
||||
char *format_str;
|
||||
char *channel_layout_str;
|
||||
} AConvertContext;
|
||||
|
||||
#define OFFSET(x) offsetof(AConvertContext, x)
|
||||
#define A AV_OPT_FLAG_AUDIO_PARAM
|
||||
#define F AV_OPT_FLAG_FILTERING_PARAM
|
||||
static const AVOption aconvert_options[] = {
|
||||
{ "sample_fmt", "", OFFSET(format_str), AV_OPT_TYPE_STRING, .flags = A|F },
|
||||
{ "channel_layout", "", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A|F },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
AVFILTER_DEFINE_CLASS(aconvert);
|
||||
|
||||
static av_cold int init(AVFilterContext *ctx)
|
||||
{
|
||||
AConvertContext *aconvert = ctx->priv;
|
||||
char *arg, *ptr = NULL;
|
||||
int ret = 0;
|
||||
char *args = av_strdup(NULL);
|
||||
|
||||
av_log(ctx, AV_LOG_WARNING, "This filter is deprecated, use aformat instead\n");
|
||||
|
||||
aconvert->out_sample_fmt = AV_SAMPLE_FMT_NONE;
|
||||
aconvert->out_chlayout = 0;
|
||||
|
||||
if ((arg = av_strtok(args, ":", &ptr)) && strcmp(arg, "auto")) {
|
||||
if ((ret = ff_parse_sample_format(&aconvert->out_sample_fmt, arg, ctx)) < 0)
|
||||
goto end;
|
||||
}
|
||||
if ((arg = av_strtok(NULL, ":", &ptr)) && strcmp(arg, "auto")) {
|
||||
if ((ret = ff_parse_channel_layout(&aconvert->out_chlayout, arg, ctx)) < 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
av_freep(&args);
|
||||
if (aconvert->format_str && strcmp(aconvert->format_str, "auto") &&
|
||||
(ret = ff_parse_sample_format(&aconvert->out_sample_fmt, aconvert->format_str, ctx)) < 0)
|
||||
return ret;
|
||||
if (aconvert->channel_layout_str && strcmp(aconvert->channel_layout_str, "auto"))
|
||||
return ff_parse_channel_layout(&aconvert->out_chlayout, NULL, aconvert->channel_layout_str, ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -181,6 +187,7 @@ AVFilter avfilter_af_aconvert = {
|
||||
.name = "aconvert",
|
||||
.description = NULL_IF_CONFIG_SMALL("Convert the input audio to sample_fmt:channel_layout."),
|
||||
.priv_size = sizeof(AConvertContext),
|
||||
.priv_class = &aconvert_class,
|
||||
.init = init,
|
||||
.uninit = uninit,
|
||||
.query_formats = query_formats,
|
||||
|
@ -114,6 +114,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
|
||||
AVFilterLink *outlink = inlink->dst->outputs[0];
|
||||
int16_t *taps, *endin, *in, *out;
|
||||
AVFrame *outsamples = ff_get_audio_buffer(inlink, insamples->nb_samples);
|
||||
int len;
|
||||
|
||||
if (!outsamples) {
|
||||
av_frame_free(&insamples);
|
||||
@ -125,16 +126,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
|
||||
out = (int16_t *)outsamples->data[0];
|
||||
in = (int16_t *)insamples ->data[0];
|
||||
|
||||
len = FFMIN(NUMTAPS, 2*insamples->nb_samples);
|
||||
// copy part of new input and process with saved input
|
||||
memcpy(taps+NUMTAPS, in, NUMTAPS * sizeof(*taps));
|
||||
out = scalarproduct(taps, taps + NUMTAPS, out);
|
||||
memcpy(taps+NUMTAPS, in, len * sizeof(*taps));
|
||||
out = scalarproduct(taps, taps + len, out);
|
||||
|
||||
// process current input
|
||||
endin = in + insamples->nb_samples * 2 - NUMTAPS;
|
||||
scalarproduct(in, endin, out);
|
||||
if (2*insamples->nb_samples >= NUMTAPS ){
|
||||
endin = in + insamples->nb_samples * 2 - NUMTAPS;
|
||||
scalarproduct(in, endin, out);
|
||||
|
||||
// save part of input for next round
|
||||
memcpy(taps, endin, NUMTAPS * sizeof(*taps));
|
||||
// save part of input for next round
|
||||
memcpy(taps, endin, NUMTAPS * sizeof(*taps));
|
||||
} else
|
||||
memmove(taps, taps + 2*insamples->nb_samples, NUMTAPS * sizeof(*taps));
|
||||
|
||||
av_frame_free(&insamples);
|
||||
return ff_filter_frame(outlink, outsamples);
|
||||
|
@ -46,7 +46,6 @@ typedef struct PanContext {
|
||||
double gain[MAX_CHANNELS][MAX_CHANNELS];
|
||||
int64_t need_renorm;
|
||||
int need_renumber;
|
||||
int nb_input_channels;
|
||||
int nb_output_channels;
|
||||
|
||||
int pure_gains;
|
||||
@ -116,10 +115,10 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
if (!args)
|
||||
return AVERROR(ENOMEM);
|
||||
arg = av_strtok(args, "|", &tokenizer);
|
||||
ret = ff_parse_channel_layout(&pan->out_channel_layout, arg, ctx);
|
||||
ret = ff_parse_channel_layout(&pan->out_channel_layout,
|
||||
&pan->nb_output_channels, arg, ctx);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
|
||||
|
||||
/* parse channel specifications */
|
||||
while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
|
||||
@ -239,12 +238,14 @@ static int query_formats(AVFilterContext *ctx)
|
||||
ff_set_common_samplerates(ctx, formats);
|
||||
|
||||
// inlink supports any channel layout
|
||||
layouts = ff_all_channel_layouts();
|
||||
layouts = ff_all_channel_counts();
|
||||
ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
|
||||
|
||||
// outlink supports only requested output channel layout
|
||||
layouts = NULL;
|
||||
ff_add_channel_layout(&layouts, pan->out_channel_layout);
|
||||
ff_add_channel_layout(&layouts,
|
||||
pan->out_channel_layout ? pan->out_channel_layout :
|
||||
FF_COUNT2LAYOUT(pan->nb_output_channels));
|
||||
ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
|
||||
return 0;
|
||||
}
|
||||
@ -257,7 +258,6 @@ static int config_props(AVFilterLink *link)
|
||||
int i, j, k, r;
|
||||
double t;
|
||||
|
||||
pan->nb_input_channels = av_get_channel_layout_nb_channels(link->channel_layout);
|
||||
if (pan->need_renumber) {
|
||||
// input channels were given by their name: renumber them
|
||||
for (i = j = 0; i < MAX_CHANNELS; i++) {
|
||||
@ -271,7 +271,7 @@ static int config_props(AVFilterLink *link)
|
||||
|
||||
// sanity check; can't be done in query_formats since the inlink
|
||||
// channel layout is unknown at that time
|
||||
if (pan->nb_input_channels > SWR_CH_MAX ||
|
||||
if (link->channels > SWR_CH_MAX ||
|
||||
pan->nb_output_channels > SWR_CH_MAX) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"libswresample support a maximum of %d channels. "
|
||||
@ -286,6 +286,10 @@ static int config_props(AVFilterLink *link)
|
||||
0, ctx);
|
||||
if (!pan->swr)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!link->channel_layout)
|
||||
av_opt_set_int(pan->swr, "ich", link->channels, 0);
|
||||
if (!pan->out_channel_layout)
|
||||
av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0);
|
||||
|
||||
// gains are pure, init the channel mapping
|
||||
if (pan->pure_gains) {
|
||||
@ -293,7 +297,7 @@ static int config_props(AVFilterLink *link)
|
||||
// get channel map from the pure gains
|
||||
for (i = 0; i < pan->nb_output_channels; i++) {
|
||||
int ch_id = -1;
|
||||
for (j = 0; j < pan->nb_input_channels; j++) {
|
||||
for (j = 0; j < link->channels; j++) {
|
||||
if (pan->gain[i][j]) {
|
||||
ch_id = j;
|
||||
break;
|
||||
@ -311,7 +315,7 @@ static int config_props(AVFilterLink *link)
|
||||
if (!((pan->need_renorm >> i) & 1))
|
||||
continue;
|
||||
t = 0;
|
||||
for (j = 0; j < pan->nb_input_channels; j++)
|
||||
for (j = 0; j < link->channels; j++)
|
||||
t += pan->gain[i][j];
|
||||
if (t > -1E-5 && t < 1E-5) {
|
||||
// t is almost 0 but not exactly, this is probably a mistake
|
||||
@ -320,7 +324,7 @@ static int config_props(AVFilterLink *link)
|
||||
"Degenerate coefficients while renormalizing\n");
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < pan->nb_input_channels; j++)
|
||||
for (j = 0; j < link->channels; j++)
|
||||
pan->gain[i][j] /= t;
|
||||
}
|
||||
av_opt_set_int(pan->swr, "icl", link->channel_layout, 0);
|
||||
@ -335,7 +339,7 @@ static int config_props(AVFilterLink *link)
|
||||
// summary
|
||||
for (i = 0; i < pan->nb_output_channels; i++) {
|
||||
cur = buf;
|
||||
for (j = 0; j < pan->nb_input_channels; j++) {
|
||||
for (j = 0; j < link->channels; j++) {
|
||||
r = snprintf(cur, buf + sizeof(buf) - cur, "%s%.3g i%d",
|
||||
j ? " + " : "", pan->gain[i][j], j);
|
||||
cur += FFMIN(buf + sizeof(buf) - cur, r);
|
||||
|
@ -109,7 +109,7 @@ static int init(AVFilterContext *ctx)
|
||||
|
||||
if (eval->chlayout_str) {
|
||||
int n;
|
||||
ret = ff_parse_channel_layout(&eval->chlayout, eval->chlayout_str, ctx);
|
||||
ret = ff_parse_channel_layout(&eval->chlayout, NULL, eval->chlayout_str, ctx);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int init(AVFilterContext *ctx)
|
||||
null->sample_rate_str, ctx)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = ff_parse_channel_layout(&null->channel_layout,
|
||||
if ((ret = ff_parse_channel_layout(&null->channel_layout, NULL,
|
||||
null->channel_layout_str, ctx)) < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -110,8 +110,8 @@ void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
|
||||
|
||||
(*count)++;
|
||||
for (i = idx + 1; i < *count; i++)
|
||||
if (*links[i])
|
||||
(*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
|
||||
if ((*links)[i])
|
||||
(*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++;
|
||||
}
|
||||
|
||||
int avfilter_link(AVFilterContext *src, unsigned srcpad,
|
||||
@ -468,7 +468,7 @@ int avfilter_register(AVFilter *filter)
|
||||
|
||||
filter->next = NULL;
|
||||
|
||||
while(avpriv_atomic_ptr_cas((void * volatile *)f, NULL, filter))
|
||||
while(*f || avpriv_atomic_ptr_cas((void * volatile *)f, NULL, filter))
|
||||
f = &(*f)->next;
|
||||
|
||||
return 0;
|
||||
|
@ -575,6 +575,10 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
|
||||
av_log(link->src, AV_LOG_ERROR, "Cannot select channel layout for"
|
||||
" the link between filters %s and %s.\n", link->src->name,
|
||||
link->dst->name);
|
||||
if (!link->in_channel_layouts->all_counts)
|
||||
av_log(link->src, AV_LOG_ERROR, "Unknown channel layouts not "
|
||||
"supported, try specifying a channel layout using "
|
||||
"'aformat=channel_layouts=something'.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
link->in_channel_layouts->nb_channel_layouts = 1;
|
||||
@ -657,7 +661,8 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
|
||||
if (inlink->type != outlink->type || fmts->nb_channel_layouts == 1)
|
||||
continue;
|
||||
|
||||
if (fmts->all_layouts) {
|
||||
if (fmts->all_layouts &&
|
||||
(!FF_LAYOUT2COUNT(fmt) || fmts->all_counts)) {
|
||||
/* Turn the infinite list into a singleton */
|
||||
fmts->all_layouts = fmts->all_counts = 0;
|
||||
ff_add_channel_layout(&outlink->in_channel_layouts, fmt);
|
||||
|
@ -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); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
@ -106,12 +106,12 @@ int main(int argc, char **argv)
|
||||
/* create a link for each of the input pads */
|
||||
for (i = 0; i < filter_ctx->input_count; 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->output_count; 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;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user