x262.git
11 years agoSSE2 zigzag_interleave
Jason Garrett-Glaser [Tue, 17 Mar 2009 18:01:57 +0000 (11:01 -0700)]
SSE2 zigzag_interleave
Replace PHADD with FastShuffle (more accurate naming).
This flag represents asm functions that rely on fast SSE2 shuffle units, and thus are only faster on Phenom, Nehalem, and Penryn CPUs.

11 years agoFaster integral_init
Jason Garrett-Glaser [Tue, 10 Mar 2009 06:37:53 +0000 (23:37 -0700)]
Faster integral_init
palignr to avoid unaligned loads is worth it in inith, but not initv.

11 years agoFaster SSSE3 hpel_filter_v
Holger Lubitz [Mon, 9 Mar 2009 21:05:16 +0000 (14:05 -0700)]
Faster SSSE3 hpel_filter_v
~10% faster hpel_filter on 64-bit Penryn.
32-bit version by Jason Garrett-Glaser.

11 years agoFaster SSE2 pixel_var
Jason Garrett-Glaser [Sun, 8 Mar 2009 00:43:09 +0000 (16:43 -0800)]
Faster SSE2 pixel_var
Optimized using the DEINTB method from r1122.  ~32% faster var_16x16 on Conroe.

11 years agoSSSE3 hpel_filter_v
Jason Garrett-Glaser [Sat, 7 Mar 2009 08:27:27 +0000 (00:27 -0800)]
SSSE3 hpel_filter_v
Optimized using the same method as in r1122.  Patch partially by Holger.
~8% faster hpel filter on 64-bit Nehalem

11 years agoUpdate some asm copyright headers
Jason Garrett-Glaser [Sat, 7 Mar 2009 02:57:15 +0000 (18:57 -0800)]
Update some asm copyright headers

11 years agoVastly faster SATD/SA8D/Hadamard_AC/SSD/DCT/IDCT
Holger Lubitz [Sat, 7 Mar 2009 02:16:30 +0000 (18:16 -0800)]
Vastly faster SATD/SA8D/Hadamard_AC/SSD/DCT/IDCT
Heavily optimized for Core 2 and Nehalem, but performance should improve on all modern x86 CPUs.
16x16 SATD: +18% speed on K8(64bit), +22% on K10(32bit), +42% on Penryn(64bit), +44% on Nehalem(64bit), +50% on P4(32bit), +98% on Conroe(64bit)
Similar performance boosts in SATD-like functions (SA8D, hadamard_ac) and somewhat less in DCT/IDCT/SSD.
Overall performance boost is up to ~15% on 64-bit Conroe.

11 years agoUpdate x264 copyright date
Jason Garrett-Glaser [Fri, 6 Mar 2009 23:28:47 +0000 (15:28 -0800)]
Update x264 copyright date

11 years agoRemove pre-scenecut from fprofile commands as well
Jason Garrett-Glaser [Wed, 4 Mar 2009 11:16:06 +0000 (03:16 -0800)]
Remove pre-scenecut from fprofile commands as well
Also add psy-trellis to fprofile

11 years agoSlightly faster 8x16 SAD on Penryn Core 2
Jason Garrett-Glaser [Wed, 4 Mar 2009 00:21:52 +0000 (16:21 -0800)]
Slightly faster 8x16 SAD on Penryn Core 2
Same as MMX 8x16 cacheline SAD, but calls SSE2 8x16 SAD in non-cacheline case.
Only Nehalem benefits from sizes smaller than 8x16, and Nehalem doesn't use cacheline functions, so no smaller versions are included.

11 years agoFix scenecut and VBV with videos of width/height <= 32
Jason Garrett-Glaser [Fri, 27 Feb 2009 03:50:09 +0000 (19:50 -0800)]
Fix scenecut and VBV with videos of width/height <= 32
Also remove an unused variable

11 years agoRemove non-pre scenecut
Jason Garrett-Glaser [Thu, 26 Feb 2009 22:29:50 +0000 (14:29 -0800)]
Remove non-pre scenecut
Add support for no-b-adapt + pre-scenecut (patch by BugMaster)
Pre-scenecut was generally better than regular scenecut in terms of accuracy and regular scenecut didn't work in threaded mode anyways.
Add no-scenecut option (scenecut=0 is now no scenecut; previously it was -1)
Fix an incorrect bias towards P-frames near scenecuts with B-adapt 2.
Simplify pre-scenecut code.

