Commit Graph

33880 Commits

Author SHA1 Message Date
Ronald S. Bultje
a35f6bdb38 vp9: add 12bpp sse2 versions of iadst4. 2015-10-13 11:05:59 -04:00
Ronald S. Bultje
235e76aeb8 vp9: initial attempt at a idct_idct_4x4 12bpp x86 simd (sse2) impl.
The trouble with this function is that intermediates overflow 31+sign
bits, so I've added some helpers (that will also be used in 10/12bpp
8x8, 16x16 and 32x32) to make that easier, basically emulating a half-
assed pmaddqd using 2xpmaddwd. It's currently sse2-only, if anyone sees
potential in adding ssse3, I'd love to hear it.
2015-10-13 11:05:58 -04:00
Ronald S. Bultje
f76423d097 vp9: add x86 simd (sse2/ssse3) for iadst4 10bpp functions. 2015-10-13 11:05:58 -04:00
Ronald S. Bultje
6b579cf547 vp9: add 10bpp simd (mmxext/ssse3) for idct_idct_4x4. 2015-10-13 11:05:58 -04:00
Ronald S. Bultje
1c3be32533 vp9: add 10/12bpp mmxext-optimized iwht_iwht_4x4 function. 2015-10-13 11:05:57 -04:00
Christophe Gisquet
b6594a9605 x86: dct-test: add more idcts
In particular for 10 and 12 bits.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 16:03:04 +02:00
Michael Niedermayer
a745d1a9e4 avcodec/dct-test: Print failure notice below the failed *dct
This makes it easier to see where a failure happens

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 16:03:03 +02:00
Christophe Gisquet
7ece8b50b1 x86: simple_idct: 12bits versions
On 12 frames of a 444p 12 bits DNxHR sequence, _put function:
C:         78902 decicycles in idct,  262071 runs,     73 skips
avx:       32478 decicycles in idct,  262045 runs,     99 skips

Difference between the 2:
stddev:    0.39 PSNR:104.47 MAXDIFF:    2

This is unavoidable and due to the scale factors used in the x86
version, which cannot match the C ones.

In addition, the trick of adding an initial bias to the input of a
pass can overflow, as the input coefficients are already 15bits,
which is the maximum this function can handle.

Overall, however, the omse on 12 bits samples goes from 0.16916 to
0.16883. Reducing rowshift by 1 improves to 0.0908, but causes
overflows.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 15:34:32 +02:00
Christophe Gisquet
4369b9dc7b x86: simple_idct(_put): 10bits versions
Modeled from the prores version. Clips to [0;1023] and is bitexact.
Bitexactness requires to add offsets in different places compared to
prores or C, and makes the function approximately 2% slower.

For 16 frames of a DNxHD 4:2:2 10bits test sequence:

C:    60861 decicycles in idct, 1048205 runs,    371 skips
sse2: 27567 decicycles in idct, 1048216 runs,    360 skips
avx:  26272 decicycles in idct, 1048171 runs,    405 skips

The add version is not implemented, so the corresponding dsp
function is set to NULL to make it clear in a code executing it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 13:32:21 +02:00
Christophe Gisquet
e652f69b35 x86: simple_idct10_template: fix overflow in pass
When the input of a pass has 15 or 16 bits of precision (in particular
the column pass), the addition of a bias to W4 may lead to overflows
in the input to pmaddwd.

