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 3CAC64D07B for ; Mon, 8 Dec 2025 11:49:13 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'D68nzTL8oXqqTizbx+PvyNcSrjXNfijNatG8riKA2Dk=', expected b'r5FTzOaSvZwoO61S02NhQFkStEuQ8iSwjd8N+O8xn6s=')) header.d=gmail.com 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=1765194540; h=to : date : message-id : mime-version : 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=47kvzOgA14aXIMGQeJ+b0pW2l7q3ZD2qZtP8zbxzuKU=; b=P6MR+T4m9wXlJorv4PHS/tOz7oy8AhbKb4qdy1kIRyIePqhEoJa1e+lHYoR68LkrgFrXx FBY/Vw0JfjzUvlmkf5182IFoptoZ5gTisedB1zkimkz2PBw47tTABUtCJvDn210cyqTSNj9 NiOT6Wr062lfQXl8GtZ3pVlmbaEbvtISg79dTZM5GO48jEUn9fGUwnhEq/HLuSFUOR7+3Zk BMiygk2l8d8lMng/xDW3olfXgVua1J/Vbk+YIULpOxI/p3y4tTRWN1CpuhmKshGIQ11o64g cArEqEVB1KTivs2Sw9ADVcQKl2NnPYJoC6MmWffzqryUzf42zl57fGDSz6PQ== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2ED99690653; Mon, 8 Dec 2025 13:49:00 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1765194526; b=VMV2AC1U+qMamEfCDE+zZlxfsHroF5dXySjgMw8M05Ek8NuE9OphA+wNCM5inB+Dd28wb oIevr4FmFsEwplUI2S259WAJ9GJm0/JKzN0HNh4u58jvkXct8hfyTNfLWeTDekTTp00CavG 1iKiNtCLipeEVBElGAFafxCZSEEfoO+6T5GmbJo4QvPJuaWj6M5gMRAcfMItc1a1rTVdsAC GdnPsEqzFAHFl/w/cQwgLMptaBicBL+CNKWiOB4iOq0j0RJFBikHxInXVr5ZA5QU3IB6zON OuFsMpr9WTerC5BTWtOjY4QG9wyScpTPMoY35nKGwiO4bidfDyF0fYbnPlsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1765194526; 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=D68nzTL8oXqqTizbx+PvyNcSrjXNfijNatG8riKA2Dk=; b=e6iAhG4B7X5Ydho+VW8EhqSUq7fz+QcvkXUu7itxPnRSVRrF0JSummKHzghsozsvFAuy0 3J13XoOxOdcr22cUswl8+5zlOTmhk2eJBGsxSJ1yWqbtCs2mSlRNJiqEcDY01hjddyh0YdN vyLxu2rJiL6jV+wxeQmtfU/UV33jIn86x64U1Pg2B79XfKL81VT0O3F7yVO9Pv+AthEwqCP vLlEsDxnAzPDAlirbJWF2WebnNVNByQjjHsddlWR8zcZasowXxn8nvO8iEgsda389v5I1yc 6SI2Q1fwmynUHDalVeUUAc+JtJ3PRmDqnB5r/oSQt0s4W+jizTGmFV/GReFg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=gmail.com; arc=none; dmarc=pass header.from=gmail.com policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=gmail.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=gmail.com policy.dmarc=quarantine Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 3EED06905E4 for ; Mon, 8 Dec 2025 13:48:33 +0200 (EET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-298287a26c3so58462595ad.0 for ; Mon, 08 Dec 2025 03:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765194511; x=1765799311; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r5FTzOaSvZwoO61S02NhQFkStEuQ8iSwjd8N+O8xn6s=; b=OM6zrTHGSvsPQfHpHIShbjrMh6j0YiTxpFrvC0t7O+dvjv04zKPlUB44VUSjcuG27a 3F1dtBnVjbKPqx+5Qx2zu249s57vzvb72XquSHcw6QOjjrcitr5Q+3N8VNM4TA4Xcz2Z pmtI3heMW6bPa/UsfAU9wJE4jGZ1DI9UPZssGuGJ9KyN/gYhtqTXPZ4jqUcSV/5ncpIi tyJhNHwZQmxSRBMGzyDvx80bOuU4f2jE/BKWF/gSGyL17L6Nsqvp+V53PSrlsjSf/Ad7 0w8AqTHEwmbFldQ0/euKGN7M7ZdFag3BG/swsQXr81IkQNmnn9NNKAzAb/awRqA804CF W33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765194511; x=1765799311; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=r5FTzOaSvZwoO61S02NhQFkStEuQ8iSwjd8N+O8xn6s=; b=aTixnImZQI+l4t8tGlfXAQO1zmcqVE9063OsX3PGvPr4ORbnzUt1+sPLv/mH2+WVkX GXeS4JpEkHUMmkwmyijS65k3LDHHQVyCHK5CLiuepXZX2FQOHhkJXt4Mb6ae2r0rNVYf ywEGRBkbuz6oei/Lu7YShlYm/oGYKAhRGXmkC8yaBoSfr1J5Abr8z+/cA9EELN4fJVbw +uik9hSGwDkTcmtkL3VlHhVyFU1iOE+8fxlqLtLxY9E+KjRo2pWInICwwp1vTCOUbEEU aj7fpGMe0PUH3eL7THbqR4cPo9Mv/KuNt9147LKE4RiY4b6uV7H1igCIXjidqcNy680+ c5lw== X-Gm-Message-State: AOJu0YwNXgqOtfJfsCuKA/43gp+d9alT7s6rW9eSEHO6kEUnMFdaf9tE +VMFJ4fUT6Eag0E2vt6KqgYzDD2AJX6X0i4gv9yHK6dZi4VIBOWyM9jFtHl/ X-Gm-Gg: ASbGncvNeQnKtpz9pNa/AbkWBWZZiZvbtBTs73IRpzt0Y3xSXirgE4sJrvxXKmRuROv M9jnFXWYTxWb9yAOXozoxIYMoo4qXPLaUGCUNks709MYK2ddGJshaxelXwhOmMeHnv0CEqbn3mV YcsCQj2FNF8X0uatiIx5PO1pYFUyVb7EWRa5evPKdcAd1zxk5wCjUWKaTzrBY7WzcgHnkaU1B1I suaQobLG6KEfIzF9A5WdvG2z4v8RCp47NlFPyORS1wHCnGomQnnK5sjnfV/1SZJWOlVqEswYBnm HWRY7L70Yj9YJDUnG/DlOmf6SOv6ogFa5NHPklygbdAlMcomODO2oXTIflE206z7uW33Waky4rI Un6o92wwlG3jt2Yu8+5QdcacViCSlIWBcILQtJrvX40smvWe+eFo6e7MsdiEuItk62psUC39FUJ pAxoslK/yc+pMpiSrIoEqqrPK29z1pmX03Y1dqzwZbvyeRC2FNEqEadhwg8RLT4qw= X-Google-Smtp-Source: AGHT+IGXG0lFpcS/gjL4hM6b8BR5t1oKiTiA2ny7SZYlwlX59IWn79Ir+uzeH0u+a3dFPuBXVvx1lQ== X-Received: by 2002:a17:903:3508:b0:271:45c0:9ec8 with SMTP id d9443c01a7336-29df5de017emr62744695ad.37.1765194510656; Mon, 08 Dec 2025 03:48:30 -0800 (PST) Received: from peuter.localdomain ([103.251.210.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29dae4cf9acsm122290865ad.28.2025.12.08.03.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Dec 2025 03:48:30 -0800 (PST) To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Dec 2025 17:18:22 +0530 Message-Id: <20251208114823.230-1-ashwanikamal.im421@gmail.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Message-ID-Hash: TBYRNA4CTVYAL4NWBLXNRX25STPLXP4W X-Message-ID-Hash: TBYRNA4CTVYAL4NWBLXNRX25STPLXP4W X-MailFrom: SRS0=MY3g=6O=gmail.com=ashwanikamal.im421@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] avutil: remove unused pca.[ch] and associated test 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: Ashwani Kumar Kamal via ffmpeg-devel Cc: Ashwani Kumar Kamal Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: The PCA implementation was previously removed in [commit](https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/cfa68a3381a7f67eed75bc503e75aab076fad3c6), but the files were later unintentionally reintroduced. They are not built, not referenced by the library, and the test is not part of FATE. Remove them again. Fixes: #11635 Signed-off-by: Ashwani Kumar Kamal --- libavutil/pca.c | 174 ------------------------------------------ libavutil/pca.h | 35 --------- libavutil/tests/pca.c | 101 ------------------------ 3 files changed, 310 deletions(-) delete mode 100644 libavutil/pca.c delete mode 100644 libavutil/pca.h delete mode 100644 libavutil/tests/pca.c diff --git a/libavutil/pca.c b/libavutil/pca.c deleted file mode 100644 index 7c3eb42b14..0000000000 --- a/libavutil/pca.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * principal component analysis (PCA) - * Copyright (c) 2004 Michael Niedermayer - * - * 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 - * principal component analysis (PCA) - */ - -#include "common.h" -#include "mem.h" -#include "pca.h" - -typedef struct PCA{ - int count; - int n; - double *covariance; - double *mean; - double *z; -}PCA; - -PCA *ff_pca_init(int n){ - PCA *pca; - if(n<=0) - return NULL; - - pca= av_mallocz(sizeof(*pca)); - if (!pca) - return NULL; - - pca->n= n; - pca->z = av_malloc_array(n, sizeof(*pca->z)); - pca->count=0; - pca->covariance= av_calloc(n*n, sizeof(double)); - pca->mean= av_calloc(n, sizeof(double)); - - if (!pca->z || !pca->covariance || !pca->mean) { - ff_pca_free(pca); - return NULL; - } - - return pca; -} - -void ff_pca_free(PCA *pca){ - av_freep(&pca->covariance); - av_freep(&pca->mean); - av_freep(&pca->z); - av_free(pca); -} - -void ff_pca_add(PCA *pca, const double *v){ - int i, j; - const int n= pca->n; - - for(i=0; imean[i] += v[i]; - for(j=i; jcovariance[j + i*n] += v[i]*v[j]; - } - pca->count++; -} - -int ff_pca(PCA *pca, double *eigenvector, double *eigenvalue){ - int i, j, pass; - int k=0; - const int n= pca->n; - double *z = pca->z; - - memset(eigenvector, 0, sizeof(double)*n*n); - - for(j=0; jmean[j] /= pca->count; - eigenvector[j + j*n] = 1.0; - for(i=0; i<=j; i++){ - pca->covariance[j + i*n] /= pca->count; - pca->covariance[j + i*n] -= pca->mean[i] * pca->mean[j]; - pca->covariance[i + j*n] = pca->covariance[j + i*n]; - } - eigenvalue[j]= pca->covariance[j + j*n]; - z[j]= 0; - } - - for(pass=0; pass < 50; pass++){ - double sum=0; - - for(i=0; icovariance[j + i*n]); - - if(sum == 0){ - for(i=0; i maxvalue){ - maxvalue= eigenvalue[j]; - k= j; - } - } - eigenvalue[k]= eigenvalue[i]; - eigenvalue[i]= maxvalue; - for(j=0; jcovariance[j + i*n]; - double t,c,s,tau,theta, h; - - if(pass < 3 && fabs(covar) < sum / (5*n*n)) //FIXME why pass < 3 - continue; - if(fabs(covar) == 0.0) //FIXME should not be needed - continue; - if(pass >=3 && fabs((eigenvalue[j]+z[j])/covar) > (1LL<<32) && fabs((eigenvalue[i]+z[i])/covar) > (1LL<<32)){ - pca->covariance[j + i*n]=0.0; - continue; - } - - h= (eigenvalue[j]+z[j]) - (eigenvalue[i]+z[i]); - theta=0.5*h/covar; - t=1.0/(fabs(theta)+sqrt(1.0+theta*theta)); - if(theta < 0.0) t = -t; - - c=1.0/sqrt(1+t*t); - s=t*c; - tau=s/(1.0+c); - z[i] -= t*covar; - z[j] += t*covar; - -#define ROTATE(a,i,j,k,l) {\ - double g=a[j + i*n];\ - double h=a[l + k*n];\ - a[j + i*n]=g-s*(h+g*tau);\ - a[l + k*n]=h+s*(g-h*tau); } - for(k=0; kcovariance,FFMIN(k,i),FFMAX(k,i),FFMIN(k,j),FFMAX(k,j)) - } - ROTATE(eigenvector,k,i,k,j) - } - pca->covariance[j + i*n]=0.0; - } - } - for (i=0; i - * - * 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 - * principal component analysis (PCA) - */ - -#ifndef AVUTIL_PCA_H -#define AVUTIL_PCA_H - -struct PCA *ff_pca_init(int n); -void ff_pca_free(struct PCA *pca); -void ff_pca_add(struct PCA *pca, const double *v); -int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue); - -#endif /* AVUTIL_PCA_H */ diff --git a/libavutil/tests/pca.c b/libavutil/tests/pca.c deleted file mode 100644 index a2a620799a..0000000000 --- a/libavutil/tests/pca.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * principal component analysis (PCA) - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/pca.c" -#include "libavutil/lfg.h" - -#include -#include - -int main(void){ - PCA *pca; - int i, j, k; -#define LEN 8 - double eigenvector[LEN*LEN]; - double eigenvalue[LEN]; - AVLFG prng; - - av_lfg_init(&prng, 1); - - pca= ff_pca_init(LEN); - - for(i=0; i<9000000; i++){ - double v[2*LEN+100]; -// double sum=0; - int pos = av_lfg_get(&prng) % LEN; - int v2 = av_lfg_get(&prng) % 101 - 50; - v[0] = av_lfg_get(&prng) % 101 - 50; - for(j=1; j<8; j++){ - if(j<=pos) v[j]= v[0]; - else v[j]= v2; -// sum += v[j]; - } -/* for(j=0; jcount= 1; - pca->mean[i]= 0; - -// (0.5^|x|)^2 = 0.5^2|x| = 0.25^|x| - - -// pca.covariance[i + i*LEN]= pow(0.5, fabs - for(j=i; jcovariance[i + j*LEN]); - } - printf("\n"); - } - - for(i=0; icovariance[FFMIN(k,j) + FFMAX(k,j)*LEN] * eigenvector[i + k*LEN]; - } - v[j] /= eigenvalue[i]; - error += fabs(v[j] - eigenvector[i + j*LEN]); - } - printf("%f ", error); - } - printf("\n"); - - for(i=0; i