[FFmpeg-devel] [PATCH 08/11] avutil/half2float: move non-inline init code out of header

Michael Niedermayer michael at niedermayer.cc
Thu Aug 11 23:46:16 EEST 2022


On Wed, Aug 10, 2022 at 10:47:09PM +0200, Timo Rothenpieler wrote:
> ---
>  libavcodec/Makefile     |  8 +++---
>  libavcodec/exr.c        |  2 +-
>  libavcodec/exrenc.c     |  2 +-
>  libavcodec/float2half.c | 19 +++++++++++++
>  libavcodec/half2float.c | 19 +++++++++++++
>  libavcodec/pnmdec.c     |  2 +-
>  libavcodec/pnmenc.c     |  2 +-
>  libavutil/float2half.c  | 53 ++++++++++++++++++++++++++++++++++
>  libavutil/float2half.h  | 36 ++---------------------
>  libavutil/half2float.c  | 63 +++++++++++++++++++++++++++++++++++++++++
>  libavutil/half2float.h  | 46 ++----------------------------
>  11 files changed, 166 insertions(+), 86 deletions(-)
>  create mode 100644 libavcodec/float2half.c
>  create mode 100644 libavcodec/half2float.c
>  create mode 100644 libavutil/float2half.c
>  create mode 100644 libavutil/half2float.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 029f1bad3d..cb80f73d99 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -337,8 +337,8 @@ OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)    += 8svx.o
>  OBJS-$(CONFIG_ESCAPE124_DECODER)       += escape124.o
>  OBJS-$(CONFIG_ESCAPE130_DECODER)       += escape130.o
>  OBJS-$(CONFIG_EVRC_DECODER)            += evrcdec.o acelp_vectors.o lsp.o
> -OBJS-$(CONFIG_EXR_DECODER)             += exr.o exrdsp.o
> -OBJS-$(CONFIG_EXR_ENCODER)             += exrenc.o
> +OBJS-$(CONFIG_EXR_DECODER)             += exr.o exrdsp.o half2float.o
> +OBJS-$(CONFIG_EXR_ENCODER)             += exrenc.o float2half.o
>  OBJS-$(CONFIG_FASTAUDIO_DECODER)       += fastaudio.o
>  OBJS-$(CONFIG_FFV1_DECODER)            += ffv1dec.o ffv1.o
>  OBJS-$(CONFIG_FFV1_ENCODER)            += ffv1enc.o ffv1.o
> @@ -570,8 +570,8 @@ OBJS-$(CONFIG_PGMYUV_DECODER)          += pnmdec.o pnm.o
>  OBJS-$(CONFIG_PGMYUV_ENCODER)          += pnmenc.o
>  OBJS-$(CONFIG_PGSSUB_DECODER)          += pgssubdec.o
>  OBJS-$(CONFIG_PGX_DECODER)             += pgxdec.o
> -OBJS-$(CONFIG_PHM_DECODER)             += pnmdec.o pnm.o
> -OBJS-$(CONFIG_PHM_ENCODER)             += pnmenc.o
> +OBJS-$(CONFIG_PHM_DECODER)             += pnmdec.o pnm.o half2float.o
> +OBJS-$(CONFIG_PHM_ENCODER)             += pnmenc.o float2half.o
>  OBJS-$(CONFIG_PHOTOCD_DECODER)         += photocd.o
>  OBJS-$(CONFIG_PICTOR_DECODER)          += pictordec.o cga_data.o
>  OBJS-$(CONFIG_PIXLET_DECODER)          += pixlet.o
> diff --git a/libavcodec/exr.c b/libavcodec/exr.c
> index 825354873d..a3582bfdd6 100644
> --- a/libavcodec/exr.c
> +++ b/libavcodec/exr.c
> @@ -2208,7 +2208,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
>      float one_gamma = 1.0f / s->gamma;
>      avpriv_trc_function trc_func = NULL;
>  
> -    init_half2float_tables(&s->h2f_tables);
> +    ff_init_half2float_tables(&s->h2f_tables);
[...]
> diff --git a/libavutil/float2half.c b/libavutil/float2half.c
> new file mode 100644
> index 0000000000..dba14cef5d
> --- /dev/null
> +++ b/libavutil/float2half.c
[...]
> +void ff_init_float2half_tables(float2half_tables *t)

this will need avpriv or break linking with shared libs

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220811/a9fa9b5e/attachment.sig>


More information about the ffmpeg-devel mailing list