Commit Graph

68 Commits

Author SHA1 Message Date
Andreas Rheinhardt b96b3e291c avutil/intreadwrite: Remove obsolete warning
Obsolete since 7ec2354c38.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Martin Storsjö 62fac040c8 intreadwrite: Indicate potential aliasing in AV_RN/AV_WN for Clang/MSVC mode
Use the GCC specific codepath for Clang in MSVC mode too.
This matches the condition used in a number of other places.

MSVC doesn't have a way to signal potential aliasing, while GCC
(and Clang) can use __attribute__((may_alias)) for this purpose.

When building with Clang in MSVC mode, __GNUC__ isn't defined but
_MSC_VER is as Clang primarily impersonates MSVC - but even then it
does support the GCC style attributes.

The GCC specific codepath uses av_alias, which expands to
the may_alias attribute if supported. The MSVC specific codepath
doesn't use av_alias so far (as MSVC doesn't support any
corresponding attribute).

This fixes a couple HEVC decoder tests when built with Clang 14 or
newer in MSVC mode (with issues observed on all of x86_64, armv7
and aarch64).

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-04 21:50:57 +03:00
Kieran Kunhya a4e616824b libavutil: Remove TOMI CPU 2023-07-22 00:36:53 +01:00
Peter Ross b4e6d1f597 intreadwrite: add AV_RL64A, AV_WL64A
macros for reading and writing 64-bit aligned little-endian values.

these macros are used by the DST decoder and give a performance boost
on platforms that where the compiler must guard against unaligned
memory access.
2019-01-11 23:43:37 +11:00
Mark Thompson 8e9be8ffba Merge commit '85e10c0a9321bfe0d2afe0f3983ab6a8df6e3fba'
* commit '85e10c0a9321bfe0d2afe0f3983ab6a8df6e3fba':
  intreadwrite: Use __unaligned in MSVC for ARM64 as well

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-25 22:45:45 +00:00
Martin Storsjö 85e10c0a93 intreadwrite: Use __unaligned in MSVC for ARM64 as well
This attribute is supported for this architecture in MSVC as well
(but produces errors if used for 32 bit x86).

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-01-16 22:52:11 +02:00
James Almer 12f4e2ba02 Merge commit '0af8a72174108b9bb482f1073a1e9a3bc258af51'
* commit '0af8a72174108b9bb482f1073a1e9a3bc258af51':
  build: Drop support for legacy TI ARM compiler

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 23:41:35 -03:00
James Almer c584368817 Merge commit '09c98327b9f25c6c1716c0ee82ce09d8b484887a'
* commit '09c98327b9f25c6c1716c0ee82ce09d8b484887a':
  build: Drop support for Tru64 Unix (OSF/1)

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 15:56:27 -03:00
Diego Biurrun 0af8a72174 build: Drop support for legacy TI ARM compiler 2017-10-25 13:39:58 +02:00
Diego Biurrun 09c98327b9 build: Drop support for Tru64 Unix (OSF/1)
This proprietary Unix flavor dropped from the face of the earth more
than a decade ago. Nothing of value was lost.
2017-10-10 23:17:54 +02:00
James Almer 30fe4b8d4c Merge commit 'f79d847400d218cfd0b95f10358fe6e65ec3c9c4'
* commit 'f79d847400d218cfd0b95f10358fe6e65ec3c9c4':
  intreadwrite: Use the __unaligned keyword on MSVC for ARM and x86_64

Merged-by: James Almer <jamrial@gmail.com>
2017-03-15 21:20:44 -03:00
James Almer 916dff9cb1 Merge commit '230b1c070baa3b6d4bd590426a365b843d60ff50'
* commit '230b1c070baa3b6d4bd590426a365b843d60ff50':
  intreadwrite: Add intermediate variables in the byteswise AV_W*() macros

Mostly a noop. Merged for cosmetic purposes.
See d83ff76ca0

Merged-by: James Almer <jamrial@gmail.com>
2017-03-15 21:17:37 -03:00
Martin Storsjö fc94a1acc2 Revert "libavutil: Use an intermediate variable in AV_COPY*U"
This reverts commit 014773b66b.

Since 230b1c070, the bytewise AV_W*() macros only expand their
argument once, i.e. doing exactly the same change as was done
in the AV_COPY*U macros, so this change is no longer necessary.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-08-02 21:18:18 +03:00
Martin Storsjö f79d847400 intreadwrite: Use the __unaligned keyword on MSVC for ARM and x86_64
AV_WN64 is meant for unaligned data, but the existing av_alias* unions
(without a definition for the av_alias attribute - we don't have one
for MSVC) indicate to the compiler that they would have sufficient
alignment for normal access, i.e. the compiler is free to assume
8 byte alignment.

