@@ -1021,49 +1021,35 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
1021
1021
static inline void fillPlane16 (uint8_t * plane , int stride , int width , int height , int y ,
1022
1022
int alpha , int bits , const int big_endian )
1023
1023
{
1024
- int i , j ;
1025
1024
uint8_t * ptr = plane + stride * y ;
1026
1025
int v = alpha ? 0xFFFF >>(16 - bits ) : (1 <<(bits - 1 ));
1027
- for (i = 0 ; i < height ; i ++ ) {
1028
- #define FILL (wfunc ) \
1029
- for (j = 0; j < width; j++) {\
1030
- wfunc(ptr+2*j, v);\
1031
- }
1032
- if (big_endian ) {
1033
- FILL (AV_WB16 );
1034
- } else {
1035
- FILL (AV_WL16 );
1036
- }
1026
+ if (big_endian != HAVE_BIGENDIAN )
1027
+ v = av_bswap16 (v );
1028
+ for (int i = 0 ; i < height ; i ++ ) {
1029
+ for (int j = 0 ; j < width ; j ++ )
1030
+ AV_WN16 (ptr + 2 * j , v );
1037
1031
ptr += stride ;
1038
1032
}
1039
- #undef FILL
1040
1033
}
1041
1034
1042
1035
static inline void fillPlane32 (uint8_t * plane , int stride , int width , int height , int y ,
1043
1036
int alpha , int bits , const int big_endian , int is_float )
1044
1037
{
1045
- int i , j ;
1046
1038
uint8_t * ptr = plane + stride * y ;
1047
1039
uint32_t v ;
1048
1040
uint32_t onef32 = 0x3f800000 ;
1049
1041
if (is_float )
1050
1042
v = alpha ? onef32 : 0 ;
1051
1043
else
1052
1044
v = alpha ? 0xFFFFFFFF >>(32 - bits ) : (1 <<(bits - 1 ));
1045
+ if (big_endian != HAVE_BIGENDIAN )
1046
+ v = av_bswap32 (v );
1053
1047
1054
- for (i = 0 ; i < height ; i ++ ) {
1055
- #define FILL (wfunc ) \
1056
- for (j = 0; j < width; j++) {\
1057
- wfunc(ptr+4*j, v);\
1058
- }
1059
- if (big_endian ) {
1060
- FILL (AV_WB32 );
1061
- } else {
1062
- FILL (AV_WL32 );
1063
- }
1048
+ for (int i = 0 ; i < height ; i ++ ) {
1049
+ for (int j = 0 ; j < width ; j ++ )
1050
+ AV_WN32 (ptr + 4 * j , v );
1064
1051
ptr += stride ;
1065
1052
}
1066
- #undef FILL
1067
1053
}
1068
1054
1069
1055
0 commit comments