[FFmpeg-cvslog] avcodec/bmpenc: Use memcpy when data has desired endianness

Andreas Rheinhardt git at videolan.org
Wed May 5 15:37:49 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Apr 27 16:50:18 2021 +0200| [60da5b87ad5823707254aa2930fa5950e45facc2] | committer: Andreas Rheinhardt

avcodec/bmpenc: Use memcpy when data has desired endianness

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60da5b87ad5823707254aa2930fa5950e45facc2
---

 libavcodec/bmpenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c
index 557e0be285..40c2f056fa 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]);



More information about the ffmpeg-cvslog mailing list