[FFmpeg-cvslog] swscale/x86/yuv2yuvX: Remove unused ff_yuv2yuvX_mmx()

2022-08-19 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Aug 18 16:26:37 2022 +0200| [8bec225c3cd1e580ef0582cbbab8120b79c8b6a3] | 
committer: Andreas Rheinhardt

swscale/x86/yuv2yuvX: Remove unused ff_yuv2yuvX_mmx()

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8bec225c3cd1e580ef0582cbbab8120b79c8b6a3
---

 libswscale/x86/yuv2yuvX.asm | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm
index b6294cb919..d5b03495fd 100644
--- a/libswscale/x86/yuv2yuvX.asm
+++ b/libswscale/x86/yuv2yuvX.asm
@@ -124,8 +124,6 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, 
dstW, dither, offset
 REP_RET
 %endmacro
 
-INIT_MMX mmx
-YUV2YUVX_FUNC
 INIT_MMX mmxext
 YUV2YUVX_FUNC
 INIT_XMM sse3

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx

2022-08-19 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Tue 
May 17 21:19:16 2022 +0100| [e1e981c65e9b45c8acd8a907ac67801acadd262c] | 
committer: Derek Buitenhuis

mov: Compare frag times in correct time base when seeking a stream without a 
corresponding sidx

Some muxers, such as GPAC, create files with only one sidx, but two streams
muxed into the same fragments pointed to by this sidx.

Prevously, in such a case, when we seeked in such files, we fell back
to, for example, using the sidx associated with the video stream, to
seek the audio stream, leaving the seekhead in the wrong place.

We can still do this, but we need to take care to compare timestamps
in the same time base.

Signed-off-by: Derek Buitenhuis 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1e981c65e9b45c8acd8a907ac67801acadd262c
---

 libavformat/mov.c | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 31f3249ca6..1d8c5b2904 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1271,15 +1271,18 @@ static int64_t 
get_stream_info_time(MOVFragmentStreamInfo * frag_stream_info)
 return frag_stream_info->tfdt_dts;
 }
 
