* [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input
@ 2022-03-30 20:31 Marton Balint
2022-03-30 20:31 ` [FFmpeg-devel] [PATCH 2/8] avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function Marton Balint
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:31 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
On empty input the awk script was always successful which caused the
filter-refcmp tests to always succeed.
Also fix the command lines for refcmp_metadata compare function because it
needs auto conversion filters, and update reference of test
filter-refcmp-psnr-rgb because it was missed in
a7fc78c1a638a32c3695c06f727774c740d675c2 but was never noticed due to the
original issue...
Signed-off-by: Marton Balint <cus@passwd.hu>
---
tests/fate-run.sh | 2 +-
tests/ref/fate/filter-refcmp-psnr-rgb | 80 +++++++++++++--------------
tests/refcmp-metadata.awk | 3 +
3 files changed, 44 insertions(+), 41 deletions(-)
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index fbfc0a925d..5e8d607d88 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -377,7 +377,7 @@ refcmp_metadata(){
refcmp=$1
pixfmt=$2
fuzz=${3:-0.001}
- ffmpeg $FLAGS $ENC_OPTS \
+ ffmpeg -auto_conversion_filters $FLAGS $ENC_OPTS \
-lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
-f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
}
diff --git a/tests/ref/fate/filter-refcmp-psnr-rgb b/tests/ref/fate/filter-refcmp-psnr-rgb
index f06db575ac..20abd3dc5a 100644
--- a/tests/ref/fate/filter-refcmp-psnr-rgb
+++ b/tests/ref/fate/filter-refcmp-psnr-rgb
@@ -1,45 +1,45 @@
frame:0 pts:0 pts_time:0
-lavfi.psnr.mse.r=1381.80
-lavfi.psnr.psnr.r=16.73
-lavfi.psnr.mse.g=896.00
-lavfi.psnr.psnr.g=18.61
-lavfi.psnr.mse.b=277.38
-lavfi.psnr.psnr.b=23.70
-lavfi.psnr.mse_avg=851.73
-lavfi.psnr.psnr_avg=18.83
+lavfi.psnr.mse.r=1367.642090
+lavfi.psnr.psnr.r=16.771078
+lavfi.psnr.mse.g=885.804382
+lavfi.psnr.psnr.g=18.657425
+lavfi.psnr.mse.b=274.825073
+lavfi.psnr.psnr.b=23.740240
+lavfi.psnr.mse_avg=842.757202
+lavfi.psnr.psnr_avg=18.873779
frame:1 pts:1 pts_time:1
-lavfi.psnr.mse.r=1380.37
-lavfi.psnr.psnr.r=16.73
-lavfi.psnr.mse.g=975.91
-lavfi.psnr.psnr.g=18.24
-lavfi.psnr.mse.b=435.72
-lavfi.psnr.psnr.b=21.74
-lavfi.psnr.mse_avg=930.67
-lavfi.psnr.psnr_avg=18.44
+lavfi.psnr.mse.r=1356.681152
+lavfi.psnr.psnr.r=16.806026
+lavfi.psnr.mse.g=958.161560
+lavfi.psnr.psnr.g=18.316416
+lavfi.psnr.mse.b=428.238312
+lavfi.psnr.psnr.b=21.813948
+lavfi.psnr.mse_avg=914.360352
+lavfi.psnr.psnr_avg=18.519630
frame:2 pts:2 pts_time:2
-lavfi.psnr.mse.r=1403.20
-lavfi.psnr.psnr.r=16.66
-lavfi.psnr.mse.g=954.05
-lavfi.psnr.psnr.g=18.34
-lavfi.psnr.mse.b=494.22
-lavfi.psnr.psnr.b=21.19
-lavfi.psnr.mse_avg=950.49
-lavfi.psnr.psnr_avg=18.35
+lavfi.psnr.mse.r=1387.254883
+lavfi.psnr.psnr.r=16.709242
+lavfi.psnr.mse.g=939.230957
+lavfi.psnr.psnr.g=18.403080
+lavfi.psnr.mse.b=493.913757
+lavfi.psnr.psnr.b=21.194292
+lavfi.psnr.mse_avg=940.133179
+lavfi.psnr.psnr_avg=18.398911
frame:3 pts:3 pts_time:3
-lavfi.psnr.mse.r=1452.80
-lavfi.psnr.psnr.r=16.51
-lavfi.psnr.mse.g=1001.02
-lavfi.psnr.psnr.g=18.13
-lavfi.psnr.mse.b=557.39
-lavfi.psnr.psnr.b=20.67
-lavfi.psnr.mse_avg=1003.74
-lavfi.psnr.psnr_avg=18.11
+lavfi.psnr.mse.r=1433.291260
+lavfi.psnr.psnr.r=16.567459
+lavfi.psnr.mse.g=990.005859
+lavfi.psnr.psnr.g=18.174425
+lavfi.psnr.mse.b=550.512329
+lavfi.psnr.psnr.b=20.723133
+lavfi.psnr.mse_avg=991.269836
+lavfi.psnr.psnr_avg=18.168884
frame:4 pts:4 pts_time:4
-lavfi.psnr.mse.r=1401.25
-lavfi.psnr.psnr.r=16.67
-lavfi.psnr.mse.g=1009.80
-lavfi.psnr.psnr.g=18.09
-lavfi.psnr.mse.b=602.42
-lavfi.psnr.psnr.b=20.33
-lavfi.psnr.mse_avg=1004.49
-lavfi.psnr.psnr_avg=18.11
+lavfi.psnr.mse.r=1385.949341
+lavfi.psnr.psnr.r=16.713329
+lavfi.psnr.mse.g=997.065796
+lavfi.psnr.psnr.g=18.143566
+lavfi.psnr.mse.b=601.962952
+lavfi.psnr.psnr.b=20.335106
+lavfi.psnr.mse_avg=994.992676
+lavfi.psnr.psnr_avg=18.152605
diff --git a/tests/refcmp-metadata.awk b/tests/refcmp-metadata.awk
index fa21aad0e0..e7ed5ae809 100644
--- a/tests/refcmp-metadata.awk
+++ b/tests/refcmp-metadata.awk
@@ -50,12 +50,15 @@ BEGIN {
}
END {
+ result = result && (NR != 0);
if (result) {
for (i = 1; i <= ref_nr; i++)
print ref_lines[i];
} else {
for (i = 1; i <= NR; i++)
print cmp_lines[i];
+ if (NR == 0)
+ print "[refcmp] no input";
if (NR != ref_nr)
print "[refcmp] lines: " NR " != " ref_nr > "/dev/stderr";
if (delta_max >= fuzz)
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 2/8] avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
@ 2022-03-30 20:31 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 3/8] avcodec/dds: use the common texture dsp decode function Marton Balint
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:31 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
This will allow using a common threaded decode or encode function from most
codecs using texture DSP functions.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/texturedsp.c | 4 +++
libavcodec/texturedsp.h | 23 +++++++++++++
libavcodec/texturedsp_template.c | 57 ++++++++++++++++++++++++++++++++
libavcodec/texturedspenc.c | 4 +++
4 files changed, 88 insertions(+)
create mode 100644 libavcodec/texturedsp_template.c
diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c
index b7dd8baa12..b8938213ef 100644
--- a/libavcodec/texturedsp.c
+++ b/libavcodec/texturedsp.c
@@ -652,3 +652,7 @@ av_cold void ff_texturedsp_init(TextureDSPContext *c)
c->rgtc2u_block = rgtc2u_block;
c->dxn3dc_block = dxn3dc_block;
}
+
+#define TEXTUREDSP_FUNC_NAME ff_texturedsp_decompress_thread
+#define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(a, b, c)
+#include "texturedsp_template.c"
diff --git a/libavcodec/texturedsp.h b/libavcodec/texturedsp.h
index 90ceb2b6aa..e15d3c2b02 100644
--- a/libavcodec/texturedsp.h
+++ b/libavcodec/texturedsp.h
@@ -39,6 +39,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "avcodec.h"
+
#define TEXTURE_BLOCK_W 4
#define TEXTURE_BLOCK_H 4
@@ -60,7 +62,28 @@ typedef struct TextureDSPContext {
int (*dxn3dc_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
} TextureDSPContext;
+typedef struct TextureDSPThreadContext {
+ union {
+ const uint8_t *in; // Input frame data
+ uint8_t *out; // Output frame data
+ } frame_data;
+ ptrdiff_t stride; // Frame linesize
+ union {
+ const uint8_t *in; // Compressed texture for decompression
+ uint8_t *out; // Compressed texture of compression
+ } tex_data;
+ int tex_ratio; // Number of compressed bytes in a texture block
+ int raw_ratio; // Number bytes in a line of a raw block
+ int slice_count; // Number of slices for threaded operations
+
+ /* Pointer to the selected compress or decompress function. */
+ int (*tex_funct)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+} TextureDSPThreadContext;
+
void ff_texturedsp_init(TextureDSPContext *c);
void ff_texturedspenc_init(TextureDSPContext *c);
+int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
+int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
+
#endif /* AVCODEC_TEXTUREDSP_H */
diff --git a/libavcodec/texturedsp_template.c b/libavcodec/texturedsp_template.c
new file mode 100644
index 0000000000..bd193aa97c
--- /dev/null
+++ b/libavcodec/texturedsp_template.c
@@ -0,0 +1,57 @@
+/*
+ * Texture block compression and decompression
+ * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * 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
+ *
+ */
+
+int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, void *arg,
+ int slice, int thread_nb)
+{
+ TextureDSPThreadContext *ctx = arg;
+ uint8_t *d = ctx->tex_data.out;
+ int w_block = avctx->coded_width / TEXTURE_BLOCK_W;
+ int h_block = avctx->coded_height / TEXTURE_BLOCK_H;
+ int x, y;
+ int start_slice, end_slice;
+ int base_blocks_per_slice = h_block / ctx->slice_count;
+ int remainder_blocks = h_block % ctx->slice_count;
+
+ /* When the frame height (in blocks) doesn't divide evenly between the
+ * number of slices, spread the remaining blocks evenly between the first
+ * operations */
+ start_slice = slice * base_blocks_per_slice;
+ /* Add any extra blocks (one per slice) that have been added before this slice */
+ start_slice += FFMIN(slice, remainder_blocks);
+
+ end_slice = start_slice + base_blocks_per_slice;
+ /* Add an extra block if there are still remainder blocks to be accounted for */
+ if (slice < remainder_blocks)
+ end_slice++;
+
+ for (y = start_slice; y < end_slice; y++) {
+ uint8_t *p = ctx->frame_data.out + y * ctx->stride * TEXTURE_BLOCK_H;
+ int off = y * w_block;
+ for (x = 0; x < w_block; x++) {
+ ctx->TEXTUREDSP_TEX_FUNC(p + x * ctx->raw_ratio, ctx->stride,
+ d + (off + x) * ctx->tex_ratio);
+ }
+ }
+
+ return 0;
+}
diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 3d68e0cf39..381be16f75 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -670,3 +670,7 @@ av_cold void ff_texturedspenc_init(TextureDSPContext *c)
c->dxt5ys_block = dxt5ys_block;
c->rgtc1u_alpha_block = rgtc1u_alpha_block;
}
+
+#define TEXTUREDSP_FUNC_NAME ff_texturedsp_compress_thread
+#define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(c, b, a)
+#include "texturedsp_template.c"
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 3/8] avcodec/dds: use the common texture dsp decode function
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
2022-03-30 20:31 ` [FFmpeg-devel] [PATCH 2/8] avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 4/8] avcodec/hapdec: use the common texturedsp " Marton Balint
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/dds.c | 135 +++++++++++++++++------------------------------
1 file changed, 48 insertions(+), 87 deletions(-)
diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 32690e1fd7..2254d18df8 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -106,12 +106,7 @@ typedef struct DDSContext {
int bpp;
enum DDSPostProc postproc;
- const uint8_t *tex_data; // Compressed texture
- int tex_ratio; // Compression ratio
- int slice_count; // Number of slices for threaded operations
-
- /* Pointer to the selected compress or decompress function. */
- int (*tex_funct)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+ TextureDSPThreadContext dec;
} DDSContext;
static int parse_pixel_format(AVCodecContext *avctx)
@@ -170,35 +165,36 @@ static int parse_pixel_format(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_RGBA;
if (ctx->compressed) {
+ ctx->dec.raw_ratio = 16;
switch (fourcc) {
case MKTAG('D', 'X', 'T', '1'):
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.dxt1a_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.dxt1a_block;
break;
case MKTAG('D', 'X', 'T', '2'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt2_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt2_block;
break;
case MKTAG('D', 'X', 'T', '3'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt3_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt3_block;
break;
case MKTAG('D', 'X', 'T', '4'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt4_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt4_block;
break;
case MKTAG('D', 'X', 'T', '5'):
- ctx->tex_ratio = 16;
+ ctx->dec.tex_ratio = 16;
if (ycocg_scaled)
- ctx->tex_funct = ctx->texdsp.dxt5ys_block;
+ ctx->dec.tex_funct = ctx->texdsp.dxt5ys_block;
else if (ycocg_classic)
- ctx->tex_funct = ctx->texdsp.dxt5y_block;
+ ctx->dec.tex_funct = ctx->texdsp.dxt5y_block;
else
- ctx->tex_funct = ctx->texdsp.dxt5_block;
+ ctx->dec.tex_funct = ctx->texdsp.dxt5_block;
break;
case MKTAG('R', 'X', 'G', 'B'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt5_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt5_block;
/* This format may be considered as a normal map,
* but it is handled differently in a separate postproc. */
ctx->postproc = DDS_SWIZZLE_RXGB;
@@ -206,25 +202,25 @@ static int parse_pixel_format(AVCodecContext *avctx)
break;
case MKTAG('A', 'T', 'I', '1'):
case MKTAG('B', 'C', '4', 'U'):
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.rgtc1u_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc1u_block;
break;
case MKTAG('B', 'C', '4', 'S'):
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.rgtc1s_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc1s_block;
break;
case MKTAG('A', 'T', 'I', '2'):
/* RGT2 variant with swapped R and G (3Dc)*/
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxn3dc_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxn3dc_block;
break;
case MKTAG('B', 'C', '5', 'U'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.rgtc2u_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc2u_block;
break;
case MKTAG('B', 'C', '5', 'S'):
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.rgtc2s_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc2s_block;
break;
case MKTAG('U', 'Y', 'V', 'Y'):
ctx->compressed = 0;
@@ -299,40 +295,40 @@ static int parse_pixel_format(AVCodecContext *avctx)
avctx->colorspace = AVCOL_SPC_RGB;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.dxt1a_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.dxt1a_block;
break;
case DXGI_FORMAT_BC2_UNORM_SRGB:
avctx->colorspace = AVCOL_SPC_RGB;
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt3_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt3_block;
break;
case DXGI_FORMAT_BC3_UNORM_SRGB:
avctx->colorspace = AVCOL_SPC_RGB;
case DXGI_FORMAT_BC3_TYPELESS:
case DXGI_FORMAT_BC3_UNORM:
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.dxt5_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.dxt5_block;
break;
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.rgtc1u_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc1u_block;
break;
case DXGI_FORMAT_BC4_SNORM:
- ctx->tex_ratio = 8;
- ctx->tex_funct = ctx->texdsp.rgtc1s_block;
+ ctx->dec.tex_ratio = 8;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc1s_block;
break;
case DXGI_FORMAT_BC5_TYPELESS:
case DXGI_FORMAT_BC5_UNORM:
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.rgtc2u_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc2u_block;
break;
case DXGI_FORMAT_BC5_SNORM:
- ctx->tex_ratio = 16;
- ctx->tex_funct = ctx->texdsp.rgtc2s_block;
+ ctx->dec.tex_ratio = 16;
+ ctx->dec.tex_funct = ctx->texdsp.rgtc2s_block;
break;
default:
av_log(avctx, AV_LOG_ERROR,
@@ -434,43 +430,6 @@ static int parse_pixel_format(AVCodecContext *avctx)
return 0;
}
-static int decompress_texture_thread(AVCodecContext *avctx, void *arg,
- int slice, int thread_nb)
-{
- DDSContext *ctx = avctx->priv_data;
- AVFrame *frame = arg;
- const uint8_t *d = ctx->tex_data;
- int w_block = avctx->coded_width / TEXTURE_BLOCK_W;
- int h_block = avctx->coded_height / TEXTURE_BLOCK_H;
- int x, y;
- int start_slice, end_slice;
- int base_blocks_per_slice = h_block / ctx->slice_count;
- int remainder_blocks = h_block % ctx->slice_count;
-
- /* When the frame height (in blocks) doesn't divide evenly between the
- * number of slices, spread the remaining blocks evenly between the first
- * operations */
- start_slice = slice * base_blocks_per_slice;
- /* Add any extra blocks (one per slice) that have been added before this slice */
- start_slice += FFMIN(slice, remainder_blocks);
-
- end_slice = start_slice + base_blocks_per_slice;
- /* Add an extra block if there are still remainder blocks to be accounted for */
- if (slice < remainder_blocks)
- end_slice++;
-
- for (y = start_slice; y < end_slice; y++) {
- uint8_t *p = frame->data[0] + y * frame->linesize[0] * TEXTURE_BLOCK_H;
- int off = y * w_block;
- for (x = 0; x < w_block; x++) {
- ctx->tex_funct(p + x * 16, frame->linesize[0],
- d + (off + x) * ctx->tex_ratio);
- }
- }
-
- return 0;
-}
-
static void do_swizzle(AVFrame *frame, int x, int y)
{
int i;
@@ -513,7 +472,7 @@ static void run_postproc(AVCodecContext *avctx, AVFrame *frame)
* http://www.realtimecollisiondetection.net/blog/?p=28 */
av_log(avctx, AV_LOG_DEBUG, "Post-processing normal map.\n");
- x_off = ctx->tex_ratio == 8 ? 0 : 3;
+ x_off = ctx->dec.tex_ratio == 8 ? 0 : 3;
for (i = 0; i < frame->linesize[0] * frame->height; i += 4) {
uint8_t *src = frame->data[0] + i;
int x = src[x_off];
@@ -664,9 +623,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
if (ctx->compressed) {
int size = (avctx->coded_height / TEXTURE_BLOCK_H) *
- (avctx->coded_width / TEXTURE_BLOCK_W) * ctx->tex_ratio;
- ctx->slice_count = av_clip(avctx->thread_count, 1,
- avctx->coded_height / TEXTURE_BLOCK_H);
+ (avctx->coded_width / TEXTURE_BLOCK_W) * ctx->dec.tex_ratio;
+ ctx->dec.slice_count = av_clip(avctx->thread_count, 1,
+ avctx->coded_height / TEXTURE_BLOCK_H);
if (bytestream2_get_bytes_left(gbc) < size) {
av_log(avctx, AV_LOG_ERROR,
@@ -676,8 +635,10 @@ static int dds_decode(AVCodecContext *avctx, void *data,
}
/* Use the decompress function on the texture, one block per thread. */
- ctx->tex_data = gbc->buffer;
- avctx->execute2(avctx, decompress_texture_thread, frame, NULL, ctx->slice_count);
+ ctx->dec.tex_data.in = gbc->buffer;
+ ctx->dec.frame_data.out = frame->data[0];
+ ctx->dec.stride = frame->linesize[0];
+ avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count);
} else if (!ctx->paletted && ctx->bpp == 4 && avctx->pix_fmt == AV_PIX_FMT_PAL8) {
uint8_t *dst = frame->data[0];
int x, y, i;
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 4/8] avcodec/hapdec: use the common texturedsp decode function
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
2022-03-30 20:31 ` [FFmpeg-devel] [PATCH 2/8] avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 3/8] avcodec/dds: use the common texture dsp decode function Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 5/8] avcodec/hapenc: use the common texturedsp encode function Marton Balint
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/hap.h | 11 ++---
libavcodec/hapdec.c | 110 ++++++++++----------------------------------
2 files changed, 28 insertions(+), 93 deletions(-)
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index 00c3dbb32d..7e065e4838 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -72,23 +72,18 @@ typedef struct HapContext {
HapChunk *chunks;
int *chunk_results; /* Results from threaded operations */
- int tex_rat; /* Compression ratio */
- int tex_rat2; /* Compression ratio of the second texture */
- const uint8_t *tex_data; /* Compressed texture */
uint8_t *tex_buf; /* Buffer for compressed texture */
size_t tex_size; /* Size of the compressed texture */
size_t max_snappy; /* Maximum compressed size for snappy buffer */
- int slice_count; /* Number of slices for threaded operations */
-
int texture_count; /* 2 for HAQA, 1 for other version */
int texture_section_size; /* size of the part of the texture section (for HAPQA) */
- int uncompress_pix_size; /* nb of byte / pixel for the target picture */
- /* Pointer to the selected compress or decompress function */
+ /* Pointer to the selected compress function (encoder only) */
int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
- int (*tex_fun2)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+
+ TextureDSPThreadContext dec[2];
} HapContext;
/*
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 4a7ac15a8e..685d65d8b8 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -247,60 +247,6 @@ static int decompress_chunks_thread(AVCodecContext *avctx, void *arg,
return 0;
}
-static int decompress_texture_thread_internal(AVCodecContext *avctx, void *arg,
- int slice, int thread_nb, int texture_num)
-{
- HapContext *ctx = avctx->priv_data;
- AVFrame *frame = arg;
- const uint8_t *d = ctx->tex_data;
- int w_block = avctx->coded_width / TEXTURE_BLOCK_W;
- int h_block = avctx->coded_height / TEXTURE_BLOCK_H;
- int x, y;
- int start_slice, end_slice;
- int base_blocks_per_slice = h_block / ctx->slice_count;
- int remainder_blocks = h_block % ctx->slice_count;
-
- /* When the frame height (in blocks) doesn't divide evenly between the
- * number of slices, spread the remaining blocks evenly between the first
- * operations */
- start_slice = slice * base_blocks_per_slice;
- /* Add any extra blocks (one per slice) that have been added before this slice */
- start_slice += FFMIN(slice, remainder_blocks);
-
- end_slice = start_slice + base_blocks_per_slice;
- /* Add an extra block if there are still remainder blocks to be accounted for */
- if (slice < remainder_blocks)
- end_slice++;
-
- for (y = start_slice; y < end_slice; y++) {
- uint8_t *p = frame->data[0] + y * frame->linesize[0] * TEXTURE_BLOCK_H;
- int off = y * w_block;
- for (x = 0; x < w_block; x++) {
- if (texture_num == 0) {
- ctx->tex_fun(p + x * 4 * ctx->uncompress_pix_size, frame->linesize[0],
- d + (off + x) * ctx->tex_rat);
- } else {
- ctx->tex_fun2(p + x * 4 * ctx->uncompress_pix_size, frame->linesize[0],
- d + (off + x) * ctx->tex_rat2);
- }
- }
- }
-
- return 0;
-}
-
-static int decompress_texture_thread(AVCodecContext *avctx, void *arg,
- int slice, int thread_nb)
-{
- return decompress_texture_thread_internal(avctx, arg, slice, thread_nb, 0);
-}
-
-static int decompress_texture2_thread(AVCodecContext *avctx, void *arg,
- int slice, int thread_nb)
-{
- return decompress_texture_thread_internal(avctx, arg, slice, thread_nb, 1);
-}
-
static int hap_decode(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
@@ -310,12 +256,9 @@ static int hap_decode(AVCodecContext *avctx, void *data,
int section_size;
enum HapSectionType section_type;
int start_texture_section = 0;
- int tex_rat[2] = {0, 0};
bytestream2_init(&ctx->gbc, avpkt->data, avpkt->size);
- tex_rat[0] = ctx->tex_rat;
-
/* check for multi texture header */
if (ctx->texture_count == 2) {
ret = ff_hap_parse_section_header(&ctx->gbc, §ion_size, §ion_type);
@@ -326,7 +269,6 @@ static int hap_decode(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
start_texture_section = 4;
- tex_rat[1] = ctx->tex_rat2;
}
/* Get the output frame ready to receive data */
@@ -344,7 +286,7 @@ static int hap_decode(AVCodecContext *avctx, void *data,
if (ctx->tex_size != (avctx->coded_width / TEXTURE_BLOCK_W)
*(avctx->coded_height / TEXTURE_BLOCK_H)
- *tex_rat[t]) {
+ *ctx->dec[t].tex_ratio) {
av_log(avctx, AV_LOG_ERROR, "uncompressed size mismatches\n");
return AVERROR_INVALIDDATA;
}
@@ -355,11 +297,11 @@ static int hap_decode(AVCodecContext *avctx, void *data,
if (hap_can_use_tex_in_place(ctx)) {
int tex_size;
/* Only DXTC texture compression in a contiguous block */
- ctx->tex_data = ctx->gbc.buffer;
+ ctx->dec[t].tex_data.in = ctx->gbc.buffer;
tex_size = FFMIN(ctx->texture_section_size, bytestream2_get_bytes_left(&ctx->gbc));
if (tex_size < (avctx->coded_width / TEXTURE_BLOCK_W)
*(avctx->coded_height / TEXTURE_BLOCK_H)
- *tex_rat[t]) {
+ *ctx->dec[t].tex_ratio) {
av_log(avctx, AV_LOG_ERROR, "Insufficient data\n");
return AVERROR_INVALIDDATA;
}
@@ -377,15 +319,12 @@ static int hap_decode(AVCodecContext *avctx, void *data,
return ctx->chunk_results[i];
}
- ctx->tex_data = ctx->tex_buf;
+ ctx->dec[t].tex_data.in = ctx->tex_buf;
}
- /* Use the decompress function on the texture, one block per thread */
- if (t == 0){
- avctx->execute2(avctx, decompress_texture_thread, frame, NULL, ctx->slice_count);
- } else{
- avctx->execute2(avctx, decompress_texture2_thread, frame, NULL, ctx->slice_count);
- }
+ ctx->dec[t].frame_data.out = frame->data[0];
+ ctx->dec[t].stride = frame->linesize[0];
+ avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec[t], NULL, ctx->dec[t].slice_count);
}
/* Frame is ready to be output */
@@ -415,40 +354,44 @@ static av_cold int hap_init(AVCodecContext *avctx)
ff_texturedsp_init(&ctx->dxtc);
ctx->texture_count = 1;
- ctx->uncompress_pix_size = 4;
+ ctx->dec[0].raw_ratio = 16;
+ ctx->dec[0].slice_count = av_clip(avctx->thread_count, 1,
+ avctx->coded_height / TEXTURE_BLOCK_H);
switch (avctx->codec_tag) {
case MKTAG('H','a','p','1'):
texture_name = "DXT1";
- ctx->tex_rat = 8;
- ctx->tex_fun = ctx->dxtc.dxt1_block;
+ ctx->dec[0].tex_ratio = 8;
+ ctx->dec[0].tex_funct = ctx->dxtc.dxt1_block;
avctx->pix_fmt = AV_PIX_FMT_RGB0;
break;
case MKTAG('H','a','p','5'):
texture_name = "DXT5";
- ctx->tex_rat = 16;
- ctx->tex_fun = ctx->dxtc.dxt5_block;
+ ctx->dec[0].tex_ratio = 16;
+ ctx->dec[0].tex_funct = ctx->dxtc.dxt5_block;
avctx->pix_fmt = AV_PIX_FMT_RGBA;
break;
case MKTAG('H','a','p','Y'):
texture_name = "DXT5-YCoCg-scaled";
- ctx->tex_rat = 16;
- ctx->tex_fun = ctx->dxtc.dxt5ys_block;
+ ctx->dec[0].tex_ratio = 16;
+ ctx->dec[0].tex_funct = ctx->dxtc.dxt5ys_block;
avctx->pix_fmt = AV_PIX_FMT_RGB0;
break;
case MKTAG('H','a','p','A'):
texture_name = "RGTC1";
- ctx->tex_rat = 8;
- ctx->tex_fun = ctx->dxtc.rgtc1u_gray_block;
+ ctx->dec[0].tex_ratio = 8;
+ ctx->dec[0].tex_funct = ctx->dxtc.rgtc1u_gray_block;
+ ctx->dec[0].raw_ratio = 4;
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
- ctx->uncompress_pix_size = 1;
break;
case MKTAG('H','a','p','M'):
texture_name = "DXT5-YCoCg-scaled / RGTC1";
- ctx->tex_rat = 16;
- ctx->tex_rat2 = 8;
- ctx->tex_fun = ctx->dxtc.dxt5ys_block;
- ctx->tex_fun2 = ctx->dxtc.rgtc1u_alpha_block;
+ ctx->dec[0].tex_ratio = 16;
+ ctx->dec[1].tex_ratio = 8;
+ ctx->dec[0].tex_funct = ctx->dxtc.dxt5ys_block;
+ ctx->dec[1].tex_funct = ctx->dxtc.rgtc1u_alpha_block;
+ ctx->dec[1].raw_ratio = 16;
+ ctx->dec[1].slice_count = ctx->dec[0].slice_count;
avctx->pix_fmt = AV_PIX_FMT_RGBA;
ctx->texture_count = 2;
break;
@@ -458,9 +401,6 @@ static av_cold int hap_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name);
- ctx->slice_count = av_clip(avctx->thread_count, 1,
- avctx->coded_height / TEXTURE_BLOCK_H);
-
return 0;
}
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 5/8] avcodec/hapenc: use the common texturedsp encode function
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
` (2 preceding siblings ...)
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 4/8] avcodec/hapdec: use the common texturedsp " Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 6/8] avcodec/vbndec: add VBN decoder Marton Balint
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
And add slice thread capabilities.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/hap.h | 4 +---
libavcodec/hapenc.c | 34 ++++++++++++++++------------------
2 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index 7e065e4838..fb5a4c4123 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -80,9 +80,7 @@ typedef struct HapContext {
int texture_count; /* 2 for HAQA, 1 for other version */
int texture_section_size; /* size of the part of the texture section (for HAPQA) */
- /* Pointer to the selected compress function (encoder only) */
- int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
-
+ TextureDSPThreadContext enc;
TextureDSPThreadContext dec[2];
} HapContext;
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index ee03fef449..148331a3dd 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -56,18 +56,14 @@ enum HapHeaderLength {
static int compress_texture(AVCodecContext *avctx, uint8_t *out, int out_length, const AVFrame *f)
{
HapContext *ctx = avctx->priv_data;
- int i, j;
if (ctx->tex_size > out_length)
return AVERROR_BUFFER_TOO_SMALL;
- for (j = 0; j < avctx->height; j += 4) {
- for (i = 0; i < avctx->width; i += 4) {
- uint8_t *p = f->data[0] + i * 4 + j * f->linesize[0];
- const int step = ctx->tex_fun(out, f->linesize[0], p);
- out += step;
- }
- }
+ ctx->enc.tex_data.out = out;
+ ctx->enc.frame_data.in = f->data[0];
+ ctx->enc.stride = f->linesize[0];
+ avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
return 0;
}
@@ -236,7 +232,6 @@ static int hap_encode(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int hap_init(AVCodecContext *avctx)
{
HapContext *ctx = avctx->priv_data;
- int ratio;
int corrected_chunk_count;
int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
@@ -256,32 +251,34 @@ static av_cold int hap_init(AVCodecContext *avctx)
switch (ctx->opt_tex_fmt) {
case HAP_FMT_RGBDXT1:
- ratio = 8;
+ ctx->enc.tex_ratio = 8;
avctx->codec_tag = MKTAG('H', 'a', 'p', '1');
avctx->bits_per_coded_sample = 24;
- ctx->tex_fun = ctx->dxtc.dxt1_block;
+ ctx->enc.tex_funct = ctx->dxtc.dxt1_block;
break;
case HAP_FMT_RGBADXT5:
- ratio = 4;
+ ctx->enc.tex_ratio = 16;
avctx->codec_tag = MKTAG('H', 'a', 'p', '5');
avctx->bits_per_coded_sample = 32;
- ctx->tex_fun = ctx->dxtc.dxt5_block;
+ ctx->enc.tex_funct = ctx->dxtc.dxt5_block;
break;
case HAP_FMT_YCOCGDXT5:
- ratio = 4;
+ ctx->enc.tex_ratio = 16;
avctx->codec_tag = MKTAG('H', 'a', 'p', 'Y');
avctx->bits_per_coded_sample = 24;
- ctx->tex_fun = ctx->dxtc.dxt5ys_block;
+ ctx->enc.tex_funct = ctx->dxtc.dxt5ys_block;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Invalid format %02X\n", ctx->opt_tex_fmt);
return AVERROR_INVALIDDATA;
}
+ ctx->enc.raw_ratio = 16;
+ ctx->enc.slice_count = av_clip(avctx->thread_count, 1, avctx->height / TEXTURE_BLOCK_H);
/* Texture compression ratio is constant, so can we computer
* beforehand the final size of the uncompressed buffer. */
- ctx->tex_size = FFALIGN(avctx->width, TEXTURE_BLOCK_W) *
- FFALIGN(avctx->height, TEXTURE_BLOCK_H) * 4 / ratio;
+ ctx->tex_size = avctx->width / TEXTURE_BLOCK_W *
+ avctx->height / TEXTURE_BLOCK_H * ctx->enc.tex_ratio;
switch (ctx->opt_compressor) {
case HAP_COMP_NONE:
@@ -294,7 +291,7 @@ static av_cold int hap_init(AVCodecContext *avctx)
case HAP_COMP_SNAPPY:
/* Round the chunk count to divide evenly on DXT block edges */
corrected_chunk_count = av_clip(ctx->opt_chunk_count, 1, HAP_MAX_CHUNKS);
- while ((ctx->tex_size / (64 / ratio)) % corrected_chunk_count != 0) {
+ while ((ctx->tex_size / ctx->enc.tex_ratio) % corrected_chunk_count != 0) {
corrected_chunk_count--;
}
@@ -356,6 +353,7 @@ const FFCodec ff_hap_encoder = {
.p.id = AV_CODEC_ID_HAP,
.priv_data_size = sizeof(HapContext),
.p.priv_class = &hapenc_class,
+ .p.capabilities = AV_CODEC_CAP_SLICE_THREADS,
.init = hap_init,
.encode2 = hap_encode,
.close = hap_close,
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 6/8] avcodec/vbndec: add VBN decoder
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
` (3 preceding siblings ...)
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 5/8] avcodec/hapenc: use the common texturedsp encode function Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 7/8] avcodec/vbnenc: add VBN encoder Marton Balint
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Add support for decoding Vizrt Binary Image (VBN) files.
LZW-compressed data is not supported yet.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
Changelog | 1 +
configure | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/codec_desc.c | 7 ++
libavcodec/codec_id.h | 1 +
libavcodec/vbn.h | 50 ++++++++++
libavcodec/vbndec.c | 196 +++++++++++++++++++++++++++++++++++++++
libavformat/allformats.c | 1 +
libavformat/img2.c | 1 +
libavformat/img2dec.c | 12 +++
11 files changed, 272 insertions(+)
create mode 100644 libavcodec/vbn.h
create mode 100644 libavcodec/vbndec.c
diff --git a/Changelog b/Changelog
index ac614f8f05..7bad88dabc 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version 5.1:
- dropped obsolete XvMC hwaccel
- pcm-bluray encoder
- DFPWM audio encoder/decoder and raw muxer/demuxer
+- Vizrt Binary Image decoder
version 5.0:
diff --git a/configure b/configure
index e4d36aa639..90c99ff85e 100755
--- a/configure
+++ b/configure
@@ -2959,6 +2959,7 @@ txd_decoder_select="texturedsp"
utvideo_decoder_select="bswapdsp llviddsp"
utvideo_encoder_select="bswapdsp huffman llvidencdsp"
vble_decoder_select="llviddsp"
+vbn_decoder_select="texturedsp"
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideodec vc1dsp"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fb8b0e824b..90700085b8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -708,6 +708,7 @@ OBJS-$(CONFIG_V408_ENCODER) += v408enc.o
OBJS-$(CONFIG_V410_DECODER) += v410dec.o
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
OBJS-$(CONFIG_VB_DECODER) += vb.o
+OBJS-$(CONFIG_VBN_DECODER) += vbndec.o
OBJS-$(CONFIG_VBLE_DECODER) += vble.o
OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1_block.o vc1_loopfilter.o \
vc1_mc.o vc1_pred.o vc1.o vc1data.o \
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 22d56760ec..f0a7ea7fd4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -347,6 +347,7 @@ extern const FFCodec ff_v408_decoder;
extern const FFCodec ff_v410_encoder;
extern const FFCodec ff_v410_decoder;
extern const FFCodec ff_vb_decoder;
+extern const FFCodec ff_vbn_decoder;
extern const FFCodec ff_vble_decoder;
extern const FFCodec ff_vc1_decoder;
extern const FFCodec ff_vc1_crystalhd_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 81f3b3c640..c08854cc93 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1863,6 +1863,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("GEM Raster image"),
.props = AV_CODEC_PROP_LOSSY,
},
+ {
+ .id = AV_CODEC_ID_VBN,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vbn",
+ .long_name = NULL_IF_CONFIG_SMALL("Vizrt Binary Image"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
/* various PCM "codecs" */
{
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 3ffb9bd22e..43c72ce8e4 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -308,6 +308,7 @@ enum AVCodecID {
AV_CODEC_ID_SIMBIOSIS_IMX,
AV_CODEC_ID_SGA_VIDEO,
AV_CODEC_ID_GEM,
+ AV_CODEC_ID_VBN,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
diff --git a/libavcodec/vbn.h b/libavcodec/vbn.h
new file mode 100644
index 0000000000..8660786de8
--- /dev/null
+++ b/libavcodec/vbn.h
@@ -0,0 +1,50 @@
+/*
+ * VBN format definitions
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * VBN format definitions.
+ */
+
+#ifndef AVCODEC_VBN_H
+#define AVCODEC_VBN_H
+
+#define VBN_MAGIC 0x900df11e
+#define VBN_MAJOR 3
+#define VBN_MINOR 4
+
+#define VBN_HEADER_SIZE 192
+
+#define VBN_FORMAT_RAW 0
+#define VBN_FORMAT_LZ 1
+#define VBN_FORMAT_DXT1 2
+#define VBN_FORMAT_DXT5 3
+
+#define VBN_COMPRESSION_NONE 0
+#define VBN_COMPRESSION_LZW 0x100
+
+#define VBN_PIX_ALPHA 0
+#define VBN_PIX_LUMINANCE 1
+#define VBN_PIX_LUMINANCE_ALPHA 2
+#define VBN_PIX_RGB 3
+#define VBN_PIX_RGBA 5
+#define VBN_PIX_INDEX 6
+
+#endif /* AVCODEC_VBN_H */
diff --git a/libavcodec/vbndec.c b/libavcodec/vbndec.c
new file mode 100644
index 0000000000..1119059c55
--- /dev/null
+++ b/libavcodec/vbndec.c
@@ -0,0 +1,196 @@
+/*
+ * Vizrt Binary Image decoder
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Vizrt Binary Image decoder
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "internal.h"
+#include "texturedsp.h"
+#include "vbn.h"
+#include "libavutil/imgutils.h"
+
+typedef struct VBNContext {
+ TextureDSPContext texdsp;
+ TextureDSPThreadContext dec;
+ GetByteContext gb;
+} VBNContext;
+
+static av_cold int vbn_init(AVCodecContext *avctx)
+{
+ VBNContext *ctx = avctx->priv_data;
+ ff_texturedsp_init(&ctx->texdsp);
+ return 0;
+}
+
+static int decompress(AVCodecContext *avctx, int compression, uint8_t **outbuf)
+{
+ VBNContext *ctx = avctx->priv_data;
+ GetByteContext *gb = &ctx->gb;
+
+ if (compression == VBN_COMPRESSION_NONE) // outbuf is left NULL because gb->buf can be used directly
+ return bytestream2_get_bytes_left(gb);
+
+ av_log(avctx, AV_LOG_ERROR, "Unsupported VBN compression: 0x%08x\n", compression);
+ return AVERROR_PATCHWELCOME;
+}
+
+static int vbn_decode_frame(AVCodecContext *avctx,
+ void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ VBNContext *ctx = avctx->priv_data;
+ GetByteContext *gb = &ctx->gb;
+ AVFrame *frame = data;
+ uint8_t *image_buf = NULL;
+ int image_len;
+ int width, height, components, format, compression, pix_fmt, linesize, data_size;
+ int ret;
+
+ bytestream2_init(gb, avpkt->data, avpkt->size);
+
+ if (bytestream2_get_bytes_left(gb) < VBN_HEADER_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "VBN header truncated\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bytestream2_get_le32(gb) != VBN_MAGIC ||
+ bytestream2_get_le32(gb) != VBN_MAJOR ||
+ bytestream2_get_le32(gb) != VBN_MINOR) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid VBN header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ width = bytestream2_get_le32(gb);
+ height = bytestream2_get_le32(gb);
+ components = bytestream2_get_le32(gb);
+ format = bytestream2_get_le32(gb);
+ pix_fmt = bytestream2_get_le32(gb);
+ bytestream2_get_le32(gb); // mipmaps
+ data_size = bytestream2_get_le32(gb);
+ bytestream2_seek(gb, VBN_HEADER_SIZE, SEEK_SET);
+
+ compression = format & 0xffffff00;
+ format = format & 0xff;
+
+ if (data_size != bytestream2_get_bytes_left(gb)) {
+ av_log(avctx, AV_LOG_ERROR, "Truncated packet\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (pix_fmt != VBN_PIX_RGBA && pix_fmt != VBN_PIX_RGB) {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format: 0x%08x\n", pix_fmt);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ ret = ff_set_dimensions(avctx, width, height);
+ if (ret < 0)
+ return ret;
+
+ if (format == VBN_FORMAT_RAW) {
+ if (pix_fmt == VBN_PIX_RGB && components == 3) {
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
+ linesize = avctx->width * 3;
+ } else if (pix_fmt == VBN_PIX_RGBA && components == 4) {
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
+ linesize = avctx->width * 4;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported number of components: %d\n", components);
+ return AVERROR_PATCHWELCOME;
+ }
+ } else if (format == VBN_FORMAT_DXT1 || format == VBN_FORMAT_DXT5) {
+ if (avctx->width % TEXTURE_BLOCK_W || avctx->height % TEXTURE_BLOCK_H) {
+ av_log(avctx, AV_LOG_ERROR, "DXTx compression only supports 4 pixel aligned resolutions\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
+ if (format == VBN_FORMAT_DXT1) {
+ ctx->dec.tex_funct = ctx->texdsp.dxt1_block;
+ ctx->dec.tex_ratio = 8;
+ linesize = avctx->coded_width / 2;
+ } else {
+ ctx->dec.tex_funct = ctx->texdsp.dxt5_block;
+ ctx->dec.tex_ratio = 16;
+ linesize = avctx->coded_width;
+ }
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported VBN format: 0x%02x\n", format);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ image_len = decompress(avctx, compression, &image_buf);
+ if (image_len < 0)
+ return image_len;
+
+ if (image_len < linesize * avctx->coded_height) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficent data\n");
+ ret = AVERROR_INVALIDDATA;
+ goto out;
+ }
+
+ ret = ff_get_buffer(avctx, frame, 0);
+ if (ret < 0)
+ goto out;
+
+ frame->pict_type = AV_PICTURE_TYPE_I;
+ frame->key_frame = 1;
+
+ if (format == VBN_FORMAT_RAW) {
+ uint8_t *flipped = frame->data[0] + frame->linesize[0] * (frame->height - 1);
+ av_image_copy_plane(flipped, -frame->linesize[0], image_buf ? image_buf : gb->buffer, linesize, linesize, frame->height);
+ } else {
+ ctx->dec.slice_count = av_clip(avctx->thread_count, 1, avctx->coded_height / TEXTURE_BLOCK_H);
+ ctx->dec.tex_data.in = image_buf ? image_buf : gb->buffer;
+ ctx->dec.raw_ratio = 16;
+ ctx->dec.frame_data.out = frame->data[0] + frame->linesize[0] * (frame->height - 1);
+ ctx->dec.stride = -frame->linesize[0];
+ avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count);
+ }
+
+ *got_frame = 1;
+ ret = avpkt->size;
+
+out:
+ av_freep(&image_buf);
+ return ret;
+}
+
+static av_cold int vbn_close(AVCodecContext *avctx)
+{
+ return 0;
+}
+
+const FFCodec ff_vbn_decoder = {
+ .p.name = "vbn",
+ .p.long_name = NULL_IF_CONFIG_SMALL("Vizrt Binary Image"),
+ .p.type = AVMEDIA_TYPE_VIDEO,
+ .p.id = AV_CODEC_ID_VBN,
+ .init = vbn_init,
+ .decode = vbn_decode_frame,
+ .close = vbn_close,
+ .priv_data_size = sizeof(VBNContext),
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE
+};
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 587ad59b3c..7c1d0ac38f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -526,6 +526,7 @@ extern const AVInputFormat ff_image_sgi_pipe_demuxer;
extern const AVInputFormat ff_image_svg_pipe_demuxer;
extern const AVInputFormat ff_image_sunrast_pipe_demuxer;
extern const AVInputFormat ff_image_tiff_pipe_demuxer;
+extern const AVInputFormat ff_image_vbn_pipe_demuxer;
extern const AVInputFormat ff_image_webp_pipe_demuxer;
extern const AVInputFormat ff_image_xbm_pipe_demuxer;
extern const AVInputFormat ff_image_xpm_pipe_demuxer;
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 4153102c92..fe2ca7bfff 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -87,6 +87,7 @@ const IdStrMap ff_img_tags[] = {
{ AV_CODEC_ID_GEM, "img" },
{ AV_CODEC_ID_GEM, "ximg" },
{ AV_CODEC_ID_GEM, "timg" },
+ { AV_CODEC_ID_VBN, "vbn" },
{ AV_CODEC_ID_NONE, NULL }
};
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index b9c06c5b54..551b9d508e 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -37,6 +37,7 @@
#include "internal.h"
#include "img2.h"
#include "libavcodec/mjpeg.h"
+#include "libavcodec/vbn.h"
#include "libavcodec/xwd.h"
#include "subtitles.h"
@@ -1131,6 +1132,16 @@ static int gem_probe(const AVProbeData *p)
return 0;
}
+static int vbn_probe(const AVProbeData *p)
+{
+ const uint8_t *b = p->buf;
+ if (AV_RL32(b ) == VBN_MAGIC &&
+ AV_RL32(b + 4) == VBN_MAJOR &&
+ AV_RL32(b + 8) == VBN_MINOR)
+ return AVPROBE_SCORE_MAX - 1;
+ return 0;
+}
+
#define IMAGEAUTO_DEMUXER_0(imgname, codecid)
#define IMAGEAUTO_DEMUXER_1(imgname, codecid)\
const AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
@@ -1181,6 +1192,7 @@ IMAGEAUTO_DEMUXER(sgi, SGI)
IMAGEAUTO_DEMUXER(sunrast, SUNRAST)
IMAGEAUTO_DEMUXER(svg, SVG)
IMAGEAUTO_DEMUXER(tiff, TIFF)
+IMAGEAUTO_DEMUXER(vbn, VBN)
IMAGEAUTO_DEMUXER(webp, WEBP)
IMAGEAUTO_DEMUXER(xbm, XBM)
IMAGEAUTO_DEMUXER(xpm, XPM)
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 7/8] avcodec/vbnenc: add VBN encoder
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
` (4 preceding siblings ...)
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 6/8] avcodec/vbndec: add VBN decoder Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder Marton Balint
2022-03-31 7:38 ` [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Tobias Rapp
7 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
Changelog | 2 +-
configure | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/vbnenc.c | 173 +++++++++++++++++++++++++++++++++++++++++
libavcodec/version.h | 2 +-
libavformat/img2enc.c | 2 +-
libavformat/version.h | 4 +-
8 files changed, 181 insertions(+), 5 deletions(-)
create mode 100644 libavcodec/vbnenc.c
diff --git a/Changelog b/Changelog
index 7bad88dabc..c3fbba5221 100644
--- a/Changelog
+++ b/Changelog
@@ -6,7 +6,7 @@ version 5.1:
- dropped obsolete XvMC hwaccel
- pcm-bluray encoder
- DFPWM audio encoder/decoder and raw muxer/demuxer
-- Vizrt Binary Image decoder
+- Vizrt Binary Image encoder/decoder
version 5.0:
diff --git a/configure b/configure
index 90c99ff85e..9c8965852b 100755
--- a/configure
+++ b/configure
@@ -2960,6 +2960,7 @@ utvideo_decoder_select="bswapdsp llviddsp"
utvideo_encoder_select="bswapdsp huffman llvidencdsp"
vble_decoder_select="llviddsp"
vbn_decoder_select="texturedsp"
+vbn_encoder_select="texturedspenc"
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideodec vc1dsp"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 90700085b8..90f46035d9 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -709,6 +709,7 @@ OBJS-$(CONFIG_V410_DECODER) += v410dec.o
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
OBJS-$(CONFIG_VB_DECODER) += vb.o
OBJS-$(CONFIG_VBN_DECODER) += vbndec.o
+OBJS-$(CONFIG_VBN_ENCODER) += vbnenc.o
OBJS-$(CONFIG_VBLE_DECODER) += vble.o
OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1_block.o vc1_loopfilter.o \
vc1_mc.o vc1_pred.o vc1.o vc1data.o \
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f0a7ea7fd4..585918da93 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -347,6 +347,7 @@ extern const FFCodec ff_v408_decoder;
extern const FFCodec ff_v410_encoder;
extern const FFCodec ff_v410_decoder;
extern const FFCodec ff_vb_decoder;
+extern const FFCodec ff_vbn_encoder;
extern const FFCodec ff_vbn_decoder;
extern const FFCodec ff_vble_decoder;
extern const FFCodec ff_vc1_decoder;
diff --git a/libavcodec/vbnenc.c b/libavcodec/vbnenc.c
new file mode 100644
index 0000000000..51f618c7d9
--- /dev/null
+++ b/libavcodec/vbnenc.c
@@ -0,0 +1,173 @@
+/*
+ * Vizrt Binary Image encoder
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Vizrt Binary Image encoder
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "encode.h"
+#include "texturedsp.h"
+#include "vbn.h"
+
+#include "libavutil/imgutils.h"
+#include "libavutil/frame.h"
+#include "libavutil/opt.h"
+
+typedef struct VBNContext {
+ AVClass *class;
+ TextureDSPContext dxtc;
+ PutByteContext pb;
+ int format;
+ TextureDSPThreadContext enc;
+} VBNContext;
+
+static int vbn_encode(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
+{
+ VBNContext *ctx = avctx->priv_data;
+ PutByteContext *pb = &ctx->pb;
+ int ret;
+ ptrdiff_t linesize;
+ int64_t pkt_size;
+
+ ret = av_image_check_size2(frame->width, frame->height, INT_MAX, frame->format, 0, avctx);
+ if (ret < 0)
+ return ret;
+
+ if (ctx->format == VBN_FORMAT_DXT1 || ctx->format == VBN_FORMAT_DXT5) {
+ if (frame->width % TEXTURE_BLOCK_W || frame->height % TEXTURE_BLOCK_H) {
+ av_log(avctx, AV_LOG_ERROR, "Video size %dx%d is not multiple of 4\n", frame->width, frame->height);
+ return AVERROR(EINVAL);
+ }
+ if (frame->format != AV_PIX_FMT_RGBA) {
+ av_log(avctx, AV_LOG_ERROR, "DXT formats only support RGBA pixel format\n");
+ return AVERROR(EINVAL);
+ }
+ ctx->enc.raw_ratio = 16;
+ ctx->enc.slice_count = av_clip(avctx->thread_count, 1, avctx->height / TEXTURE_BLOCK_H);
+ }
+
+ switch (ctx->format) {
+ case VBN_FORMAT_DXT1:
+ linesize = frame->width / 2;
+ ctx->enc.tex_funct = ctx->dxtc.dxt1_block;
+ ctx->enc.tex_ratio = 8;
+ break;
+ case VBN_FORMAT_DXT5:
+ linesize = frame->width;
+ ctx->enc.tex_funct = ctx->dxtc.dxt5_block;
+ ctx->enc.tex_ratio = 16;
+ break;
+ case VBN_FORMAT_RAW:
+ linesize = av_image_get_linesize(frame->format, frame->width, 0);
+ if (linesize < 0)
+ return linesize;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Invalid format %02X\n", ctx->format);
+ return AVERROR(EINVAL);
+ }
+
+ pkt_size = VBN_HEADER_SIZE + linesize * frame->height;
+ if (pkt_size > INT_MAX)
+ return AVERROR(EINVAL);
+
+ if ((ret = ff_get_encode_buffer(avctx, pkt, pkt_size, 0)) < 0)
+ return ret;
+
+ memset(pkt->data, 0, VBN_HEADER_SIZE);
+ bytestream2_init_writer(pb, pkt->data, pkt_size);
+ bytestream2_put_le32(pb, VBN_MAGIC);
+ bytestream2_put_le32(pb, VBN_MAJOR);
+ bytestream2_put_le32(pb, VBN_MINOR);
+ bytestream2_put_le32(pb, frame->width);
+ bytestream2_put_le32(pb, frame->height);
+ bytestream2_put_le32(pb, frame->format == AV_PIX_FMT_RGBA ? 4 : 3);
+ bytestream2_put_le32(pb, ctx->format);
+ bytestream2_put_le32(pb, frame->format == AV_PIX_FMT_RGBA ? VBN_PIX_RGBA : VBN_PIX_RGB);
+ bytestream2_put_le32(pb, 0); // mipmaps
+ bytestream2_put_le32(pb, pkt_size - VBN_HEADER_SIZE);
+ bytestream2_seek_p(pb, 64, SEEK_SET);
+ bytestream2_put_le32(pb, pkt_size - VBN_HEADER_SIZE);
+
+ if (ctx->format == VBN_FORMAT_DXT1 || ctx->format == VBN_FORMAT_DXT5) {
+ ctx->enc.frame_data.in = (frame->height - 1) * frame->linesize[0] + frame->data[0];
+ ctx->enc.stride = -frame->linesize[0];
+ ctx->enc.tex_data.out = pkt->data + VBN_HEADER_SIZE;
+ avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
+ } else {
+ uint8_t *flipped = frame->data[0] + frame->linesize[0] * (frame->height - 1);
+ av_image_copy_plane(pkt->data + VBN_HEADER_SIZE, linesize, flipped, -frame->linesize[0], linesize, frame->height);
+ }
+
+ *got_packet = 1;
+ return 0;
+}
+
+static av_cold int vbn_init(AVCodecContext *avctx)
+{
+ VBNContext *ctx = avctx->priv_data;
+ ff_texturedspenc_init(&ctx->dxtc);
+ return 0;
+}
+
+static av_cold int vbn_close(AVCodecContext *avctx)
+{
+ return 0;
+}
+
+#define OFFSET(x) offsetof(VBNContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "format", "Texture format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = VBN_FORMAT_DXT5 }, VBN_FORMAT_RAW, VBN_FORMAT_DXT5, FLAGS, "format" },
+ { "raw", "RAW texture", 0, AV_OPT_TYPE_CONST, { .i64 = VBN_FORMAT_RAW }, 0, 0, FLAGS, "format" },
+ { "dxt1", "DXT1 texture", 0, AV_OPT_TYPE_CONST, { .i64 = VBN_FORMAT_DXT1 }, 0, 0, FLAGS, "format" },
+ { "dxt5", "DXT5 texture", 0, AV_OPT_TYPE_CONST, { .i64 = VBN_FORMAT_DXT5 }, 0, 0, FLAGS, "format" },
+ { NULL },
+};
+
+static const AVClass vbnenc_class = {
+ .class_name = "VBN encoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+const FFCodec ff_vbn_encoder = {
+ .p.name = "vbn",
+ .p.long_name = NULL_IF_CONFIG_SMALL("Vizrt Binary Image"),
+ .p.type = AVMEDIA_TYPE_VIDEO,
+ .p.id = AV_CODEC_ID_VBN,
+ .p.capabilities = AV_CODEC_CAP_SLICE_THREADS,
+ .p.priv_class = &vbnenc_class,
+ .init = vbn_init,
+ .encode2 = vbn_encode,
+ .close = vbn_close,
+ .priv_data_size = sizeof(VBNContext),
+ .p.pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE,
+ },
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
+ FF_CODEC_CAP_INIT_CLEANUP,
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a744e7469f..26ee41eb1f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 25
+#define LIBAVCODEC_VERSION_MINOR 26
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 9b3b8741c8..ae351963d9 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -265,7 +265,7 @@ const AVOutputFormat ff_image2_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
.extensions = "bmp,dpx,exr,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,png,"
"ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,im24,"
- "sunras,xbm,xface,pix,y",
+ "sunras,vbn,xbm,xface,pix,y",
.priv_data_size = sizeof(VideoMuxData),
.video_codec = AV_CODEC_ID_MJPEG,
.write_header = write_header,
diff --git a/libavformat/version.h b/libavformat/version.h
index f4a26c2870..683184d5da 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 20
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 21
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
` (5 preceding siblings ...)
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 7/8] avcodec/vbnenc: add VBN encoder Marton Balint
@ 2022-03-30 20:32 ` Marton Balint
2022-04-09 22:46 ` Marton Balint
2022-03-31 7:38 ` [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Tobias Rapp
7 siblings, 1 reply; 12+ messages in thread
From: Marton Balint @ 2022-03-30 20:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
tests/Makefile | 1 +
tests/fate-run.sh | 11 +++++++++++
tests/fate/vbn.mak | 36 ++++++++++++++++++++++++++++++++++++
tests/ref/fate/vbn-dxt1 | 11 +++++++++++
tests/ref/fate/vbn-dxt5 | 11 +++++++++++
tests/ref/fate/vbn-raw-rgb24 | 9 +++++++++
tests/ref/fate/vbn-raw-rgba | 11 +++++++++++
7 files changed, 90 insertions(+)
create mode 100644 tests/fate/vbn.mak
create mode 100644 tests/ref/fate/vbn-dxt1
create mode 100644 tests/ref/fate/vbn-dxt5
create mode 100644 tests/ref/fate/vbn-raw-rgb24
create mode 100644 tests/ref/fate/vbn-raw-rgba
diff --git a/tests/Makefile b/tests/Makefile
index 9f33394856..e3b41a4f7b 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -191,6 +191,7 @@ include $(SRC_PATH)/tests/fate/speedhq.mak
include $(SRC_PATH)/tests/fate/subtitles.mak
include $(SRC_PATH)/tests/fate/truehd.mak
include $(SRC_PATH)/tests/fate/utvideo.mak
+include $(SRC_PATH)/tests/fate/vbn.mak
include $(SRC_PATH)/tests/fate/video.mak
include $(SRC_PATH)/tests/fate/voice.mak
include $(SRC_PATH)/tests/fate/vorbis.mak
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 5e8d607d88..3022aa44a6 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -382,6 +382,17 @@ refcmp_metadata(){
-f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
}
+refcmp_metadata_files(){
+ refcmp=$1
+ pixfmt=$2
+ file1=$3
+ file2=$4
+ fuzz=${5:-0.001}
+ ffmpeg -auto_conversion_filters $FLAGS -i $file1 $FLAGS -i $file2 $ENC_OPTS \
+ -lavfi "[0:v]format=${pixfmt}[v0];[1:v]format=${pixfmt}[v1];[v0][v1]${refcmp},metadata=print:file=-" \
+ -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
+}
+
pixfmt_conversion(){
conversion="${test#pixfmt-}"
outdir="tests/data/pixfmt"
diff --git a/tests/fate/vbn.mak b/tests/fate/vbn.mak
new file mode 100644
index 0000000000..044b110ac1
--- /dev/null
+++ b/tests/fate/vbn.mak
@@ -0,0 +1,36 @@
+fate-vbn-%: VBN_FILE = tests/data/$(subst fate-vbn-,,$(@)).vbn
+fate-vbn-%: PIX_FMT = rgba
+fate-vbn-raw-rgb24: PIX_FMT = rgb24
+fate-vbn-%: SRC = $(TARGET_SAMPLES)/png1/lena-$(PIX_FMT).png
+fate-vbn-%: CMD = refcmp_metadata_files psnr $(PIX_FMT) $(VBN_FILE) $(SRC)
+
+fate-vbn-dxt1: tests/data/dxt1.vbn
+fate-vbn-dxt5: tests/data/dxt5.vbn
+fate-vbn-raw-rgba: tests/data/raw-rgba.vbn
+fate-vbn-raw-rgb24: tests/data/raw-rgb24.vbn
+
+FATE_VBN += fate-vbn-dxt1
+FATE_VBN += fate-vbn-dxt5
+FATE_VBN += fate-vbn-raw-rgba
+FATE_VBN += fate-vbn-raw-rgb24
+
+tests/data/dxt1.vbn: TAG = GEN
+tests/data/dxt1.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt1 $(TARGET_PATH)/$@ -y 2>/dev/null
+
+tests/data/dxt5.vbn: TAG = GEN
+tests/data/dxt5.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt5 $(TARGET_PATH)/$@ -y 2>/dev/null
+
+tests/data/raw-rgba.vbn: TAG = GEN
+tests/data/raw-rgba.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
+
+tests/data/raw-rgb24.vbn: TAG = GEN
+tests/data/raw-rgb24.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgb24.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
+
+VBN_REFCMP_DEPS = PSNR_FILTER METADATA_FILTER VBN_ENCODER VBN_DECODER IMAGE2_MUXER IMAGE2_DEMUXER PNG_DECODER
+
+FATE_SAMPLES_FFMPEG-$(call ALLYES, $(VBN_REFCMP_DEPS)) += $(FATE_VBN)
+fate-vbn: $(FATE_VBN)
diff --git a/tests/ref/fate/vbn-dxt1 b/tests/ref/fate/vbn-dxt1
new file mode 100644
index 0000000000..0af4444d94
--- /dev/null
+++ b/tests/ref/fate/vbn-dxt1
@@ -0,0 +1,11 @@
+frame:0 pts:0 pts_time:0
+lavfi.psnr.mse.r=36.794250
+lavfi.psnr.psnr.r=32.473003
+lavfi.psnr.mse.g=33.350525
+lavfi.psnr.psnr.g=32.899776
+lavfi.psnr.mse.b=28.317383
+lavfi.psnr.psnr.b=33.610271
+lavfi.psnr.mse.a=21186.988281
+lavfi.psnr.psnr.a=4.870111
+lavfi.psnr.mse_avg=5321.362793
+lavfi.psnr.psnr_avg=10.870575
diff --git a/tests/ref/fate/vbn-dxt5 b/tests/ref/fate/vbn-dxt5
new file mode 100644
index 0000000000..dbec0bd13d
--- /dev/null
+++ b/tests/ref/fate/vbn-dxt5
@@ -0,0 +1,11 @@
+frame:0 pts:0 pts_time:0
+lavfi.psnr.mse.r=36.794250
+lavfi.psnr.psnr.r=32.473003
+lavfi.psnr.mse.g=33.350525
+lavfi.psnr.psnr.g=32.899776
+lavfi.psnr.mse.b=28.317383
+lavfi.psnr.psnr.b=33.610271
+lavfi.psnr.mse.a=0.000183
+lavfi.psnr.psnr.a=85.503792
+lavfi.psnr.mse_avg=24.615585
+lavfi.psnr.psnr_avg=34.218700
diff --git a/tests/ref/fate/vbn-raw-rgb24 b/tests/ref/fate/vbn-raw-rgb24
new file mode 100644
index 0000000000..06143c27b6
--- /dev/null
+++ b/tests/ref/fate/vbn-raw-rgb24
@@ -0,0 +1,9 @@
+frame:0 pts:0 pts_time:0
+lavfi.psnr.mse.r=0.000000
+lavfi.psnr.psnr.r=inf
+lavfi.psnr.mse.g=0.000000
+lavfi.psnr.psnr.g=inf
+lavfi.psnr.mse.b=0.000000
+lavfi.psnr.psnr.b=inf
+lavfi.psnr.mse_avg=0.000000
+lavfi.psnr.psnr_avg=inf
diff --git a/tests/ref/fate/vbn-raw-rgba b/tests/ref/fate/vbn-raw-rgba
new file mode 100644
index 0000000000..4614ab5c25
--- /dev/null
+++ b/tests/ref/fate/vbn-raw-rgba
@@ -0,0 +1,11 @@
+frame:0 pts:0 pts_time:0
+lavfi.psnr.mse.r=0.000000
+lavfi.psnr.psnr.r=inf
+lavfi.psnr.mse.g=0.000000
+lavfi.psnr.psnr.g=inf
+lavfi.psnr.mse.b=0.000000
+lavfi.psnr.psnr.b=inf
+lavfi.psnr.mse.a=0.000000
+lavfi.psnr.psnr.a=inf
+lavfi.psnr.mse_avg=0.000000
+lavfi.psnr.psnr_avg=inf
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
` (6 preceding siblings ...)
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder Marton Balint
@ 2022-03-31 7:38 ` Tobias Rapp
2022-03-31 21:30 ` [FFmpeg-devel] [PATCH v2 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty or truncated input Marton Balint
7 siblings, 1 reply; 12+ messages in thread
From: Tobias Rapp @ 2022-03-31 7:38 UTC (permalink / raw)
To: ffmpeg-devel
On 30/03/2022 22:31, Marton Balint wrote:
> On empty input the awk script was always successful which caused the
> filter-refcmp tests to always succeed.
>
> Also fix the command lines for refcmp_metadata compare function because it
> needs auto conversion filters, and update reference of test
> filter-refcmp-psnr-rgb because it was missed in
> a7fc78c1a638a32c3695c06f727774c740d675c2 but was never noticed due to the
> original issue...
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> tests/fate-run.sh | 2 +-
> tests/ref/fate/filter-refcmp-psnr-rgb | 80 +++++++++++++--------------
> tests/refcmp-metadata.awk | 3 +
> 3 files changed, 44 insertions(+), 41 deletions(-)
>
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index fbfc0a925d..5e8d607d88 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -377,7 +377,7 @@ refcmp_metadata(){
> refcmp=$1
> pixfmt=$2
> fuzz=${3:-0.001}
> - ffmpeg $FLAGS $ENC_OPTS \
> + ffmpeg -auto_conversion_filters $FLAGS $ENC_OPTS \
> -lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
> -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
> }
> diff --git a/tests/ref/fate/filter-refcmp-psnr-rgb b/tests/ref/fate/filter-refcmp-psnr-rgb
> index f06db575ac..20abd3dc5a 100644
> --- a/tests/ref/fate/filter-refcmp-psnr-rgb
> +++ b/tests/ref/fate/filter-refcmp-psnr-rgb
> @@ -1,45 +1,45 @@
> frame:0 pts:0 pts_time:0
> -lavfi.psnr.mse.r=1381.80
> -lavfi.psnr.psnr.r=16.73
> -lavfi.psnr.mse.g=896.00
> -lavfi.psnr.psnr.g=18.61
> -lavfi.psnr.mse.b=277.38
> -lavfi.psnr.psnr.b=23.70
> -lavfi.psnr.mse_avg=851.73
> -lavfi.psnr.psnr_avg=18.83
> +lavfi.psnr.mse.r=1367.642090
> +lavfi.psnr.psnr.r=16.771078
> +lavfi.psnr.mse.g=885.804382
> +lavfi.psnr.psnr.g=18.657425
> +lavfi.psnr.mse.b=274.825073
> +lavfi.psnr.psnr.b=23.740240
> +lavfi.psnr.mse_avg=842.757202
> +lavfi.psnr.psnr_avg=18.873779
> frame:1 pts:1 pts_time:1
> -lavfi.psnr.mse.r=1380.37
> -lavfi.psnr.psnr.r=16.73
> -lavfi.psnr.mse.g=975.91
> -lavfi.psnr.psnr.g=18.24
> -lavfi.psnr.mse.b=435.72
> -lavfi.psnr.psnr.b=21.74
> -lavfi.psnr.mse_avg=930.67
> -lavfi.psnr.psnr_avg=18.44
> +lavfi.psnr.mse.r=1356.681152
> +lavfi.psnr.psnr.r=16.806026
> +lavfi.psnr.mse.g=958.161560
> +lavfi.psnr.psnr.g=18.316416
> +lavfi.psnr.mse.b=428.238312
> +lavfi.psnr.psnr.b=21.813948
> +lavfi.psnr.mse_avg=914.360352
> +lavfi.psnr.psnr_avg=18.519630
> frame:2 pts:2 pts_time:2
> -lavfi.psnr.mse.r=1403.20
> -lavfi.psnr.psnr.r=16.66
> -lavfi.psnr.mse.g=954.05
> -lavfi.psnr.psnr.g=18.34
> -lavfi.psnr.mse.b=494.22
> -lavfi.psnr.psnr.b=21.19
> -lavfi.psnr.mse_avg=950.49
> -lavfi.psnr.psnr_avg=18.35
> +lavfi.psnr.mse.r=1387.254883
> +lavfi.psnr.psnr.r=16.709242
> +lavfi.psnr.mse.g=939.230957
> +lavfi.psnr.psnr.g=18.403080
> +lavfi.psnr.mse.b=493.913757
> +lavfi.psnr.psnr.b=21.194292
> +lavfi.psnr.mse_avg=940.133179
> +lavfi.psnr.psnr_avg=18.398911
> frame:3 pts:3 pts_time:3
> -lavfi.psnr.mse.r=1452.80
> -lavfi.psnr.psnr.r=16.51
> -lavfi.psnr.mse.g=1001.02
> -lavfi.psnr.psnr.g=18.13
> -lavfi.psnr.mse.b=557.39
> -lavfi.psnr.psnr.b=20.67
> -lavfi.psnr.mse_avg=1003.74
> -lavfi.psnr.psnr_avg=18.11
> +lavfi.psnr.mse.r=1433.291260
> +lavfi.psnr.psnr.r=16.567459
> +lavfi.psnr.mse.g=990.005859
> +lavfi.psnr.psnr.g=18.174425
> +lavfi.psnr.mse.b=550.512329
> +lavfi.psnr.psnr.b=20.723133
> +lavfi.psnr.mse_avg=991.269836
> +lavfi.psnr.psnr_avg=18.168884
> frame:4 pts:4 pts_time:4
> -lavfi.psnr.mse.r=1401.25
> -lavfi.psnr.psnr.r=16.67
> -lavfi.psnr.mse.g=1009.80
> -lavfi.psnr.psnr.g=18.09
> -lavfi.psnr.mse.b=602.42
> -lavfi.psnr.psnr.b=20.33
> -lavfi.psnr.mse_avg=1004.49
> -lavfi.psnr.psnr_avg=18.11
> +lavfi.psnr.mse.r=1385.949341
> +lavfi.psnr.psnr.r=16.713329
> +lavfi.psnr.mse.g=997.065796
> +lavfi.psnr.psnr.g=18.143566
> +lavfi.psnr.mse.b=601.962952
> +lavfi.psnr.psnr.b=20.335106
> +lavfi.psnr.mse_avg=994.992676
> +lavfi.psnr.psnr_avg=18.152605
> diff --git a/tests/refcmp-metadata.awk b/tests/refcmp-metadata.awk
> index fa21aad0e0..e7ed5ae809 100644
> --- a/tests/refcmp-metadata.awk
> +++ b/tests/refcmp-metadata.awk
> @@ -50,12 +50,15 @@ BEGIN {
> }
>
> END {
> + result = result && (NR != 0);
Checking for "NR == ref_nr" would additionally catch truncated input.
> if (result) {
> for (i = 1; i <= ref_nr; i++)
> print ref_lines[i];
> } else {
> for (i = 1; i <= NR; i++)
> print cmp_lines[i];
> + if (NR == 0)
> + print "[refcmp] no input";
Output should go to stderr here.
> if (NR != ref_nr)
> print "[refcmp] lines: " NR " != " ref_nr > "/dev/stderr";
Maybe add an "else" before the "if" to avoid that both lines are printed
for empty input.
> if (delta_max >= fuzz)
Otherwise looks good to me. Thanks for catching the issue!
Regards,
Tobias
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty or truncated input
2022-03-31 7:38 ` [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Tobias Rapp
@ 2022-03-31 21:30 ` Marton Balint
2022-04-01 6:26 ` Tobias Rapp
0 siblings, 1 reply; 12+ messages in thread
From: Marton Balint @ 2022-03-31 21:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
On empty input the awk script was always successful which caused the
filter-refcmp tests to always succeed.
Also fix the command lines for refcmp_metadata compare function because it
needs auto conversion filters, and update reference of test
filter-refcmp-psnr-rgb because it was missed in
a7fc78c1a638a32c3695c06f727774c740d675c2 but was never noticed due to the
original issue...
Signed-off-by: Marton Balint <cus@passwd.hu>
---
tests/fate-run.sh | 2 +-
tests/ref/fate/filter-refcmp-psnr-rgb | 80 +++++++++++++--------------
tests/refcmp-metadata.awk | 5 +-
3 files changed, 45 insertions(+), 42 deletions(-)
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index fbfc0a925d..5e8d607d88 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -377,7 +377,7 @@ refcmp_metadata(){
refcmp=$1
pixfmt=$2
fuzz=${3:-0.001}
- ffmpeg $FLAGS $ENC_OPTS \
+ ffmpeg -auto_conversion_filters $FLAGS $ENC_OPTS \
-lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
-f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
}
diff --git a/tests/ref/fate/filter-refcmp-psnr-rgb b/tests/ref/fate/filter-refcmp-psnr-rgb
index f06db575ac..20abd3dc5a 100644
--- a/tests/ref/fate/filter-refcmp-psnr-rgb
+++ b/tests/ref/fate/filter-refcmp-psnr-rgb
@@ -1,45 +1,45 @@
frame:0 pts:0 pts_time:0
-lavfi.psnr.mse.r=1381.80
-lavfi.psnr.psnr.r=16.73
-lavfi.psnr.mse.g=896.00
-lavfi.psnr.psnr.g=18.61
-lavfi.psnr.mse.b=277.38
-lavfi.psnr.psnr.b=23.70
-lavfi.psnr.mse_avg=851.73
-lavfi.psnr.psnr_avg=18.83
+lavfi.psnr.mse.r=1367.642090
+lavfi.psnr.psnr.r=16.771078
+lavfi.psnr.mse.g=885.804382
+lavfi.psnr.psnr.g=18.657425
+lavfi.psnr.mse.b=274.825073
+lavfi.psnr.psnr.b=23.740240
+lavfi.psnr.mse_avg=842.757202
+lavfi.psnr.psnr_avg=18.873779
frame:1 pts:1 pts_time:1
-lavfi.psnr.mse.r=1380.37
-lavfi.psnr.psnr.r=16.73
-lavfi.psnr.mse.g=975.91
-lavfi.psnr.psnr.g=18.24
-lavfi.psnr.mse.b=435.72
-lavfi.psnr.psnr.b=21.74
-lavfi.psnr.mse_avg=930.67
-lavfi.psnr.psnr_avg=18.44
+lavfi.psnr.mse.r=1356.681152
+lavfi.psnr.psnr.r=16.806026
+lavfi.psnr.mse.g=958.161560
+lavfi.psnr.psnr.g=18.316416
+lavfi.psnr.mse.b=428.238312
+lavfi.psnr.psnr.b=21.813948
+lavfi.psnr.mse_avg=914.360352
+lavfi.psnr.psnr_avg=18.519630
frame:2 pts:2 pts_time:2
-lavfi.psnr.mse.r=1403.20
-lavfi.psnr.psnr.r=16.66
-lavfi.psnr.mse.g=954.05
-lavfi.psnr.psnr.g=18.34
-lavfi.psnr.mse.b=494.22
-lavfi.psnr.psnr.b=21.19
-lavfi.psnr.mse_avg=950.49
-lavfi.psnr.psnr_avg=18.35
+lavfi.psnr.mse.r=1387.254883
+lavfi.psnr.psnr.r=16.709242
+lavfi.psnr.mse.g=939.230957
+lavfi.psnr.psnr.g=18.403080
+lavfi.psnr.mse.b=493.913757
+lavfi.psnr.psnr.b=21.194292
+lavfi.psnr.mse_avg=940.133179
+lavfi.psnr.psnr_avg=18.398911
frame:3 pts:3 pts_time:3
-lavfi.psnr.mse.r=1452.80
-lavfi.psnr.psnr.r=16.51
-lavfi.psnr.mse.g=1001.02
-lavfi.psnr.psnr.g=18.13
-lavfi.psnr.mse.b=557.39
-lavfi.psnr.psnr.b=20.67
-lavfi.psnr.mse_avg=1003.74
-lavfi.psnr.psnr_avg=18.11
+lavfi.psnr.mse.r=1433.291260
+lavfi.psnr.psnr.r=16.567459
+lavfi.psnr.mse.g=990.005859
+lavfi.psnr.psnr.g=18.174425
+lavfi.psnr.mse.b=550.512329
+lavfi.psnr.psnr.b=20.723133
+lavfi.psnr.mse_avg=991.269836
+lavfi.psnr.psnr_avg=18.168884
frame:4 pts:4 pts_time:4
-lavfi.psnr.mse.r=1401.25
-lavfi.psnr.psnr.r=16.67
-lavfi.psnr.mse.g=1009.80
-lavfi.psnr.psnr.g=18.09
-lavfi.psnr.mse.b=602.42
-lavfi.psnr.psnr.b=20.33
-lavfi.psnr.mse_avg=1004.49
-lavfi.psnr.psnr_avg=18.11
+lavfi.psnr.mse.r=1385.949341
+lavfi.psnr.psnr.r=16.713329
+lavfi.psnr.mse.g=997.065796
+lavfi.psnr.psnr.g=18.143566
+lavfi.psnr.mse.b=601.962952
+lavfi.psnr.psnr.b=20.335106
+lavfi.psnr.mse_avg=994.992676
+lavfi.psnr.psnr_avg=18.152605
diff --git a/tests/refcmp-metadata.awk b/tests/refcmp-metadata.awk
index fa21aad0e0..850aaac5a3 100644
--- a/tests/refcmp-metadata.awk
+++ b/tests/refcmp-metadata.awk
@@ -50,13 +50,16 @@ BEGIN {
}
END {
+ result = result && (NR == ref_nr);
if (result) {
for (i = 1; i <= ref_nr; i++)
print ref_lines[i];
} else {
for (i = 1; i <= NR; i++)
print cmp_lines[i];
- if (NR != ref_nr)
+ if (NR == 0)
+ print "[refcmp] no input" > "/dev/stderr";
+ else if (NR != ref_nr)
print "[refcmp] lines: " NR " != " ref_nr > "/dev/stderr";
if (delta_max >= fuzz)
print "[refcmp] delta_max: " delta_max " >= " fuzz > "/dev/stderr";
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty or truncated input
2022-03-31 21:30 ` [FFmpeg-devel] [PATCH v2 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty or truncated input Marton Balint
@ 2022-04-01 6:26 ` Tobias Rapp
0 siblings, 0 replies; 12+ messages in thread
From: Tobias Rapp @ 2022-04-01 6:26 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Marton Balint
On 31/03/2022 23:30, Marton Balint wrote:
> On empty input the awk script was always successful which caused the
> filter-refcmp tests to always succeed.
>
> Also fix the command lines for refcmp_metadata compare function because it
> needs auto conversion filters, and update reference of test
> filter-refcmp-psnr-rgb because it was missed in
> a7fc78c1a638a32c3695c06f727774c740d675c2 but was never noticed due to the
> original issue...
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> tests/fate-run.sh | 2 +-
> tests/ref/fate/filter-refcmp-psnr-rgb | 80 +++++++++++++--------------
> tests/refcmp-metadata.awk | 5 +-
> 3 files changed, 45 insertions(+), 42 deletions(-)
>
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index fbfc0a925d..5e8d607d88 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -377,7 +377,7 @@ refcmp_metadata(){
> refcmp=$1
> pixfmt=$2
> fuzz=${3:-0.001}
> - ffmpeg $FLAGS $ENC_OPTS \
> + ffmpeg -auto_conversion_filters $FLAGS $ENC_OPTS \
> -lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
> -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
> }
> diff --git a/tests/ref/fate/filter-refcmp-psnr-rgb b/tests/ref/fate/filter-refcmp-psnr-rgb
> index f06db575ac..20abd3dc5a 100644
> --- a/tests/ref/fate/filter-refcmp-psnr-rgb
> +++ b/tests/ref/fate/filter-refcmp-psnr-rgb
> @@ -1,45 +1,45 @@
> frame:0 pts:0 pts_time:0
> -lavfi.psnr.mse.r=1381.80
> -lavfi.psnr.psnr.r=16.73
> -lavfi.psnr.mse.g=896.00
> -lavfi.psnr.psnr.g=18.61
> -lavfi.psnr.mse.b=277.38
> -lavfi.psnr.psnr.b=23.70
> -lavfi.psnr.mse_avg=851.73
> -lavfi.psnr.psnr_avg=18.83
> +lavfi.psnr.mse.r=1367.642090
> +lavfi.psnr.psnr.r=16.771078
> +lavfi.psnr.mse.g=885.804382
> +lavfi.psnr.psnr.g=18.657425
> +lavfi.psnr.mse.b=274.825073
> +lavfi.psnr.psnr.b=23.740240
> +lavfi.psnr.mse_avg=842.757202
> +lavfi.psnr.psnr_avg=18.873779
> frame:1 pts:1 pts_time:1
> -lavfi.psnr.mse.r=1380.37
> -lavfi.psnr.psnr.r=16.73
> -lavfi.psnr.mse.g=975.91
> -lavfi.psnr.psnr.g=18.24
> -lavfi.psnr.mse.b=435.72
> -lavfi.psnr.psnr.b=21.74
> -lavfi.psnr.mse_avg=930.67
> -lavfi.psnr.psnr_avg=18.44
> +lavfi.psnr.mse.r=1356.681152
> +lavfi.psnr.psnr.r=16.806026
> +lavfi.psnr.mse.g=958.161560
> +lavfi.psnr.psnr.g=18.316416
> +lavfi.psnr.mse.b=428.238312
> +lavfi.psnr.psnr.b=21.813948
> +lavfi.psnr.mse_avg=914.360352
> +lavfi.psnr.psnr_avg=18.519630
> frame:2 pts:2 pts_time:2
> -lavfi.psnr.mse.r=1403.20
> -lavfi.psnr.psnr.r=16.66
> -lavfi.psnr.mse.g=954.05
> -lavfi.psnr.psnr.g=18.34
> -lavfi.psnr.mse.b=494.22
> -lavfi.psnr.psnr.b=21.19
> -lavfi.psnr.mse_avg=950.49
> -lavfi.psnr.psnr_avg=18.35
> +lavfi.psnr.mse.r=1387.254883
> +lavfi.psnr.psnr.r=16.709242
> +lavfi.psnr.mse.g=939.230957
> +lavfi.psnr.psnr.g=18.403080
> +lavfi.psnr.mse.b=493.913757
> +lavfi.psnr.psnr.b=21.194292
> +lavfi.psnr.mse_avg=940.133179
> +lavfi.psnr.psnr_avg=18.398911
> frame:3 pts:3 pts_time:3
> -lavfi.psnr.mse.r=1452.80
> -lavfi.psnr.psnr.r=16.51
> -lavfi.psnr.mse.g=1001.02
> -lavfi.psnr.psnr.g=18.13
> -lavfi.psnr.mse.b=557.39
> -lavfi.psnr.psnr.b=20.67
> -lavfi.psnr.mse_avg=1003.74
> -lavfi.psnr.psnr_avg=18.11
> +lavfi.psnr.mse.r=1433.291260
> +lavfi.psnr.psnr.r=16.567459
> +lavfi.psnr.mse.g=990.005859
> +lavfi.psnr.psnr.g=18.174425
> +lavfi.psnr.mse.b=550.512329
> +lavfi.psnr.psnr.b=20.723133
> +lavfi.psnr.mse_avg=991.269836
> +lavfi.psnr.psnr_avg=18.168884
> frame:4 pts:4 pts_time:4
> -lavfi.psnr.mse.r=1401.25
> -lavfi.psnr.psnr.r=16.67
> -lavfi.psnr.mse.g=1009.80
> -lavfi.psnr.psnr.g=18.09
> -lavfi.psnr.mse.b=602.42
> -lavfi.psnr.psnr.b=20.33
> -lavfi.psnr.mse_avg=1004.49
> -lavfi.psnr.psnr_avg=18.11
> +lavfi.psnr.mse.r=1385.949341
> +lavfi.psnr.psnr.r=16.713329
> +lavfi.psnr.mse.g=997.065796
> +lavfi.psnr.psnr.g=18.143566
> +lavfi.psnr.mse.b=601.962952
> +lavfi.psnr.psnr.b=20.335106
> +lavfi.psnr.mse_avg=994.992676
> +lavfi.psnr.psnr_avg=18.152605
> diff --git a/tests/refcmp-metadata.awk b/tests/refcmp-metadata.awk
> index fa21aad0e0..850aaac5a3 100644
> --- a/tests/refcmp-metadata.awk
> +++ b/tests/refcmp-metadata.awk
> @@ -50,13 +50,16 @@ BEGIN {
> }
>
> END {
> + result = result && (NR == ref_nr);
> if (result) {
> for (i = 1; i <= ref_nr; i++)
> print ref_lines[i];
> } else {
> for (i = 1; i <= NR; i++)
> print cmp_lines[i];
> - if (NR != ref_nr)
> + if (NR == 0)
> + print "[refcmp] no input" > "/dev/stderr";
> + else if (NR != ref_nr)
> print "[refcmp] lines: " NR " != " ref_nr > "/dev/stderr";
> if (delta_max >= fuzz)
> print "[refcmp] delta_max: " delta_max " >= " fuzz > "/dev/stderr";
Looks good to me.
Regards,
Tobias
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder Marton Balint
@ 2022-04-09 22:46 ` Marton Balint
0 siblings, 0 replies; 12+ messages in thread
From: Marton Balint @ 2022-04-09 22:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 30 Mar 2022, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> tests/Makefile | 1 +
> tests/fate-run.sh | 11 +++++++++++
> tests/fate/vbn.mak | 36 ++++++++++++++++++++++++++++++++++++
> tests/ref/fate/vbn-dxt1 | 11 +++++++++++
> tests/ref/fate/vbn-dxt5 | 11 +++++++++++
> tests/ref/fate/vbn-raw-rgb24 | 9 +++++++++
> tests/ref/fate/vbn-raw-rgba | 11 +++++++++++
> 7 files changed, 90 insertions(+)
> create mode 100644 tests/fate/vbn.mak
> create mode 100644 tests/ref/fate/vbn-dxt1
> create mode 100644 tests/ref/fate/vbn-dxt5
> create mode 100644 tests/ref/fate/vbn-raw-rgb24
> create mode 100644 tests/ref/fate/vbn-raw-rgba
Will apply the series soon.
Regards,
Marton
>
> diff --git a/tests/Makefile b/tests/Makefile
> index 9f33394856..e3b41a4f7b 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -191,6 +191,7 @@ include $(SRC_PATH)/tests/fate/speedhq.mak
> include $(SRC_PATH)/tests/fate/subtitles.mak
> include $(SRC_PATH)/tests/fate/truehd.mak
> include $(SRC_PATH)/tests/fate/utvideo.mak
> +include $(SRC_PATH)/tests/fate/vbn.mak
> include $(SRC_PATH)/tests/fate/video.mak
> include $(SRC_PATH)/tests/fate/voice.mak
> include $(SRC_PATH)/tests/fate/vorbis.mak
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index 5e8d607d88..3022aa44a6 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -382,6 +382,17 @@ refcmp_metadata(){
> -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
> }
>
> +refcmp_metadata_files(){
> + refcmp=$1
> + pixfmt=$2
> + file1=$3
> + file2=$4
> + fuzz=${5:-0.001}
> + ffmpeg -auto_conversion_filters $FLAGS -i $file1 $FLAGS -i $file2 $ENC_OPTS \
> + -lavfi "[0:v]format=${pixfmt}[v0];[1:v]format=${pixfmt}[v1];[v0][v1]${refcmp},metadata=print:file=-" \
> + -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
> +}
> +
> pixfmt_conversion(){
> conversion="${test#pixfmt-}"
> outdir="tests/data/pixfmt"
> diff --git a/tests/fate/vbn.mak b/tests/fate/vbn.mak
> new file mode 100644
> index 0000000000..044b110ac1
> --- /dev/null
> +++ b/tests/fate/vbn.mak
> @@ -0,0 +1,36 @@
> +fate-vbn-%: VBN_FILE = tests/data/$(subst fate-vbn-,,$(@)).vbn
> +fate-vbn-%: PIX_FMT = rgba
> +fate-vbn-raw-rgb24: PIX_FMT = rgb24
> +fate-vbn-%: SRC = $(TARGET_SAMPLES)/png1/lena-$(PIX_FMT).png
> +fate-vbn-%: CMD = refcmp_metadata_files psnr $(PIX_FMT) $(VBN_FILE) $(SRC)
> +
> +fate-vbn-dxt1: tests/data/dxt1.vbn
> +fate-vbn-dxt5: tests/data/dxt5.vbn
> +fate-vbn-raw-rgba: tests/data/raw-rgba.vbn
> +fate-vbn-raw-rgb24: tests/data/raw-rgb24.vbn
> +
> +FATE_VBN += fate-vbn-dxt1
> +FATE_VBN += fate-vbn-dxt5
> +FATE_VBN += fate-vbn-raw-rgba
> +FATE_VBN += fate-vbn-raw-rgb24
> +
> +tests/data/dxt1.vbn: TAG = GEN
> +tests/data/dxt1.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
> + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt1 $(TARGET_PATH)/$@ -y 2>/dev/null
> +
> +tests/data/dxt5.vbn: TAG = GEN
> +tests/data/dxt5.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
> + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt5 $(TARGET_PATH)/$@ -y 2>/dev/null
> +
> +tests/data/raw-rgba.vbn: TAG = GEN
> +tests/data/raw-rgba.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
> + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
> +
> +tests/data/raw-rgb24.vbn: TAG = GEN
> +tests/data/raw-rgb24.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
> + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgb24.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
> +
> +VBN_REFCMP_DEPS = PSNR_FILTER METADATA_FILTER VBN_ENCODER VBN_DECODER IMAGE2_MUXER IMAGE2_DEMUXER PNG_DECODER
> +
> +FATE_SAMPLES_FFMPEG-$(call ALLYES, $(VBN_REFCMP_DEPS)) += $(FATE_VBN)
> +fate-vbn: $(FATE_VBN)
> diff --git a/tests/ref/fate/vbn-dxt1 b/tests/ref/fate/vbn-dxt1
> new file mode 100644
> index 0000000000..0af4444d94
> --- /dev/null
> +++ b/tests/ref/fate/vbn-dxt1
> @@ -0,0 +1,11 @@
> +frame:0 pts:0 pts_time:0
> +lavfi.psnr.mse.r=36.794250
> +lavfi.psnr.psnr.r=32.473003
> +lavfi.psnr.mse.g=33.350525
> +lavfi.psnr.psnr.g=32.899776
> +lavfi.psnr.mse.b=28.317383
> +lavfi.psnr.psnr.b=33.610271
> +lavfi.psnr.mse.a=21186.988281
> +lavfi.psnr.psnr.a=4.870111
> +lavfi.psnr.mse_avg=5321.362793
> +lavfi.psnr.psnr_avg=10.870575
> diff --git a/tests/ref/fate/vbn-dxt5 b/tests/ref/fate/vbn-dxt5
> new file mode 100644
> index 0000000000..dbec0bd13d
> --- /dev/null
> +++ b/tests/ref/fate/vbn-dxt5
> @@ -0,0 +1,11 @@
> +frame:0 pts:0 pts_time:0
> +lavfi.psnr.mse.r=36.794250
> +lavfi.psnr.psnr.r=32.473003
> +lavfi.psnr.mse.g=33.350525
> +lavfi.psnr.psnr.g=32.899776
> +lavfi.psnr.mse.b=28.317383
> +lavfi.psnr.psnr.b=33.610271
> +lavfi.psnr.mse.a=0.000183
> +lavfi.psnr.psnr.a=85.503792
> +lavfi.psnr.mse_avg=24.615585
> +lavfi.psnr.psnr_avg=34.218700
> diff --git a/tests/ref/fate/vbn-raw-rgb24 b/tests/ref/fate/vbn-raw-rgb24
> new file mode 100644
> index 0000000000..06143c27b6
> --- /dev/null
> +++ b/tests/ref/fate/vbn-raw-rgb24
> @@ -0,0 +1,9 @@
> +frame:0 pts:0 pts_time:0
> +lavfi.psnr.mse.r=0.000000
> +lavfi.psnr.psnr.r=inf
> +lavfi.psnr.mse.g=0.000000
> +lavfi.psnr.psnr.g=inf
> +lavfi.psnr.mse.b=0.000000
> +lavfi.psnr.psnr.b=inf
> +lavfi.psnr.mse_avg=0.000000
> +lavfi.psnr.psnr_avg=inf
> diff --git a/tests/ref/fate/vbn-raw-rgba b/tests/ref/fate/vbn-raw-rgba
> new file mode 100644
> index 0000000000..4614ab5c25
> --- /dev/null
> +++ b/tests/ref/fate/vbn-raw-rgba
> @@ -0,0 +1,11 @@
> +frame:0 pts:0 pts_time:0
> +lavfi.psnr.mse.r=0.000000
> +lavfi.psnr.psnr.r=inf
> +lavfi.psnr.mse.g=0.000000
> +lavfi.psnr.psnr.g=inf
> +lavfi.psnr.mse.b=0.000000
> +lavfi.psnr.psnr.b=inf
> +lavfi.psnr.mse.a=0.000000
> +lavfi.psnr.psnr.a=inf
> +lavfi.psnr.mse_avg=0.000000
> +lavfi.psnr.psnr_avg=inf
> --
> 2.31.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-04-09 22:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 20:31 [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Marton Balint
2022-03-30 20:31 ` [FFmpeg-devel] [PATCH 2/8] avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 3/8] avcodec/dds: use the common texture dsp decode function Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 4/8] avcodec/hapdec: use the common texturedsp " Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 5/8] avcodec/hapenc: use the common texturedsp encode function Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 6/8] avcodec/vbndec: add VBN decoder Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 7/8] avcodec/vbnenc: add VBN encoder Marton Balint
2022-03-30 20:32 ` [FFmpeg-devel] [PATCH 8/8] fate: add fate tests for VBN encoder and decoder Marton Balint
2022-04-09 22:46 ` Marton Balint
2022-03-31 7:38 ` [FFmpeg-devel] [PATCH 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty input Tobias Rapp
2022-03-31 21:30 ` [FFmpeg-devel] [PATCH v2 1/8] fate/filter-refcmp-*: make refcmp_metadata fail on empty or truncated input Marton Balint
2022-04-01 6:26 ` Tobias Rapp
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git