On ARM, this makes sure that AV_WN64 (or two consecutive AV_WN32) is
done with two str instructions instead of one strd.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-08-02 11:33:23 +03:00
Martin Storsjö 230b1c070b intreadwrite: Add intermediate variables in the byteswise AV_W*() macros
This avoids issues with expanding the argument multiple times,
and makes sure that it is of the right type for the following shifts.

Even if the caller of a macro could be expected not to pass parameters
that have side effects if expanded multiple times, these fallback
codepaths are rarely, if ever, tested, so it is expected that such
issues can arise.

Thefore, for safety, make sure the fallback codepaths only expand
the arguments once.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-08-02 11:32:35 +03:00
Martin Storsjö 014773b66b libavutil: Use an intermediate variable in AV_COPY*U
If AV_RN and AV_WN are macros with multiple individual reads and
writes, the previous version of the AV_COPYU macro would fail if
the reads and writes overlap.

This should not be any less efficient in any case, given a
sensibly optimizing compiler.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-31 22:50:55 +03:00
Christophe Gisquet 8da1defe69 libavutil: document side effects of macros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-19 14:55:46 +02:00
Paul B Mahol cf73e0bff3 lavu/intreadwrite: add AV_[RW][BLN]48
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-02-13 15:35:54 +00:00
Michael Niedermayer 5555d2075a Merge commit 'ceb754d041f5f6327fd9195a5f43575af9516daa'
* commit 'ceb754d041f5f6327fd9195a5f43575af9516daa':
  lzo: Use AV_COPY*U macros where appropriate
  prepare 9_beta2 release
  dsputil: Replace AV_WNxx(AV_RNxx()) combinations by AV_COPYxxU
  intreadwrite: Add AV_COPYxxU macros for copying to/from unaligned addresses
  dxtory: Replace AV_WN16A(AV_RN16A()) combination by AV_COPY16
  mp3: properly forward mp_decode_frame errors

Conflicts:
	RELEASE
	libavcodec/mpegaudiodec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-24 14:01:36 +02:00
Diego Biurrun af6dd6de08 intreadwrite: Add AV_COPYxxU macros for copying to/from unaligned addresses 2012-10-23 16:54:08 +02:00
Michael Niedermayer d83ff76ca0 intreadwrite: Dont evaluate value for AV_W* multiple times.
Evaluating it multiple times, can have side effects and is possibly slow.
So its definitly a bad idea.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-04 21:45:13 +02:00
Michael Niedermayer 2905e3ff64 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavc: add opt_find to AVCodecContext class.
  h264: Complexify frame num gap shortening code
  intreadwrite.h: fix AV_RL32/AV_RB32 signedness.
  Fix decoding of mpegts streams with h264 video that does *NOT* have b frames
  Add minor bumps and APIChanges entries for lavf private options.
  ffmpeg: deprecate -vc and -tvstd
  ffmpeg: use new avformat_open_* API.
  ffserver: use new avformat_open_* API.
  ffprobe: use new avformat_open_* API.
  ffplay: use new avformat_open_* API.
  cmdutils: add opt_default2().
  dict: add AV_DICT_APPEND flag.
  lavf: add avformat_write_header() as a replacement for av_write_header().
  Deprecate av_open_input_* and remove their uses.
  lavf: add avformat_open_input() as a replacement for av_open_input_*
  AVOptions: add av_opt_find() as a replacement for av_find_opt.
  AVOptions: add av_opt_set_dict() mapping a dictionary struct to a context.
  ffmpeg: don't abuse a global for passing frame size from input to output
  ffmpeg: don't abuse a global for passing pixel format from input to output
  ffmpeg: initialise encoders earlier.

Conflicts:
	cmdutils.c
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	ffprobe.c
	libavcodec/h264.c
	libavformat/avformat.h
	libavformat/utils.c
	libavformat/version.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-18 05:10:38 +02:00
Uoti Urpala c98b928fa7 intreadwrite.h: fix AV_RL32/AV_RB32 signedness.
The output type of the AV_RL32/AV_RB32 macros was signed int. The
resulting overflow broke at least some ASF streams with large
timestamps. Fix by adding a cast to uint32_t.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-06-16 20:49:19 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Måns Rullgård 8681669272 Make intreadwrite.h installation-safe
Originally committed as revision 24173 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-10 22:22:03 +00:00
Måns Rullgård 8fc0162ac4 Add av_ prefix to bswap macros
Originally committed as revision 24170 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-10 22:12:30 +00:00
Måns Rullgård 7918375f88 intreadwrite: common.h is not needed, attributes.h is sufficient
Originally committed as revision 24155 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-10 00:40:59 +00:00
Måns Rullgård 3d7b94ba5a Fix build failure with fast_unaligned and non-gcc-compatible compilers
Originally committed as revision 22142 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-02 03:16:24 +00:00
Michael Niedermayer 8ef4e65e94 AV_COPY16() & AV_ZERO16()
Originally committed as revision 22037 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-24 20:38:31 +00:00
Måns Rullgård 95c0d02ddc TOMI: 16- and 32-bit intreadwrite functions
Originally committed as revision 21890 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-19 03:20:01 +00:00
Måns Rullgård f4a7434f16 Add alias-safe aligned AV_[RW]N macros
Originally committed as revision 21880 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-18 13:44:38 +00:00
Måns Rullgård 7a6053ef72 Use alias-safe types in AV_COPY/SWAP/ZERO macros
Originally committed as revision 21879 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-18 13:40:24 +00:00
Måns Rullgård 0c76e635f5 Use alias-safe types in AV_[RW] macros
Originally committed as revision 21878 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-18 13:40:21 +00:00
Måns Rullgård d10458c9e2 Add alias-safe union typedefs
Originally committed as revision 21877 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-18 13:40:19 +00:00
Måns Rullgård 6c88973a75 Add AV_COPY32
Originally committed as revision 21524 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-29 03:26:17 +00:00
Alexander Strange f6d0390657 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
Add x86 implementation using MMX/SSE.

Originally committed as revision 21281 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-18 10:24:33 +00:00
Måns Rullgård c25210278c Add missing parens in AV_WN macros
Originally committed as revision 21260 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-17 12:47:06 +00:00
Måns Rullgård d691da9508 AVR32: optimisations for intreadwrite.h
Originally committed as revision 19665 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-17 00:15:53 +00:00
Måns Rullgård 4a051891f6 cosmetics: reformat intreadwrite.h
Originally committed as revision 19659 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-16 18:06:25 +00:00
Måns Rullgård 63826ceb32 intreadwrite: ensure arch-specific versions are always used if defined
The per-arch headers can define any combination of B/L/N variants.
This ensures that whatever is defined in an arch header gets used
for all equivalents not defined there.  E.g. on a little-endian
machine, AV_RN and AV_RL should give the same code.

Originally committed as revision 19658 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-16 15:51:55 +00:00
Måns Rullgård 57c36bdcea intreadwrite: allow arch-specific 24-bit access macros
Originally committed as revision 19657 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-16 15:51:52 +00:00
Måns Rullgård 63613fe615 Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN
Originally committed as revision 19508 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-26 12:20:04 +00:00
Måns Rullgård e7ea5e3d8d Check for __attribute__((packed)) support
Not all compilers claiming to be gcc support this attribute.

Originally committed as revision 19453 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-17 08:21:43 +00:00
Måns Rullgård 530456bf31 MIPS: inline asm for intreadwrite.h
Originally committed as revision 18980 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-05-28 23:19:35 +00:00
Måns Rullgård 9f5ff83f2a PPC asm for AV_RL*()
PPC is normally big endian but has special little endian load/store
instructions.  Using these avoids a separate byteswap.  This makes the
vorbis decoder about 5% faster.  Not much else uses little-endian
read/write extensively.

GCC generates horrible PPC code for the default AV_[RW]B64 (which uses
a packed struct), so we override it with a plain pointer cast.

Originally committed as revision 18602 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-18 00:00:31 +00:00
Måns Rullgård 3c55ce039d ARM asm for AV_RN*()
ARMv6 and later support unaligned loads and stores for single
word/halfword but not double/multiple.  GCC is ignorant of this and
will always use bytewise accesses for unaligned data.  Casting to an
int32_t pointer is dangerous since a load/store double or multiple
instruction might be used (this happens with some code in FFmpeg).
Implementing the AV_[RW]* macros with inline asm using only supported
instructions gives fast and safe unaligned accesses.  ARM RVCT does
the right thing with generic code.

This gives an overall speedup of up to 10%.

Originally committed as revision 18601 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-18 00:00:28 +00:00
Måns Rullgård a6783b8961 Reorganise intreadwrite.h
This changes intreadwrite.h to support per-arch implementations of the
various macros allowing us to take advantage of special instructions
or other properties the compiler does not know about.

Originally committed as revision 18600 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-18 00:00:22 +00:00
Aurelien Jacobs b250f9c66d Change semantic of CONFIG_*, HAVE_* and ARCH_*.
They are now always defined to either 0 or 1.

Originally committed as revision 16590 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-13 23:44:16 +00:00
Stefano Sabatini 987903826b Globally rename the header inclusion guard names.
Consistently apply this rule: the guard name is obtained from the
filename by stripping the leading "lib", converting '/' and '.'  to
'_' and uppercasing the resulting name. Guard names in the root
directory have to be prefixed by "FFMPEG_".

Originally committed as revision 15120 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-31 07:39:47 +00:00
Måns Rullgård b7b38fb28a intreadwrite: support DEC compiler __unaligned type qualifier
Originally committed as revision 14275 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-07-18 01:18:59 +00:00