Skip to content

Commit

Permalink
get rid of WORDS_BIGENDIAN
Browse files Browse the repository at this point in the history
WORDS_BIGENDIAN is defiend by config.h

Use __BYTE_ORDER__  defined by GNU compilers (POSIX 2024 further defines
endian.h header but not yet in macOS /15/),
  • Loading branch information
MartinPulec committed Sep 26, 2024
1 parent 01e4d1b commit 707e4af
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/aja_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include "aja_common.hpp" // include after color_out to override its stuff for MSVC

#ifndef BYTE_SWAP
#ifdef WORDS_BIGENDIAN
#if !defined _MSC_VER && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BYTE_SWAP(x) (3 - x)
#else
#define BYTE_SWAP(x) x
Expand Down
2 changes: 1 addition & 1 deletion src/libavcodec/from_lavc_vid_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

#define MOD_NAME "[from_lavc_vid_conv] "

#ifdef WORDS_BIGENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BYTE_SWAP(x) (3 - x)
#else
#define BYTE_SWAP(x) x
Expand Down
8 changes: 1 addition & 7 deletions src/libavcodec/to_lavc_vid_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#define MOD_NAME "[to_lavc_vid_conv] "

#ifdef WORDS_BIGENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BYTE_SWAP(x) (3 - x)
#else
#define BYTE_SWAP(x) x
Expand Down Expand Up @@ -1152,12 +1152,6 @@ static void r10k_to_gbrp16le(AVFrame * __restrict out_frame, const unsigned char
r10k_to_gbrpXXle(out_frame, in_data, width, height, 16U);
}

#ifdef WORDS_BIGENDIAN
#define BYTE_SWAP(x) (3 - x)
#else
#define BYTE_SWAP(x) x
#endif

/// @note out_depth needs to be at least 12
#if defined __GNUC__
static inline void r12l_to_gbrpXXle(AVFrame * __restrict out_frame, const unsigned char * __restrict in_data, int width, int height, unsigned int out_depth)
Expand Down
2 changes: 1 addition & 1 deletion src/rtp/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static void rtp_process_data(struct rtp *session, uint32_t curr_rtp_ts,
#define RTCP_RX 205

typedef struct {
#ifdef WORDS_BIGENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
unsigned short version:2; /* packet type */
unsigned short p:1; /* padding flag */
unsigned short count:5; /* varies by payload type */
Expand Down
2 changes: 1 addition & 1 deletion src/utils/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
* Therefore, this is stored as a big endian even on little-endian architectures - first byte
* of FourCC is in the memory on the lowest address.
*/
#ifdef WORDS_BIGENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define to_fourcc(a,b,c,d) (((uint32_t)(d)) | ((uint32_t)(c)<<8U) | ((uint32_t)(b)<<16U) | ((uint32_t)(a)<<24U))
#else
#define to_fourcc(a,b,c,d) (((uint32_t)(a)) | ((uint32_t)(b)<<8U) | ((uint32_t)(c)<<16U) | ((uint32_t)(d)<<24U))
Expand Down
6 changes: 0 additions & 6 deletions src/video_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@

char pixfmt_conv_pref[] = "dsc"; ///< bitdepth, subsampling, color space

#ifdef WORDS_BIGENDIAN
#define BYTE_SWAP(x) (3 - x)
#else
#define BYTE_SWAP(x) x
#endif

#ifdef __SSE2__
static void vc_deinterlace_aligned(unsigned char *src, long src_linesize, int lines);
static void vc_deinterlace_unaligned(unsigned char *src, long src_linesize, int lines);
Expand Down

0 comments on commit 707e4af

Please sign in to comment.