-static int64_t get_frag_time(MOVFragmentIndex *frag_index,
- int index, int track_id)
+static int64_t get_frag_time(AVFormatContext *s, AVStream *dst_st,
+ MOVFragmentIndex *frag_index, int index)
 {
 MOVFragmentStreamInfo * frag_stream_info;
+MOVStreamContext *sc = dst_st->priv_data;
 int64_t timestamp;
-int i;
+int i, j;
 
-if (track_id >= 0) {
-frag_stream_info = get_frag_stream_info(frag_index, index, track_id);
+// If the stream is referenced by any sidx, limit the search
+// to fragments that referenced this stream in the sidx
+if (sc->has_sidx) {
+frag_stream_info = get_frag_stream_info(frag_index, index, dst_st->id);
 if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE)
 return frag_stream_info->sidx_pts;
 if (frag_stream_info->first_tfra_pts != AV_NOPTS_VALUE)
@@ -1288,28 +1291,27 @@ static int64_t get_frag_time(MOVFragmentIndex 
*frag_index,
 }
 
 for (i = 0; i < frag_index->item[index].nb_stream_info; i++) {
+AVStream *frag_stream = NULL;
 frag_stream_info = &frag_index->item[index].stream_info[i];
+for (j = 0; j < s->nb_streams; j++)
+if (s->streams[j]->id == frag_stream_info->id)
+frag_stream = s->streams[j];
+if (!frag_stream) {
+av_log(s, AV_LOG_WARNING, "No stream matching sidx ID found.\n");
+continue;
+}
 timestamp = get_stream_info_time(frag_stream_info);
 if (timestamp != AV_NOPTS_VALUE)
-return timestamp;
+return av_rescale_q(timestamp, frag_stream->time_base, 
dst_st->time_base);
 }
 return AV_NOPTS_VALUE;
 }
 
-static int search_frag_timestamp(MOVFragmentIndex *frag_index,
+static int search_frag_timestamp(AVFormatContext *s, MOVFragmentIndex 
*frag_index,
  AVStream *st, int64_t timestamp)
 {
 int a, b, m, m0;
 int64_t frag_time;
-int id = -1;
-
-if (st) {
-// If the stream is referenced by any sidx, limit the search
-// to fragments that referenced this stream in the sidx
-MOVStreamContext *sc = st->priv_data;
-if (sc->has_sidx)
-id = st->id;
-}
 
 a = -1;
 b = frag_index->nb_items;
@@ -1318,7 +1320,7 @@ static int search_frag_timestamp(MOVFragmentIndex 
*frag_index,
 m0 = m = (a + b) >> 1;
 
 while (m < b &&
-   (frag_time = get_frag_time(frag_index, m, id)) == 
AV_NOPTS_VALUE)
+   (frag_time = get_frag_time(s, st, frag_index, m)) == 
AV_NOPTS_VALUE)
 m++;
 
 if (m < b && frag_time <= timestamp)
@@ -8862,7 +8864,7 @@ static int mov_seek_fragment(AVFormatContext *s, AVStream 
*st, int64_t timestamp
 if (!mov->frag_index.complete)
 return 0;
 
-index = search_frag_timestamp(&mov->frag_index, st, timestamp);
+index = search_frag_timestamp(s, &mov->frag_index, st, timestamp);
 if (index < 0)
 index = 0;
 if (!mov->frag_index.item[index].headers_read)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] checkasm: sw_scale: Produce more realistic test filter coefficients for yuv2yuvX

2022-08-19 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Wed Aug 17 
23:25:02 2022 +0300| [f921c583353bde2403334b94c1a3ca0785364924] | committer: 
Martin Storsjö

checkasm: sw_scale: Produce more realistic test filter coefficients for yuv2yuvX

This avoids triggering overflows in the filters, and avoids stray
test failures in the approximate functions on x86; due to rounding
differences, one implementation might overflow while another one
doesn't.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f921c583353bde2403334b94c1a3ca0785364924
---

 tests/checkasm/sw_scale.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index 86d266fb3e..3b8dd310ec 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -187,7 +187,6 @@ static void check_yuv2yuvX(int accurate)
 uint8_t d_val = rnd();
 memset(dither, d_val, LARGEST_INPUT_SIZE);
 randomize_buffers((uint8_t*)src_pixels, LARGEST_FILTER * 
LARGEST_INPUT_SIZE * sizeof(int16_t));
-randomize_buffers((uint8_t*)filter_coeff, LARGEST_FILTER * 
sizeof(int16_t));
 ctx = sws_alloc_context();
 if (accurate)
 ctx->flags |= SWS_ACCURATE_RND;
@@ -201,6 +200,21 @@ static void check_yuv2yuvX(int accurate)
 if (dstW <= osi)
 continue;
 for (fsi = 0; fsi < FILTER_SIZES; ++fsi) {
+// Generate filter coefficients for the given filter size,
+// with some properties:
+// - The coefficients add up to the intended sum (4096, 1<<12)
+// - The coefficients contain negative values
+// - The filter intermediates don't overflow for worst case
+//   inputs (all positive coefficients are coupled with
+//   input_max and all negative coefficients with input_min,
+//   or vice versa).
+// Produce a filter with all coefficients set to
+// -((1<<12)/(filter_size-1)) except for one (randomly chosen)
+// which is set to ((1<<13)-1).
+for (i = 0; i < filter_sizes[fsi]; ++i)
+filter_coeff[i] = -((1 << 12) / (filter_sizes[fsi] - 1));
+filter_coeff[rnd() % filter_sizes[fsi]] = (1 << 13) - 1;
+
 src = av_malloc(sizeof(int16_t*) * filter_sizes[fsi]);
 vFilterData = av_malloc((filter_sizes[fsi] + 2) * sizeof(union 
VFilterData));
 memset(vFilterData, 0, (filter_sizes[fsi] + 2) * sizeof(union 
VFilterData));

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil: move half-precision float helper to avutil

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Aug 
10 00:42:41 2022 +0200| [b42925264a910e6807e9e7134feaa44ae47bf911] | committer: 
Timo Rothenpieler

avutil: move half-precision float helper to avutil

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b42925264a910e6807e9e7134feaa44ae47bf911
---

 libavcodec/exr.c   | 2 +-
 libavcodec/exrenc.c| 2 +-
 libavcodec/pnmdec.c| 3 ++-
 libavcodec/pnmenc.c| 2 +-
 {libavcodec => libavutil}/float2half.h | 6 +++---
 {libavcodec => libavutil}/half2float.h | 6 +++---
 6 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 3a6b9c3014..5c6ca9adbf 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -41,6 +41,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/color_utils.h"
+#include "libavutil/half2float.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
@@ -53,7 +54,6 @@
 #include "exrdsp.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "half2float.h"
 #include "mathops.h"
 #include "thread.h"
 
diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index 8cf7827bb6..56c084d483 100644
--- a/libavcodec/exrenc.c
+++ b/libavcodec/exrenc.c
@@ -31,11 +31,11 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/float2half.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_internal.h"
 #include "encode.h"
-#include "float2half.h"
 
 enum ExrCompr {
 EXR_RAW,
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 130407df25..9383dc8e60 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -21,12 +21,13 @@
 
 #include "config_components.h"
 
+#include "libavutil/half2float.h"
+
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "internal.h"
 #include "put_bits.h"
 #include "pnm.h"
-#include "half2float.h"
 
 static void samplecpy(uint8_t *dst, const uint8_t *src, int n, int maxval)
 {
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index b16c93c88f..7ce534d06e 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -24,10 +24,10 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/float2half.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
-#include "float2half.h"
 
 typedef struct PHMEncContext {
 uint16_t basetable[512];
diff --git a/libavcodec/float2half.h b/libavutil/float2half.h
similarity index 96%
rename from libavcodec/float2half.h
rename to libavutil/float2half.h
index e05125088c..d6aaab8278 100644
--- a/libavcodec/float2half.h
+++ b/libavutil/float2half.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVCODEC_FLOAT2HALF_H
-#define AVCODEC_FLOAT2HALF_H
+#ifndef AVUTIL_FLOAT2HALF_H
+#define AVUTIL_FLOAT2HALF_H
 
 #include 
 
@@ -64,4 +64,4 @@ static uint16_t float2half(uint32_t f, uint16_t *basetable, 
uint8_t *shifttable)
 return h;
 }
 
-#endif /* AVCODEC_FLOAT2HALF_H */
+#endif /* AVUTIL_FLOAT2HALF_H */
diff --git a/libavcodec/half2float.h b/libavutil/half2float.h
similarity index 96%
rename from libavcodec/half2float.h
rename to libavutil/half2float.h
index 7df6747e50..1f6deade07 100644
--- a/libavcodec/half2float.h
+++ b/libavutil/half2float.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVCODEC_HALF2FLOAT_H
-#define AVCODEC_HALF2FLOAT_H
+#ifndef AVUTIL_HALF2FLOAT_H
+#define AVUTIL_HALF2FLOAT_H
 
 #include 
 
@@ -71,4 +71,4 @@ static uint32_t half2float(uint16_t h, const uint32_t 
*mantissatable, const uint
 return f;
 }
 
-#endif /* AVCODEC_HALF2FLOAT_H */
+#endif /* AVUTIL_HALF2FLOAT_H */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/half2float: adjust conversion of NaN

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Tue Aug  
9 22:16:50 2022 +0200| [cb8ad005bb73b1adf0d36eeb794c4c375fd3ee12] | committer: 
Timo Rothenpieler

avutil/half2float: adjust conversion of NaN

IEEE-754 differentiates two different kind of NaNs.
Quiet and Signaling ones. They are differentiated by the MSB of the
mantissa.

For whatever reason, actual hardware conversion of half to single always
sets the signaling bit to 1 if the mantissa is != 0, and to 0 if it's 0.
So our code has to follow suite or fate-testing hardware float16 will be
impossible.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb8ad005bb73b1adf0d36eeb794c4c375fd3ee12
---

 libavcodec/exr.c| 2 +-
 libavcodec/pnm.h| 2 +-
 libavutil/half2float.h  | 5 +
 tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 5c6ca9adbf..47f4786491 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -191,7 +191,7 @@ typedef struct EXRContext {
 float gamma;
 union av_intfloat32 gamma_table[65536];
 
-uint32_t mantissatable[2048];
+uint32_t mantissatable[3072];
 uint32_t exponenttable[64];
 uint16_t offsettable[64];
 } EXRContext;
diff --git a/libavcodec/pnm.h b/libavcodec/pnm.h
index 5bf2eaa4d9..7e5445f529 100644
--- a/libavcodec/pnm.h
+++ b/libavcodec/pnm.h
@@ -34,7 +34,7 @@ typedef struct PNMContext {
 int half;
 float scale;
 
-uint32_t mantissatable[2048];
+uint32_t mantissatable[3072];
 uint32_t exponenttable[64];
 uint16_t offsettable[64];
 } PNMContext;
diff --git a/libavutil/half2float.h b/libavutil/half2float.h
index 1f6deade07..5af4690cfe 100644
--- a/libavutil/half2float.h
+++ b/libavutil/half2float.h
@@ -45,6 +45,9 @@ static void half2float_table(uint32_t *mantissatable, 
uint32_t *exponenttable,
 mantissatable[i] = convertmantissa(i);
 for (int i = 1024; i < 2048; i++)
 mantissatable[i] = 0x3800UL + ((i - 1024) << 13UL);
+for (int i = 2048; i < 3072; i++)
+mantissatable[i] = mantissatable[i - 1024] | 0x40UL;
+mantissatable[2048] = mantissatable[1024];
 
 exponenttable[0] = 0;
 for (int i = 1; i < 31; i++)
@@ -58,7 +61,9 @@ static void half2float_table(uint32_t *mantissatable, 
uint32_t *exponenttable,
 offsettable[0] = 0;
 for (int i = 1; i < 64; i++)
 offsettable[i] = 1024;
+offsettable[31] = 2048;
 offsettable[32] = 0;
+offsettable[63] = 2048;
 }
 
 static uint32_t half2float(uint16_t h, const uint32_t *mantissatable, const 
uint32_t *exponenttable,
diff --git a/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x 
b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x
index b6201116fe..e45a40b498 100644
--- a/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x
+++ b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 256x256
 #sar 0: 1/1
-0,  0,  0,1,   786432, 0x1445e411
+0,  0,  0,1,   786432, 0xce9be2be

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/half2float: move tables to header-internal structs

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Aug 
10 01:00:56 2022 +0200| [f3fb528cd5bfecec6835a3951c75903a194ae1ad] | committer: 
Timo Rothenpieler

avutil/half2float: move tables to header-internal structs

Having to put the knowledge of the size of those arrays into a multitude
of places is rather smelly.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3fb528cd5bfecec6835a3951c75903a194ae1ad
---

 libavcodec/exr.c   | 27 +-
 libavcodec/exrenc.c| 11 +--
 libavcodec/pnm.h   |  5 ++---
 libavcodec/pnmdec.c| 42 +
 libavcodec/pnmenc.c| 13 ++---
 libavutil/float2half.h | 51 +++---
 libavutil/half2float.h | 46 -
 7 files changed, 84 insertions(+), 111 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 47f4786491..b0e2e85024 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -191,9 +191,7 @@ typedef struct EXRContext {
 float gamma;
 union av_intfloat32 gamma_table[65536];
 
-uint32_t mantissatable[3072];
-uint32_t exponenttable[64];
-uint16_t offsettable[64];
+Half2FloatTables h2f_tables;
 } EXRContext;
 
 static int zip_uncompress(const EXRContext *s, const uint8_t *src, int 
compressed_size,
@@ -899,10 +897,7 @@ static int ac_uncompress(const EXRContext *s, 
GetByteContext *gb, float *block)
 n += val & 0xff;
 } else {
 ret = n;
-block[ff_zigzag_direct[n]] = av_int2float(half2float(val,
-  s->mantissatable,
-  s->exponenttable,
-  s->offsettable));
+block[ff_zigzag_direct[n]] = av_int2float(half2float(val, 
&s->h2f_tables));
 n++;
 }
 }
@@ -1120,8 +1115,7 @@ static int dwa_uncompress(const EXRContext *s, const 
uint8_t *src, int compresse
 uint16_t *dc = (uint16_t *)td->dc_data;
 union av_intfloat32 dc_val;
 
-dc_val.i = half2float(dc[idx], s->mantissatable,
-  s->exponenttable, s->offsettable);
+dc_val.i = half2float(dc[idx], &s->h2f_tables);
 
 block[0] = dc_val.f;
 ac_uncompress(s, &agb, block);
@@ -1171,7 +1165,7 @@ static int dwa_uncompress(const EXRContext *s, const 
uint8_t *src, int compresse
 for (int x = 0; x < td->xsize; x++) {
 uint16_t ha = ai0[x] | (ai1[x] << 8);
 
-ao[x] = half2float(ha, s->mantissatable, s->exponenttable, 
s->offsettable);
+ao[x] = half2float(ha, &s->h2f_tables);
 }
 }
 
@@ -1427,10 +1421,7 @@ static int decode_block(AVCodecContext *avctx, void 
*tdata,
 }
 } else {
 for (x = 0; x < xsize; x++) {
-ptr_x[0].i = half2float(bytestream_get_le16(&src),
-s->mantissatable,
-s->exponenttable,
-s->offsettable);
+ptr_x[0].i = half2float(bytestream_get_le16(&src), 
&s->h2f_tables);
 ptr_x++;
 }
 }
@@ -2217,7 +2208,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 float one_gamma = 1.0f / s->gamma;
 avpriv_trc_function trc_func = NULL;
 
-half2float_table(s->mantissatable, s->exponenttable, s->offsettable);
+init_half2float_tables(&s->h2f_tables);
 
 s->avctx  = avctx;
 
@@ -2230,18 +2221,18 @@ static av_cold int decode_init(AVCodecContext *avctx)
 trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type);
 if (trc_func) {
 for (i = 0; i < 65536; ++i) {
-t.i = half2float(i, s->mantissatable, s->exponenttable, 
s->offsettable);
+t.i = half2float(i, &s->h2f_tables);
 t.f = trc_func(t.f);
 s->gamma_table[i] = t;
 }
 } else {
 if (one_gamma > 0.f && one_gamma < 1.0001f) {
 for (i = 0; i < 65536; ++i) {
-s->gamma_table[i].i = half2float(i, s->mantissatable, 
s->exponenttable, s->offsettable);
+s->gamma_table[i].i = half2float(i, &s->h2f_tables);
 }
 } else {
 for (i = 0; i < 65536; ++i) {
-t.i = half2float(i, s->mantissatable, s->exponenttable, 
s->offsettable);
+t.i = half2float(i, &s->h2f_tables);
 /* If negative value we reuse half value */
 if (t.f <= 0.0f) {
 s->gamma_table[i] = t;
diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index 56c084d483..356bd11543 100644
--- a/libavcodec

[FFmpeg-cvslog] avutil/half2float: move non-inline init code out of header

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Aug 
10 01:53:10 2022 +0200| [6dc79f1d04eb88ec97360c45be4cadc66b7e5780] | committer: 
Timo Rothenpieler

avutil/half2float: move non-inline init code out of header

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6dc79f1d04eb88ec97360c45be4cadc66b7e5780
---

 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(-)

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 b0e2e85024..859dd6fedd 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);
 
 s->avctx  = avctx;
 
diff --git a/libavcodec/exrenc.c b/libavcodec/exrenc.c
index 356bd11543..3dad107d62 100644
--- a/libavcodec/exrenc.c
+++ b/libavcodec/exrenc.c
@@ -94,7 +94,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 {
 EXRContext *s = avctx->priv_data;
 
-init_float2half_tables(&s->f2h_tables);
+ff_init_float2half_tables(&s->f2h_tables);
 
 switch (avctx->pix_fmt) {
 case AV_PIX_FMT_GBRPF32:
diff --git a/libavcodec/float2half.c b/libavcodec/float2half.c
new file mode 100644
index 00..90a6f63fac
--- /dev/null
+++ b/libavcodec/float2half.c
@@ -0,0 +1,19 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/float2half.c"
diff --git a/libavcodec/half2float.c b/libavcodec/half2float.c
new file mode 100644
index 00..1b023f96a5
--- /dev/null
+++ b/libavcodec/half2float.c
@@ -0,0 +1,19 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU L

[FFmpeg-cvslog] avutil/half2float: use native _Float16 if available

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Aug 
10 02:23:26 2022 +0200| [ef2c2a22207d7ec046bb0711fcae18f539828188] | committer: 
Timo Rothenpieler

avutil/half2float: use native _Float16 if available

_Float16 support was available on arm/aarch64 for a while, and with gcc
12 was enabled on x86 as long as SSE2 is supported.

If the target arch supports f16c, gcc emits fairly efficient assembly,
taking advantage of it. This is the case on x86-64-v3 or higher.
Same goes on arm, which has native float16 support.
On x86, without f16c, it emulates it in software using sse2 instructions.

This has shown to perform rather poorly:

_Float16 full SSE2 emulation:
frame=50074 fps=848 q=-0.0 size=N/A time=00:33:22.96 bitrate=N/A speed=33.9x

_Float16 f16c accelerated (Zen2, --cpu=znver2):
frame=50636 fps=1965 q=-0.0 Lsize=N/A time=00:33:45.40 bitrate=N/A speed=78.6x

classic half2float full software implementation:
frame=49926 fps=1605 q=-0.0 Lsize=N/A time=00:33:17.00 bitrate=N/A speed=64.2x

Hence an additional check was introduced, that only enables use of
_Float16 on x86 if f16c is being utilized.

On aarch64, a similar uplift in performance is seen:

RPi4 half2float full software implementation:
frame= 6088 fps=126 q=-0.0 Lsize=N/A time=00:04:03.48 bitrate=N/A speed=5.06x

RPi4 _Float16:
frame= 6103 fps=158 q=-0.0 Lsize=N/A time=00:04:04.08 bitrate=N/A speed=6.32x

Since arm/aarch64 always natively support 16 bit floats, it can always
be considered fast there.

I'm not aware of any additional platforms that currently support
_Float16. And if there are, they should be considered non-fast until
proven fast.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef2c2a22207d7ec046bb0711fcae18f539828188
---

 configure  | 12 
 libavutil/float2half.c |  2 ++
 libavutil/float2half.h | 16 
 libavutil/half2float.c |  4 
 libavutil/half2float.h | 16 
 5 files changed, 50 insertions(+)

diff --git a/configure b/configure
index fe94941a03..ea50c94002 100755
--- a/configure
+++ b/configure
@@ -2145,6 +2145,7 @@ ARCH_FEATURES="
 fast_64bit
 fast_clz
 fast_cmov
+fast_float16
 local_aligned
 simd_align_16
 simd_align_32
@@ -5127,6 +5128,8 @@ elif enabled arm; then
 ;;
 esac
 
+test_cflags -mfp16-format=ieee && add_cflags -mfp16-format=ieee
+
 elif enabled avr32; then
 
 case $cpu in
@@ -6231,6 +6234,15 @@ check_builtin sync_val_compare_and_swap "" "int *ptr; 
int oldval, newval; __sync
 check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
 check_builtin localtime_r time.h "time_t *time; struct tm *tm; 
localtime_r(time, tm)"
 
+check_builtin float16 "" "_Float16 f16var"
+if enabled float16; then
+if enabled x86; then
+test_cpp_condition stddef.h "defined(__F16C__)" && enable fast_float16
+elif enabled arm || enabled aarch64; then
+enable fast_float16
+fi
+fi
+
 case "$custom_allocator" in
 jemalloc)
 # jemalloc by default does not use a prefix
diff --git a/libavutil/float2half.c b/libavutil/float2half.c
index c79a3abfa1..1a283956e7 100644
--- a/libavutil/float2half.c
+++ b/libavutil/float2half.c
@@ -20,6 +20,7 @@
 
 void ff_init_float2half_tables(Float2HalfTables *t)
 {
+#if !HAVE_FAST_FLOAT16
 for (int i = 0; i < 256; i++) {
 int e = i - 127;
 
@@ -50,4 +51,5 @@ void ff_init_float2half_tables(Float2HalfTables *t)
 t->shifttable[i|0x100] = 13;
 }
 }
+#endif
 }
diff --git a/libavutil/float2half.h b/libavutil/float2half.h
index 20fdc2a36b..e619046911 100644
--- a/libavutil/float2half.h
+++ b/libavutil/float2half.h
@@ -20,21 +20,37 @@
 #define AVUTIL_FLOAT2HALF_H
 
 #include 
+#include "intfloat.h"
+
+#include "config.h"
 
 typedef struct Float2HalfTables {
+#if HAVE_FAST_FLOAT16
+uint8_t dummy;
+#else
 uint16_t basetable[512];
 uint8_t shifttable[512];
+#endif
 } Float2HalfTables;
 
 void ff_init_float2half_tables(Float2HalfTables *t);
 
 static inline uint16_t float2half(uint32_t f, const Float2HalfTables *t)
 {
+#if HAVE_FAST_FLOAT16
+union {
+_Float16 f;
+uint16_t i;
+} u;
+u.f = av_int2float(f);
+return u.i;
+#else
 uint16_t h;
 
 h = t->basetable[(f >> 23) & 0x1ff] + ((f & 0x007f) >> 
t->shifttable[(f >> 23) & 0x1ff]);
 
 return h;
+#endif
 }
 
 #endif /* AVUTIL_FLOAT2HALF_H */
diff --git a/libavutil/half2float.c b/libavutil/half2float.c
index 1967126f76..4de2180a19 100644
--- a/libavutil/half2float.c
+++ b/libavutil/half2float.c
@@ -18,6 +18,7 @@
 
 #include "libavutil/half2float.h"
 
+#if !HAVE_FAST_FLOAT16
 static uint32_t convertmantissa(uint32_t i)
 {
 int32_t m = i << 13; // Zero pad mantissa bits
@@ -33,9 +34,11 @@ static uint32_t convertmantissa(uint32_t i)
 
 return m | e; // Return combined number
 }
+#endif
 
 void ff_init_half2float_tables(Half2FloatTables *t)
 {
+#if !HAVE_FAST_FLOAT16
 t->mantissatable[0] = 0;
 f

[FFmpeg-cvslog] swscale: add opaque parameter to input functions

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Wed Aug 
10 15:12:24 2022 +0200| [f2de911818fbd7e73343803626b697fd0c968121] | committer: 
Timo Rothenpieler

swscale: add opaque parameter to input functions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2de911818fbd7e73343803626b697fd0c968121
---

 libswscale/hscale.c   |  12 ++--
 libswscale/input.c| 149 +++---
 libswscale/swscale_internal.h |  17 +++--
 libswscale/x86/swscale.c  |  13 ++--
 4 files changed, 106 insertions(+), 85 deletions(-)

diff --git a/libswscale/hscale.c b/libswscale/hscale.c
index eca0635338..6789ce7540 100644
--- a/libswscale/hscale.c
+++ b/libswscale/hscale.c
@@ -105,18 +105,18 @@ static int lum_convert(SwsContext *c, SwsFilterDescriptor 
*desc, int sliceY, int
 uint8_t * dst = desc->dst->plane[0].line[i];
 
 if (c->lumToYV12) {
-c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal);
+c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal, 
c->input_opaque);
 } else if (c->readLumPlanar) {
-c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table);
+c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table, 
c->input_opaque);
 }
 
 
 if (desc->alpha) {
 dst = desc->dst->plane[3].line[i];
 if (c->alpToYV12) {
-c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal);
+c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal, 
c->input_opaque);
 } else if (c->readAlpPlanar) {
-c->readAlpPlanar(dst, src, srcW, NULL);
+c->readAlpPlanar(dst, src, srcW, NULL, c->input_opaque);
 }
 }
 }
@@ -224,9 +224,9 @@ static int chr_convert(SwsContext *c, SwsFilterDescriptor 
*desc, int sliceY, int
 uint8_t * dst1 = desc->dst->plane[1].line[i];
 uint8_t * dst2 = desc->dst->plane[2].line[i];
 if (c->chrToYV12) {
-c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal);
+c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal, 
c->input_opaque);
 } else if (c->readChrPlanar) {
-c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table);
+c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table, 
c->input_opaque);
 }
 }
 return sliceH;
