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 0022A4E41C for ; Thu, 22 Jan 2026 09:55:32 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'1BA4euoOvMriamhZ4zx2bgLI07QwltB+NriL5PfcScI=', expected b'1/ZBALSIlO1cxkLD581+W/GJRPp8sOA2P/oA/t6J2b8=')) 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=1769075715; 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=1BA4euoOvMriamhZ4zx2bgLI07QwltB+NriL5PfcScI=; b=SE5sRCZd+qnUT9IA8P+nLfM9VujAefRRxVgpkv88bk4Z6lX63ehcxlKejdNamFrQj43Q2 PSjvMHLY7/AGmBUAALv2m7flU/ErTX9qRty1Mw9hRubqlGlgOKfL5u1mBCI/B6JRbVAezPY n876VuoEwLNGYx+BTl8C3Iw0q71FkU0zHQ4P4KbnCURtxYpqWiPJrebwidBhVLmc+W7BCl3 AlN2tQhJLv6YfyfvTLRe5h6Ver8fz8qTtg8pj2t3OaJkYoveO4gRu7InqF4AzhmPfv5KU6d HQzqUJqXbsxp0ppoj1X3vKIlw+dY7wOYnRdUjbKi/JAH8izv2qEop5T9XQlg== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 14286690FF7; Thu, 22 Jan 2026 11:55:15 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1769075700; b=ehM2GVLO4x6Lm17ngrkRjH1P8J6AT2933OA97ys5KpSfzCBnhCLNhqvmbJt4/zHoAL9z9 5N23RrGpHDr/ww5yuuQ5m5J/+Y5GdxocOH8xR8XPeYYKOd+qFPQsBOgHr+gBuAcyEvrzxAy RkAT/n/00LOU5SxipNcK/WM9caUCbMF4iY95QdfSuO1tzjfyt8BX0yoB5wrjmGVTrPkw3QD XB1VL6Mafgjvl8dSYL80/iQ5oKpKq2pq3AnwDsYhHASGg6QqgaCXtoihkg1EBCjBhV0rSnD RA7oucAmJXB4jKFRV4iNTzChZEfsCrlQW47BGr9DGg8bOTBz619QwvVwJzCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1769075700; 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=s8PUQPMWrJPzY7Ffm+7Xuz9ehIoDMz8Kw3di/WveD5A=; b=dqwttgDXxjbElgB02ZahByaGGUDMpj4kq3kil1iZPBnULbK3ME1Jekza+faHWTdrW5Oiw TSHP9WSaYgJJz2mc+ypBtfX3z/G/VpWX1KyZL2gtJZ3zuEnLPROyDUbeSsOdIqDtXoG95dB 6OVOziVcVftjlfA4uGypFzesBYGmBujoj6LU/i62HTw/ykwdhh0mXYYtvF26J4bft5/xFHT wfgkG+SL6CRajlPh4wqXju32aQMprma98HrQdv24z7bqBNqVsdSYk019qHEOptgU+gxEevj dUweBOCBdZQvRod35IWTDR1aDIPa5FYM1RZAJH7t3zanhkIVgl2HTz5n/BQQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1769075691; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=1/ZBALSIlO1cxkLD581+W/GJRPp8sOA2P/oA/t6J2b8=; b=lirCrju1F9ImoBOSL8dwITMcr0XBs4f6JE4OMso6aqc9h6bDtCRYqwwDkdLB5NnGXsZID 4DOw5mfz7pTzJzohmdxmPBThh8Du2C7gUgda1XrkndNjuS97MqZ9kE4gsWOIznmjYcKqPC3 mR/gwNJNZHQtSJH/rSv2G02zJWUyMBWU8MkCTHhWiGcR5G6pOje7v9zxtoqv9MVL2l6DkuX k7QsHIpz12VMNczp/APWJLuAbOM9qfJT5TCeSA8cFs0zMH8vRloLEzMiJWlMS6hBw3tMheo U/M/hbyhTwbUIxLo7y9MrejiFYhDH25R3UWTuzVumnGBF444++O9EcIs8WYA== Received: from 69dab402ede7 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 8F41E690F6D for ; Thu, 22 Jan 2026 11:54:51 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Jan 2026 09:54:51 -0000 Message-ID: <176907569173.25.1892324628786893840@4457048688e7> Message-ID-Hash: SGQCNWPZ6HAJ7QTCV6QQZICIZUWDFECB X-Message-ID-Hash: SGQCNWPZ6HAJ7QTCV6QQZICIZUWDFECB X-MailFrom: code@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 X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] avutil: remove unused pca.[ch] and its test (PR #21543) 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: Jun Zhao via ffmpeg-devel Cc: Jun Zhao Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21543 opened by Jun Zhao (mypopydev) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21543 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21543.patch These files were deleted in cfa68a3381a7f67eed75bc503e75aab076fad3c6 but were re-introduced through merges. The PCA code is not built into libavutil and is only referenced by its own test which includes the source directly. Fixes https://trac.ffmpeg.org/ticket/11635 Signed-off-by: Jun Zhao >>From 915f97d2809ff5be4341bc19f5ae1142493230d4 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Thu, 22 Jan 2026 17:41:43 +0800 Subject: [PATCH] avutil: remove unused pca.[ch] and its test These files were deleted in cfa68a3381a7f67eed75bc503e75aab076fad3c6 but were re-introduced through merges. The PCA code is not built into libavutil and is only referenced by its own test which includes the source directly. Fixes https://trac.ffmpeg.org/ticket/11635 Signed-off-by: Jun Zhao --- libavutil/Makefile | 1 - libavutil/pca.c | 174 ------------------------------------------ libavutil/pca.h | 35 --------- libavutil/tests/pca.c | 101 ------------------------ 4 files changed, 311 deletions(-) delete mode 100644 libavutil/pca.c delete mode 100644 libavutil/pca.h delete mode 100644 libavutil/tests/pca.c diff --git a/libavutil/Makefile b/libavutil/Makefile index c5241895ff..90f7fa27d5 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -288,7 +288,6 @@ TESTPROGS = adler32 \ md5 \ murmur3 \ opt \ - pca \ parseutils \ pixdesc \ pixelutils \ 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