diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-24 23:11:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-25 00:07:51 +0100 |
commit | 6bc20e84d84f5d8d6941fc364dc3bf53662ea222 (patch) | |
tree | 9aa01e5ff5a2e9540abafde1b2e0f782dbe4f693 /libavfilter/drawutils.c | |
parent | 0d65a7d033040e641336230fb97d573d522076e6 (diff) | |
download | ffmpeg-6bc20e84d84f5d8d6941fc364dc3bf53662ea222.tar.gz |
avfilter/drawutils: Fix ff_fill_rectangle() on big endian
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/drawutils.c')
-rw-r--r-- | libavfilter/drawutils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index 7edaa4ac6c..876a859e1f 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -298,6 +298,7 @@ void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, { int plane, x, y, wp, hp; uint8_t *p0, *p; + FFDrawColor color_tmp = *color; for (plane = 0; plane < draw->nb_planes; plane++) { p0 = pointer_at(draw, dst, dst_linesize, plane, dst_x, dst_y); @@ -306,9 +307,15 @@ void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, if (!hp) return; p = p0; + + if (HAVE_BIGENDIAN && draw->desc->comp[0].depth > 8) { + for (x = 0; 2*x < draw->pixelstep[plane]; x++) + color_tmp.comp[plane].u16[x] = av_bswap16(color_tmp.comp[plane].u16[x]); + } + /* copy first line from color */ for (x = 0; x < wp; x++) { - memcpy(p, color->comp[plane].u8, draw->pixelstep[plane]); + memcpy(p, color_tmp.comp[plane].u8, draw->pixelstep[plane]); p += draw->pixelstep[plane]; } wp *= draw->pixelstep[plane]; |