[Cin] Real fix for 16-bit pngs

Phyllis Smith phylsmith2017 at gmail.com
Tue Mar 24 18:35:55 CET 2020


Andrew,
GG writes here:  This is weird.  I have looked into this and Little Endian
/ png / swapping in ffmpeg, libpng.
see libpng16-src pnginfo.h, no endian or swap or relevant order params.
see ffmpeg-4.2 libavcodec/pngdec.c:618 decode_idat_chunk, only 16be formats.
Little Endian format is not supported in ffmpg.  It is not in any png.h
header data.  It only seems to be a user specified transform option.   In
other words, you have to tell it not to use the default of big endian
(network byte order).  Since this only generates the possibility of a fail,
I think that the best idea is to remove it as a possibility.   Perhaps you
should investigate why it is the default on the machine you are using.  I
do not see any way it could be normally generated using libpng16 source
(the current version used by all os vendors).


On Tue, Mar 24, 2020 at 6:13 AM Andrew Randrianasulu <
randrianasulu at gmail.com> wrote:

> Sorry, I apparently send wrong patch - 16 bit pngs were still broken.
>
> I scratched my head a lot (because it was working!)
> and realized I swapped order of calls!
>
> diff relative to commit 8c43913b9f18a3856bbff826aef96587a32f0470
>
> diff --git a/cinelerra-5.1/cinelerra/filepng.C
> b/cinelerra-5.1/cinelerra/filepng.C
> index 4df95f1e..c2e1cf6c 100644
> --- a/cinelerra-5.1/cinelerra/filepng.C
> +++ b/cinelerra-5.1/cinelerra/filepng.C
> @@ -229,9 +229,9 @@ int FilePNG::write_frame(VFrame *frame, VFrame *data,
> FrameWriterUnit *unit)
>                                 asset->png_use_alpha ?
> PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB,
>                                 PNG_INTERLACE_NONE,
> PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
>  // does not work (gg 2020/03/17 libpng16 fc31)
> +                       png_write_info(png_ptr, info_ptr);
>                         if( asset->png_depth == 16 &&
> BC_Resources::little_endian )
>                                 png_set_swap(png_ptr);
> -                       png_write_info(png_ptr, info_ptr);
>                         png_write_image(png_ptr, output_frame->get_rows());
>                         png_write_end(png_ptr, info_ptr);
>                         result = 0;
>
> this way it SHOULD work .... Tested!
>
> Also, hint for ccache:
> in .ccache/ccache.conf set for maximum compression
>
> compression = true
> compression_level = 8
> --
> Cin mailing list
> Cin at lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20200324/7bffe060/attachment-0001.html>


More information about the Cin mailing list