[FFmpeg-devel] [PATCH] add color table for 8-bit gray scale raw image data
一滴水
229135609 at qq.com
Sun Aug 15 10:48:10 EEST 2021
From: RaydroidX <229135609 at qq.com>
---
libavformat/riffenc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index c04d55c423..e33bcdb339 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -242,6 +242,15 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
avio_wl32(pb, pal_avi ? 1 << par->bits_per_coded_sample : 0);
avio_wl32(pb, 0);
+ if (par->bits_per_coded_sample == 8) {
+ for(int i=0; i<256; i++) {
+ avio_w8(pb,i);
+ avio_w8(pb,i);
+ avio_w8(pb,i);
+ avio_w8(pb,0);
+ }
+ }
+
if (!ignore_extradata) {
if (par->extradata_size) {
avio_write(pb, par->extradata, extradata_size);
--
2.30.1 (Apple Git-130)
More information about the ffmpeg-devel
mailing list