diff --git a/libswscale/input.c b/libswscale/input.c
index 68abc4d62c..36ef1e43ac 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -88,7 +88,7 @@ rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
 
 #define rgb64funcs(pattern, BE_LE, origin) \
 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t 
*_src, const uint8_t *unused0, const uint8_t *unused1,\
-int width, uint32_t *rgb2yuv) \
+int width, uint32_t *rgb2yuv, void *opq) \
 { \
 const uint16_t *src = (const uint16_t *) _src; \
 uint16_t *dst = (uint16_t *) _dst; \
@@ -97,7 +97,7 @@ static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, 
const uint8_t *_src,
  \
 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
 const uint8_t *unused0, const uint8_t 
*_src1, const uint8_t *_src2, \
-int width, uint32_t *rgb2yuv) \
+int width, uint32_t *rgb2yuv, void *opq) \
 { \
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
@@ -107,7 +107,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t 
*_dstU, uint8_t *_dstV, \
  \
 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t 
*_dstV, \
 const uint8_t *unused0, const uint8_t 
*_src1, const uint8_t *_src2, \
-int width, uint32_t *rgb2yuv) \
+int width, uint32_t *rgb2yuv, void *opq) \
 { \
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
@@ -192,7 +192,8 @@ static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst,  
\
 const uint8_t *_src,\
 const uint8_t *unused0, const 
uint8_t *unused1,\
 int width,  \
-uint32_t *rgb2yuv)  \
+uint32_t *rgb2yuv,  \
+void *opq)  \
 {   \
 const uint16_t *src = (const uint16_t *)_src;   \
 uint16_t *dst   = (uint16_t *)_dst; \
@@ -205,7 +206,8 @@ static void patt

[FFmpeg-cvslog] swscale/input: add rgbaf16 input support

2022-08-19 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Mon Aug  
8 14:02:31 2022 +0200| [aca569aad26f33fe68eb36c5c689b2dc4de77084] | committer: 
Timo Rothenpieler

swscale/input: add rgbaf16 input support

This is by no means perfect, since at least ddagrab will return scRGB
data with values outside of 0.0f to 1.0f for HDR values.
Its primary purpose is to be able to work with the format at all.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aca569aad26f33fe68eb36c5c689b2dc4de77084
---

 libswscale/Makefile   |   1 +
 libswscale/half2float.c   |  19 ++
 libswscale/input.c| 130 ++
 libswscale/slice.c|   9 ++-
 libswscale/swscale_internal.h |  10 
 libswscale/utils.c|   2 +
 libswscale/version.h  |   2 +-
 7 files changed, 171 insertions(+), 2 deletions(-)

diff --git a/libswscale/Makefile b/libswscale/Makefile
index 4c950e6c43..757997b401 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -9,6 +9,7 @@ OBJS = alphablend.o \
hscale.o \
hscale_fast_bilinear.o   \
gamma.o  \
+   half2float.o \
input.o  \
options.o\
output.o \
diff --git a/libswscale/half2float.c b/libswscale/half2float.c
new file mode 100644
index 00..1b023f96a5
--- /dev/null
+++ b/libswscale/half2float.c
@@ -0,0 +1,19 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/half2float.c"
diff --git a/libswscale/input.c b/libswscale/input.c
index 36ef1e43ac..1077d01e91 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1124,6 +1124,112 @@ static void grayf32##endian_name##ToY16_c(uint8_t *dst, 
const uint8_t *src,
 rgbf32_planar_funcs_endian(le, 0)
 rgbf32_planar_funcs_endian(be, 1)
 
+#define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : 
AV_RL16(&src), h2f_tbl))
+
+static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t 
*dstV, int is_be,
+ const uint16_t *src, int 
width,
+ int32_t *rgb2yuv, 
Half2FloatTables *h2f_tbl)
+{
+int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+int i;
+for (i = 0; i < width; i++) {
+int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) 
+
+ lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 
65535.0f))) >> 1;
+int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) 
+
+ lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 
65535.0f))) >> 1;
+int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) 
+
+ lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 
65535.0f))) >> 1;
+
+dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+}
+}
+
+static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t 
*dstV, int is_be,
+const uint16_t *src, int width,
+int32_t *rgb2yuv, 
Half2FloatTables *h2f_tbl)
+{
+int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+int i;
+for (i = 0; i < width; i++) {
+int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
+int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
+int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
+
+dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHIFT;
+dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> 
RGB2YUV_SHI

[FFmpeg-cvslog] The vuya pixel format was recently added, so this lavc workaround is no longer

2022-08-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Aug  7 14:50:18 
2022 -0300| [352799dca8f80b81c37ae3260e424b9479269829] | committer: James Almer

The vuya pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=352799dca8f80b81c37ae3260e424b9479269829
---

 doc/APIchanges |  4 
 libavcodec/allcodecs.c |  2 ++
 libavcodec/codec_desc.c|  2 ++
 libavcodec/codec_id.h  |  4 
 libavcodec/v408dec.c   | 11 ++-
 libavcodec/v408enc.c   | 12 +++-
 libavcodec/version.h   |  2 +-
 libavcodec/version_major.h |  1 +
 8 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b3ba07ee7c..31f99e3b25 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2022-08-xx - xx - lavc 59.42.101 - codec_id.h
+  Deprecate AV_CODEC_ID_AYUV and ayuv decoder/encoder. The rawvideo codec
+  and vuya pixel format combination will be used instead from now on.
+
 2022-08-07 - e95b08a7dd - lavu 57.33.101 - pixfmt.h
   Add AV_PIX_FMT_RGBAF16{BE,LE} pixel formats.
 
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index c94e2d5966..6939a4e25f 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -61,8 +61,10 @@ extern const FFCodec ff_avrn_decoder;
 extern const FFCodec ff_avs_decoder;
 extern const FFCodec ff_avui_encoder;
 extern const FFCodec ff_avui_decoder;
+#if FF_API_AYUV_CODECID
 extern const FFCodec ff_ayuv_encoder;
 extern const FFCodec ff_ayuv_decoder;
+#endif
 extern const FFCodec ff_bethsoftvid_decoder;
 extern const FFCodec ff_bfi_decoder;
 extern const FFCodec ff_bink_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index c1a177c22d..06dfe55d0f 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1462,6 +1462,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#if FF_API_AYUV_CODECID
 {
 .id= AV_CODEC_ID_AYUV,
 .type  = AVMEDIA_TYPE_VIDEO,
@@ -1469,6 +1470,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#endif
 {
 .id= AV_CODEC_ID_TARGA_Y216,
 .type  = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 386a00a7ef..2247bc0309 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -24,6 +24,8 @@
 #include "libavutil/avutil.h"
 #include "libavutil/samplefmt.h"
 
+#include "version_major.h"
+
 /**
  * @addtogroup lavc_core
  * @{
@@ -251,7 +253,9 @@ enum AVCodecID {
 AV_CODEC_ID_AVRP,
 AV_CODEC_ID_012V,
 AV_CODEC_ID_AVUI,
+#if FF_API_AYUV_CODECID
 AV_CODEC_ID_AYUV,
+#endif
 AV_CODEC_ID_TARGA_Y216,
 AV_CODEC_ID_V308,
 AV_CODEC_ID_V408,
diff --git a/libavcodec/v408dec.c b/libavcodec/v408dec.c
index 88fa777f22..694ee96b77 100644
--- a/libavcodec/v408dec.c
+++ b/libavcodec/v408dec.c
@@ -29,6 +29,10 @@ static av_cold int v408_decode_init(AVCodecContext *avctx)
 {
 avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
 
+#if FF_API_AYUV_CODECID
+if (avctx->codec_id==AV_CODEC_ID_AYUV)
+av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be 
removed.\n");
+#endif
 return 0;
 }
 
@@ -57,12 +61,15 @@ static int v408_decode_frame(AVCodecContext *avctx, AVFrame 
*pic,
 
 for (i = 0; i < avctx->height; i++) {
 for (j = 0; j < avctx->width; j++) {
+#if FF_API_AYUV_CODECID
 if (avctx->codec_id==AV_CODEC_ID_AYUV) {
 v[j] = *src++;
 u[j] = *src++;
 y[j] = *src++;
 a[j] = *src++;
-} else {
+} else
+#endif
+{
 u[j] = *src++;
 y[j] = *src++;
 v[j] = *src++;
@@ -81,6 +88,7 @@ static int v408_decode_frame(AVCodecContext *avctx, AVFrame 
*pic,
 return avpkt->size;
 }
 
+#if FF_API_AYUV_CODECID
 #if CONFIG_AYUV_DECODER
 const FFCodec ff_ayuv_decoder = {
 .p.name   = "ayuv",
@@ -92,6 +100,7 @@ const FFCodec ff_ayuv_decoder = {
 .p.capabilities = AV_CODEC_CAP_DR1,
 };
 #endif
+#endif
 #if CONFIG_V408_DECODER
 const FFCodec ff_v408_decoder = {
 .p.name   = "v408",
diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c
index 77d2b026b3..7ab59792e6 100644
--- a/libavcodec/v408enc.c
+++ b/libavcodec/v408enc.c
@@ -33,6 +33,11 @@ static av_cold int v408_encode_init(AVCodecContext *avctx)
 avctx->bits_per_coded_sample = 32;
 avctx->bit_rate = ff_guess_coded_bitrate(avctx);
 
+#if FF_API_AYUV_CODECID
+if (avctx->codec_id 

[FFmpeg-cvslog] APIchanges: fix library version in the latest entry

2022-08-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Aug 19 23:00:12 
2022 -0300| [0446282320c2cc43c729355f229d37c5b44867b0] | committer: James Almer

APIchanges: fix library version in the latest entry

Also add commit hash and date while at it.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0446282320c2cc43c729355f229d37c5b44867b0
---

 doc/APIchanges | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 31f99e3b25..2df65a521d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,7 +14,7 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
-2022-08-xx - xx - lavc 59.42.101 - codec_id.h
+2022-08-19 - 352799dca8 - lavc 59.42.102 - codec_id.h
   Deprecate AV_CODEC_ID_AYUV and ayuv decoder/encoder. The rawvideo codec
   and vuya pixel format combination will be used instead from now on.
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".