Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-05 Thread Nuo Mi
On Fri, Feb 5, 2021 at 12:57 AM Derek Buitenhuis wrote: > GIF palette entries are not compressed, and writing 256 entries, > which can be up to every frame, uses a significant amount of > space, especially in extreme cases, where palettes can be very > small. > > Example, first six seconds of

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-05 Thread Jean First
Derek Buitenhuis wrote on 04.02.21 19:42: On 04/02/2021 17:26, Paul B Mahol wrote: How would that work? I'm not against if that does not break existing usage. Somethng like '-no_global_paltte 1' to not use a global palette, and write a palette each frame. Default would be off, so curent

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-05 Thread Derek Buitenhuis
On 05/02/2021 01:54, Andreas Rheinhardt wrote: > Could AV_CODEC_FLAG_GLOBAL_HEADER be used for this? It could, but I don't think it should. The global header is still written, just not with a global palette. I think it would be, at best, confusing, especially in terms of intent. - Derek

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Andreas Rheinhardt
Derek Buitenhuis: > On 04/02/2021 17:26, Paul B Mahol wrote: >> How would that work? >> I'm not against if that does not break existing usage. > > Somethng like '-no_global_paltte 1' to not use a global > palette, and write a palette each frame. Default would be > off, so curent behavior is

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Derek Buitenhuis
On 04/02/2021 17:26, Paul B Mahol wrote: > How would that work? > I'm not against if that does not break existing usage. Somethng like '-no_global_paltte 1' to not use a global palette, and write a palette each frame. Default would be off, so curent behavior is maintained. - Derek

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Paul B Mahol
On Thu, Feb 4, 2021 at 6:15 PM Derek Buitenhuis wrote: > On 04/02/2021 17:09, Derek Buitenhuis wrote: > > Accidentally left it in, removed it now. > > > > Further, I forgot to add re-mapping of the frame values > > for the case where the user-provided palette is not > > front-loaded (e.g. it has

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Derek Buitenhuis
On 04/02/2021 17:07, Paul B Mahol wrote: > You first init array to 0 and than use memset? Accidentally left it in, removed it now. Further, I forgot to add re-mapping of the frame values for the case where the user-provided palette is not front-loaded (e.g. it has gaps), so I'll send a v2. -

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Derek Buitenhuis
On 04/02/2021 17:09, Derek Buitenhuis wrote: > Accidentally left it in, removed it now. > > Further, I forgot to add re-mapping of the frame values > for the case where the user-provided palette is not > front-loaded (e.g. it has gaps), so I'll send a v2. Another case to consider is that we

Re: [FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Paul B Mahol
On Thu, Feb 4, 2021 at 5:57 PM Derek Buitenhuis wrote: > GIF palette entries are not compressed, and writing 256 entries, > which can be up to every frame, uses a significant amount of > space, especially in extreme cases, where palettes can be very > small. > > Example, first six seconds of

[FFmpeg-devel] [PATCH] libavcodec/gifenc: Only write palette entries that actually used

2021-02-04 Thread Derek Buitenhuis
GIF palette entries are not compressed, and writing 256 entries, which can be up to every frame, uses a significant amount of space, especially in extreme cases, where palettes can be very small. Example, first six seconds of Tears of Steel, palette generated with libimagequant, 320x240