mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/dpxenc: implement write16/32 as functions
Fixes undefined behavior and segfault
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8edc17b639
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
dd141a50cc
commit
fc0df14de1
|
@ -75,17 +75,20 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define write16(p, value) \
|
static av_always_inline void write16_internal(int big_endian, void *p, int value)
|
||||||
do { \
|
{
|
||||||
if (s->big_endian) AV_WB16(p, value); \
|
if (big_endian) AV_WB16(p, value);
|
||||||
else AV_WL16(p, value); \
|
else AV_WL16(p, value);
|
||||||
} while(0)
|
}
|
||||||
|
|
||||||
#define write32(p, value) \
|
static av_always_inline void write32_internal(int big_endian, void *p, int value)
|
||||||
do { \
|
{
|
||||||
if (s->big_endian) AV_WB32(p, value); \
|
if (big_endian) AV_WB32(p, value);
|
||||||
else AV_WL32(p, value); \
|
else AV_WL32(p, value);
|
||||||
} while(0)
|
}
|
||||||
|
|
||||||
|
#define write16(p, value) write16_internal(s->big_endian, p, value)
|
||||||
|
#define write32(p, value) write32_internal(s->big_endian, p, value)
|
||||||
|
|
||||||
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
|
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue