This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 3bbb3269a1aa1dc1c6472a0d1d92d6f9cf42d277 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Tue Jan 6 16:37:39 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sat Jan 10 22:47:22 2026 +0100 avcodec/pngdec: Move ff_add_png_paeth_prediction() to pngdsp.c Also rename it to ff_png_add_paeth_prediction() so that it has a proper prefix. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/png.h | 2 -- libavcodec/pngdec.c | 28 ---------------------------- libavcodec/pngdsp.c | 30 +++++++++++++++++++++++++++++- libavcodec/pngdsp.h | 6 ++++++ 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/libavcodec/png.h b/libavcodec/png.h index 01171e682e..903f217aed 100644 --- a/libavcodec/png.h +++ b/libavcodec/png.h @@ -57,8 +57,6 @@ int ff_png_get_nb_channels(int color_type); /* compute the row size of an interleaved pass */ int ff_png_pass_row_size(int pass, int bits_per_pixel, int width); -void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp); - void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp); diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index fff27305d5..3651da265f 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -218,34 +218,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width, } } -void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, - int w, int bpp) -{ - int i; - for (i = 0; i < w; i++) { - int a, b, c, p, pa, pb, pc; - - a = dst[i - bpp]; - b = top[i]; - c = top[i - bpp]; - - p = b - c; - pc = a - c; - - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); - - if (pa <= pb && pa <= pc) - p = a; - else if (pb <= pc) - p = b; - else - p = c; - dst[i] = p + src[i]; - } -} - #define UNROLL1(bpp, op) \ { \ r = dst[0]; \ diff --git a/libavcodec/pngdsp.c b/libavcodec/pngdsp.c index ae40113a51..e7afce8772 100644 --- a/libavcodec/pngdsp.c +++ b/libavcodec/pngdsp.c @@ -19,11 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <stdlib.h> + #include "config.h" #include "libavutil/attributes.h" #include "libavutil/intreadwrite.h" #include "libavutil/macros.h" -#include "png.h" #include "pngdsp.h" #if HAVE_FAST_64BIT @@ -53,6 +54,33 @@ static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) dst[i] = src1[i] + src2[i]; } +void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, + int w, int bpp) +{ + for (int i = 0; i < w; ++i) { + int a, b, c, p, pa, pb, pc; + + a = dst[i - bpp]; + b = top[i]; + c = top[i - bpp]; + + p = b - c; + pc = a - c; + + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); + + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; + dst[i] = p + src[i]; + } +} + av_cold void ff_pngdsp_init(PNGDSPContext *dsp) { dsp->add_bytes_l2 = add_bytes_l2_c; diff --git a/libavcodec/pngdsp.h b/libavcodec/pngdsp.h index 5475d0d943..a32ffb88af 100644 --- a/libavcodec/pngdsp.h +++ b/libavcodec/pngdsp.h @@ -24,6 +24,8 @@ #include <stdint.h> +#include "libavutil/attributes_internal.h" + typedef struct PNGDSPContext { void (*add_bytes_l2)(uint8_t *dst, uint8_t *src1 /* align 16 */, @@ -34,7 +36,11 @@ typedef struct PNGDSPContext { uint8_t *top, int w, int bpp); } PNGDSPContext; +FF_VISIBILITY_PUSH_HIDDEN +void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp); + void ff_pngdsp_init(PNGDSPContext *dsp); void ff_pngdsp_init_x86(PNGDSPContext *dsp); +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_PNGDSP_H */ _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
