From eac4c3574bb4e145a84e160c4dba1c50b60f3470 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 7 Feb 2022 03:42:19 +0100 Subject: [PATCH] lavu/tx: disable debugging information when CONFIG_SMALL --- libavutil/tx.c | 36 +++++++++++++++++++++++------------- libavutil/tx_priv.h | 12 ++++++------ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/libavutil/tx.c b/libavutil/tx.c index 573f4863d1..2d8d21b65f 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -292,6 +292,7 @@ static const FFTXCodelet * const ff_tx_null_list[] = { NULL, }; +#if !CONFIG_SMALL static void print_flags(AVBPrint *bp, uint64_t f) { int prev = 0; @@ -371,6 +372,20 @@ static void print_cd_info(const FFTXCodelet *cd, int prio, int print_prio) av_log(NULL, AV_LOG_VERBOSE, "%s\n", bp.str); } +static void print_tx_structure(AVTXContext *s, int depth) +{ + const FFTXCodelet *cd = s->cd_self; + + for (int i = 0; i <= depth; i++) + av_log(NULL, AV_LOG_VERBOSE, " "); + + print_cd_info(cd, cd->prio, 0); + + for (int i = 0; i < s->nb_sub; i++) + print_tx_structure(&s->sub[i], depth + 1); +} +#endif /* CONFIG_SMALL */ + typedef struct TXCodeletMatch { const FFTXCodelet *cd; int prio; @@ -431,7 +446,9 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, TXCodeletMatch *cd_tmp, *cd_matches = NULL; unsigned int cd_matches_size = 0; int nb_cd_matches = 0; +#if !CONFIG_SMALL AVBPrint bp = { 0 }; +#endif /* Array of all compiled codelet lists. Order is irrelevant. */ const FFTXCodelet * const * const codelet_list[] = { @@ -543,6 +560,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, } } +#if !CONFIG_SMALL /* Print debugging info */ av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&bp, "For transform of length %i, %s, ", len, @@ -552,6 +570,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, print_flags(&bp, flags); av_bprintf(&bp, ", found %i matches%s", nb_cd_matches, nb_cd_matches ? ":" : "."); +#endif /* No matches found */ if (!nb_cd_matches) @@ -560,12 +579,14 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, /* Sort the list */ AV_QSORT(cd_matches, nb_cd_matches, TXCodeletMatch, cmp_matches); +#if !CONFIG_SMALL av_log(NULL, AV_LOG_VERBOSE, "%s\n", bp.str); for (int i = 0; i < nb_cd_matches; i++) { av_log(NULL, AV_LOG_VERBOSE, " %i: ", i + 1); print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 1); } +#endif if (!s->sub) { s->sub = sub = av_mallocz(TX_MAX_SUB*sizeof(*sub)); @@ -614,19 +635,6 @@ end: return ret; } -static void print_tx_structure(AVTXContext *s, int depth) -{ - const FFTXCodelet *cd = s->cd_self; - - for (int i = 0; i <= depth; i++) - av_log(NULL, AV_LOG_VERBOSE, " "); - - print_cd_info(cd, cd->prio, 0); - - for (int i = 0; i < s->nb_sub; i++) - print_tx_structure(&s->sub[i], depth + 1); -} - av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags) { @@ -655,8 +663,10 @@ av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, *ctx = &tmp.sub[0]; *tx = tmp.fn[0]; +#if !CONFIG_SMALL av_log(NULL, AV_LOG_VERBOSE, "Transform tree:\n"); print_tx_structure(*ctx, 0); +#endif return ret; } diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h index 28c8435c83..c9eda44e61 100644 --- a/libavutil/tx_priv.h +++ b/libavutil/tx_priv.h @@ -27,10 +27,10 @@ #ifdef TX_FLOAT #define TX_TAB(x) x ## _float #define TX_NAME(x) x ## _float_c -#define TX_NAME_STR(x) x "_float_c" +#define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_float_c") #define TX_TYPE(x) AV_TX_FLOAT_ ## x #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _float_ ## suffix -#define TX_FN_NAME_STR(fn, suffix) #fn "_float_" #suffix +#define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_float_" #suffix) #define MULT(x, m) ((x) * (m)) #define SCALE_TYPE float typedef float TXSample; @@ -38,10 +38,10 @@ typedef AVComplexFloat TXComplex; #elif defined(TX_DOUBLE) #define TX_TAB(x) x ## _double #define TX_NAME(x) x ## _double_c -#define TX_NAME_STR(x) x "_double_c" +#define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_double_c") #define TX_TYPE(x) AV_TX_DOUBLE_ ## x #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _double_ ## suffix -#define TX_FN_NAME_STR(fn, suffix) #fn "_double_" #suffix +#define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_double_" #suffix) #define MULT(x, m) ((x) * (m)) #define SCALE_TYPE double typedef double TXSample; @@ -49,10 +49,10 @@ typedef AVComplexDouble TXComplex; #elif defined(TX_INT32) #define TX_TAB(x) x ## _int32 #define TX_NAME(x) x ## _int32_c -#define TX_NAME_STR(x) x "_int32_c" +#define TX_NAME_STR(x) NULL_IF_CONFIG_SMALL(x "_int32_c") #define TX_TYPE(x) AV_TX_INT32_ ## x #define TX_FN_NAME(fn, suffix) ff_tx_ ## fn ## _int32_ ## suffix -#define TX_FN_NAME_STR(fn, suffix) #fn "_int32_" #suffix +#define TX_FN_NAME_STR(fn, suffix) NULL_IF_CONFIG_SMALL(#fn "_int32_" #suffix) #define MULT(x, m) (((((int64_t)(x)) * (int64_t)(m)) + 0x40000000) >> 31) #define SCALE_TYPE float typedef int32_t TXSample;