Re: [FFmpeg-devel] [PATCH 2/2] avcodec/smacker: Optimize constant 16bit audio output
tis 2022-05-03 klockan 18:30 +0200 skrev Michael Niedermayer: > > + } else if (stereo) { > + val = 256*values[1] + values[0]; > + val2 = 256*values[3] + values[2]; > + for(; i < unp_size; i+=2) { > + pred[0] += val; > + pred[1] += val2; > + *samples++ = pred[0]; > + *samples++ = pred[1]; > + } > + } else { > + val = 256*values[1] + values[0]; > + for(; i < unp_size; i++) { > + pred[0] += val; > + *samples++ = pred[0]; > + } > + } Got any numbers on how much faster this is? Just out of curiosity Probably want to follow this up with a reindent patch /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] doc/encoders.texi: Document cinepak encoder
Ping I tested patch 2's output on Windows 3.1, still works fine. Could potentially merge both documentation patches /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 0/2] JPEG XL Colorspace Fixes
Add proper colorspace handling and tagging to the libjxl decoder and encoder wrappers. Changes v3: - some cosmetic changes - properly handle P3 spaces - properly handle PQ transfer v2: - avoid misusing AVMasteringDisplayMetadata - ignore custom primaries in header (very rare without iccp) Leo Izen (2): avcodec/libjxldec: properly tag output colorspace avcodec/libjxlenc: properly read input colorspace libavcodec/libjxldec.c | 91 - libavcodec/libjxlenc.c | 128 ++--- 2 files changed, 184 insertions(+), 35 deletions(-) -- 2.36.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 1/2] avcodec/libjxldec: properly tag output colorspace
Whether an ICC profile is present or not, the decoder should now properly tag the colorspace of pixel data received by the decoder. --- libavcodec/libjxldec.c | 91 -- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index cd4bca3343..823d24648f 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -189,16 +189,101 @@ static int libjxl_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_f continue; case JXL_DEC_COLOR_ENCODING: av_log(avctx, AV_LOG_DEBUG, "COLOR_ENCODING event emitted\n"); -jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &iccp_len); +jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &iccp_len); if (jret == JXL_DEC_SUCCESS && iccp_len > 0) { av_buffer_unref(&ctx->iccp); ctx->iccp = av_buffer_alloc(iccp_len); if (!ctx->iccp) return AVERROR(ENOMEM); -jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, ctx->iccp->data, iccp_len); -if (jret != JXL_DEC_SUCCESS) +jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, ctx->iccp->data, iccp_len); +if (jret != JXL_DEC_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICCP from header\n"); av_buffer_unref(&ctx->iccp); +} } +avctx->color_range = frame->color_range = AVCOL_RANGE_JPEG; +if (ctx->iccp) { +/* if the ICCP is present, libjxl outputs sRGB */ +if (ctx->jxl_pixfmt.num_channels >= 3) { +avctx->colorspace = AVCOL_SPC_RGB; +avctx->color_primaries = AVCOL_PRI_BT709; +} +/* linear sRGB if float values, standard sRGB if int values */ +avctx->color_trc = ctx->jxl_pixfmt.data_type == JXL_TYPE_FLOAT +|| ctx->jxl_pixfmt.data_type == JXL_TYPE_FLOAT16 +? AVCOL_TRC_LINEAR : AVCOL_TRC_IEC61966_2_1; +} else { +JxlColorEncoding jxl_encoding; +jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_encoding); +if (jret != JXL_DEC_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Unable to obtain color encoding from header\n"); +continue; +} + +if (ctx->jxl_pixfmt.num_channels >= 3) { +avctx->colorspace = AVCOL_SPC_RGB; +switch (jxl_encoding.primaries) { +case JXL_PRIMARIES_SRGB: +avctx->color_primaries = AVCOL_PRI_BT709; +break; +case JXL_PRIMARIES_2100: +/* BT2020 and BT2100 use the same primaries */ +avctx->color_primaries = AVCOL_PRI_BT2020; +break; +case JXL_PRIMARIES_P3: +/* DCI P3 uses DCI, Display P3 uses D65 */ +if (jxl_pixfmt.white_point == JXL_WHITE_POINT_DCI) +avctx->color_primaries = AVCOL_PRI_SMPTE431; +else +avctx->color_primaries = AVCOL_PRI_SMPTE432; +break; +case JXL_PRIMARIES_CUSTOM: +av_log(avctx, AV_LOG_WARNING, "Custom primaries are unsupported without an ICC profile\n"); +avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; +break; +default: +av_log(avctx, AV_LOG_WARNING, "Unknown JXL color primaries: %d\n", jxl_encoding.primaries); +avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; +} +} + +switch (jxl_encoding.transfer_function) { +case JXL_TRANSFER_FUNCTION_709: +avctx->color_trc = AVCOL_TRC_BT709; +break; +case JXL_TRANSFER_FUNCTION_LINEAR: +avctx->color_trc = AVCOL_TRC_LINEAR; +break; +case JXL_TRANSFER_FUNCTION_SRGB: +avctx->color_trc = AVCOL_TRC_IEC61966_2_1; +break; +case JXL_TRANSFER_FUNCTION_PQ: +avctx->color_trc = AVCOL_TRC_SMPTE2084; +break; +case JXL_TRANSFER_FUNCTION_DCI: +avctx->color_trc = AVCOL_TRC
[FFmpeg-devel] [PATCH v3 2/2] avcodec/libjxlenc: properly read input colorspace
Whether an ICC profile is present or not, the libjxl encoder wrapper should now properly read colorspace tags and forward them to libjxl appropriately, rather than just assume sRGB as before. It will also print warnings when colorimetric assumptions are made about the input data. --- libavcodec/libjxlenc.c | 128 ++--- 1 file changed, 96 insertions(+), 32 deletions(-) diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c index 8bebec6aeb..43bb7299c6 100644 --- a/libavcodec/libjxlenc.c +++ b/libavcodec/libjxlenc.c @@ -117,7 +117,7 @@ static int libjxl_init_jxl_encoder(AVCodecContext *avctx) return AVERROR_EXTERNAL; } -/* check for negative zero, our default */ +/* check for negative, our default */ if (ctx->distance < 0.0) { /* use ffmpeg.c -q option if passed */ if (avctx->flags & AV_CODEC_FLAG_QSCALE) @@ -133,7 +133,8 @@ static int libjxl_init_jxl_encoder(AVCodecContext *avctx) */ if (ctx->distance > 0.0 && ctx->distance < 0.01) ctx->distance = 0.01; -if (JxlEncoderOptionsSetDistance(ctx->options, ctx->distance) != JXL_ENC_SUCCESS) { + +if (JxlEncoderSetFrameDistance(ctx->options, ctx->distance) != JXL_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to set distance: %f\n", ctx->distance); return AVERROR_EXTERNAL; } @@ -219,57 +220,120 @@ static int libjxl_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFra info.num_color_channels = jxl_fmt.num_channels - info.num_extra_channels; info.bits_per_sample = av_get_bits_per_pixel(pix_desc) / jxl_fmt.num_channels; info.alpha_bits = (info.num_extra_channels > 0) * info.bits_per_sample; + if (pix_desc->flags & AV_PIX_FMT_FLAG_FLOAT) { info.exponent_bits_per_sample = info.bits_per_sample > 16 ? 8 : 5; info.alpha_exponent_bits = info.alpha_bits ? info.exponent_bits_per_sample : 0; jxl_fmt.data_type = info.bits_per_sample > 16 ? JXL_TYPE_FLOAT : JXL_TYPE_FLOAT16; -JxlColorEncodingSetToLinearSRGB(&jxl_color, info.num_color_channels == 1); } else { info.exponent_bits_per_sample = 0; info.alpha_exponent_bits = 0; jxl_fmt.data_type = info.bits_per_sample <= 8 ? JXL_TYPE_UINT8 : JXL_TYPE_UINT16; -JxlColorEncodingSetToSRGB(&jxl_color, info.num_color_channels == 1); } -if (info.bits_per_sample > 16 -|| info.xsize > (1 << 18) || info.ysize > (1 << 18) -|| (info.xsize << 4) * (info.ysize << 4) > (1 << 20)) { -/* - * must upgrade codestream to level 10, from level 5 - * the encoder will not do this automatically - */ -if (JxlEncoderSetCodestreamLevel(ctx->encoder, 10) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "Could not upgrade JXL Codestream level.\n"); -return AVERROR_EXTERNAL; -} -} +/* JPEG XL format itself does not support partial range */ +if (avctx->color_range == AVCOL_RANGE_MPEG) +av_log(avctx, AV_LOG_ERROR, "This encoder does not support partial(tv) range, colors will be wrong!\n"); +else if (avctx->color_range != AVCOL_RANGE_JPEG) +av_log(avctx, AV_LOG_WARNING, "Unknown color range, assuming full\n"); -/* bitexact lossless requires there to be no XYB transform */ + /* bitexact lossless requires there to be no XYB transform */ info.uses_original_profile = ctx->distance == 0.0; -sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); -if (sd && sd->size && JxlEncoderSetICCProfile(ctx->encoder, sd->data, sd->size) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_WARNING, "Could not set ICC Profile\n"); -} else if (info.uses_original_profile) { -/* -* the color encoding is not used if uses_original_profile is false -* this just works around a bug in libjxl 0.7.0 and lower -*/ -if (JxlEncoderSetColorEncoding(ctx->encoder, &jxl_color) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "Failed to set JxlColorEncoding\n"); -return AVERROR_EXTERNAL; -} -} - if (JxlEncoderSetBasicInfo(ctx->encoder, &info) != JXL_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to set JxlBasicInfo\n"); return AVERROR_EXTERNAL; } +/* rendering intent doesn't matter here + * but libjxl will whine if we don't set it */ +jxl_color.rendering_intent = JXL_RENDERING_INTENT_RELATIVE; + +switch (avctx->color_trc) { +case AVCOL_TRC_BT709: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_709; +break; +case AVCOL_TRC_LINEAR: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_LINEAR; +break; +case AVCOL_TRC_IEC61966_2_1: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_SRGB; +break; +case AVCOL_TRC_SMPTE428: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_DCI; +
[FFmpeg-devel] [PATCH v4 0/2] JPEG XL Colorspace Fixes
Changes v4: - fix a typo. bluh v3: - some cosmetic changes - properly handle P3 spaces - properly handle PQ transfer v2: - avoid misusing AVMasteringDisplayMetadata - ignore custom primaries in header (very rare without iccp) Leo Izen (2): avcodec/libjxldec: properly tag output colorspace avcodec/libjxlenc: properly read input colorspace libavcodec/libjxldec.c | 91 - libavcodec/libjxlenc.c | 128 ++--- 2 files changed, 184 insertions(+), 35 deletions(-) -- 2.36.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 1/2] avcodec/libjxldec: properly tag output colorspace
Whether an ICC profile is present or not, the decoder should now properly tag the colorspace of pixel data received by the decoder. --- libavcodec/libjxldec.c | 91 -- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index cd4bca3343..381def8b25 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -189,16 +189,101 @@ static int libjxl_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_f continue; case JXL_DEC_COLOR_ENCODING: av_log(avctx, AV_LOG_DEBUG, "COLOR_ENCODING event emitted\n"); -jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &iccp_len); +jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &iccp_len); if (jret == JXL_DEC_SUCCESS && iccp_len > 0) { av_buffer_unref(&ctx->iccp); ctx->iccp = av_buffer_alloc(iccp_len); if (!ctx->iccp) return AVERROR(ENOMEM); -jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_ORIGINAL, ctx->iccp->data, iccp_len); -if (jret != JXL_DEC_SUCCESS) +jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, ctx->iccp->data, iccp_len); +if (jret != JXL_DEC_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICCP from header\n"); av_buffer_unref(&ctx->iccp); +} } +avctx->color_range = frame->color_range = AVCOL_RANGE_JPEG; +if (ctx->iccp) { +/* if the ICCP is present, libjxl outputs sRGB */ +if (ctx->jxl_pixfmt.num_channels >= 3) { +avctx->colorspace = AVCOL_SPC_RGB; +avctx->color_primaries = AVCOL_PRI_BT709; +} +/* linear sRGB if float values, standard sRGB if int values */ +avctx->color_trc = ctx->jxl_pixfmt.data_type == JXL_TYPE_FLOAT +|| ctx->jxl_pixfmt.data_type == JXL_TYPE_FLOAT16 +? AVCOL_TRC_LINEAR : AVCOL_TRC_IEC61966_2_1; +} else { +JxlColorEncoding jxl_encoding; +jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_encoding); +if (jret != JXL_DEC_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Unable to obtain color encoding from header\n"); +continue; +} + +if (ctx->jxl_pixfmt.num_channels >= 3) { +avctx->colorspace = AVCOL_SPC_RGB; +switch (jxl_encoding.primaries) { +case JXL_PRIMARIES_SRGB: +avctx->color_primaries = AVCOL_PRI_BT709; +break; +case JXL_PRIMARIES_2100: +/* BT2020 and BT2100 use the same primaries */ +avctx->color_primaries = AVCOL_PRI_BT2020; +break; +case JXL_PRIMARIES_P3: +/* DCI P3 uses DCI, Display P3 uses D65 */ +if (jxl_encoding.white_point == JXL_WHITE_POINT_DCI) +avctx->color_primaries = AVCOL_PRI_SMPTE431; +else +avctx->color_primaries = AVCOL_PRI_SMPTE432; +break; +case JXL_PRIMARIES_CUSTOM: +av_log(avctx, AV_LOG_WARNING, "Custom primaries are unsupported without an ICC profile\n"); +avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; +break; +default: +av_log(avctx, AV_LOG_WARNING, "Unknown JXL color primaries: %d\n", jxl_encoding.primaries); +avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; +} +} + +switch (jxl_encoding.transfer_function) { +case JXL_TRANSFER_FUNCTION_709: +avctx->color_trc = AVCOL_TRC_BT709; +break; +case JXL_TRANSFER_FUNCTION_LINEAR: +avctx->color_trc = AVCOL_TRC_LINEAR; +break; +case JXL_TRANSFER_FUNCTION_SRGB: +avctx->color_trc = AVCOL_TRC_IEC61966_2_1; +break; +case JXL_TRANSFER_FUNCTION_PQ: +avctx->color_trc = AVCOL_TRC_SMPTE2084; +break; +case JXL_TRANSFER_FUNCTION_DCI: +avctx->color_trc = AVCOL_T
[FFmpeg-devel] [PATCH v4 2/2] avcodec/libjxlenc: properly read input colorspace
Whether an ICC profile is present or not, the libjxl encoder wrapper should now properly read colorspace tags and forward them to libjxl appropriately, rather than just assume sRGB as before. It will also print warnings when colorimetric assumptions are made about the input data. --- libavcodec/libjxlenc.c | 128 ++--- 1 file changed, 96 insertions(+), 32 deletions(-) diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c index 8bebec6aeb..43bb7299c6 100644 --- a/libavcodec/libjxlenc.c +++ b/libavcodec/libjxlenc.c @@ -117,7 +117,7 @@ static int libjxl_init_jxl_encoder(AVCodecContext *avctx) return AVERROR_EXTERNAL; } -/* check for negative zero, our default */ +/* check for negative, our default */ if (ctx->distance < 0.0) { /* use ffmpeg.c -q option if passed */ if (avctx->flags & AV_CODEC_FLAG_QSCALE) @@ -133,7 +133,8 @@ static int libjxl_init_jxl_encoder(AVCodecContext *avctx) */ if (ctx->distance > 0.0 && ctx->distance < 0.01) ctx->distance = 0.01; -if (JxlEncoderOptionsSetDistance(ctx->options, ctx->distance) != JXL_ENC_SUCCESS) { + +if (JxlEncoderSetFrameDistance(ctx->options, ctx->distance) != JXL_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to set distance: %f\n", ctx->distance); return AVERROR_EXTERNAL; } @@ -219,57 +220,120 @@ static int libjxl_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFra info.num_color_channels = jxl_fmt.num_channels - info.num_extra_channels; info.bits_per_sample = av_get_bits_per_pixel(pix_desc) / jxl_fmt.num_channels; info.alpha_bits = (info.num_extra_channels > 0) * info.bits_per_sample; + if (pix_desc->flags & AV_PIX_FMT_FLAG_FLOAT) { info.exponent_bits_per_sample = info.bits_per_sample > 16 ? 8 : 5; info.alpha_exponent_bits = info.alpha_bits ? info.exponent_bits_per_sample : 0; jxl_fmt.data_type = info.bits_per_sample > 16 ? JXL_TYPE_FLOAT : JXL_TYPE_FLOAT16; -JxlColorEncodingSetToLinearSRGB(&jxl_color, info.num_color_channels == 1); } else { info.exponent_bits_per_sample = 0; info.alpha_exponent_bits = 0; jxl_fmt.data_type = info.bits_per_sample <= 8 ? JXL_TYPE_UINT8 : JXL_TYPE_UINT16; -JxlColorEncodingSetToSRGB(&jxl_color, info.num_color_channels == 1); } -if (info.bits_per_sample > 16 -|| info.xsize > (1 << 18) || info.ysize > (1 << 18) -|| (info.xsize << 4) * (info.ysize << 4) > (1 << 20)) { -/* - * must upgrade codestream to level 10, from level 5 - * the encoder will not do this automatically - */ -if (JxlEncoderSetCodestreamLevel(ctx->encoder, 10) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "Could not upgrade JXL Codestream level.\n"); -return AVERROR_EXTERNAL; -} -} +/* JPEG XL format itself does not support partial range */ +if (avctx->color_range == AVCOL_RANGE_MPEG) +av_log(avctx, AV_LOG_ERROR, "This encoder does not support partial(tv) range, colors will be wrong!\n"); +else if (avctx->color_range != AVCOL_RANGE_JPEG) +av_log(avctx, AV_LOG_WARNING, "Unknown color range, assuming full\n"); -/* bitexact lossless requires there to be no XYB transform */ + /* bitexact lossless requires there to be no XYB transform */ info.uses_original_profile = ctx->distance == 0.0; -sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); -if (sd && sd->size && JxlEncoderSetICCProfile(ctx->encoder, sd->data, sd->size) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_WARNING, "Could not set ICC Profile\n"); -} else if (info.uses_original_profile) { -/* -* the color encoding is not used if uses_original_profile is false -* this just works around a bug in libjxl 0.7.0 and lower -*/ -if (JxlEncoderSetColorEncoding(ctx->encoder, &jxl_color) != JXL_ENC_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "Failed to set JxlColorEncoding\n"); -return AVERROR_EXTERNAL; -} -} - if (JxlEncoderSetBasicInfo(ctx->encoder, &info) != JXL_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed to set JxlBasicInfo\n"); return AVERROR_EXTERNAL; } +/* rendering intent doesn't matter here + * but libjxl will whine if we don't set it */ +jxl_color.rendering_intent = JXL_RENDERING_INTENT_RELATIVE; + +switch (avctx->color_trc) { +case AVCOL_TRC_BT709: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_709; +break; +case AVCOL_TRC_LINEAR: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_LINEAR; +break; +case AVCOL_TRC_IEC61966_2_1: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_SRGB; +break; +case AVCOL_TRC_SMPTE428: +jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_DCI; +
[FFmpeg-devel] [PATCH] avcodec/vp9: ipred_vl_16x16_16 avx2 implementation
From: Semen Belozerov --- libavcodec/x86/vp9dsp_init_16bpp.c| 2 ++ libavcodec/x86/vp9intrapred_16bpp.asm | 51 +++ 2 files changed, 53 insertions(+) diff --git a/libavcodec/x86/vp9dsp_init_16bpp.c b/libavcodec/x86/vp9dsp_init_16bpp.c index 27e746aea1..b17826326f 100644 --- a/libavcodec/x86/vp9dsp_init_16bpp.c +++ b/libavcodec/x86/vp9dsp_init_16bpp.c @@ -54,6 +54,7 @@ decl_ipred_fn(dl, 16, 16, avx2); decl_ipred_fn(dl, 32, 16, avx2); decl_ipred_fn(dr, 16, 16, avx2); decl_ipred_fn(dr, 32, 16, avx2); +decl_ipred_fn(vl, 16, 16, avx2); #define decl_ipred_dir_funcs(type) \ decl_ipred_fns(type, 16, sse2, sse2); \ @@ -139,6 +140,7 @@ av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp) init_ipred_func(dl, DIAG_DOWN_LEFT, 16, 16, avx2); init_ipred_func(dl, DIAG_DOWN_LEFT, 32, 16, avx2); init_ipred_func(dr, DIAG_DOWN_RIGHT, 16, 16, avx2); +init_ipred_func(vl, VERT_LEFT, 16, 16, avx2); #if ARCH_X86_64 init_ipred_func(dr, DIAG_DOWN_RIGHT, 32, 16, avx2); #endif diff --git a/libavcodec/x86/vp9intrapred_16bpp.asm b/libavcodec/x86/vp9intrapred_16bpp.asm index 32b698243a..0dad91ac5c 100644 --- a/libavcodec/x86/vp9intrapred_16bpp.asm +++ b/libavcodec/x86/vp9intrapred_16bpp.asm @@ -1222,6 +1222,57 @@ cglobal vp9_ipred_dr_16x16_16, 4, 5, 6, dst, stride, l, a mova [dst3q+strideq*4], m5 ; 7 RET +cglobal vp9_ipred_vl_16x16_16, 4, 5, 7, dst, stride, l, a +movifnidn aq, amp +movam0, [aq] ; abcdefghijklmnop +vpbroadcastw xm1, [aq+30]; +vperm2i128 m2, m0, m1, q0201 ; ijklmnop +vpalignrm3, m2, m0, 2 ; bcdefghijklmnopp +vperm2i128 m4, m3, m1, q0201 ; jklmnopp +vpalignrm5, m2, m0, 4 ; cdefghijklmnoppp +vperm2i128 m6, m5, m1, q0201 ; klmnoppp +LOWPASS 5, 3, 0 ; BCDEFGHIJKLMNOPP +LOWPASS 6, 4, 2 ; JKLMNOPP +pavgw m3, m0 ; abcdefghijklmnop +pavgw m4, m2 ; ijklmnop +DEFINE_ARGS dst, stride, stride3, stride5, dst4 +lea dst4q, [dstq+strideq*4] +lea stride3q, [strideq*3] +lea stride5q, [stride3q+strideq*2] + +mova [dstq+strideq*0], m3 ; 0 abcdefghijklmnop +mova [dstq+strideq*1], m5 ; 1 BCDEFGHIJKLMNOPP +vpalignrm0, m4, m3, 2 +vpalignrm1, m6, m5, 2 +mova [dstq+strideq*2 ], m0 ; 2 bcdefghijklmnopp +mova [dstq+stride3q*1], m1 ; 3 CDEFGHIJKLMNOPPP +vpalignrm0, m4, m3, 4 +vpalignrm1, m6, m5, 4 +mova [dst4q+strideq*0], m0 ; 4 cdefghijklmnoppp +mova [dstq+stride5q*1], m1 ; 5 DEFGHIJKLMNO +vpalignrm0, m4, m3, 6 +vpalignrm1, m6, m5, 6 +mova[ dstq+stride3q*2], m0 ; 6 defghijklmno +mova[dst4q+stride3q*1], m1 ; 7 EFGHIJKLMNOP +vpalignrm0, m4, m3, 8 +vpalignrm1, m6, m5, 8 +mova[ dstq+strideq*8], m0 ; 8 efghijklmnop +mova[dst4q+stride5q*1], m1 ; 9 FGHIJKLMNOPP +vpalignrm0, m4, m3, 10 +mova [dstq+stride5q*2], m0 ; 10 fghijklmnopp +vpalignrm0, m4, m3, 12 +mova [dst4q+strideq*8], m0 ; 12 ghijklmnoppp +vpalignrm0, m4, m3, 14 +mova[dst4q+stride5q*2], m0 ; 14 hijklmno +sub dst4q, strideq +vpalignrm1, m6, m5, 10 +mova [dst4q+strideq*8], m1 ; 11 GHIJKLMNOPPP +vpalignrm1, m6, m5, 12 +mova[dst4q+stride5q*2], m1 ; 13 HIJKLMNO +vpalignrm1, m6, m5, 14 +mova[dst4q+stride3q*4], m1 ; 15 IJKLMNOP +RET + %if ARCH_X86_64 cglobal vp9_ipred_dr_32x32_16, 4, 7, 10, dst, stride, l, a movam0, [lq+mmsize*0+0]; l[0-15] -- 2.35.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/7] tests/Makefile: Redo how to keep intermediate FATE-files
Extend the ordinary mechanism to signal KEEP for this. This also allows to remove the keep-parameter from enc_dec, transcode and stream_remux, so that several empty parameters '""' could be removed. Signed-off-by: Andreas Rheinhardt --- tests/Makefile | 14 +- tests/fate-run.sh | 20 ++-- tests/fate/acodec.mak | 2 +- tests/fate/caf.mak | 2 +- tests/fate/cover-art.mak| 6 +++--- tests/fate/ffmpeg.mak | 4 ++-- tests/fate/filter-video.mak | 4 ++-- tests/fate/id3v2.mak| 4 ++-- tests/fate/image.mak| 4 ++-- tests/fate/matroska.mak | 20 ++-- tests/fate/mov.mak | 10 +- tests/fate/mxf.mak | 2 +- tests/fate/oma.mak | 2 +- tests/fate/seek.mak | 2 +- tests/fate/vcodec.mak | 2 +- 15 files changed, 55 insertions(+), 43 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index ca228ae897..7ddfbcfd7e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,16 @@ +ifneq ($(strip $(KEEP)),) +ifneq ($(strip $(KEEP)),0) +# KEEP_FILES is normally undefined; it is set to 2 # if the user requested +# to keep all intermediate FATE-files by setting KEEP. +# For some tests it is also set to 1 if it is unset; this indicates +# that only some intermediate files (namely only non-raw files) +# are to be kept. This allows reusing these intermediate files as input +# files for other tests (mostly the seek-tests). +KEEP_FILES = 2 +endif +endif + THREADS = 1 VREF = tests/vsynth1/00.pgm AREF = tests/data/asynth1.sw @@ -279,7 +291,7 @@ $(FATE): export EXECSUF = $(EXESUF) $(FATE): export HOSTEXECSUF = $(HOSTEXESUF) $(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | $(FATE_OUTDIRS) @echo "TEST$(@:fate-%=%)" - $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(TARGET_SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)' '$(HWACCEL)' '$(REPORT)' '$(KEEP)' + $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(TARGET_SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)' '$(HWACCEL)' '$(REPORT)' '$(KEEP_FILES)' fate-list: @printf '%s\n' $(sort $(FATE)) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 2606fcb917..42cd50f50f 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -205,11 +205,11 @@ enc_dec(){ enc_opt=$4 dec_fmt=$5 dec_opt=$6 -ffprobe_opts=$9 +ffprobe_opts=$8 encfile="${outdir}/${test}.${enc_fmt}" decfile="${outdir}/${test}.out.${dec_fmt}" cleanfiles="$cleanfiles $decfile" -test "$7" = -keep || cleanfiles="$cleanfiles $encfile" +test "$keep" -ge 1 || cleanfiles="$cleanfiles $encfile" tsrcfile=$(target_path $srcfile) tencfile=$(target_path $encfile) tdecfile=$(target_path $decfile) @@ -217,7 +217,7 @@ enc_dec(){ -f $enc_fmt -y $tencfile || return do_md5sum $encfile echo $(wc -c $encfile) -ffmpeg -auto_conversion_filters $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \ +ffmpeg -auto_conversion_filters $7 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \ -f $dec_fmt -y $tdecfile || return do_md5sum $decfile tests/tiny_psnr${HOSTEXECSUF} $srcfile $decfile $cmp_unit $cmp_shift @@ -231,12 +231,12 @@ transcode(){ enc_fmt=$3 enc_opt=$4 final_encode=$5 -ffprobe_opts=$7 -additional_input=$8 -final_decode=$9 +ffprobe_opts=$6 +additional_input=$7 +final_decode=$8 test -z "$additional_input" || additional_input="$DEC_OPTS $additional_input" encfile="${outdir}/${test}.${enc_fmt}" -test "$6" = -keep || cleanfiles="$cleanfiles $encfile" +test $keep -ge 1 || cleanfiles="$cleanfiles $encfile" tsrcfile=$(target_path $srcfile) tencfile=$(target_path $encfile) ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $additional_input \ @@ -255,9 +255,9 @@ stream_remux(){ enc_fmt=$3 stream_maps=$4 final_decode=$5 -ffprobe_opts=$7 +ffprobe_opts=$6 encfile="${outdir}/${test}.${enc_fmt}" -test "$6" = -keep || cleanfiles="$cleanfiles $encfile" +test $keep -ge 1 || cleanfiles="$cleanfiles $encfile" tsrcfile=$(target_path $srcfile) tencfile=$(target_path $encfile) ffmpeg -f $src_fmt -i $tsrcfile $stream_maps -codec copy $FLAGS \ @@ -598,7 +598,7 @@ if test $err != 0 && test $gen != "no" ; then fi if test $err = 0; then -if test $keep = 0; then +if test $keep -lt 2; then rm -f $outfile $errfile $cmpfile $cleanfiles fi elif test $gen = "no"; then diff --git a/tests/fate/acodec.mak b/tests/fate/acodec.mak index 848d57ef9c..27b69ad9fc 100644 --- a/tests/fate/acodec.mak +++ b/tests/fate/acodec.mak @@ -1,6 +1,6
[FFmpeg-devel] [PATCH 6/7] tests/fate-run: Remove temporary fate-lavf files if possible
The temporary fate-lavf files can easily be removed if they are not needed as inputs for other tests (mainly fate-seek-tests). This commit implements this. The size of the remaining files decreases from 260890083B to 79481793B. Signed-off-by: Andreas Rheinhardt --- tests/fate-run.sh| 12 +++- tests/fate/api.mak | 1 + tests/fate/concatdec.mak | 7 ++- tests/fate/ffmpeg.mak| 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 42cd50f50f..5939761997 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -310,6 +310,7 @@ lavf_audio(){ t="${test#lavf-}" outdir="tests/data/lavf" file=${outdir}/lavf.$t +test "$keep" -ge 1 || cleanfiles="$cleanfiles $file" do_avconv $file -auto_conversion_filters $DEC_OPTS $1 -ar 44100 -f s16le -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $2 test "$4" = "disable_crc" || do_avconv_crc $file -auto_conversion_filters $DEC_OPTS $3 -i $target_path/$file @@ -319,6 +320,7 @@ lavf_container(){ t="${test#lavf-}" outdir="tests/data/lavf" file=${outdir}/lavf.$t +test "$keep" -ge 1 || cleanfiles="$cleanfiles $file" do_avconv $file -auto_conversion_filters $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $1 -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -b:a 64k -t 1 -qscale:v 10 $2 test "$3" = "disable_crc" || do_avconv_crc $file -auto_conversion_filters $DEC_OPTS -i $target_path/$file $3 @@ -347,11 +349,18 @@ lavf_container_fate() } lavf_image(){ +nb_frames=13 t="${test#lavf-}" outdir="tests/data/images/$t" mkdir -p "$outdir" file=${outdir}/%02d.$t -run_avconv $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $1 "$ENC_OPTS -metadata title=lavftest" -vf scale -frames 13 -y -qscale 10 $target_path/$file +if [ "$keep" -lt 1 ]; then +for i in `seq $nb_frames`; do +filename=`printf "$file" $i` +cleanfiles="$cleanfiles $filename" +done +fi +run_avconv $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $1 "$ENC_OPTS -metadata title=lavftest" -vf scale -frames $nb_frames -y -qscale 10 $target_path/$file do_md5sum ${outdir}/02.$t do_avconv_crc $file -auto_conversion_filters $DEC_OPTS $2 -i $target_path/$file $2 echo $(wc -c ${outdir}/02.$t) @@ -370,6 +379,7 @@ lavf_video(){ t="${test#lavf-}" outdir="tests/data/lavf" file=${outdir}/lavf.$t +test "$keep" -ge 1 || cleanfiles="$cleanfiles $file" do_avconv $file -auto_conversion_filters $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $1 $2 do_avconv_crc $file -auto_conversion_filters $DEC_OPTS -i $target_path/$file $1 } diff --git a/tests/fate/api.mak b/tests/fate/api.mak index 10288f5aba..688fc0f9b3 100644 --- a/tests/fate/api.mak +++ b/tests/fate/api.mak @@ -18,6 +18,7 @@ fate-api-h264-slice: CMD = run $(APITESTSDIR)/api-h264-slice-test$(EXESUF) 2 $(T FATE_API_LIBAVFORMAT-$(call DEMDEC, FLV, FLV) += fate-api-seek fate-api-seek: $(APITESTSDIR)/api-seek-test$(EXESUF) fate-lavf-flv +fate-lavf-flv: KEEP_FILES ?= 1 fate-api-seek: CMD = run $(APITESTSDIR)/api-seek-test$(EXESUF) $(TARGET_PATH)/tests/data/lavf/lavf.flv 0 720 fate-api-seek: CMP = null diff --git a/tests/fate/concatdec.mak b/tests/fate/concatdec.mak index 26d4a63179..c0dc6d4c94 100644 --- a/tests/fate/concatdec.mak +++ b/tests/fate/concatdec.mak @@ -4,7 +4,12 @@ FATE_CONCAT_DEMUXER_SIMPLE2_LAVF := ts FATE_CONCAT_DEMUXER_EXTENDED_LAVF := mxf mxf_d10 -$(foreach D,SIMPLE1 SIMPLE2 EXTENDED,$(eval FATE_CONCAT_DEMUXER_$(D)_LAVF := $$(filter $$(FATE_LAVF_CONTAINER:fate-lavf-%=%),$$(FATE_CONCAT_DEMUXER_$(D)_LAVF +define FATE_CONCAT_DEMUXER_SUITE +$$(addprefix fate-lavf-,$$(FATE_CONCAT_DEMUXER_$(D)_LAVF)): KEEP_FILES ?= 1 +FATE_CONCAT_DEMUXER_$(D)_LAVF := $$(filter $$(FATE_LAVF_CONTAINER:fate-lavf-%=%),$$(FATE_CONCAT_DEMUXER_$(D)_LAVF)) +endef + +$(foreach D,SIMPLE1 SIMPLE2 EXTENDED,$(eval $(FATE_CONCAT_DEMUXER_SUITE))) $(foreach D,$(FATE_CONCAT_DEMUXER_SIMPLE1_LAVF),$(eval fate-concat-demuxer-simple1-lavf-$(D): fate-lavf-$(D))) $(foreach D,$(FATE_CONCAT_DEMUXER_SIMPLE1_LAVF),$(eval fate-concat-demuxer-simple1-lavf-$(D): CMD = concat $(SRC_PATH)/tests/simple1.ffconcat ../lavf/lavf.$(D))) diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index c83978f39e..9d14a96e13 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -138,6 +138,7 @@ fate-copy-trac2211-avi: CMD = transcode "h264 -r 14" $(TARGET_SAMPLES)/h264/bbc2 FATE_STREAMCOPY-$(call ENCDEC, APNG, APNG) += fate-copy-apng fate-copy-apng: fate-lavf-apng +fate-lavf-apng: KEEP_FILES ?= 1 fate-copy-apng: CMD = transcode apng tests/data/lavf/lavf.apng apng "-c:v copy" FATE_STREAMCOPY-$(call DEMMUX, OGG, OGG) += fate-limited_input_seek fate-limited_input_seek-copyts -- 2.32.0 __
[FFmpeg-devel] [PATCH 7/7] tests/fate-run: Remove temporary files from pixfmt conversions
Signed-off-by: Andreas Rheinhardt --- tests/fate-run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 5939761997..c0d65be6f4 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -432,6 +432,7 @@ pixfmt_conversion(){ outdir="tests/data/pixfmt" raw_dst="$outdir/$conversion.out.yuv" file=${outdir}/${conversion}.yuv +cleanfiles="$cleanfiles $raw_dst $file" run_avconv $DEC_OPTS -r 1 -f image2 -c:v pgmyuv -i $raw_src \ $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $conversion $target_path/$raw_dst do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $conversion -i $target_path/$raw_dst \ -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avfilter/vf_libplacebo: Match AV_OPT_TYPE_FLOAT to dbl
Signed-off-by: Michael Niedermayer --- libavfilter/vf_libplacebo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 5bcdd64d84..cfee1117e8 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -718,7 +718,7 @@ static const AVOption libplacebo_options[] = { /* Performance/quality tradeoff options */ { "skip_aa", "Skip anti-aliasing", OFFSET(skip_aa), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 0, DYNAMIC }, -{ "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.i64 = 0}, 0.0, 1.0, DYNAMIC }, +{ "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC }, { "disable_linear", "Disable linear scaling", OFFSET(disable_linear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, { "disable_builtin", "Disable built-in scalers", OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, { "force_icc_lut", "Force the use of a full ICC 3DLUT for color mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, -- 2.17.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/libxavs2: Improve r redundancy in occured
Signed-off-by: Michael Niedermayer --- libavcodec/libxavs2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index f77078e3fb..bf34b7acbb 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -208,7 +208,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ret = cae->api->encoder_encode(cae->encoder, &pic, &cae->packet); if (ret) { -av_log(avctx, AV_LOG_ERROR, "Encoding error occured.\n"); +av_log(avctx, AV_LOG_ERROR, "Encoding error occurred.\n"); return AVERROR_EXTERNAL; } -- 2.17.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avformat/libzmq: Improve r redundancy in occured
--- libavformat/libzmq.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c index 1b0d8638db..04c72ac601 100644 --- a/libavformat/libzmq.c +++ b/libavformat/libzmq.c @@ -51,7 +51,7 @@ static int zmq_proto_wait(URLContext *h, void *socket, int write) zmq_pollitem_t items = { .socket = socket, .fd = 0, .events = ev, .revents = 0 }; ret = zmq_poll(&items, 1, POLLING_TIME); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_poll(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_poll(): %s\n", ZMQ_STRERROR); return AVERROR_EXTERNAL; } return items.revents & ev ? 0 : AVERROR(EAGAIN); @@ -90,7 +90,7 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags) s->context = zmq_ctx_new(); if (!s->context) { /*errno not set on failure during zmq_ctx_new()*/ -av_log(h, AV_LOG_ERROR, "Error occured during zmq_ctx_new()\n"); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_ctx_new()\n"); return AVERROR_EXTERNAL; } @@ -100,13 +100,13 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags) if (h->flags & AVIO_FLAG_WRITE) { s->socket = zmq_socket(s->context, ZMQ_PUB); if (!s->socket) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_socket(): %s\n", ZMQ_STRERROR); goto fail_term; } ret = zmq_bind(s->socket, uri); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_bind(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_bind(): %s\n", ZMQ_STRERROR); goto fail_close; } } @@ -115,19 +115,19 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags) if (h->flags & AVIO_FLAG_READ) { s->socket = zmq_socket(s->context, ZMQ_SUB); if (!s->socket) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_socket(): %s\n", ZMQ_STRERROR); goto fail_term; } ret = zmq_setsockopt(s->socket, ZMQ_SUBSCRIBE, "", 0); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_setsockopt(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_setsockopt(): %s\n", ZMQ_STRERROR); goto fail_close; } ret = zmq_connect(s->socket, uri); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_connect(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_connect(): %s\n", ZMQ_STRERROR); goto fail_close; } } @@ -150,7 +150,7 @@ static int zmq_proto_write(URLContext *h, const unsigned char *buf, int size) return ret; ret = zmq_send(s->socket, buf, size, 0); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_send(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_send(): %s\n", ZMQ_STRERROR); return AVERROR_EXTERNAL; } return ret; /*number of bytes sent*/ @@ -166,7 +166,7 @@ static int zmq_proto_read(URLContext *h, unsigned char *buf, int size) return ret; ret = zmq_recv(s->socket, buf, size, 0); if (ret == -1) { -av_log(h, AV_LOG_ERROR, "Error occured during zmq_recv(): %s\n", ZMQ_STRERROR); +av_log(h, AV_LOG_ERROR, "Error occurred during zmq_recv(): %s\n", ZMQ_STRERROR); return AVERROR_EXTERNAL; } if (ret > size) { -- 2.17.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-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_libplacebo: Match AV_OPT_TYPE_FLOAT to dbl
On Wed, May 4, 2022 at 11:37 PM Michael Niedermayer wrote: > > Signed-off-by: Michael Niedermayer > --- > libavfilter/vf_libplacebo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c > index 5bcdd64d84..cfee1117e8 100644 > --- a/libavfilter/vf_libplacebo.c > +++ b/libavfilter/vf_libplacebo.c > @@ -718,7 +718,7 @@ static const AVOption libplacebo_options[] = { > > /* Performance/quality tradeoff options */ > { "skip_aa", "Skip anti-aliasing", OFFSET(skip_aa), AV_OPT_TYPE_BOOL, > {.i64 = 0}, 0, 0, DYNAMIC }, > -{ "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), > AV_OPT_TYPE_FLOAT, {.i64 = 0}, 0.0, 1.0, DYNAMIC }, > +{ "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), > AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC }, > { "disable_linear", "Disable linear scaling", OFFSET(disable_linear), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, > { "disable_builtin", "Disable built-in scalers", > OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, > { "force_icc_lut", "Force the use of a full ICC 3DLUT for color > mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC > }, > -- > 2.17.1 > Patchset looks good, thx ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 5/7] avcodec/cbs_sei: refactor to use avutil/uuid
On 2/5/22 07:06, Mark Thompson wrote: Maybe additional options exist. I do not have a definitive opinion. Some folks expressed strong interest in having a consistent scheme for manipulating UUIDs. I think for now the simplest option is just not to change the CBS header, which is completely fine with your current patch set. Okay, I'll drop the header changes from the patch set. Zane ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
On Tue, May 3, 2022 at 7:46 PM "zhilizhao(赵志立)" wrote: > > Thanks for the review! > > > On May 3, 2022, at 5:35 AM, Vignesh Venkatasubramanian > > wrote: > > > > Add an AVIF muxer by re-using the existing the mov/mp4 muxer. > > > > AVIF Specification: https://aomediacodec.github.io/av1-avif > > > > Sample usage for still image: > > ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif > > > > Sample usage for animated AVIF image: > > ffmpeg -i video.mp4 animated.avif > > > > We can re-use any of the AV1 encoding options that will make > > sense for image encoding (like bitrate, tiles, encoding speed, > > etc). > > > > The files generated by this muxer has been verified to be valid > > AVIF files by the following: > > 1) Displays on Chrome (both still and animated images). > > 2) Displays on Firefox (only still images, firefox does not support > > animated AVIF yet). > > 3) Verified to be valid by Compliance Warden: > > https://github.com/gpac/ComplianceWarden > > > > Fixes the encoder/muxer part of Trac Ticket #7621 > > > > Signed-off-by: Vignesh Venkatasubramanian > > --- > > configure| 1 + > > libavformat/allformats.c | 1 + > > libavformat/movenc.c | 335 --- > > libavformat/movenc.h | 5 + > > 4 files changed, 317 insertions(+), 25 deletions(-) > > > > > > […] > > > static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, > > MOVMuxContext *mov, MOVTrack *track) > > { > > int ret = AVERROR_BUG; > > @@ -2156,6 +2176,8 @@ static int mov_write_video_tag(AVFormatContext *s, > > AVIOContext *pb, MOVMuxContex > > avio_wb32(pb, 0); /* size */ > > if (mov->encryption_scheme != MOV_ENC_NONE) { > > ffio_wfourcc(pb, "encv"); > > +} else if (track->mode == MODE_AVIF) { > > +ffio_wfourcc(pb, "av01"); > > Can the ‘else’ path handle the case? > You are right. Removed the "else if" case. > > } else { > > avio_wl32(pb, track->tag); // store it byteswapped > > } > > @@ -2272,7 +2294,7 @@ static int mov_write_video_tag(AVFormatContext *s, > > AVIOContext *pb, MOVMuxContex > > else > > av_log(mov->fc, AV_LOG_WARNING, "Not writing 'gama' atom. > > Format is not MOV.\n"); > > } > > -if (track->mode == MODE_MOV || track->mode == MODE_MP4) { > > +if (track->mode == MODE_MOV || track->mode == MODE_MP4 || track->mode > > == MODE_AVIF) { > > int has_color_info = track->par->color_primaries != > > AVCOL_PRI_UNSPECIFIED && > > track->par->color_trc != AVCOL_TRC_UNSPECIFIED > > && > > track->par->color_space != > > AVCOL_SPC_UNSPECIFIED; > > @@ -2324,6 +2346,9 @@ static int mov_write_video_tag(AVFormatContext *s, > > AVIOContext *pb, MOVMuxContex > > if (avid) > > avio_wb32(pb, 0); > > > > +if (track->mode == MODE_AVIF) > > +mov_write_ccst_tag(pb); > > + > > return update_size(pb, pos); > > } > > > > @@ -2825,7 +2850,10 @@ static int mov_write_hdlr_tag(AVFormatContext *s, > > AVIOContext *pb, MOVTrack *tra > > > > if (track) { > > hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; > > -if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) { > > +if (track->mode == MODE_AVIF) { > > +hdlr_type = "pict"; > > +descr = "PictureHandler"; > > +} else if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) { > > I prefer put check inside the ‘if (track->par->codec_type == > AVMEDIA_TYPE_VIDEO)’. > It’s a special case of ‘AVMEDIA_TYPE_VIDEO’. > Done. > > hdlr_type = "vide"; > > descr = "VideoHandler"; > > } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) { > > @@ -2892,6 +2920,128 @@ static int mov_write_hdlr_tag(AVFormatContext *s, > > AVIOContext *pb, MOVTrack *tra > > return update_size(pb, pos); > > } > > > > +static int mov_write_pitm_tag(AVIOContext *pb, int item_id) > > +{ > > +int64_t pos = avio_tell(pb); > > +avio_wb32(pb, 0); /* size */ > > +ffio_wfourcc(pb, "pitm"); > > +avio_wb32(pb, 0); /* Version & flags */ > > +avio_wb16(pb, item_id); /* item_id */ > > +return update_size(pb, pos); > > +} > > + > > +static int mov_write_iloc_tag(AVIOContext *pb, MOVMuxContext *mov, > > AVFormatContext *s) > > +{ > > +int64_t pos = avio_tell(pb); > > +avio_wb32(pb, 0); /* size */ > > +ffio_wfourcc(pb, "iloc"); > > +avio_wb32(pb, 0); /* Version & flags */ > > +avio_w8(pb, (4 << 4) + 4); /* offset_size(4) and length_size(4) */ > > +avio_w8(pb, 0); /* base_offset_size(4) and reserved(4) */ > > +avio_wb16(pb, 1); /* item_count */ > > + > > +avio_wb16(pb, 1); /* item_id */ > > +avio_wb16(pb, 0); /* data_reference_index */ > > +avio_wb16(pb, 1); /* extent_count */ > > +mov->avif_extent_pos = avio_tell(pb); > > +avio_wb32(pb, 0); /* extent_offset (written later) */ > > +// For animated AVIF, we simp
[FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
Add an AVIF muxer by re-using the existing the mov/mp4 muxer. AVIF Specification: https://aomediacodec.github.io/av1-avif Sample usage for still image: ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif Sample usage for animated AVIF image: ffmpeg -i video.mp4 animated.avif We can re-use any of the AV1 encoding options that will make sense for image encoding (like bitrate, tiles, encoding speed, etc). The files generated by this muxer has been verified to be valid AVIF files by the following: 1) Displays on Chrome (both still and animated images). 2) Displays on Firefox (only still images, firefox does not support animated AVIF yet). 3) Verified to be valid by Compliance Warden: https://github.com/gpac/ComplianceWarden Fixes the encoder/muxer part of Trac Ticket #7621 Signed-off-by: Vignesh Venkatasubramanian --- configure| 1 + libavformat/allformats.c | 1 + libavformat/movenc.c | 336 --- libavformat/movenc.h | 5 + 4 files changed, 318 insertions(+), 25 deletions(-) diff --git a/configure b/configure index 196873c4aa..2992f9760e 100755 --- a/configure +++ b/configure @@ -3404,6 +3404,7 @@ asf_stream_muxer_select="asf_muxer" av1_demuxer_select="av1_frame_merge_bsf av1_parser" avi_demuxer_select="riffdec exif" avi_muxer_select="riffenc" +avif_muxer_select="mov_muxer" caf_demuxer_select="iso_media" caf_muxer_select="iso_media" dash_muxer_select="mp4_muxer" diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 63876c468f..1802536633 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer; extern const AVInputFormat ff_av1_demuxer; extern const AVInputFormat ff_avi_demuxer; extern const AVOutputFormat ff_avi_muxer; +extern const AVOutputFormat ff_avif_muxer; extern const AVInputFormat ff_avisynth_demuxer; extern const AVOutputFormat ff_avm2_muxer; extern const AVInputFormat ff_avr_demuxer; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 271db99b46..b1c8b0fd81 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1335,7 +1335,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, 0); ffio_wfourcc(pb, "av1C"); -ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); +ff_isom_write_av1c(pb, track->vos_data, track->vos_len, track->mode != MODE_AVIF); return update_size(pb, pos); } @@ -2037,12 +2037,13 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) } } -/* We should only ever be called by MOV or MP4. */ -av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4); +/* We should only ever be called for MOV, MP4 and AVIF. */ +av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 || + track->mode == MODE_AVIF); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "colr"); -if (track->mode == MODE_MP4) +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) ffio_wfourcc(pb, "nclx"); else ffio_wfourcc(pb, "nclc"); @@ -2052,7 +2053,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) avio_wb16(pb, track->par->color_primaries); avio_wb16(pb, track->par->color_trc); avio_wb16(pb, track->par->color_space); -if (track->mode == MODE_MP4) { +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) { int full_range = track->par->color_range == AVCOL_RANGE_JPEG; avio_w8(pb, full_range << 7); } @@ -2118,7 +2119,7 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); -if (track->mode == MODE_MOV && +if ((track->mode == MODE_AVIF || track->mode == MODE_MOV) && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { @@ -2139,6 +2140,25 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) } } +static int mov_write_ccst_tag(AVIOContext *pb) +{ +int64_t pos = avio_tell(pb); +// Write sane defaults: +// all_ref_pics_intra = 0 : all samples can use any type of reference. +// intra_pred_used = 1 : intra prediction may or may not be used. +// max_ref_per_pic = 15 : reserved value to indicate that any number of +//reference images can be used. +uint8_t ccstValue = (0 << 7) | /* all_ref_pics_intra */ +(1 << 6) | /* intra_pred_used */ +(15 << 2); /* max_ref_per_pic */ +avio_wb32(pb, 0); /* size */ +ffio_wfourcc(pb, "ccst"); +avio_wb32(pb, 0); /* Version &
Re: [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
> On May 5, 2022, at 12:45 AM, Vignesh Venkatasubramanian > wrote: > >>> >>> -mov_write_track_udta_tag(pb, mov, st); >>> +if (track->mode != MODE_AVIF) >>> +mov_write_track_udta_tag(pb, mov, st); >> >> Please check if the check can be removed. mov_write_track_udta_tag() does >> nothing >> for mode other than MOV/MP4. >> > > mov_write_track_udta_tag() writes itunes meta and loci tags when mode > is not MOV/MP4. So this check is necessary. > I think you are referring to ‘mov_write_udta_tag', not ‘mov_write_track_udta_tag', no? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
On Wed, May 4, 2022 at 10:10 AM "zhilizhao(赵志立)" wrote: > > > > > On May 5, 2022, at 12:45 AM, Vignesh Venkatasubramanian > > wrote: > > > >>> > >>> -mov_write_track_udta_tag(pb, mov, st); > >>> +if (track->mode != MODE_AVIF) > >>> +mov_write_track_udta_tag(pb, mov, st); > >> > >> Please check if the check can be removed. mov_write_track_udta_tag() does > >> nothing > >> for mode other than MOV/MP4. > >> > > > > mov_write_track_udta_tag() writes itunes meta and loci tags when mode > > is not MOV/MP4. So this check is necessary. > > > > I think you are referring to ‘mov_write_udta_tag', not > ‘mov_write_track_udta_tag', no? Ah yes you are right. mov_write_track_udta_tag doesn't do anything for non-MOV/MP4. I have removed the check. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Vignesh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing
Add an AVIF muxer by re-using the existing the mov/mp4 muxer. AVIF Specification: https://aomediacodec.github.io/av1-avif Sample usage for still image: ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif Sample usage for animated AVIF image: ffmpeg -i video.mp4 animated.avif We can re-use any of the AV1 encoding options that will make sense for image encoding (like bitrate, tiles, encoding speed, etc). The files generated by this muxer has been verified to be valid AVIF files by the following: 1) Displays on Chrome (both still and animated images). 2) Displays on Firefox (only still images, firefox does not support animated AVIF yet). 3) Verified to be valid by Compliance Warden: https://github.com/gpac/ComplianceWarden Fixes the encoder/muxer part of Trac Ticket #7621 Signed-off-by: Vignesh Venkatasubramanian --- configure| 1 + libavformat/allformats.c | 1 + libavformat/movenc.c | 333 --- libavformat/movenc.h | 5 + 4 files changed, 316 insertions(+), 24 deletions(-) diff --git a/configure b/configure index 196873c4aa..2992f9760e 100755 --- a/configure +++ b/configure @@ -3404,6 +3404,7 @@ asf_stream_muxer_select="asf_muxer" av1_demuxer_select="av1_frame_merge_bsf av1_parser" avi_demuxer_select="riffdec exif" avi_muxer_select="riffenc" +avif_muxer_select="mov_muxer" caf_demuxer_select="iso_media" caf_muxer_select="iso_media" dash_muxer_select="mp4_muxer" diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 63876c468f..1802536633 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer; extern const AVInputFormat ff_av1_demuxer; extern const AVInputFormat ff_avi_demuxer; extern const AVOutputFormat ff_avi_muxer; +extern const AVOutputFormat ff_avif_muxer; extern const AVInputFormat ff_avisynth_demuxer; extern const AVOutputFormat ff_avm2_muxer; extern const AVInputFormat ff_avr_demuxer; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 271db99b46..1a20fe17ca 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1335,7 +1335,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, 0); ffio_wfourcc(pb, "av1C"); -ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); +ff_isom_write_av1c(pb, track->vos_data, track->vos_len, track->mode != MODE_AVIF); return update_size(pb, pos); } @@ -2037,12 +2037,13 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) } } -/* We should only ever be called by MOV or MP4. */ -av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4); +/* We should only ever be called for MOV, MP4 and AVIF. */ +av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 || + track->mode == MODE_AVIF); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "colr"); -if (track->mode == MODE_MP4) +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) ffio_wfourcc(pb, "nclx"); else ffio_wfourcc(pb, "nclc"); @@ -2052,7 +2053,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) avio_wb16(pb, track->par->color_primaries); avio_wb16(pb, track->par->color_trc); avio_wb16(pb, track->par->color_space); -if (track->mode == MODE_MP4) { +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) { int full_range = track->par->color_range == AVCOL_RANGE_JPEG; avio_w8(pb, full_range << 7); } @@ -2118,7 +2119,7 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); -if (track->mode == MODE_MOV && +if ((track->mode == MODE_AVIF || track->mode == MODE_MOV) && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { @@ -2139,6 +2140,25 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track) } } +static int mov_write_ccst_tag(AVIOContext *pb) +{ +int64_t pos = avio_tell(pb); +// Write sane defaults: +// all_ref_pics_intra = 0 : all samples can use any type of reference. +// intra_pred_used = 1 : intra prediction may or may not be used. +// max_ref_per_pic = 15 : reserved value to indicate that any number of +//reference images can be used. +uint8_t ccstValue = (0 << 7) | /* all_ref_pics_intra */ +(1 << 6) | /* intra_pred_used */ +(15 << 2); /* max_ref_per_pic */ +avio_wb32(pb, 0); /* size */ +ffio_wfourcc(pb, "ccst"); +avio_wb32(pb, 0); /* Version &
Re: [FFmpeg-devel] [PATCH] avfilter: add multiply video filter
Gonna apply soon. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] FFmpeg 4.2 / 3.4 / 3.2 / 2.8
Hi Some fixes that where backported to 4.3 / 4.1 where not backported to 4.2 / 3.4 / 3.2 / 2.8 This was reported by Enrico Zini (in CC) Ive backported these today and will make new releases from the affected branches. Theres also a smaller set of memleak fixes missing from 4.1. As such these would not justify a new release but if we make 4 new ones maybe i make a new 4.1 release too for completeness If you know of any other missing fixes, especially anything security related please backport them Thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v15 4/4] avformat/image2: add Jpeg XL as image2 format
On Sat, Apr 23, 2022 at 7:53 PM Lynne wrote: > 17 Apr 2022, 15:22 by leo.i...@gmail.com: > > > This commit adds support to libavformat for muxing > > and demuxing Jpeg XL images as image2 streams. > > --- > > MAINTAINERS| 1 + > > libavformat/Makefile | 1 + > > libavformat/allformats.c | 1 + > > libavformat/img2.c | 1 + > > libavformat/img2dec.c | 20 ++ > > libavformat/img2enc.c | 6 +- > > libavformat/jpegxl_probe.c | 393 + > > libavformat/jpegxl_probe.h | 32 +++ > > libavformat/mov.c | 1 + > > 9 files changed, 453 insertions(+), 3 deletions(-) > > create mode 100644 libavformat/jpegxl_probe.c > > create mode 100644 libavformat/jpegxl_probe.h > > > > Patchset pushed, thanks! > Hi, I might have found a bug here. Or I might not be using it correctly, that's entirely possible too! What i try is just making an animated jxl from a bunch of input images. This command for example works and creates a gif: ffmpeg -f image2 -framerate 1 -i thumb%04d.jpg output.gif This command (just changing "gif" to "jxl") errors. ffmpeg -f image2 -framerate 1 -i thumb%04d.jpg output.jxl The error: [image2 @ 0x557ea81112c0] Could not get frame filename number 2 from pattern 'output.jxl'. Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %03d within the filename. av_interleaved_write_frame(): Invalid argument It does look like it tries to use "output.jxl" as a pattern file as opposed to "thumb%04d.jpg". Am I doing something wrong here? > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] PATCH - libmad MP3 decoding support
> Andreas Rheinhardt wrote: > > David Fletcher: > > Following today's posts about help with submitting patches I realised I > > sent the libmad patch yesterday in the wrong format. Apologies, I was > > not familiar with the git format patches. > > > > Hopefully the attached version is now in the correct format against the > > current master branch. > > > > The bug report about why this exists is at the following link, including > > a link to sample distorted audio from decoding an mp3 stream on ARMv4 > > hardware: https://trac.ffmpeg.org/ticket/9764 > > > > Best regards, David. > > > > > > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > > index c47133aa18..e3df6178c8 100644 > > --- a/libavcodec/allcodecs.c > > +++ b/libavcodec/allcodecs.c > > @@ -744,6 +744,7 @@ extern const FFCodec ff_libcodec2_decoder; > > extern const FFCodec ff_libdav1d_decoder; > > extern const FFCodec ff_libdavs2_decoder; > > extern const FFCodec ff_libfdk_aac_encoder; > > +extern const AVCodec ff_libmad_decoder; > > extern const FFCodec ff_libfdk_aac_decoder; > > extern const FFCodec ff_libgsm_encoder; > > extern const FFCodec ff_libgsm_decoder; > > This should look weird to you. Now you've pointed it out - yes, it does! This error was matched by a similar use of AVCodec in place of FFCodec in the libmaddec.c file. It seems these structures have enough in common that I'd got away with it running without noticing this. > > > > > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h > > index 8b317fa121..be70f4a71c 100644 > > --- a/libavcodec/codec_id.h > > +++ b/libavcodec/codec_id.h > > @@ -519,6 +519,7 @@ enum AVCodecID { > > AV_CODEC_ID_FASTAUDIO, > > AV_CODEC_ID_MSNSIREN, > > AV_CODEC_ID_DFPWM, > > +AV_CODEC_ID_LIBMAD, > > > > /* subtitle codecs */ > > AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID > > pointing at the start of subtitle codecs. > > This makes no sense: Your decoder is still expected to decode MP3 and > not a new, previously unsupported format. This was left over from some development experiments while I was working out how to integrate libmad. It was not used and needed to be removed. The ff_libmad_decoder structure in libmaddec.c already used AV_CODEC_ID_MP3 and never mentioned AV_CODEC_ID_LIBMAD. > > > diff --git a/libavcodec/libmaddec.c b/libavcodec/libmaddec.c > > new file mode 100644 > > index 00..7082c53f4d > > --- /dev/null > > +++ b/libavcodec/libmaddec.c > > @@ -0,0 +1,181 @@ > > +/* > > + * MP3 decoder using libmad > > + * Copyright (c) 2022 David Fletcher > > + * > > + * 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 > > + > > +#include "libavutil/channel_layout.h" > > +#include "libavutil/common.h" > > +#include "avcodec.h" > > +#include "internal.h" > > +#include "decode.h" > > + > > +#define MAD_BUFSIZE (32 * 1024) > > +#define MIN(a, b) ((a) < (b) ? (a) : (b)) > > + > > +typedef struct libmad_context { > > +uint8_t input_buffer[MAD_BUFSIZE+MAD_BUFFER_GUARD]; > > +struct mad_synth synth; > > +struct mad_stream stream; > > +struct mad_frame frame; > > +struct mad_header header; > > +int got_header; > > +}libmad_context; > > + > > +/* utility to scale and round samples to 16 bits */ > > +static inline signed int mad_scale(mad_fixed_t sample) > > +{ > > + /* round */ > > + sample += (1L << (MAD_F_FRACBITS - 16)); > > + > > + /* clip */ > > + if (sample >= MAD_F_ONE) > > + sample = MAD_F_ONE - 1; > > + else if (sample < -MAD_F_ONE) > > + sample = -MAD_F_ONE; > > + > > + /* quantize */ > > + return sample >> (MAD_F_FRACBITS + 1 - 16); > > +} > > + > > +static av_cold int libmad_decode_init(AVCodecContext *avc) > > +{ > > + libmad_context *mad = avc->priv_data; > > + > > + mad_synth_init (&mad->synth); > > + mad_stream_init (&mad->stream); > > + mad_frame_init (&mad->frame); > > + mad->got_header = 0; > > + > > + return 0; > > +} > > + > > +static av_cold int libmad_decode_close(AVCodecContext *avc) > > +{ > > + libmad_context *mad = avc->priv_data; > > + > > + mad_synth_finish(&mad->synth); >
Re: [FFmpeg-devel] [PATCH v2 3/5] avutil/hwcontext_d3d11va: add a format check for staging texture
> > -Original Message- > > From: ffmpeg-devel On Behalf Of > Tong > > Wu > > Sent: Friday, April 29, 2022 12:45 PM > > To: ffmpeg-devel@ffmpeg.org > > Cc: Tong Wu > > Subject: [FFmpeg-devel] [PATCH v2 3/5] avutil/hwcontext_d3d11va: add a > > format check for staging texture > > > > The texDesc.Format needs to be filled in with a corresponding format. > > I > > add a format check to initialize the format in case sometimes the > > ctx->internal->priv is not initialized, such as during the hwmap > > process. > > ctx->internal->priv is D3D11VAFramesContext. When it wouldn't be > initialized, then hwmap couldn't work. > > D3D11VAFramesContext.format is set during d3d11va_frames_init. > You would need to find out whether init is not called or > whether AVHWFramesContext.sw_format is not (yet) set during > init. > For the hwmap process, the new FramesContext is created in av_hwframe_ctx_create_derived and the init function is never called. > > If that doesn't work out for some reason, I think the next best > solution would be to add a 'format parameter' to > d3d11va_create_staging_texture() and in d3d11va_transfer_data() > (the only caller) do ID3D11Texture2D_GetDesc() on the frame > texture ('texture' variable) and pass the returned format to > d3d11va_create_staging_texture() > I think this solution makes sense. I will resubmit the patch. Thanks for the review. Regards, Tong > Kind regards, > softworkz > > > > > > $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ > > -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \ > > -i input.h264 -vf > > > "hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" > \ > > -f null - > > > > Signed-off-by: Tong Wu > > --- > > libavutil/hwcontext_d3d11va.c | 16 > > 1 file changed, 16 insertions(+) > > > > diff --git a/libavutil/hwcontext_d3d11va.c > > b/libavutil/hwcontext_d3d11va.c > > index db529acbb4..0ec0e07d3a 100644 > > --- a/libavutil/hwcontext_d3d11va.c > > +++ b/libavutil/hwcontext_d3d11va.c > > @@ -349,6 +349,8 @@ static int > > d3d11va_create_staging_texture(AVHWFramesContext *ctx) > > AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; > > D3D11VAFramesContext *s = ctx->internal->priv; > > HRESULT hr; > > +int i; > > + > > D3D11_TEXTURE2D_DESC texDesc = { > > .Width = ctx->width, > > .Height = ctx->height, > > @@ -360,6 +362,20 @@ static int > > d3d11va_create_staging_texture(AVHWFramesContext *ctx) > > .CPUAccessFlags = D3D11_CPU_ACCESS_READ | > > D3D11_CPU_ACCESS_WRITE, > > }; > > > > +if (!texDesc.Format) { > > +for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++) { > > +if (ctx->sw_format == supported_formats[i].pix_fmt) { > > +texDesc.Format = supported_formats[i].d3d_format; > > +break; > > +} > > +} > > +if (i == FF_ARRAY_ELEMS(supported_formats)) { > > +av_log(ctx, AV_LOG_ERROR, "Unsupported pixel format: > > %s\n", > > +av_get_pix_fmt_name(ctx->sw_format)); > > +return AVERROR(EINVAL); > > +} > > +} > > + > > hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, > > NULL, &s->staging_texture); > > if (FAILED(hr)) { > > av_log(ctx, AV_LOG_ERROR, "Could not create the staging > > texture (%lx)\n", (long)hr); > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 01/10] avfilter/af_afir: Only keep DSP stuff in header
Andreas Rheinhardt: > Only the AudioFIRDSPContext and the functions for its initialization > are needed outside of lavfi/af_afir.c. > Also rename the header to af_afirdsp.h to reflect the change. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/af_afir.c | 71 +- > libavfilter/af_afir.h | 108 - > libavfilter/af_afirdsp.h | 34 +++ > libavfilter/x86/af_afir_init.c | 2 +- > tests/checkasm/af_afir.c | 2 +- > 5 files changed, 106 insertions(+), 111 deletions(-) > delete mode 100644 libavfilter/af_afir.h > create mode 100644 libavfilter/af_afirdsp.h > > diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c > index 72e77eda19..d7ae468428 100644 > --- a/libavfilter/af_afir.c > +++ b/libavfilter/af_afir.c > @@ -30,8 +30,11 @@ > #include "libavutil/channel_layout.h" > #include "libavutil/common.h" > #include "libavutil/float_dsp.h" > +#include "libavutil/frame.h" > #include "libavutil/intreadwrite.h" > +#include "libavutil/log.h" > #include "libavutil/opt.h" > +#include "libavutil/rational.h" > #include "libavutil/xga_font_data.h" > > #include "audio.h" > @@ -39,7 +42,73 @@ > #include "filters.h" > #include "formats.h" > #include "internal.h" > -#include "af_afir.h" > +#include "af_afirdsp.h" > + > +typedef struct AudioFIRSegment { > +int nb_partitions; > +int part_size; > +int block_size; > +int fft_length; > +int coeff_size; > +int input_size; > +int input_offset; > + > +int *output_offset; > +int *part_index; > + > +AVFrame *sumin; > +AVFrame *sumout; > +AVFrame *blockin; > +AVFrame *blockout; > +AVFrame *buffer; > +AVFrame *coeff; > +AVFrame *input; > +AVFrame *output; > + > +AVTXContext **tx, **itx; > +av_tx_fn tx_fn, itx_fn; > +} AudioFIRSegment; > + > +typedef struct AudioFIRContext { > +const AVClass *class; > + > +float wet_gain; > +float dry_gain; > +float length; > +int gtype; > +float ir_gain; > +int ir_format; > +float max_ir_len; > +int response; > +int w, h; > +AVRational frame_rate; > +int ir_channel; > +int minp; > +int maxp; > +int nb_irs; > +int selir; > + > +float gain; > + > +int eof_coeffs[32]; > +int have_coeffs; > +int nb_taps; > +int nb_channels; > +int nb_coef_channels; > +int one2many; > + > +AudioFIRSegment seg[1024]; > +int nb_segments; > + > +AVFrame *in; > +AVFrame *ir[32]; > +AVFrame *video; > +int min_part_size; > +int64_t pts; > + > +AudioFIRDSPContext afirdsp; > +AVFloatDSPContext *fdsp; > +} AudioFIRContext; > > static void fcmul_add_c(float *sum, const float *t, const float *c, > ptrdiff_t len) > { > diff --git a/libavfilter/af_afir.h b/libavfilter/af_afir.h > deleted file mode 100644 > index cf00dbfc66..00 > --- a/libavfilter/af_afir.h > +++ /dev/null > @@ -1,108 +0,0 @@ > -/* > - * Copyright (c) 2017 Paul B Mahol > - * > - * 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 > - */ > - > -#ifndef AVFILTER_AFIR_H > -#define AVFILTER_AFIR_H > - > -#include > -#include > - > -#include "libavutil/tx.h" > -#include "libavutil/float_dsp.h" > -#include "libavutil/frame.h" > -#include "libavutil/log.h" > -#include "libavutil/rational.h" > - > -typedef struct AudioFIRSegment { > -int nb_partitions; > -int part_size; > -int block_size; > -int fft_length; > -int coeff_size; > -int input_size; > -int input_offset; > - > -int *output_offset; > -int *part_index; > - > -AVFrame *sumin; > -AVFrame *sumout; > -AVFrame *blockin; > -AVFrame *blockout; > -AVFrame *buffer; > -AVFrame *coeff; > -AVFrame *input; > -AVFrame *output; > - > -AVTXContext **tx, **itx; > -av_tx_fn tx_fn, itx_fn; > -} AudioFIRSegment; > - > -typedef struct AudioFIRDSPContext { > -void (*fcmul_add)(float *sum, const float *t, const float *c, > - ptrdiff_t len); > -} AudioFIRDSPContext; > - > -typedef struct AudioFIRContext { > -const AVClass *class; > - > -float wet_gain; > -float dry_gain; > -float length; > -int gtype; > -f
Re: [FFmpeg-devel] [PATCH v15 4/4] avformat/image2: add Jpeg XL as image2 format
On 5/4/22 17:56, Mark Gaiser wrote: Hi, I might have found a bug here. Or I might not be using it correctly, that's entirely possible too! What i try is just making an animated jxl from a bunch of input images. Currently animated JXL is not supported. - Leo Izen (thebombzen) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] libavcodec/cbs_av1: Add size check before parse obu
> On 29/03/2022 09:29, Wenbin Chen wrote: > > cbs_av1_write_unit() check pbc size after parsing obu frame, and return > > AVERROR(ENOSPC) if pbc is small. pbc will be reallocated and this obu > > frame will be parsed again, but this may cause error because > > CodedBitstreamAV1Context has already been updated, for example > > ref_order_hint is updated and will not match the same obu frame. Now > size > > check is added before parsing obu frame to avoid this error. > > > > Signed-off-by: Wenbin Chen > > --- > > libavcodec/cbs_av1.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c > > index 1229480567..29e7bc16df 100644 > > --- a/libavcodec/cbs_av1.c > > +++ b/libavcodec/cbs_av1.c > > @@ -1075,6 +1075,9 @@ static int > cbs_av1_write_obu(CodedBitstreamContext *ctx, > > put_bits32(pbc, 0); > > } > > > > +if (8 * (unit->data_size + obu->obu_size) > put_bits_left(pbc)) > > +return AVERROR(ENOSPC); > > unit->data_size is not usefully set when we are writing here (it might be the > size of the old bitstream in editing cases, or it might just be zero). Thank you for pointing this out. If data_size is unset this check wouldn't work and the problem still occurs. I will try to find a better way to fix this. > > > + > > td = NULL; > > start_pos = put_bits_count(pbc); > > > > @@ -1196,9 +1199,6 @@ static int > cbs_av1_write_obu(CodedBitstreamContext *ctx, > > flush_put_bits(pbc); > > av_assert0(data_pos <= start_pos); > > > > -if (8 * obu->obu_size > put_bits_left(pbc)) > > -return AVERROR(ENOSPC); > > - > > if (obu->obu_size > 0) { > > memmove(pbc->buf + data_pos, > > pbc->buf + start_pos, header_size); > > So, this doesn't work? The header hasn't been written that point, so you > don't know if there is enough space for both the OBU header and the OBU > data. > > Having the check in both places would be fine (the newly-added one being a > way to bail early when there definitely isn't enough space), but that wouldn't > do what you want. Ok, I will keep the both places in my next patch if I still fix issue in this way. > > I'm not sure what the right answer is here. Do we need some way to unwind > the written header? The initial buffer size is 1MB and gets doubled each > time, > so this is not going to be hit very often. Unwinding header is an alternative way. I will check If it is possible. This problem is rare. The problem occurs when I frame below buffer size but one P/B frame in the gop is greater than buffer size. Thanks Wenbin > > - Mark > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".