diff mbox series

[FFmpeg-devel,10/46] avcodec/bmpenc: Use memcpy when data has desired endianness

Message ID HE1PR0301MB21546D1722F1AF71730A77138F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 60da5b87ad5823707254aa2930fa5950e45facc2
Headers show
Series [FFmpeg-devel,01/46] avcodec/a64multienc: Avoid intermediate buffer | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 29, 2021, 11:56 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/bmpenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c
index 409564d257..0082ec675a 100644
--- a/libavcodec/bmpenc.c
+++ b/libavcodec/bmpenc.c
@@ -20,6 +20,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
 #include "libavutil/imgutils.h"
 #include "libavutil/avassert.h"
 #include "avcodec.h"
@@ -139,7 +141,7 @@  static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
     buf = pkt->data + hsize;
     for(i = 0; i < avctx->height; i++) {
-        if (bit_count == 16) {
+        if (HAVE_BIGENDIAN && bit_count == 16) {
             const uint16_t *src = (const uint16_t *) ptr;
             for(n = 0; n < avctx->width; n++)
                 AV_WL16(buf + 2 * n, src[n]);