Message ID | tencent_817BC144DE34A0FA582BC88900CA049E5508@qq.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] libavformat/riffenc: support raw avi for raw PAL8 or Gray8 pixel data | expand |
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 |
This is a my latest committed patch. Please ignore those similar mails I sent before. > 2021年8月16日 下午5:01,rui.jiang <229135609@qq.com> 写道: > > add palette data in avi header when the input data is raw PAL8 or Gray8 pixel data and the output data is 8bit raw avi video; > > Signed-off-by: rui.jiang <229135609@qq.com> > --- > libavformat/riffenc.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c > index 43c8bf957a..bc654b3cd3 100644 > --- a/libavformat/riffenc.c > +++ b/libavformat/riffenc.c > @@ -228,7 +228,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, > pal_avi = !for_asf && > (pix_fmt == AV_PIX_FMT_PAL8 || > pix_fmt == AV_PIX_FMT_MONOWHITE || > - pix_fmt == AV_PIX_FMT_MONOBLACK); > + pix_fmt == AV_PIX_FMT_MONOBLACK || > + pix_fmt == AV_PIX_FMT_GRAY8); > > /* Size (not including the size of the color table or color masks) */ > avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size)); > @@ -263,6 +264,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, > avio_wl32(pb, 0xffffff); > else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK) > avio_wl32(pb, 0xffffff); > + else if (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8) { > + /* Initialize palette */ > + avio_w8(pb,i); > + avio_w8(pb,i); > + avio_w8(pb,i); > + avio_w8(pb,0); > + } > else > avio_wl32(pb, 0); > } > -- > 2.30.1 (Apple Git-130) >
On Mon, Aug 16, 2021 at 05:01:14PM +0800, rui.jiang wrote: > add palette data in avi header when the input data is raw PAL8 or Gray8 pixel data and the output data is 8bit raw avi video; > > Signed-off-by: rui.jiang <229135609@qq.com> > --- > libavformat/riffenc.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c > index 43c8bf957a..bc654b3cd3 100644 > --- a/libavformat/riffenc.c > +++ b/libavformat/riffenc.c > @@ -228,7 +228,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, > pal_avi = !for_asf && > (pix_fmt == AV_PIX_FMT_PAL8 || > pix_fmt == AV_PIX_FMT_MONOWHITE || > - pix_fmt == AV_PIX_FMT_MONOBLACK); > + pix_fmt == AV_PIX_FMT_MONOBLACK || > + pix_fmt == AV_PIX_FMT_GRAY8); > > /* Size (not including the size of the color table or color masks) */ > avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size)); > @@ -263,6 +264,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, > avio_wl32(pb, 0xffffff); > else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK) > avio_wl32(pb, 0xffffff); > + else if (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8) { > + /* Initialize palette */ > + avio_w8(pb,i); > + avio_w8(pb,i); > + avio_w8(pb,i); > + avio_w8(pb,0); I dont think this will always match the palette also this is going to break fate i would assume [...]
is that I should only deal with gray8 format in particular?and it has passed the fate test > 2021年8月17日 上午3:00,Michael Niedermayer <michael@niedermayer.cc> 写道: > > On Mon, Aug 16, 2021 at 05:01:14PM +0800, rui.jiang wrote: >> add palette data in avi header when the input data is raw PAL8 or Gray8 pixel data and the output data is 8bit raw avi video; >> >> Signed-off-by: rui.jiang <229135609@qq.com> >> --- >> libavformat/riffenc.c | 10 +++++++++- >> 1 file changed, 9 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c >> index 43c8bf957a..bc654b3cd3 100644 >> --- a/libavformat/riffenc.c >> +++ b/libavformat/riffenc.c >> @@ -228,7 +228,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, >> pal_avi = !for_asf && >> (pix_fmt == AV_PIX_FMT_PAL8 || >> pix_fmt == AV_PIX_FMT_MONOWHITE || >> - pix_fmt == AV_PIX_FMT_MONOBLACK); >> + pix_fmt == AV_PIX_FMT_MONOBLACK || >> + pix_fmt == AV_PIX_FMT_GRAY8); >> >> /* Size (not including the size of the color table or color masks) */ >> avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size)); >> @@ -263,6 +264,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, >> avio_wl32(pb, 0xffffff); >> else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK) >> avio_wl32(pb, 0xffffff); >> + else if (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8) { >> + /* Initialize palette */ >> + avio_w8(pb,i); >> + avio_w8(pb,i); >> + avio_w8(pb,i); >> + avio_w8(pb,0); > > I dont think this will always match the palette > also this is going to break fate i would assume > > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 43c8bf957a..bc654b3cd3 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -228,7 +228,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, pal_avi = !for_asf && (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_MONOWHITE || - pix_fmt == AV_PIX_FMT_MONOBLACK); + pix_fmt == AV_PIX_FMT_MONOBLACK || + pix_fmt == AV_PIX_FMT_GRAY8); /* Size (not including the size of the color table or color masks) */ avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size)); @@ -263,6 +264,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, avio_wl32(pb, 0xffffff); else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK) avio_wl32(pb, 0xffffff); + else if (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8) { + /* Initialize palette */ + avio_w8(pb,i); + avio_w8(pb,i); + avio_w8(pb,i); + avio_w8(pb,0); + } else avio_wl32(pb, 0); }
add palette data in avi header when the input data is raw PAL8 or Gray8 pixel data and the output data is 8bit raw avi video; Signed-off-by: rui.jiang <229135609@qq.com> --- libavformat/riffenc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)