This requires postponing the adding of the bias to after the first
butterfly. To do so, the fact that m15, unused although zeroed, is
exploited. In case the pass is safe, an address can be directly used,
and the number of xmm regs can be decreased. Otherwise, the 32bits bias
is loaded into it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 12:51:10 +02:00
Christophe Gisquet
2fd14dd8eb avcodec/simple_idct10: improve precision
omse goes from 0.03060703 (which fails for dct-test) to 0.01663750.
This also actually improve the error of decoding the sample generated
by fate-vsynth3-dnxhd1080i-10bit using simple_idct10 to FAANI, which
goes (when resampled to yuv422p) from:
stddev:    0.06 PSNR: 72.28 MAXDIFF:    1
to identical.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 02:10:51 +02:00
Christophe Gisquet
e9a68b0316 x86: prores: templatize 10 bits simple_idct
This should be reused for a generic simple_idct10 function.
Requires a bit of trickery to declare common constants in C.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 01:10:34 +02:00
Rostislav Pehlivanov
93e6b23c9f aacenc: shorten name of ff_aac_adjust_common_prediction
To keep it similar to the other functions which are all named *_pred.
2015-10-12 23:33:07 +01:00
Rostislav Pehlivanov
65f5b96dd8 aacenc: increase size of s->planar_samples[] from 6 to 8
Left out of last commit which added support for eight channel audio.
2015-10-12 23:25:45 +01:00
Christophe Gisquet
9f3bfe30dd mpegvideo: dnxhdenc: permute 10bits content
Dequant or encoding were trying to reverse a scan that hadn't been
applied...

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 00:01:39 +02:00
Michael Niedermayer
97437bd17a avcodec/mips/aaccoder_mips: Disable ff_aac_coder_init_mips() to prevent build failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 00:01:39 +02:00
Ricardo Constantino
53886d6955 avcodec/webvttdec: Deal with WebVTT escapes
Bare ampersand characters are still accepted, even though out-of-spec.
Also fixes adjacent tags not being parsed.

Fixes trac #4915

Signed-off-by: Ricardo Constantino <wiiaboo@gmail.com>
2015-10-12 22:04:05 +02:00
Derek Buitenhuis
1156b634c1 avcodec: Don't lock on init for codecs without an init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-12 15:25:51 -03:00
Rostislav Pehlivanov
e2749ef60a aacenc_utils: fit find_form_factor() below 80 chars per line 2015-10-12 17:14:50 +01:00
Rostislav Pehlivanov
0f4334df45 aacenc: add support for changing options based on a profile
This commit adds the ability for a profile to set the default
options, as well as for the user to override such options
by simply stating them in the command line while still keeping
the same profile, as long as those options are still permitted by
the profile.

Example: setting the profile to aac_low (the default) will turn
PNS and IS on. They can be disabled by -aac_pns 0 and -aac_is 0,
respectively. Turning on -aac_pred 1 will cause the profile to be
elevated to aac_main, as long as no options forbidding aac_main
have been entered (like AAC-LTP, which will be pushed soon).

A useful feature is that by setting the profile to mpeg2_aac_low,
all MPEG4 features will be disabled and if the user tries to enable
them then the program will exit with an error. This profile is
signalled with the same bitstream as aac_low (MPEG4) but some devices
and decoders will fail if any MPEG4 features have been enabled.
2015-10-12 16:57:56 +01:00
Rostislav Pehlivanov
b3deaece87 aacenc: add support for encoding 7.1 channel audio
This commit implements support for 7.1 channel audio. There's no
more predefined bitstream channel mappings so going beyond 8 channels
(and 7 channels exactly) will require programmable channel elements,
which is already underway.
2015-10-12 15:53:17 +01:00
Rostislav Pehlivanov
e679a1e65f aacenc_quantization: fix header description
Two guesses as to which file was used as boilerplate.
2015-10-12 15:41:50 +01:00
Claudio Freire
b629c67ddf AAC encoder: memoize quantize_band_cost
The bulk of calls to quantize_band_cost are replaced
by a call to a version that memoizes, greatly improving
performance, since during coefficient search there is
a great deal of repeat work.

Memoization cannot always be applied, so do this in a
different function, and leave the original as-is.
2015-10-12 03:56:22 -03:00
Claudio Freire
07b3b779a9 AAC encoder: fix assertion error re SF differences
Intermediate results can indeed violate SF delta. Instead of asserting
there, just make the code safe, and assert on the final result.

Also re-clamp SFs more often in short windows (which tend to violate
the restriction when encoding the switch from one window to the other)
2015-10-11 23:00:46 -03:00
Rostislav Pehlivanov
d25c033ddd aaccoder_twoloop.h: simplify and comment ff_pns_bits() 2015-10-12 01:42:43 +01:00
Rostislav Pehlivanov
5f760da6b6 aacenc_utils: add 'inline' flag to find_form_factor, silence warning
Seems it was forgotten.
2015-10-12 01:12:43 +01:00
Andreas Cadhalpun
ec0275843d avcodec: remove leftover iff_byterun1 decoder
It was merged with the iff_ilbm decoder in commit
929a24efff.