11 years agoAdd AltiVec version of hadamard_ac. 2.4x faster than the C version.
Guillaume Poirier [Tue, 3 Mar 2009 15:44:18 +0000 (07:44 -0800)]
Add AltiVec version of hadamard_ac. 2.4x faster than the C version.
Note this this implementation is pretty naive and should be improved
by implementing what's discussed in this ML thread:
date: Mon, Feb 2, 2009 at 6:58 PM
subject: Re: [x264-devel] [PATCH] AltiVec implementation of hadamard_ac routines

11 years agoFix regression in r1085
Jason Garrett-Glaser [Thu, 26 Feb 2009 20:07:56 +0000 (12:07 -0800)]
Fix regression in r1085
Deblocking was very slightly incorrect with partitions=all.
Bug found by BugMaster.

11 years agoOptimize neighbor CBP calculation and fix related regression
Jason Garrett-Glaser [Mon, 16 Feb 2009 13:56:12 +0000 (05:56 -0800)]
Optimize neighbor CBP calculation and fix related regression
r1105 introduced array overflow in cbp handling

11 years agoShow FPS when importing a raw YUV file
Tal Aloni [Sat, 14 Feb 2009 00:30:14 +0000 (16:30 -0800)]
Show FPS when importing a raw YUV file

11 years agoWindows 64-bit support
Anton Mitrofanov [Wed, 11 Feb 2009 18:38:56 +0000 (10:38 -0800)]
Windows 64-bit support
A "make distclean" is probably required after updating to this revision.

11 years agoMinor fixes and cosmetics
Jason Garrett-Glaser [Wed, 11 Feb 2009 18:35:56 +0000 (10:35 -0800)]
Minor fixes and cosmetics
Suppress a GCC warning, fix a non-problematic array overflow, one REP->REP_RET.

11 years agofix 10l in 75b495f2723fcb77f
Manuel [Tue, 10 Feb 2009 20:06:47 +0000 (12:06 -0800)]
fix 10l in 75b495f2723fcb77f
Original thread:
date: Mon, Feb 9, 2009 at 9:37 PM
subject: [x264-devel] commit: Spare a vec_perm and a vec_mergeh though using a LUT of permutation vectors . (Guillaume Poirier )

11 years agoSpare a vec_perm and a vec_mergeh though using a LUT of permutation vectors.
Guillaume Poirier [Mon, 9 Feb 2009 20:17:33 +0000 (21:17 +0100)]
Spare a vec_perm and a vec_mergeh though using a LUT of permutation vectors.

11 years agoPromote chroma planes to 16 byte alignment.
Guillaume Poirier [Mon, 9 Feb 2009 20:12:23 +0000 (21:12 +0100)]
Promote chroma planes to 16 byte alignment.
This will allow simplifying vectors loads that can only load 16-bytes
aligned data (such as AltiVec).

11 years agoFix 10L in intra pred
Jason Garrett-Glaser [Mon, 9 Feb 2009 19:30:54 +0000 (11:30 -0800)]
Fix 10L in intra pred
Forgetting a %define resulted in SIGILL on 32-bit systems without SSE (e.g. Athlon XP).

11 years agoAdd decimation in i16x16 blocks
Jason Garrett-Glaser [Mon, 9 Feb 2009 07:36:40 +0000 (23:36 -0800)]
Add decimation in i16x16 blocks
Up to +0.04db with CAVLC, generally a lot less with CABAC.

11 years agoMuch faster CABAC residual context selection
Jason Garrett-Glaser [Sat, 7 Feb 2009 10:27:16 +0000 (02:27 -0800)]
Much faster CABAC residual context selection
Up to ~17% faster CABAC RDO, ~36% faster intra-only CABAC RDO.
Up to 7% faster overall in extreme cases.

11 years agoFaster coeff_last64 on 32-bit
Jason Garrett-Glaser [Sat, 7 Feb 2009 09:57:43 +0000 (01:57 -0800)]
Faster coeff_last64 on 32-bit

11 years agoMore intra pred asm optimizations
Jason Garrett-Glaser [Fri, 6 Feb 2009 10:59:36 +0000 (02:59 -0800)]
More intra pred asm optimizations
SSSE3 version of predict_8x8_hu
SSE2 version of predict_8x8c_p
SSSE3 versions of both planar prediction functions
Optimizations to predict_16x16_p_sse2
Some unnecessary REP_RETs -> RETs.
SSE2 version of predict_8x8_vr by Holger.
SSE2 version of predict_8x8_hd.
Don't compile MMX versions of some of the pred functions on x86_64.
Remove now-useless x86_64 C versions of 4x4 pred functions.
Rewrite some of the x86_64-only C functions in asm.

