1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-05 23:58:59 +02:00
Commit Graph

163 Commits

Author SHA1 Message Date
Clément Bœsch
d0e132bab6 Merge commit '1bd890ad173d79e7906c5e1d06bf0a06cca4519d'
* commit '1bd890ad173d79e7906c5e1d06bf0a06cca4519d':
  hevc: Separate adding residual to prediction from IDCT

This commit should be a noop but isn't because of the following renames:

- transform_add  → add_residual
- transform_skip → dequant
- idct_4x4_luma  → transform_4x4_luma

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-01-31 15:31:34 +01:00
Zhou Xiaoyong
5b74ebe937 avcodec/mips: version 1 of vc1dsp optimizations for loongson mmi
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-17 18:41:18 +01:00
Zhou Xiaoyong
d84e635d06 avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-13 03:47:04 +01:00
Zhou Xiaoyong
c5c6e30781 avcodec/mips: version 1 of vp8dsp optimizations for loongson mmi
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-13 03:47:04 +01:00
Zhou Xiaoyong
89ec4adad6 avcodec/mips: loongson optimize mmi load and store operators
1.MMI_ load/store macros are defined in libavutil/mips/mmiutils.h
2.Replace some unnecessary unaligned access with aligned operator
3.The MMI_ load/store is compatible with cpu loongson2e/2f which not support instructions start with gs

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-23 03:23:09 +02:00
Vicente Olivert Riera
04b0792e4a libavcodec/mips/h264dsp_msa.c: fix type in some function parameters
This fixes a build problem for MIPS architecture that looks like this:

libavcodec/mips/h264dsp_msa.c:2498:6: error: conflicting types for
‘ff_weight_h264_pixels16_8_msa’
 void ff_weight_h264_pixels16_8_msa(uint8_t *src, int stride,

This bug was introduced by commit bc26fe8927:

  avcodec/h264: Use ptrdiff_t for (bi)weight functions

That commit changed the data type of some function parameters in some
function definitions. However, the implementation of those functions in
libavcodec/mips/h264dsp_msa.c wasn't changed accordingly.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-13 19:15:48 +02:00
Michael Niedermayer
bc26fe8927 avcodec/h264: Use ptrdiff_t for (bi)weight functions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-23 04:10:44 +02:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
ZhouXiaoyong
2c7fd0e36b avcodec/mips/h264qpel_mmi.c: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator
3. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction extension bug in O32 ABI)
4. h264qpel use hepldsp optimizations

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-30 22:00:02 +02:00
ZhouXiaoyong
8392794c92 avcodec/mips/idctdsp_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
    2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-23 23:42:05 +02:00
ZhouXiaoyong
377e5db3db avcodec/mips/pixblockdsp_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
    2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-23 23:42:04 +02:00
ZhouXiaoyong
05a546181f avcodec/mips/blockdsp_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
    2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-23 23:42:03 +02:00
Zhou Xiaoyong
c749be9eb3 avcodec/mips: loongson optimize h264pred with mmi v3
1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator
3. ff_pred16x16_plane_ functions only support N64 ABI now

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-21 17:13:13 +02:00
Zhou Xiaoyong
4a963ee698 avcodec/mips: loongson optimize hpeldsp with mmi v1
1.the codes are compatible with O32 ABI
2.use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction extension bug in O32 ABI)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-21 17:13:13 +02:00
Zhou Xiaoyong
a20646bb24 avcodec/mips/mpegvideo_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-21 17:13:13 +02:00
ZhouXiaoyong
a3eb5a3cdd avcodec/mips/h264chroma_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator
3. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction extension bug in O32 ABI)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-21 14:25:33 +02:00
ZhouXiaoyong
af3e944e7e avcodec/mips/h264dsp_mmi: Version 2 of the optimizations for loongson mmi
1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator
3. optimize some unaligned loads and stores
4. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction extension bug in O32 ABI)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-17 04:18:42 +02:00
Jovan Zelincevic
b73c27151e avcodec/mips: Optimization synced to the newest code base.
FFT expanded to 2^17.

Signed-off-by: Jovan Zelincevic <jovan.zelincevic@imgtec.com>
Reviewed-by: Nedeljko Babic <Nedeljko.Babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-29 17:06:16 +02:00
Vicente Olivert Riera
ad16eff64b mips: add support for R6
Understanding the mips32r6 and mips64r6 ISAs in the configure script is
not enough. In order to have full support for MIPS R6 in FFmpeg we need
to be able to build it, and for that we need to make sure we don't use
incompatible assembler code which makes the build fail. Ifdefing the
offending code is sufficient to fix the problem.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-09 20:05:04 +01:00
Michael Niedermayer
ae76b84221 avcodec: Extend fft to size 2^17
Asked-for-by: durandal_1707

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-04 13:51:42 +01:00
Timothy Gu
180f9a0958 all: Make header guard names consistent 2016-01-31 15:44:11 -08:00
Timothy Gu
e74378aa8c amrwbdec_mips: Add missing ff_ prefix 2016-01-28 19:49:51 -08:00
Luca Barbato
c4de754d4d mathops: mips: Correctly enable loongson-specific assembly
The code wrongly assumed that the instructions used are supported
on mips64, while it is supported only on loongson cpus.
2016-01-19 20:47:49 +01:00
Claudio Freire
6711aa21e2 AAC encoder: various fixes in M/S coding
1. Fix sf_idx and band_type addressing to address only the first
subwindow in the group (others could hold garbage values)

