Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnderground78 <underground78@users.sourceforge.net>2013-01-25 23:56:37 +0400
committerUnderground78 <underground78@users.sourceforge.net>2013-01-26 00:16:10 +0400
commitc1fac3a506861e0879b5b30c1fa4c362f46a77c2 (patch)
treeb4d60734c28e379ed33001bc8a99a852d6b61667 /src/filters
parent4709ce868f7d4c21296f4f13cba851744985cb0e (diff)
Cosmetics: Use the GCD function when possible and rename it to use English.
Diffstat (limited to 'src/filters')
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp28
-rw-r--r--src/filters/parser/FLVSplitter/FLVSplitter.cpp9
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp9
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp16
-rw-r--r--src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp14
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp15
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp15
7 files changed, 53 insertions, 53 deletions
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
index 244784e0b..7bfdf383a 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -394,14 +394,10 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
h.ifps = 10 * h.ifps / 27;
h.bitrate = h.bitrate == (1 << 30) - 1 ? 0 : h.bitrate * 400;
- DWORD a = h.arx, b = h.ary;
- while (a) {
- DWORD tmp = a;
- a = b % tmp;
- b = tmp;
- }
- if (b) {
- h.arx /= b, h.ary /= b;
+ int gcd = GCD(h.arx, h.ary);
+ if (gcd > 1) {
+ h.arx /= gcd;
+ h.ary /= gcd;
}
if (!pmt) {
@@ -1708,9 +1704,10 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
h.sar.den = 1;
}
CSize aspect(h.width * h.sar.num, h.height * h.sar.den);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
if (aspect.cx * 2 < aspect.cy) {
@@ -2178,9 +2175,10 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
if (h.width == h.sar.num && h.height == h.sar.den) {
aspect = CSize(h.width, h.height);
}
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
vi->dwPictAspectRatioX = aspect.cx;
diff --git a/src/filters/parser/FLVSplitter/FLVSplitter.cpp b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
index 3923fba1d..d77a7767a 100644
--- a/src/filters/parser/FLVSplitter/FLVSplitter.cpp
+++ b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -638,9 +638,10 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
sar.den = 1;
}
CSize aspect(Width * sar.num, Height * sar.den);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
vih->hdr.dwPictAspectRatioX = aspect.cx;
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
index 26bd95933..0bfffbeb2 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -853,9 +853,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mvih->hdr.bmiHeader.biBitCount = 24;
CSize aspect(mvih->hdr.bmiHeader.biWidth * num, mvih->hdr.bmiHeader.biHeight * den);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
mvih->hdr.dwPictAspectRatioX = aspect.cx;
mvih->hdr.dwPictAspectRatioY = aspect.cy;
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
index 26a607e04..a1f60bf87 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
+++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -564,18 +564,20 @@ avcsuccess:
memcpy(mt.Format() + vih2, mts[i].Format() + vih1, bmi);
CSize aspect((int)pTE->v.DisplayWidth, (int)pTE->v.DisplayHeight);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = aspect.cx;
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = aspect.cy;
mts.InsertAt(i++, mt);
} else if (mts[i].formattype == FORMAT_MPEG2Video) {
CSize aspect((int)pTE->v.DisplayWidth, (int)pTE->v.DisplayHeight);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = aspect.cx;
((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioY = aspect.cy;
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
index 49ab073d3..2f8558057 100644
--- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
+++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -612,14 +612,10 @@ HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
int vsfilter = 0;
GetOutputSize(m_w, m_h, m_arx, m_ary, RealWidth, RealHeight, vsfilter);
- DWORD a = m_arx, b = m_ary;
- while (a) {
- int tmp = a;
- a = b % tmp;
- b = tmp;
- }
- if (b) {
- m_arx /= b, m_ary /= b;
+ int gcd = GCD(m_arx, m_ary);
+ if (gcd > 1) {
+ m_arx /= gcd;
+ m_ary /= gcd;
}
} else if (dir == PINDIR_OUTPUT) {
int wout = 0, hout = 0, arxout = 0, aryout = 0;
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
index cbc623f55..bc37f1197 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
@@ -1248,10 +1248,10 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction, const CMediaTy
// Compute the expected Pixel AR
m_par.cx = m_arx * m_h;
m_par.cy = m_ary * m_w;
- int lnko = LNKO(m_par.cx, m_par.cy);
- if (lnko > 1) {
- m_par.cx /= lnko;
- m_par.cy /= lnko;
+ int gcd = GCD(m_par.cx, m_par.cy);
+ if (gcd > 1) {
+ m_par.cx /= gcd;
+ m_par.cy /= gcd;
}
}
@@ -2077,9 +2077,10 @@ void CMPCVideoDecFilter::UpdateAspectRatio()
if (m_par != PAR) {
m_par = PAR;
CSize aspect(m_nWidth * PAR.cx, m_nHeight * PAR.cy);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if (lnko > 1) {
- aspect.cx /= lnko, aspect.cy /= lnko;
+ int gcd = GCD(aspect.cx, aspect.cy);
+ if (gcd > 1) {
+ aspect.cx /= gcd;
+ aspect.cy /= gcd;
}
SetAspect(aspect);
}
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
index 2ee3592fb..d4c436a7c 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
@@ -638,9 +638,10 @@ void CMpeg2DecFilter::UpdateAspectRatio()
m_par.cy = m_dec->m_info.m_sequence->pixel_height;
CSize dar(m_dec->m_info.m_sequence->picture_width * m_par.cx,
m_dec->m_info.m_sequence->picture_height * m_par.cy);
- int lnko = LNKO(dar.cx, dar.cy);
- if (lnko > 1) {
- dar.cx /= lnko, dar.cy /= lnko;
+ int gcd = GCD(dar.cx, dar.cy);
+ if (gcd > 1) {
+ dar.cx /= gcd;
+ dar.cy /= gcd;
}
SetAspect(dar);
}
@@ -1028,10 +1029,10 @@ HRESULT CMpeg2DecFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
// Compute the expected Pixel AR
m_par.cx = m_arx * m_h;
m_par.cy = m_ary * m_w;
- int lnko = LNKO(m_par.cx, m_par.cy);
- if (lnko > 1) {
- m_par.cx /= lnko;
- m_par.cy /= lnko;
+ int gcd = GCD(m_par.cx, m_par.cy);
+ if (gcd > 1) {
+ m_par.cx /= gcd;
+ m_par.cy /= gcd;
}
}