11 years agoSpeed-up mc_chroma_altivec by using vec_mladd cleverly, and unrolling.
Manuel [Sun, 8 Feb 2009 20:35:51 +0000 (21:35 +0100)]
Speed-up mc_chroma_altivec by using vec_mladd cleverly, and unrolling.
Also put width == 2 variant in its own scalar function because it's faster
than a vectorized one.

11 years agoMerging Holger's GSOC branch part 2: intra prediction
Holger Lubitz [Wed, 4 Feb 2009 20:46:17 +0000 (12:46 -0800)]
Merging Holger's GSOC branch part 2: intra prediction
Assembly versions of most remaining 4x4 and 8x8 intra pred functions.
Assembly version of predict_8x8_filter.
A few other optimizations.
Primarily Core 2-optimized.

11 years ago10l: fix compilation with GCC 4.3+
Guillaume Poirier [Wed, 4 Feb 2009 10:04:55 +0000 (10:04 +0000)]
10l: fix compilation with GCC 4.3+

11 years agoFaster 8x8dct+CAVLC interleave
Jason Garrett-Glaser [Sat, 31 Jan 2009 13:00:39 +0000 (05:00 -0800)]
Faster 8x8dct+CAVLC interleave
Integrate array_non_zero with the CAVLC 8x8dct interleave function.
Roughly 1.5-2x faster than the original separate array_non_zero method.

11 years agoMeasure CBP cost in i8x8 RD refinement
Jason Garrett-Glaser [Sat, 31 Jan 2009 09:00:26 +0000 (01:00 -0800)]
Measure CBP cost in i8x8 RD refinement
~0.02-0.05db PSNR gain at high quants in intra-only encoding, pretty small otherwise.
Allows a small optimization in i8x8 encoding.

11 years agoTake advantage of saturated signed horizontal sum instructions in
Guillaume Poirier [Sun, 1 Feb 2009 19:58:00 +0000 (20:58 +0100)]
Take advantage of saturated signed horizontal sum instructions in
the variance computation epilogue since there won't be any overflow
triggering an overflow.
Suggested by Loren Merritt

11 years agoMassive overhaul of nnz/cbp calculation
Jason Garrett-Glaser [Fri, 30 Jan 2009 11:40:54 +0000 (03:40 -0800)]
Massive overhaul of nnz/cbp calculation
Modify quantization to also calculate array_non_zero.
PPC assembly changes by gpoirior.
New quant asm includes some small tweaks to quant and SSE4 versions using ptest for the array_non_zero.
Use this new feature of quant to merge nnz/cbp calculation directly with encoding and avoid many unnecessary calls to dequant/zigzag/decimate/etc.
Also add new i16x16 DC-only iDCT with asm.
Since intra encoding now directly calculates nnz, skip_intra now backs up nnz/cbp as well.
Output should be equivalent except when using p4x4+RDO because of a subtlety involving old nnz values lying around.
Performance increase in macroblock_encode: ~18% with dct-decimate, 30% without at CRF 25.
Overall performance increase 0-6% depending on encoding settings.

11 years agoAdd PowerPC support for "checkasm --bench", reading the time base register.
Guillaume Poirier [Thu, 29 Jan 2009 09:28:12 +0000 (01:28 -0800)]
Add PowerPC support for "checkasm --bench", reading the time base register.
This isn't ideal since the `time base' register is running at a fraction
of the processor cycle speed, so the measurement isn't as precise as x86's
rdtsc.
It's better than nothing though...

11 years agofix detection of pthread and isfinite on OpenBSD
Brad [Thu, 29 Jan 2009 04:35:34 +0000 (04:35 +0000)]
fix detection of pthread and isfinite on OpenBSD

11 years agoremove $ECHON kludge, which broke on SunOS. bring back `gcc -MT`.
Loren Merritt [Tue, 27 Jan 2009 05:42:51 +0000 (05:42 +0000)]
remove $ECHON kludge, which broke on SunOS. bring back `gcc -MT`.
remove auto-reconfigure on svn update, which has done nothing since we stopped using svn.
fix $AS on sparc (was disabled by mmx check).
fix --extra-asflags (was ignored).
mark bash scripts as bash, not sh

