From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 5643B4C72B for ; Fri, 12 Sep 2025 10:17:49 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'epW0oUd6RQognH59FYss/jfE8UuwMnG9YJMonQUq5fk=', expected b'WPtwnGXOZCfZvEGbWrh9di3Fse8LIG1lT1h37lS7c3A=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757672242; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=epW0oUd6RQognH59FYss/jfE8UuwMnG9YJMonQUq5fk=; b=A3V8FaPhPzTvBEJE1lv5wVAaFa5K1a9mDKZtrYqNeQz1ujI2axIQVPvoxCQzUFvulioPf apaOdXuLvVWCKIuOKPA4vJPq8XSDRCDgL5ipSQ5lGD31Yx5QDl2HplX+QMUKuF4Ko0VQ/ou veGvmYoJnAcy0gwjNHMyvmLqB9SNae1CxqMIoyeLjwED/TOKMjC9rBAD3o9zFWgPKWKkLbx OMEYs+hWbozGNx0v3ubV8n0J64MGXY+dXwhRGxua7FP8WPiZigecN2N1Skym9ZwyZZdJLnf aZVIR4HbaDSzXq0SZzPBN0U1Kp7w4HkeNSL2v6qKKV8BuO4jfgKF/4Wj3PWA== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 43B4F68E847; Fri, 12 Sep 2025 13:17:22 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1757672239; b=NKrHaboEynAE4JoLtcPxHWxLsUtucfB/0LcVWH84oZIja2Z/XhxgL5RzowL0h/PGsg+ut EMC+n13xmAAtWM74d65Kwkw2Vp0G1PD2xR1G9zFS2oWB6UImFxtt3PDdCCdNo9pCC5D5gxs ngT5rh07Pnqk+LykIzVi8BTxdQZujgaZFi3lZcZOEXIHv7IQyhJ3jqISOJ/xAvTx/FohYsr bo7+pJy3j+JNPrHhXvIOKg9uMSjRZ3rk8ZxOnB2TmSOZH/mBJq/3JrWe/UelWu0BFy+ZTPH +p4Jh7ScD4DnUWOWfzyRxLB83ufFwaX17EP69tIjb5+nJGNZKMwHTvdJZ73g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1757672239; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=puVGbQUcnANoOW13vg2L6v0KuBiYm10viXmmo16CvkI=; b=ZwE0sNZD4kQOJSWhAxHkqkKvg95VSVVF86eGcGLVL2tUD6WyayWNPGhH0xV6kKZKsoEAd TdGnoCvVJiZJfdDO4iQxdoc5acJAyWXDF/2r5tsNL/s4eIZlNJB/jUTa33+W6OGVxl+zhjn wjzSYXlL1FRGgwZ3fS37bGjkKRUveTkb5ObIbEAjSG2agXJj+ajAPqa6chiJFnKd8IKKyYD 7ISe5BTYIm2NtmW9zQ8dhvWxJ37oye3rElJtFmgPkGA17kq41+GbcJ+UUsfDGzCM5I5XCPI OFahyccUQCmsCxinp/Hrd+RYNVHEsfPjighVjI0ZTsO7YWzyJcfspSeXePIw== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757672228; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=WPtwnGXOZCfZvEGbWrh9di3Fse8LIG1lT1h37lS7c3A=; b=OjrCsnjBKDHQ6Na99LU85rMtdeP8COUiLeItscHpRLQrIsxcDsch0PoTBxGDG1bmPnS4b 9UhZDOfHodCWrJzhIDlagKxXRHMmvDP6+W6JtH0CZuflliWbkadHDxVFOmLgnZr1PNwZKw6 ahLQjjiEd8pAUcbyRENT9b4X/Ms3wswvceIfbDnqcvLhl9RW/TomSyo94+gD67d3KAImDuj /ke5j3ujlmJs4c8VtY9Pogwb/otIJUkXtD3DSzfrgdFP7syabrTwHWPAZO94B5ZHRH0Ympf ZYOV2z2/796sydTIgtiwGlKlNZVVgqO5dk5BJBRbgWU1yVD/oR1pAok+Cm1g== Received: from 3f9d35a0eedc (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 5734A68E835 for ; Fri, 12 Sep 2025 13:17:08 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Sep 2025 10:17:07 -0000 Message-ID: <175767222859.25.5466479572598387289@463a07221176> Message-ID-Hash: SNK7KYW3K7JM3AN7AVXPZNL5NWSKZPOL X-Message-ID-Hash: SNK7KYW3K7JM3AN7AVXPZNL5NWSKZPOL X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] swresample: Delete matrix_flt to optimize memory (PR #20502) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Renjianguang-mi via ffmpeg-devel Cc: Renjianguang-mi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20502 opened by Renjianguang-mi URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20502 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20502.patch float occupies 4 bytes, which can reduce 64K memory usage Signed-off-by: renjianguang >>From 5cd5775ad832551fc470a4f4255df8a9777f9e9d Mon Sep 17 00:00:00 2001 From: renjianguang Date: Fri, 12 Sep 2025 18:12:26 +0800 Subject: [PATCH] swresample: Delete matrix_flt to optimize memory float occupies 4 bytes, which can reduce 64K memory usage Signed-off-by: renjianguang --- libswresample/rematrix.c | 12 ++---------- libswresample/swresample_internal.h | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index f55b85a52d..cb57927108 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -69,13 +69,12 @@ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride) if (!s || s->in_convert) // s needs to be allocated but not initialized return AVERROR(EINVAL); memset(s->matrix, 0, sizeof(s->matrix)); - memset(s->matrix_flt, 0, sizeof(s->matrix_flt)); nb_in = s->user_in_chlayout.nb_channels; nb_out = s->user_out_chlayout.nb_channels; for (out = 0; out < nb_out; out++) { for (in = 0; in < nb_in; in++) - s->matrix_flt[out][in] = s->matrix[out][in] = matrix[in]; + s->matrix[out][in] = matrix[in]; matrix += stride; } s->rematrix_custom = 1; @@ -452,13 +451,6 @@ av_cold static int auto_matrix(SwrContext *s) maxval, s->rematrix_volume, (double*)s->matrix, s->matrix[1] - s->matrix[0], s->matrix_encoding, s); - if (ret >= 0 && s->int_sample_fmt == AV_SAMPLE_FMT_FLTP) { - int i, j; - for (i = 0; i < FF_ARRAY_ELEMS(s->matrix[0]); i++) - for (j = 0; j < FF_ARRAY_ELEMS(s->matrix[0]); j++) - s->matrix_flt[i][j] = s->matrix[i][j]; - } - return ret; } @@ -628,7 +620,7 @@ int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mus float v=0; for(j=0; jmatrix_ch[out_i][0]; j++){ in_i= s->matrix_ch[out_i][1+j]; - v+= ((float*)in->ch[in_i])[i] * s->matrix_flt[out_i][in_i]; + v+= ((float*)in->ch[in_i])[i] * (float)s->matrix[out_i][in_i]; } ((float*)out->ch[out_i])[i]= v; } diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h index 21c9e33fa1..161adcdd8b 100644 --- a/libswresample/swresample_internal.h +++ b/libswresample/swresample_internal.h @@ -167,7 +167,6 @@ struct SwrContext { struct Resampler const *resampler; ///< resampler virtual function table double matrix[SWR_CH_MAX][SWR_CH_MAX]; ///< floating point rematrixing coefficients - float matrix_flt[SWR_CH_MAX][SWR_CH_MAX]; ///< single precision floating point rematrixing coefficients uint8_t *native_matrix; uint8_t *native_one; uint8_t *native_simd_one; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org