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 EF521400CC for ; Thu, 11 Dec 2025 03:23:40 +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=1765423410; 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=BmcT7ijpfBtAKtIjm21GJ/Ngvs6rMBA+30tfHKUBxDAKducn2cvGxnc0bvy7j7LBWf1kp a+Pvu3IWooDC4JJSaEhIdDUvZ96l3n/09BhWm3WHJ/5UjCM8eQRDwypl2bJsiRaVaxaFV7M RIsake+Y0ijpxuHyIqeGeUucFBC0VMvKE/N3s5O8GJe8Yan0JjguEa/peS+HF58y3WO/71c +MlK1GXwBoN+vgZtbLTYdVHil7yn3/txjEDoh6n9nW8o+BErtbEg6Og5c8tBpje4GUls5l4 m3GQYxsW2niVWVKRMgZLznxBz40b4luI/zT0RVgS9JoRZRkBvzxb/YB8cGtw== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 495016907B2; Thu, 11 Dec 2025 05:23:30 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1765423395; b=Ou6U3+eoqPHvZG6imet99HLhHd5ZfNJnI5HOKa0/ti0wL8SeenZAm9h8LnuEA8B0oYHKv zt+6LGptwNTZwzIQvYFP7QdyOW/kNPNcYh6rB7bN1i+5AN6qN+WYwot+2m0P1Vb/hGh2jgy qxlSS07Pc4txz5TccCs/pX6Pwc6cYuR98NTGkIL6b2QVB9c3Zczt/Rgl4fVVGg1OfI+rMT8 C3GeRrimH6cA0wrkfxEf3M524AhSECuzPunAG+QoHakVQ1lwHQOZgp3MCLDVUgfyvbv28VC Ix2vVYngwQgxpTRCCcIrKlJIDjKgQh+ud55b3izwfvpcizpWxEcbuHL1HJ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1765423395; 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=WGzDhBDcnRfmoLPLlpIj6gsh6ZwRb9vGEoIGHMOZbbbICgUdRxVPr+53oYjvJcwzdymQM GlEAOe2sEkSF63SgLAYm5aroWSZFwhDC67Lz1Iisc46WpMt7BNoc/2fJHgZwr6sm5xwbvjT uUY5OXDxOs+oXI9FaojRtpLKWq/vkqwU0xN29BUQ8wWkohxhjLyRepPG6Mtic0CmrrShP3W hnWUZkVaDmG48nDRbeDDTXLVx7IoFRFTAClFB0i7DfuQteKMeybCSGb1uJmFASqvhHs+ZHn TQ/43I/lnsJ7HnWq01zPoPXMAkV2iYjwr/YGpL8SNfhLKaNy8pyhDFhcW/ag== 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-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id C41B06904A2 for ; Sun, 7 Dec 2025 09:20:36 +0200 (EET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7bc248dc16aso2726289b3a.0 for ; Sat, 06 Dec 2025 23:20:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765092034; x=1765696834; 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=MWtlKB98iLYIqPsLG/cQA4jkyPhIKJtzCkBkAC9EPNIntuutVOxgd0OKXq4+BkRTVb BfPJ/jHT+E+4HjaUZQtwloasi8qefu2a+GbIZa7JllRPtuY3tFjDJ6LprK8izw8Zz9Fb E4bsMuOHuP8zF3oM6avdauGUFbEE3GaWrmjJWe+Z2JqpKuyGsggaZygeBLiicEOR/ggz 3H5SjyPh4fVwQOpm0tNZKb4j5VYt5QrNBhI1ZWzZytlv5oipbD6TdbbFs5vhlSyTrNwJ kpqceIwFhIkEwek5xs6kOeXOeviJ3BqiRKJl3EcSznEuMafMofNn9mRevEhnUnxT/B/z m8fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765092034; x=1765696834; 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=kLW4UnA4d7goGleWmpSEv2UL9QmMTGSIzUyA4czxwmK2dyerwEJlMzyUP8RyK3Qc/w vepPeIf5xpCFe/5Xd+o4X8lmX6r6xsC+KWPlYKCv9c+0lo758F47EOcRJHRA/MVabJht cFXAIeD4Wmhn9x+Srif/h44VMYbNMQyaaGTsWNtSVJAyXItP4QnwbHpxPS6sqb4lzA+0 bTf9OeyRqR6qapQEwDraaQeRpejVr6XCeMIJ5H5k1u28K0ZBjlbJkPnpuPe6g2FH3RKN 0ol0iFOspirb42evei71Z5t+NF5Sdp1wH0On9f9+vDSk7CHijr7peigx4LW+Gk60JaHI it5g== X-Gm-Message-State: AOJu0YyaSAPCzFcv91dAC05A3VIydt1tllduJQP1ADAO4aHUA8qpwzr7 xGOsTMFPc44LVA/nrIb8DnXfx3cNMjg5yv5beZFqeMD20Q2at25z/xmKixJE X-Gm-Gg: ASbGncvo/FWhC4YTbfXHrcupouMK9EONpGLOHWzh5ibE51Fo3igAQUHerqAYqMd9wOJ ex0RiLGg7DObaVqMFZ/ggd2vfK5eCdft8uTNcPq8Q1Tho03LJi/Vo43VQ03sCnhgRBXBJhDT7XS dUwlaBphjm24LsPXuzYJxB7zsN+PJts9v+Q2dVcasaGj4oGvR1amo/wO06Qp17MH/tiKLzE0bM0 Sg6u/ykt/fyQyhSF4CN1OSztXJxcoCJhWalLMNbmbxB/fKZ4gndhm93xe80SD2kJHCXFq/AJF8Y bAX0tVDnzMrt85HJJZ06zJGHmoGc2V7pmsBGk7f2IK7GS7z6Hy97x82kqyDKLWzHqSGU6phdn5Y LobrS4bS3FHvkBMjIWituKd4PwXh60cl2aAn8NZCN4pMSsTo/eLK9Min1tkKjwk/eC78yfHt6vi iffw841zgEc8Utq5WimUJeDVWNGWKnNVQugFE/Kiwe/KXE9yHU2E8KM19LMuf1zKBW7tfPozw1d Q== X-Google-Smtp-Source: AGHT+IF8v3EmSTzwKnbomkhPOdIpegDjnFFS61DzBUzCnyK4ySe0195Svi19KEeFQTM5XJJPWrsWAw== X-Received: by 2002:a05:6a00:1705:b0:781:2740:11b2 with SMTP id d2e1a72fcca58-7e8c09dcebbmr4053780b3a.25.1765092034356; Sat, 06 Dec 2025 23:20:34 -0800 (PST) Received: from peuter.localdomain ([103.251.210.244]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7e2afa31c47sm9828767b3a.66.2025.12.06.23.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Dec 2025 23:20:33 -0800 (PST) To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Dec 2025 12:49:38 +0530 Message-Id: <20251207071938.3380-1-ashwanikamal.im421@gmail.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-MailFrom: SRS0=/XTY=6N=gmail.com=ashwanikamal.im421@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: QCDJ5PLTIBTIQT4PXMYV72OOVSQOCPND X-Message-ID-Hash: QCDJ5PLTIBTIQT4PXMYV72OOVSQOCPND X-Mailman-Approved-At: Thu, 11 Dec 2025 03:23:09 +0000 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