Define AV_CODEC_ID_IFF_BYTERUN1 as AV_CODEC_ID_IFF_ILBM for API
compatibility.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-12 00:21:13 +02:00
Ronald S. Bultje
93866c2aa2 intmath: remove av_ctz.
It's a non-installed header and only used in one place (flacenc).
Since ff_ctz is static inline, it's fine to use that instead.
2015-10-11 18:03:10 -04:00
Claudio Freire
323d37521d AAC encoder: cosmetics from last commit
Reindent
2015-10-11 18:06:02 -03:00
Claudio Freire
01ecb7172b AAC encoder: Extensive improvements
This finalizes merging of the work in the patches in ticket #2686.

Improvements to twoloop and RC logic are extensive.

The non-exhaustive list of twoloop improvments includes:
 - Tweaks to distortion limits on the RD optimization phase of twoloop
 - Deeper search in twoloop
 - PNS information marking to let twoloop decide when to use it
   (turned out having the decision made separately wasn't working)
 - Tonal band detection and priorization
 - Better band energy conservation rules
 - Strict hole avoidance

For rate control:
 - Use psymodel's bit allocation to allow proper use of the bit
   reservoir. Don't work against the bit reservoir by moving lambda
   in the opposite direction when psymodel decides to allocate more/less
   bits to a frame.
 - Retry the encode if the effective rate lies outside a reasonable
   margin of psymodel's allocation or the selected ABR.
 - Log average lambda at the end. Useful info for everyone, but especially
   for tuning of the various encoder constants that relate to lambda
   feedback.

Psy:
 - Do not apply lowpass with a FIR filter, instead just let the coder
   zero bands above the cutoff. The FIR filter induces group delay,
   and while zeroing bands causes ripple, it's lost in the quantization
   noise.
 - Experimental VBR bit allocation code
 - Tweak automatic lowpass filter threshold to maximize audio bandwidth
   at all bitrates while still providing acceptable, stable quality.

I/S:
 - Phase decision fixes. Unrelated to #2686, but the bugs only surfaced
   when the merge was finalized. Measure I/S band energy accounting for
   phase, and prevent I/S and M/S from being applied both.

PNS:
 - Avoid marking short bands with PNS when they're part of a window
   group in which there's a large variation of energy from one window
   to the next. PNS can't preserve those and the effect is extremely
   noticeable.

M/S:
 - Implement BMLD protection similar to the specified in
   ISO-IEC/13818:7-2003, Appendix C Section 6.1. Since M/S decision
   doesn't conform to section 6.1, a different method had to be
   implemented, but should provide equivalent protection.
 - Move the decision logic closer to the method specified in
   ISO-IEC/13818:7-2003, Appendix C Section 6.1. Specifically,
   make sure M/S needs less bits than dual stereo.
 - Don't apply M/S in bands that are using I/S

Now, this of course needed adjustments in the compare targets and
fuzz factors of the AAC encoder's fate tests, but if wondering why
the targets go up (more distortion), consider the previous coder
was using too many bits on LF content (far more than required by
psy), and thus those signals will now be more distorted, not less.

The extra distortion isn't audible though, I carried extensive
ABX testing to make sure.

A very similar patch was also extensively tested by Kamendo2 in
the context of #2686.
2015-10-11 17:29:50 -03:00
Paul B Mahol
f226c25a37 avcodec/sipr: use AVERROR return code instead of -1
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-11 18:40:28 +02:00
Michael Niedermayer
98b8bf12bc avcodec/pngdec: Use av_malloc_array()
Suggested-by: ubitux
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 16:39:41 +02:00
Michael Niedermayer
c08b06c225 avcodec/jpeg2000dec: Check that step_x/y are valid before use in JPEG2000_PGOD_PCRL
Fixes: CID1322305 and CID1322304

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 15:43:26 +02:00
Michael Niedermayer
47c5a3058e avcodec/pngdec: Alloc buffer after blend_op check in handle_p_frame_apng()
Avoids memleak on error
Fixes CID1322342

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 13:09:56 +02:00
Michael Niedermayer
1e7e4f13f9 avcodec/pngdec: Check blend_op.
Fixes CID1322359, CID1322358

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 03:46:44 +02:00
Rodger Combs
0d53a6f5b4 lavc: move bitstream filter args to the bsf ctx 2015-10-10 10:41:10 -05:00
Ganesh Ajjanagadde
979572365f avcodec/ac3enc: fix undefined negative left shift
This should fix the undefined behavior reported in:
https://trac.ffmpeg.org/ticket/4727.

I can reproduce this at runtime: simply stick in an abort call in
asym_quant to check if c < 0 and run FATE. I don't know ac3 so I can't
confirm if negative coefficients are intentional, but at the moment they
clearly are according to FATE.

This resolves the undefined behavior. Tested with FATE.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 14:43:22 +02:00
Hendrik Leppkes
c4e23ca853 Merge commit 'c3e5c47bdae2bb8219fea62d91b7455650b22c60'
* commit 'c3e5c47bdae2bb8219fea62d91b7455650b22c60':
  libopenh264enc: Added max_nal_size option

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-10 09:58:42 +02:00
Anton Khirnov
8a73b8c5b4 cabac: Make cabac starts hardcoded
There's not much reason to generate such a small table at runtime.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-10 09:52:18 +02:00
Derek Buitenhuis
9692fd7622 Revert "cabac: Allow hardcoding CABAC table."
This becomes unuseful in the following commit.

This reverts commit 092d1977cc.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-10 09:52:13 +02:00
Hendrik Leppkes
a71fff213d Merge commit '58b42345b38b46d11c32e11d9c57517f99d6a601'
* commit '58b42345b38b46d11c32e11d9c57517f99d6a601':
  dcadec: reorganise context data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-10 09:32:59 +02:00
Hendrik Leppkes
d3952510d2 Merge commit '3a4d369ea4ded91b1178ae6e2ff0ab9ea470e344'
* commit '3a4d369ea4ded91b1178ae6e2ff0ab9ea470e344':
  g2m: Relax resolution change constraints

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-10 09:13:32 +02:00
James Almer
dab5f65b25 x86/takdsp: use arithmetic shift instructions
p1 and p2 are int32_t.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-10-09 23:52:39 -03:00
赵宇龙
cd847839f3 h264_mp4toannexb: fix the pps offset when there are more than one sps in avcc
the pps offset is used to locate pps in the spspps_buf; however, the
current calc method is wrong because it is the offset of the original
avctx->extradata;
when there is only one sps in the avcc; the value is correct by
coincidence, however, it will fail in avcc with multi sps

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 01:37:00 +02:00
Michael Niedermayer
3d126ef188 avcodec/h264_mp4toannexb_bsf: Use av_freep() to free spspps_buf
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-10 01:29:22 +02:00
Ganesh Ajjanagadde
9953038728 avcodec/xvmc: apply attribute_deprecated correctly
This fixes a warning observed on Clang 3.7:
"warning: attribute 'deprecated' is ignored, place it after "struct" to apply attribute to type declaration [-Wignored-attributes]"
and thus enables deprecation warning for the relevant struct.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2015-10-09 19:01:08 -04:00
Ganesh Ajjanagadde
3be27e07d3 avcodec/mpegvideoenc: fix undefined negative left shift
This should fix the first undefined behavior reported in:
https://trac.ffmpeg.org/ticket/4727.

I can't reproduce the runtime behavior reported in the ticket, hence I
can't confirm that this actually fixes the exact issue reported in the
ticket.

Regardless, I can confirm that this is a genuine issue, and that
negative shifts can (and do) occur, fixed by this.

Tested with FATE.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-09 23:01:55 +02:00
Andreas Cadhalpun
8d6625642d doc: fix spelling errors
Reviewed-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-09 22:09:08 +02:00
Paul B Mahol
35af7add6f avcodec/takdec: add x86 SIMD for rest of decorrelation modes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-09 21:38:15 +02:00
Carl Eugen Hoyos
d6cfbcd621 lavc/mjpegenc: Add an option to force outputting chroma matrix.
RFC 2435 suggests that mjpeg over rtp uses both two tables.
2015-10-09 20:58:07 +02:00