patch partly by Greg Robinson and Jugdish.

11 years ago1.6x faster satd_c (and sa8d and hadamard_ac) with pseudo-simd.
Loren Merritt [Mon, 26 Jan 2009 14:28:48 +0000 (14:28 +0000)]
1.6x faster satd_c (and sa8d and hadamard_ac) with pseudo-simd.
60KB smaller binary.

11 years agoHack around a potential failure point in VBV
Jason Garrett-Glaser [Wed, 28 Jan 2009 07:27:56 +0000 (23:27 -0800)]
Hack around a potential failure point in VBV
pred_b_from_p can become absurdly large in static scenes, leading to rare collapses of quality with VBV+B-frames+threads.
This isn't a final fix, but should resolve the problem in most cases in the meantime.

11 years agoMuch faster chroma encoding and other opts
Jason Garrett-Glaser [Tue, 27 Jan 2009 07:43:25 +0000 (23:43 -0800)]
Much faster chroma encoding and other opts
~15% faster chroma encode by reorganizing CBP calculation and adding special-case idct_dc function, since most coded chroma blocks are DC-only.
Small optimization in cache_save (skip_bp)
Fix array_non_zero to not violate strict aliasing (should eliminate miscompilation issues in the future)
Add in automatic substitutions for some asm instructions that have an equivalent smaller representation.

11 years agoadd AltiVec implementation of x264_mc_copy_w16_aligned
Guillaume Poirier [Mon, 26 Jan 2009 14:28:23 +0000 (06:28 -0800)]
add AltiVec implementation of x264_mc_copy_w16_aligned

11 years agoadd AltiVec implementation of x264_pixel_var_16x16 and x264_pixel_var_8x8
Guillaume Poirier [Fri, 23 Jan 2009 21:53:06 +0000 (13:53 -0800)]
add AltiVec implementation of x264_pixel_var_16x16 and x264_pixel_var_8x8

11 years agoadd AltiVec 16 <-> 32 bits conversions macros
Guillaume Poirier [Fri, 23 Jan 2009 09:11:20 +0000 (01:11 -0800)]
add AltiVec 16 <-> 32 bits conversions macros

11 years agoReplace 16x16=>32 mul + pack + add by a simple 16x16=>16 multiply-add.
Guillaume Poirier [Mon, 19 Jan 2009 20:29:27 +0000 (21:29 +0100)]
Replace 16x16=>32 mul + pack + add by a simple 16x16=>16 multiply-add.
Suggested by Loren.

11 years agoEliminate support for direct_8x8_inference=0
Jason Garrett-Glaser [Mon, 19 Jan 2009 23:17:53 +0000 (15:17 -0800)]
Eliminate support for direct_8x8_inference=0
The benefit in the most extreme contrived situation was at most 0.001db PSNR, at the cost of slower decoding.
As this option was basically useless, it was a waste of code and prevented some other useful optimizations.
Remove some unused mc code related to sub-8x8 partitions.
Small deblocking speedup when p4x4 is used.
Also remove unused x264_nal_decode prototype from x264.h.

11 years agoAdd AltiVec and CPU numbers detection on OpenBSD.
Brad [Mon, 19 Jan 2009 13:14:53 +0000 (05:14 -0800)]
Add AltiVec and CPU numbers detection on OpenBSD.

11 years agoAdd AltiVec implementation of predict_8x8c_p. 2.6x faster than scalar C.
Guillaume Poirier [Sun, 18 Jan 2009 21:44:14 +0000 (22:44 +0100)]
Add AltiVec implementation of predict_8x8c_p. 2.6x faster than scalar C.

11 years agoWarn if direct auto wasn't set on the first pass
Jason Garrett-Glaser [Sat, 17 Jan 2009 20:16:37 +0000 (15:16 -0500)]
Warn if direct auto wasn't set on the first pass
And, if it wasn't, run direct auto as if it was the first pass, rather than simply forcing temporal direct mode on all frames.
Also a small tweak to coeff_level_run asm.

11 years agoChanges the PowerPC ppccommon.h header so it no longer checks for a particular
Brad [Sat, 17 Jan 2009 12:52:28 +0000 (12:52 +0000)]
Changes the PowerPC ppccommon.h header so it no longer checks for a particular
OS such as Linux but instead looks for HAVE_ALTIVEC_H being set.
Fixes all *BSD/PowerPC builds.