2. Don't step on ms_mask when is_mask is set. I/S selection
already sets the ms_mask properly and shouldn't be overridden.

3. Use mid/sid cb/sf when computing coding error, as should be
since those are the cb/sfs that will eventually be set.

4. Fix distortion computation on multi-subwindow groups (was
subtracting the bits terms multiple times)

5. Clear ms_mask when one side uses PNS and the other doesn't.
When using PNS, ms_mask signals correlated noise, which can be
detected just like regular M/S detection, so we don't skip
noise bands, but when only one side uses PNS setting the flag
can confuse some encoders, so avoid that.
2016-01-13 05:28:34 -03:00
Vicente Olivert Riera
a27401a05b mips: rename mipsdspr1 to mipsdsp
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 02:35:42 +01:00
Claudio Freire
ca203e9985 AAC encoder: improve SF range utilization
This patch does 4 things, all of which interact and thus it
woudln't be possible to commit them separately without causing
either quality regressions or assertion failures.

Fate comparison targets don't all reflect improvements in
quality, yet listening tests show substantially improved quality
and stability.

1. Increase SF range utilization.

The spec requires SF delta values to be constrained within the
range -60..60. The previous code was applying that range to
the whole SF array and not only the deltas of consecutive values,
because doing so requires smarter code: zeroing or otherwise
skipping a band may invalidate lots of SF choices.

This patch implements that logic to allow the coders to utilize
the full dynamic range of scalefactors, increasing quality quite
considerably, and fixing delta-SF-related assertion failures,
since now the limitation is enforced rather than asserted.

2. PNS tweaks

The previous modification makes big improvements in twoloop's
efficiency, and every time that happens PNS logic needs to be
tweaked accordingly to avoid it from stepping all over twoloop's
decisions. This patch includes modifications of the sort.

3. Account for lowpass cutoff during PSY analysis

The closer PSY's allocation is to final allocation the better
the quality is, and given these modifications, twoloop is now
very efficient at avoiding holes. Thus, to compute accurate
thresholds, PSY needs to account for the lowpass applied
implicitly during twoloop (by zeroing high bands).

This patch makes twoloop set the cutoff in psymodel's context
the first time it runs, and makes PSY account for it during
threshold computation, making PE and threshold computations
closer to the final allocation and thus achieving better
subjective quality.

4. Tweaks to RC lambda tracking loop in relation to PNS

Without this tweak some corner cases cause quality regressions.
Basically, lambda needs to react faster to overall bitrate
efficiency changes since now PNS can be quite successful in
enforcing maximum bitrates, when PSY allocates too many bits
to the lower bands, suppressing the signals RC logic uses to
lower lambda in those cases and causing aggressive PNS.

This tweak makes PNS much less aggressive, though it can still
use some further tweaks.

Also update MIPS specializations and adjust fuzz

Also in lavc/mips/aacpsy_mips.h: remove trailing whitespace
2015-12-02 07:47:37 -03:00
Nedeljko Babic
de262d018d avcodec/mips/aaccoder_mips: Sync with the generic code
This patch fixes build of AAC encoder optimized for mips that was broken due
 to some changes in generic code that were not propagated to the optimized code.

Also, some functions in the optimized code are basically duplicate of functions
 from generic code. Since they do not bring enough improvement to the optimized
 code to justify their existence, they are removed (which improves
 maintainability of the optimized code).

Optimizations disabled in 97437bd are enabled again.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 17:22:56 +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
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
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
Shivraj Patil
322e960dbf avcodec/mips: build fix for MSA 64bit
Modified datatype of function argument (pitch from int32_t to ptrdiff_t)

Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-07 16:40:05 +02:00
Shivraj Patil
b0732b0214 avcodec/mips: build fix for MSA
Modified sps and pps access from old HEVCContext(s) structure to newly introduced HEVCParamSets(ps)

Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-07 16:40:05 +02:00
Christophe Gisquet
562ba4a827 blockdsp: remove high bitdepth parameter
It is only (mis-)used to set the dsp fucntions clear_block(s). But
these functions always work on 16bits-wide elements, which make
the parameter useless and actually harmful, as it causes all content
on more than 8-bits to not use accelerated functions.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-02 04:38:40 +02:00
Claudio Freire
b01f3ddad3 AAC encoder: simplify and speed up find_min_book
Trivial change to simplify the small but hot
find_min_book function. The new form is easier to
understand and faster.
2015-09-23 02:33:40 -03:00
Michael Niedermayer
2d35757814 avcodec/mpegvideo: Change mpeg2 unquant to work with higher precission qscale
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-18 02:39:17 +02:00
Michael Niedermayer
e1ac0ecbba avcodec/mips/aaccoder_mips: Remove duplicate include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-17 15:16:05 +02:00
Claudio Freire
8df9bf8e39 AAC encoder: refactor to resynchronize MIPS port
This patch refactors the AAC coders to reuse code
between the MIPS port and the regular, portable C code.
There were two main functions that had to use
hand-optimized versions of quantization code:
 - search_for_quantizers_twoloop
 - codebook_trellis_rate

Those two were split into their own template header
files so they can be inlined inside both the MIPS port
and the generic code. In each context, they'll link
to their specialized implementations, and thus be
optimized by the compiler.

This approach I believe is better than maintaining
several copies of each function. As past experience has
proven, having to keep those in sync was error prone.
In this way, they will remain in sync by default.

Also, an implementation of the dequantized output
argument for the optimized quantize_and_encode
functions is included in the patch. While the current
implementation of search_for_pred still isn't using
it, future iterations of main prediction probably will.
It should not imply any measurable performance hit while
not being used.
2015-09-16 23:14:26 -03:00
Timothy Gu
ca00dda216 aaccoder_mips: Fix indentation 2015-09-14 08:54:44 -07:00
Nedeljko Babic
b65ffa316e avcodec/mips/aaccoder_mips: Sync with generic aaccoder file.
Code in aaccoder_mips.c was not synced with changes in aaccoder.c for
some time.

That was cause for some fate-aac tests failing.

This patch fixes the problems.

Optimizations disabled in 933309a are enabled again.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-14 15:35:35 +02:00
周晓勇
a78656a187 avcodec: loongson delete invalid simple idct put and add optimization
Change-Id: I23a36c65915f01a1cf20e317c14b8eaaa62958b4
Signed-off-by: ZhouXiaoyong <zhouxiaoyong@loongson.cn>

Fixes Decoding of http://loongnix.org/ftp/multimedia/testing/nanocore_720p_24fps_mpeg4_ac3_short.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-08 01:04:36 +02:00
周晓勇
f7e9b9d260 avcodec: loongson optimize h264dsp idct and loop filter with mmi
Change-Id: Ic87fb8f5cd22a502ff9dbbc5a5a8ea97cfc8a1dd
Signed-off-by: ZhouXiaoyong <zhouxiaoyong@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 22:49:52 +02:00
Claudio Freire
5131ba5657 AAC: MIPS: Add missing codebooks in quantize funcs
Add entries on the quantize function tables for the missing
codebooks (which all behave like ZERO)
2015-09-03 11:27:52 -03:00
周晓勇
95010d49a2 avcodec: loongson optimize mpeg2 dct unquantize intra and denoise dct
Change-Id: I2f391ae912a079fb32f0703841dca86358aac72a
Signed-off-by: ZhouXiaoyong <zhouxiaoyong@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-02 16:53:32 +02:00
Michael Niedermayer
933309a6ca avcodec/mips/aaccoder_mips: disable optimizatios which break fate-aac-pns-encode
These should be re enabled once the issue is fixed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-02 13:04:57 +02:00
Rostislav Pehlivanov
860dbe0275 aaccoder_mips: update function definitions
This commit updates the function definitions in the aaccoder_mips.c
file. This was broken around a month or so ago with the addition
of the rounding argument.
The previous commit in this series also introduced a separate array
to put the quantization error in, this also needed to be updated,
albeit non-functional, in the MIPS optimized aaccoder file.

Credits for the rounding goes to Claudio Freire.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-21 19:00:15 +01:00
周晓勇
7fbafd0b1b avcodec: loongson optimize h264qpel with mmi v1
Signed-off-by: ZhouXiaoyong <zhouxiaoyong@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-09 20:43:54 +02:00
周晓勇
71575d98f5 avcodec: loongson optimized h264pred with mmi v2
Signed-off-by: ZhouXiaoyong <zhouxiaoyong@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-05 22:52:52 +02:00
Shivraj Patil
dec16372df avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for VP8 functions
Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
2015-08-04 11:15:06 -04:00
James Almer
a0092cea46 mips/hevcdsp: fix string concatenation on macros
Needed for old compilers like GCC 4.2

Tested by trac user brad. Fixes ticket #4745

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-07-30 20:44:32 -03:00
Shivraj Patil
71aede3ced avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for VP9 bilinear functions
Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 17:13:24 +02:00