11 years agoupdate x264_hpel_filter_altivec's prototype to match the one of the C version.
Guillaume Poirier [Wed, 14 Jan 2009 20:56:31 +0000 (21:56 +0100)]
update x264_hpel_filter_altivec's prototype to match the one of the C version.
It changed in commit 045ae4045a1827555b3eaab4fbf3c9809e98c58f (factorization of mallocs)
(NB: Altivec implementation wasn't allocating and writing to any scratch memory.)

11 years agorename vector+array unions to closer match the vector typedefs names.
Guillaume Poirier [Wed, 14 Jan 2009 20:49:42 +0000 (21:49 +0100)]
rename vector+array unions to closer match the vector typedefs names.

11 years agoAdd Altivec implementation of all the remaining 16x16 predict routines.
Guillaume Poirier [Wed, 14 Jan 2009 20:13:58 +0000 (21:13 +0100)]
Add Altivec implementation of all the remaining 16x16 predict routines.

11 years agoCache ref costs and use more accurate MV costs
Jason Garrett-Glaser [Wed, 14 Jan 2009 02:11:50 +0000 (21:11 -0500)]
Cache ref costs and use more accurate MV costs
New MV costs should improve quality slightly by improving the smoothness of the field of MV costs (and they're closer to CABAC's actual costs).
Despite being optimized for CABAC, they still help under CAVLC, albeit less.
MV cost change by Loren Merritt

11 years agoSupport forced frametypes with scenecut/b-adapt
Jason Garrett-Glaser [Wed, 14 Jan 2009 01:22:36 +0000 (20:22 -0500)]
Support forced frametypes with scenecut/b-adapt
This allows an input qpfile to be used to force I-frames, for example.
The same can be done through the library interface.
Document the format of the qpfile in --longhelp and the forcing of frametypes in x264.h
Note that forcing B-frames and B-refs may not always have the intended result.
Patch partially by Steven Walters <kemuri9@gmail.com>.

11 years agoRemove an IDIV from i8x8 analysis
Jason Garrett-Glaser [Wed, 14 Jan 2009 00:58:44 +0000 (19:58 -0500)]
Remove an IDIV from i8x8 analysis
Only one IDIV is left in macroblock level code (transform_rd)

11 years agoFix regression in r1066
Jason Garrett-Glaser [Thu, 8 Jan 2009 20:07:16 +0000 (15:07 -0500)]
Fix regression in r1066
With some combinations of video width and other settings, the scratch buffer was slightly too small.
This caused heap corruption on some systems.
Also prevent merange from being raised during encoding with esa/tesa through encoder_reconfig, as this no longer works.

11 years agoDisable B-frames in lossless mode
Jason Garrett-Glaser [Tue, 6 Jan 2009 21:55:44 +0000 (16:55 -0500)]
Disable B-frames in lossless mode
They hurt compression anyways, and direct auto was bugged with lossless.

11 years agoFactorize in ppccommon.h the conditional inclusion of altivec.h on Linux systems.
Brad Smith [Mon, 5 Jan 2009 22:53:11 +0000 (22:53 +0000)]
Factorize in ppccommon.h the conditional inclusion of altivec.h on Linux systems.

11 years agoDisable __builtin_clz() intrinsic on gcc versions prior to 3.4.
Brad Smith [Mon, 5 Jan 2009 20:58:32 +0000 (15:58 -0500)]
Disable __builtin_clz() intrinsic on gcc versions prior to 3.4.
The function did not exist before that version.

11 years agoSmall tweaks to coeff asm
Jason Garrett-Glaser [Fri, 2 Jan 2009 02:44:00 +0000 (21:44 -0500)]
Small tweaks to coeff asm
Factor out a few redundant pxors
Related cosmetics

11 years agoUse the correct strtok under MSVC
Steven Walters [Wed, 31 Dec 2008 03:20:37 +0000 (22:20 -0500)]
Use the correct strtok under MSVC
Also change one malloc -> x264_malloc

11 years agoAdd stack alignment for lookahead functions
Jason Garrett-Glaser [Wed, 31 Dec 2008 03:14:45 +0000 (22:14 -0500)]
Add stack alignment for lookahead functions
Should allow libx264 to be called from non-gcc-compiled applications without adding force_align_arg_pointer.

11 years agoAdd support for SSE4a (Phenom) LZCNT instruction
Jason Garrett-Glaser [Wed, 31 Dec 2008 01:47:45 +0000 (20:47 -0500)]
Add support for SSE4a (Phenom) LZCNT instruction
Significantly speeds up coeff_last and coeff_level_run on Phenom CPUs for faster CAVLC and CABAC.
Also a small tweak to coeff_level_run asm.

11 years agofactor mallocs out of hpel, ssim, and esa.
Steven Walters [Mon, 29 Dec 2008 05:14:26 +0000 (05:14 +0000)]
factor mallocs out of hpel, ssim, and esa.
there should now be no memory allocation outside of init-time.

11 years agoMuch faster CAVLC RDO and bitstream writing
Jason Garrett-Glaser [Tue, 30 Dec 2008 03:12:17 +0000 (03:12 +0000)]
Much faster CAVLC RDO and bitstream writing
Pure asm version of level/run coding.  Over 2x faster than C.
Up to 40% faster CAVLC RDO.  Overall benefit up to ~7.5% with RDO or ~5% with fast encoding settings.

11 years agoCosmetics: cleaner syntax for defining temporary registers in asm
Loren Merritt [Tue, 30 Dec 2008 02:52:25 +0000 (21:52 -0500)]
Cosmetics: cleaner syntax for defining temporary registers in asm
Globally define t#[qdwb], so that only t# needs to be locally defined when reorganizing registers

11 years agoMuch faster CABAC RDO
Jason Garrett-Glaser [Sun, 28 Dec 2008 02:36:14 +0000 (21:36 -0500)]
Much faster CABAC RDO
Since RDO doesn't care about what order bit costs are calculated, merge sigmap and level coding into the same loop in RDO.
This is bit-exact for 4x4dct but slightly incorrect for 8x8dct due to the sigmap containing duplicated contexts.
However, the PSNR penalty of this is extremely small (~0.001db).
Speed benefit is about 15% in 4x4dct and 30% in 8x8dct residual bit cost calculation at QP20.
Overall encoding speed benefit is up to 5%, depending on encoding settings.
Also remove an old unnecessary CABAC table that hasn't been used for years.

11 years agoVLC table optimizations
Jason Garrett-Glaser [Fri, 26 Dec 2008 12:35:49 +0000 (07:35 -0500)]
VLC table optimizations
Slightly reorganize VLC tables for ~2% faster block_residual_write_cavlc.
Also a small optimization in p8x8 CAVLC.

11 years agoFix crash in --me esa/tesa introduced in r1058
Loren Merritt [Thu, 25 Dec 2008 03:58:17 +0000 (22:58 -0500)]
Fix crash in --me esa/tesa introduced in r1058
Also suppress the last mingw warning message

11 years agoOptimize variance asm + minor changes
Jason Garrett-Glaser [Wed, 24 Dec 2008 03:33:28 +0000 (22:33 -0500)]
Optimize variance asm + minor changes
Remove SAD argument from var, not needed anymore.
Speed up var asm a bit by eliminating psadbw and instead HADDWing at end.
Eliminate all remaining warnings on gcc 3.4 on cygwin
Port another minor optimization from lavc (pskip)

11 years agoMinor CABAC cleanups and related optimizations
Jason Garrett-Glaser [Tue, 23 Dec 2008 23:31:48 +0000 (18:31 -0500)]
Minor CABAC cleanups and related optimizations
Merge the two list tables to allow cleaner MC/CABAC/CAVLC code
Remove lots of unnecessary {s
Port some very minor opts from lavc

11 years agofaster ESA init
Loren Merritt [Thu, 11 Dec 2008 19:47:17 +0000 (19:47 +0000)]
faster ESA init
reduce memory if using ESA and not p4x4

11 years agoMore macroblock_cache optimizations
Jason Garrett-Glaser [Tue, 16 Dec 2008 07:02:49 +0000 (23:02 -0800)]
More macroblock_cache optimizations
Patch partially by Loren Merritt

11 years agoFaster macroblock_cache_rect
Jason Garrett-Glaser [Mon, 15 Dec 2008 21:15:29 +0000 (13:15 -0800)]
Faster macroblock_cache_rect
Explicit loop unrolling

11 years agoOptimizations in predict_mv_direct
Jason Garrett-Glaser [Mon, 15 Dec 2008 02:30:51 +0000 (18:30 -0800)]
Optimizations in predict_mv_direct
Add some early terminations and minor optimizations
This change may also fix the extremely rare direct+threading MV bug.

11 years agoFix visual corruption when picture width was not mod 32.
David Wolstencroft [Sun, 14 Dec 2008 10:47:28 +0000 (10:47 +0000)]
Fix visual corruption when picture width was not mod 32.
The previous Altivec implemention of mc_chroma assumed that i_src_stride was always mod 16.

11 years agoAdd support for FSF GCC version >= 4.3 on OSX.
Guillaume Poirier [Mon, 8 Dec 2008 20:11:45 +0000 (21:11 +0100)]
Add support for FSF GCC version >= 4.3 on OSX.
So far, only Apple GCC version was supported.

11 years agoMore accurate refcost for p8x8 CAVLC
Jason Garrett-Glaser [Fri, 12 Dec 2008 01:31:52 +0000 (17:31 -0800)]
More accurate refcost for p8x8 CAVLC
Slightly better quality, especially in non-RD mode, with CAVLC.

11 years agouse lookup tables instead of actual exp/pow for AQ
Loren Merritt [Thu, 11 Dec 2008 04:54:17 +0000 (20:54 -0800)]
use lookup tables instead of actual exp/pow for AQ
Significant speed boost, especially on CPUs with atrociously slow floating point units (e.g. Pentium 4 saves 800 clocks per MB with this change).
Add x264_clz function as part of the LUT system: this may be useful later.
Note this changes output somewhat as the numbers from the lookup table are not exact.

11 years agoSuppress saveptr warnings on Windows GCC
Jason Garrett-Glaser [Thu, 11 Dec 2008 04:53:13 +0000 (20:53 -0800)]
Suppress saveptr warnings on Windows GCC

11 years agoMore small speed tweaks to macroblock.c
Jason Garrett-Glaser [Thu, 11 Dec 2008 04:52:06 +0000 (20:52 -0800)]
More small speed tweaks to macroblock.c

11 years agoMuch faster CAVLC residual coding
Jason Garrett-Glaser [Mon, 8 Dec 2008 21:44:23 +0000 (13:44 -0800)]
Much faster CAVLC residual coding
Use a VLC table for common levelcodes instead of constructing them on-the-spot
Branchless version of i_trailing calculation (2x faster on Nehalem)
Completely remove array_non_zero_count and instead use the count calculated in level/run coding.  Note: this slightly changes output with subme > 7 due to different nonzero counts being stored during qpel RD.

11 years agofix compilation with GCC-4.3+
Guillaume Poirier [Fri, 5 Dec 2008 21:26:55 +0000 (22:26 +0100)]
fix compilation with GCC-4.3+

11 years agoHigh Profile allows 25% higher maxbitrate/cpb
Jason Garrett-Glaser [Sun, 30 Nov 2008 07:13:58 +0000 (23:13 -0800)]
High Profile allows 25% higher maxbitrate/cpb
Correct level detection to take this into account.

11 years agos/nasm/yasm in VS project file
BugMaster [Sat, 29 Nov 2008 22:04:29 +0000 (14:04 -0800)]
s/nasm/yasm in VS project file

11 years agoCosmetic: update various file headers.
Jason Garrett-Glaser [Sat, 29 Nov 2008 12:49:18 +0000 (04:49 -0800)]
Cosmetic: update various file headers.

11 years agoadd date and compiler to `x264 --version`
Loren Merritt [Sat, 29 Nov 2008 11:54:02 +0000 (11:54 +0000)]
add date and compiler to `x264 --version`

11 years ago10L in r1041
Jason Garrett-Glaser [Fri, 28 Nov 2008 22:32:11 +0000 (14:32 -0800)]
10L in r1041

11 years agoSignificantly faster CABAC and CAVLC residual coding and bit cost calculation
Jason Garrett-Glaser [Fri, 28 Nov 2008 03:37:56 +0000 (19:37 -0800)]
Significantly faster CABAC and CAVLC residual coding and bit cost calculation
Early-terminate in residual writing using stored nnz counts
To allow the above, store nnz counts for luma and chroma DC
Add assembly functions to find the last nonzero coefficient in a block
Overall ~1.9% faster at subme9+8x8dct+qp25 with CAVLC, ~0.7% faster with CABAC
Note this changes output slightly with CABAC RDO because it requires always storing correct nnz values during RDO, which wasn't done before in cases it wasn't useful.
CAVLC output should be equivalent.

11 years agodequant_4x4_dc assembly
Jason Garrett-Glaser [Thu, 27 Nov 2008 07:42:55 +0000 (23:42 -0800)]
dequant_4x4_dc assembly
About 3.5x faster DC dequant on Conroe

11 years agofix an overflow in dct4x4dc_mmx
Loren Merritt [Thu, 27 Nov 2008 02:37:46 +0000 (02:37 +0000)]
fix an overflow in dct4x4dc_mmx
(unlikely to have occurred in any real video)

11 years agoRemove nasm support
Jason Garrett-Glaser [Wed, 26 Nov 2008 00:30:39 +0000 (16:30 -0800)]
Remove nasm support
Nasm won't correctly parse the SSE4 code introduced a few revisions ago, so we're removing support.
Users should upgrade to yasm 0.6.1 or later.

11 years agoFix rare warning messages in ratecontrol due to r1020
BugMaster [Tue, 25 Nov 2008 23:11:24 +0000 (15:11 -0800)]
Fix rare warning messages in ratecontrol due to r1020

11 years agoFix MSVC compilation and clean up MSVC build file
BugMaster [Tue, 25 Nov 2008 23:10:43 +0000 (15:10 -0800)]
Fix MSVC compilation and clean up MSVC build file
Remove Release64 which never worked anyways.

11 years agoFaster width4 SSD+SATD, SSE4 optimizations
Jason Garrett-Glaser [Tue, 25 Nov 2008 09:04:26 +0000 (01:04 -0800)]
Faster width4 SSD+SATD, SSE4 optimizations
Do satd 4x8 by transposing the two blocks' positions and running satd 8x4.
Use pinsrd (SSE4) for faster width4 SSD
Globally replace movlhps with punpcklqdq (it seems to be faster on Conroe)
Move mask_misalign declaration to cpu.h to avoid warning in encoder.c.
These optimizations help on Nehalem, Phenom, and Penryn CPUs.

11 years agofix indentation, whitespace cleanup, more consistent indentation of macro backslashes
Guillaume Poirier [Tue, 25 Nov 2008 16:27:27 +0000 (17:27 +0100)]
fix indentation, whitespace cleanup, more consistent indentation of macro backslashes

11 years agoChange some macros to be more sensitive to memory alignment, thus avoiding
David Wolstencroft [Sat, 22 Nov 2008 16:54:38 +0000 (17:54 +0100)]
Change some macros to be more sensitive to memory alignment, thus avoiding
useless loads/stores and calculations of permutation vectors.
Affected functions are all of mc_luma, mc_chroma, 'get_ref', SATD, SA8D and deblock.
Gains globally vary from ~5% - 15% on a depending on settings running on a 1.42 ghz G4.

11 years agorefactor satd. 20KB smaller binary.
Loren Merritt [Fri, 7 Nov 2008 05:31:24 +0000 (05:31 +0000)]
refactor satd. 20KB smaller binary.
refactor sa8d. slightly faster.
more checkasm for hadamard.

11 years agoFix crash with threads and SSEMisalign on Phenom
Jason Garrett-Glaser [Tue, 25 Nov 2008 05:56:24 +0000 (21:56 -0800)]
Fix crash with threads and SSEMisalign on Phenom
Misalign mask needed to be set separately for each encoding thread.

11 years agoPhenom CPU optimizations
Jason Garrett-Glaser [Fri, 21 Nov 2008 11:39:11 +0000 (03:39 -0800)]
Phenom CPU optimizations
Faster hpel_filter by using unaligned loads instead of emulated PALIGNR
Faster hpel_filter on 64-bit by using the 32-bit version (the cost of emulated PALIGNR is high enough that the savings from caching intermediate values is not worth it).
Add support for misaligned_mask on Phenom: ~2% faster hpel_filter, ~4% faster width16 multisad, 7% faster width20 get_ref.
Replace width12 mmx with width16 sse on Phenom and Nehalem: 32% faster width12 get_ref on Phenom.
Merge cpu-32.asm and cpu-64.asm
Thanks to Easy123 for contributing a Phenom box for a weekend so I could write these optimizations.

11 years agoA few tweaks to decimate asm
Jason Garrett-Glaser [Fri, 21 Nov 2008 04:11:14 +0000 (20:11 -0800)]
A few tweaks to decimate asm
A little bit faster on both 32-bit and 64-bit