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:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
commitefbc9d9043ff8ff92716ddd00a5f61412d535593 (patch)
tree8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters/source/D2VSource
parentdf6b139a6d9027156f614b68687e039e3a5854db (diff)
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/source/D2VSource')
-rw-r--r--src/filters/source/D2VSource/D2VSource.cpp264
-rw-r--r--src/filters/source/D2VSource/D2VSource.h22
-rw-r--r--src/filters/source/D2VSource/MPEG2Dec.h418
-rw-r--r--src/filters/source/D2VSource/idctfpu.cpp714
-rw-r--r--src/filters/source/D2VSource/idctref.cpp618
-rw-r--r--src/filters/source/D2VSource/resource.h2
6 files changed, 1010 insertions, 1028 deletions
diff --git a/src/filters/source/D2VSource/D2VSource.cpp b/src/filters/source/D2VSource/D2VSource.cpp
index 088aa3fdd..6806e440f 100644
--- a/src/filters/source/D2VSource/D2VSource.cpp
+++ b/src/filters/source/D2VSource/D2VSource.cpp
@@ -1,19 +1,19 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program 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 General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
@@ -26,49 +26,49 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CD2VSource), L"MPC - D2VSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CD2VSource), L"MPC - D2VSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
- _T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
- _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".d2v"),
- _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".d2v"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".d2v"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".d2v"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -82,9 +82,9 @@ CFilterApp theApp;
//
CD2VSource::CD2VSource(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
+ : CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CD2VSource::~CD2VSource()
@@ -95,40 +95,40 @@ CD2VSource::~CD2VSource()
// CD2VStream
//
-CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
- : CBaseStream(NAME("D2VSourceStream"), pParent, phr)
- , m_pFrameBuffer(NULL)
+CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("D2VSourceStream"), pParent, phr)
+ , m_pFrameBuffer(NULL)
{
- CAutoLock cAutoLock(&m_cSharedState);
-
- m_pDecoder.Attach(DNew CMPEG2Dec());
- if(!m_pDecoder)
- {
- if(phr) *phr = E_OUTOFMEMORY;
- return;
- }
-
- if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width * m_pDecoder->Clip_Height * 4))
- {
- if(phr) *phr = E_OUTOFMEMORY;
- return;
- }
-
- m_AvgTimePerFrame = 10000000000i64 / m_pDecoder->VF_FrameRate;
- m_rtDuration = m_rtStop = m_AvgTimePerFrame * m_pDecoder->VF_FrameLimit;
-
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_pDecoder.Attach(DNew CMPEG2Dec());
+ if(!m_pDecoder)
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4))
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ m_AvgTimePerFrame = 10000000000i64/m_pDecoder->VF_FrameRate;
+ m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_pDecoder->VF_FrameLimit;
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
CD2VStream::~CD2VStream()
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
}
HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -140,12 +140,12 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
HRESULT hr = NOERROR;
- int w, h, bpp;
- if(!GetDim(w, h, bpp))
- return E_FAIL;
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return E_FAIL;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = w * h * bpp >> 3;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = w*h*bpp>>3;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -158,41 +158,41 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
{
- if(!m_pDecoder)
- return S_FALSE;
+ if(!m_pDecoder)
+ return S_FALSE;
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- SetMediaType(&mt);
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
+ DeleteMediaType(pmt);
+ }
- int w, h, bpp;
- if(!GetDim(w, h, bpp))
- return S_FALSE;
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return S_FALSE;
- BYTE* pIn = m_pFrameBuffer;
+ BYTE* pIn = m_pFrameBuffer;
- int pitchIn, pitchOut = 0;
+ int pitchIn, pitchOut = 0;
- pitchIn = m_pDecoder->Clip_Width * bpp >> 3;
- pitchOut = w * bpp >> 3;
+ pitchIn = m_pDecoder->Clip_Width*bpp>>3;
+ pitchOut = w*bpp>>3;
- m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
+ m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
- for(int y = 0, p = min(pitchIn, pitchOut);
- y < h;
- y++, pIn += pitchIn, pOut += pitchOut)
- {
- memcpy(pOut, pIn, p);
- }
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pIn += pitchIn, pOut += pitchOut)
+ {
+ memcpy(pOut, pIn, p);
+ }
- len = pitchOut * h;
+ len = pitchOut*h;
- return S_OK;
+ return S_OK;
}
HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
@@ -207,77 +207,77 @@ HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetFormatType(&FORMAT_VideoInfo);
pmt->SetTemporalCompression(FALSE);
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- vih->AvgTimePerFrame = m_AvgTimePerFrame;
- vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
- vih->bmiHeader.biWidth = m_pDecoder->Clip_Width;
- vih->bmiHeader.biHeight = m_pDecoder->Clip_Height;
- vih->bmiHeader.biPlanes = 1;
- vih->bmiHeader.biBitCount = 16;
- vih->bmiHeader.biCompression = '2YUY';
- vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth * abs(vih->bmiHeader.biHeight) * vih->bmiHeader.biBitCount >> 3;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->AvgTimePerFrame = m_AvgTimePerFrame;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = m_pDecoder->Clip_Width;
+ vih->bmiHeader.biHeight = m_pDecoder->Clip_Height;
+ vih->bmiHeader.biPlanes = 1;
+ vih->bmiHeader.biBitCount = 16;
+ vih->bmiHeader.biCompression = '2YUY';
+ vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth*abs(vih->bmiHeader.biHeight)*vih->bmiHeader.biBitCount>>3;
- pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
+ pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
return NOERROR;
}
HRESULT CD2VStream::SetMediaType(const CMediaType* pmt)
{
- if(m_pDecoder)
- {
- if(pmt->subtype == MEDIASUBTYPE_YUY2)
- m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
- else
- return E_FAIL;
- }
-
- return CSourceStream::SetMediaType(pmt);
+ if(m_pDecoder)
+ {
+ if(pmt->subtype == MEDIASUBTYPE_YUY2)
+ m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
+ else
+ return E_FAIL;
+ }
+
+ return CSourceStream::SetMediaType(pmt);
}
HRESULT CD2VStream::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Video
- && pmt->subtype == MEDIASUBTYPE_YUY2
- && pmt->formattype == FORMAT_VideoInfo
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Video
+ && pmt->subtype == MEDIASUBTYPE_YUY2
+ && pmt->formattype == FORMAT_VideoInfo
+ ? S_OK
+ : E_INVALIDARG;
}
STDMETHODIMP CD2VStream::Notify(IBaseFilter* pSender, Quality q)
{
- if(q.Late > 0 && q.Late < 100000000)
- {
- CAutoLock cAutoLockShared(&m_cSharedState);
+ if(q.Late > 0 && q.Late < 100000000)
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
- m_rtSampleTime += (q.Late / m_AvgTimePerFrame) * m_AvgTimePerFrame;
- m_rtPosition += (q.Late / m_AvgTimePerFrame) * m_AvgTimePerFrame;
- }
+ m_rtSampleTime += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ m_rtPosition += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ }
- return S_OK;
+ return S_OK;
}
//
bool CD2VStream::GetDim(int& w, int& h, int& bpp)
{
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
- w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
- w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else
- {
- return(false);
- }
-
- return(true);
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else
+ {
+ return(false);
+ }
+
+ return(true);
}
diff --git a/src/filters/source/D2VSource/D2VSource.h b/src/filters/source/D2VSource/D2VSource.h
index ac0bddc2d..bf2e18f9a 100644
--- a/src/filters/source/D2VSource/D2VSource.h
+++ b/src/filters/source/D2VSource/D2VSource.h
@@ -1,19 +1,19 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program 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 General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
@@ -27,8 +27,8 @@ class CD2VStream;
class CD2VSource : public CBaseSource<CD2VStream>
{
public:
- CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CD2VSource();
+ CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CD2VSource();
};
class CMPEG2Dec;
@@ -36,14 +36,14 @@ class CMPEG2Dec;
class CD2VStream : public CBaseStream
{
private:
- CAutoPtr<CMPEG2Dec> m_pDecoder;
- CAutoVectorPtr<BYTE> m_pFrameBuffer;
+ CAutoPtr<CMPEG2Dec> m_pDecoder;
+ CAutoVectorPtr<BYTE> m_pFrameBuffer;
- bool GetDim(int& w, int& h, int& bpp);
+ bool GetDim(int& w, int& h, int& bpp);
public:
CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr);
- virtual ~CD2VStream();
+ virtual ~CD2VStream();
HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/);
@@ -52,5 +52,5 @@ public:
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
HRESULT SetMediaType(const CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/D2VSource/MPEG2Dec.h b/src/filters/source/D2VSource/MPEG2Dec.h
index aea3f4f07..34368208b 100644
--- a/src/filters/source/D2VSource/MPEG2Dec.h
+++ b/src/filters/source/D2VSource/MPEG2Dec.h
@@ -73,244 +73,232 @@
#define FO_SWAP 2
-typedef void (WINAPI *PBufferOp)(unsigned char*, int, int);
+typedef void (WINAPI *PBufferOp) (unsigned char*, int, int);
#define MAX_FRAME_NUMBER 1000000
#define MAX_GOP_SIZE 1024
-class CMPEG2Dec
+class CMPEG2Dec
{
protected:
- // getbit.cpp
- void Initialize_Buffer();
- void Fill_Buffer();
- void Next_Packet();
- void Flush_Buffer_All(unsigned int N);
- unsigned int Get_Bits_All(unsigned int N);
- void Next_File();
-
- unsigned int Show_Bits(unsigned int N);
- unsigned int Get_Bits(unsigned int N);
- void Flush_Buffer(unsigned int N);
- void Fill_Next();
- unsigned int Get_Byte();
- unsigned int Get_Short();
- void next_start_code();
-
- unsigned char Rdbfr[BUFFER_SIZE], *Rdptr, *Rdmax;
- unsigned int CurrentBfr, NextBfr, BitsLeft, Val, Read;
-
- // gethdr.cpp
- int Get_Hdr();
- void sequence_header();
- int slice_header();
+ // getbit.cpp
+ void Initialize_Buffer();
+ void Fill_Buffer();
+ void Next_Packet();
+ void Flush_Buffer_All(unsigned int N);
+ unsigned int Get_Bits_All(unsigned int N);
+ void Next_File();
+
+ unsigned int Show_Bits(unsigned int N);
+ unsigned int Get_Bits(unsigned int N);
+ void Flush_Buffer(unsigned int N);
+ void Fill_Next();
+ unsigned int Get_Byte();
+ unsigned int Get_Short();
+ void next_start_code();
+
+ unsigned char Rdbfr[BUFFER_SIZE], *Rdptr, *Rdmax;
+ unsigned int CurrentBfr, NextBfr, BitsLeft, Val, Read;
+
+ // gethdr.cpp
+ int Get_Hdr();
+ void sequence_header();
+ int slice_header();
private:
- void group_of_pictures_header();
- void picture_header();
- void sequence_extension();
- void sequence_display_extension();
- void quant_matrix_extension();
- void picture_display_extension();
- void picture_coding_extension();
- void copyright_extension();
- int extra_bit_information();
- void extension_and_user_data();
+ void group_of_pictures_header();
+ void picture_header();
+ void sequence_extension();
+ void sequence_display_extension();
+ void quant_matrix_extension();
+ void picture_display_extension();
+ void picture_coding_extension();
+ void copyright_extension();
+ int extra_bit_information();
+ void extension_and_user_data();
protected:
- // getpic.cpp
- void Decode_Picture(int ref, unsigned char *dst, int pitch);
+ // getpic.cpp
+ void Decode_Picture(int ref, unsigned char *dst, int pitch);
private:
- void Update_Picture_Buffers();
- void picture_data();
- int slice(int MBAmax);
- void macroblock_modes(int *pmacroblock_type, int *pmotion_type,
- int *pmotion_vector_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
- void Clear_Block(int count);
- void Add_Block(int count, int bx, int by, int dct_type, int addflag);
- void motion_compensation(int MBA, int macroblock_type, int motion_type,
- int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2], int dct_type);
- void skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2],
- int *motion_type, int motion_vertical_field_select[2][2], int *macroblock_type);
- int start_of_slice(int *MBA, int *MBAinc, int dc_dct_pred[3], int PMV[2][2][2]);
- int decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
- int PMV[2][2][2], int dc_dct_pred[3], int motion_vertical_field_select[2][2], int dmvector[2]);
- void Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]);
- void Decode_MPEG2_Non_Intra_Block(int comp);
-
- int Get_macroblock_type();
- int Get_I_macroblock_type();
- int Get_P_macroblock_type();
- int Get_B_macroblock_type();
- int Get_D_macroblock_type();
- int Get_coded_block_pattern();
- int Get_macroblock_address_increment();
- int Get_Luma_DC_dct_diff();
- int Get_Chroma_DC_dct_diff();
-
- void form_predictions(int bx, int by, int macroblock_type, int motion_type,
- int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2]);
- void form_prediction(unsigned char *src[], int sfield, unsigned char *dst[], int dfield,
- int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
- void form_component_prediction(unsigned char *src, unsigned char *dst,
- int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
-
- // motion.cpp
- void motion_vectors(int PMV[2][2][2], int dmvector[2], int motion_vertical_field_select[2][2],
- int s, int motion_vector_count, int mv_format,
- int h_r_size, int v_r_size, int dmv, int mvscale);
- void Dual_Prime_Arithmetic(int DMV[][2], int *dmvector, int mvx, int mvy);
+ void Update_Picture_Buffers();
+ void picture_data();
+ int slice(int MBAmax);
+ void macroblock_modes(int *pmacroblock_type, int *pmotion_type,
+ int *pmotion_vector_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
+ void Clear_Block(int count);
+ void Add_Block(int count, int bx, int by, int dct_type, int addflag);
+ void motion_compensation(int MBA, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2], int dct_type);
+ void skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2],
+ int *motion_type, int motion_vertical_field_select[2][2], int *macroblock_type);
+ int start_of_slice(int *MBA, int *MBAinc, int dc_dct_pred[3], int PMV[2][2][2]);
+ int decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
+ int PMV[2][2][2], int dc_dct_pred[3], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]);
+ void Decode_MPEG2_Non_Intra_Block(int comp);
+
+ int Get_macroblock_type();
+ int Get_I_macroblock_type();
+ int Get_P_macroblock_type();
+ int Get_B_macroblock_type();
+ int Get_D_macroblock_type();
+ int Get_coded_block_pattern();
+ int Get_macroblock_address_increment();
+ int Get_Luma_DC_dct_diff();
+ int Get_Chroma_DC_dct_diff();
+
+ void form_predictions(int bx, int by, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void form_prediction(unsigned char *src[], int sfield, unsigned char *dst[], int dfield,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+ void form_component_prediction(unsigned char *src, unsigned char *dst,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+
+ // motion.cpp
+ void motion_vectors(int PMV[2][2][2], int dmvector[2], int motion_vertical_field_select[2][2],
+ int s, int motion_vector_count, int mv_format,
+ int h_r_size, int v_r_size, int dmv, int mvscale);
+ void Dual_Prime_Arithmetic(int DMV[][2], int *dmvector, int mvx, int mvy);
private:
- void motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
- int dmv, int mvscale, int full_pel_vector);
- void decode_motion_vector(int *pred, int r_size, int motion_code,
- int motion_residualesidual, int full_pel_vector);
- int Get_motion_code();
- int Get_dmvector();
+ void motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
+ int dmv, int mvscale, int full_pel_vector);
+ void decode_motion_vector(int *pred, int r_size, int motion_code,
+ int motion_residualesidual, int full_pel_vector);
+ int Get_motion_code();
+ int Get_dmvector();
protected:
- // store.cpp
- void assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch);
+ // store.cpp
+ void assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch);
private:
- void Luminance_Filter(unsigned char *src, unsigned char *dst);
- void conv420to422(unsigned char *src, unsigned char *dst, int frame_type);
- void conv422to444(unsigned char *src, unsigned char *dst);
- void conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
- void conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+ void Luminance_Filter(unsigned char *src, unsigned char *dst);
+ void conv420to422(unsigned char *src, unsigned char *dst, int frame_type);
+ void conv422to444(unsigned char *src, unsigned char *dst);
+ void conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+ void conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
protected:
- // decoder operation control flags
- int Fault_Flag;
- int File_Flag;
- int File_Limit;
- int FO_Flag;
- int IDCT_Flag;
- int SystemStream_Flag;
-
- int Luminance_Flag;
- int Resize_Flag;
-
- int KeyOp_Flag;
- int lfsr0, lfsr1;
- PBufferOp BufferOp;
-
- int Infile[MAX_FILE_NUMBER];
- char *Infilename[MAX_FILE_NUMBER];
-
- int intra_quantizer_matrix[64];
- int non_intra_quantizer_matrix[64];
- int chroma_intra_quantizer_matrix[64];
- int chroma_non_intra_quantizer_matrix[64];
-
- int load_intra_quantizer_matrix;
- int load_non_intra_quantizer_matrix;
- int load_chroma_intra_quantizer_matrix;
- int load_chroma_non_intra_quantizer_matrix;
-
- int q_scale_type;
- int alternate_scan;
- int quantizer_scale;
-
- void *fTempArray, *p_fTempArray;
- short *block[8], *p_block[8];
- int pf_backward, pf_forward, pf_current;
-
- // global values
- unsigned char *backward_reference_frame[3], *forward_reference_frame[3];
- unsigned char *auxframe[3], *current_frame[3];
- unsigned char *u422, *v422, *u444, *v444, /* *rgb24,*/ *lum;
- unsigned char *dstFrame; // replaces rgb24
- __int64 RGB_Scale, RGB_Offset, RGB_CRV, RGB_CBU, RGB_CGX, LumOffsetMask, LumGainMask;
-
- int HALF_WIDTH, PROGRESSIVE_HEIGHT, INTERLACED_HEIGHT, DOUBLE_WIDTH;
- int /*TWIDTH, SWIDTH,*/ HALF_WIDTH_D8, LUM_AREA, CLIP_AREA, HALF_CLIP_AREA, CLIP_STEP;
- int DSTBYTES, DSTBYTES2; // these replace TWIDTH and SWIDTH
+ // decoder operation control flags
+ int Fault_Flag;
+ int File_Flag;
+ int File_Limit;
+ int FO_Flag;
+ int IDCT_Flag;
+ int SystemStream_Flag;
+
+ int Luminance_Flag;
+ int Resize_Flag;
+
+ int KeyOp_Flag;
+ int lfsr0, lfsr1;
+ PBufferOp BufferOp;
+
+ int Infile[MAX_FILE_NUMBER];
+ char *Infilename[MAX_FILE_NUMBER];
+
+ int intra_quantizer_matrix[64];
+ int non_intra_quantizer_matrix[64];
+ int chroma_intra_quantizer_matrix[64];
+ int chroma_non_intra_quantizer_matrix[64];
+
+ int load_intra_quantizer_matrix;
+ int load_non_intra_quantizer_matrix;
+ int load_chroma_intra_quantizer_matrix;
+ int load_chroma_non_intra_quantizer_matrix;
+
+ int q_scale_type;
+ int alternate_scan;
+ int quantizer_scale;
+
+ void *fTempArray, *p_fTempArray;
+ short *block[8], *p_block[8];
+ int pf_backward, pf_forward, pf_current;
+
+ // global values
+ unsigned char *backward_reference_frame[3], *forward_reference_frame[3];
+ unsigned char *auxframe[3], *current_frame[3];
+ unsigned char *u422, *v422, *u444, *v444, /* *rgb24,*/ *lum;
+ unsigned char *dstFrame; // replaces rgb24
+ __int64 RGB_Scale, RGB_Offset, RGB_CRV, RGB_CBU, RGB_CGX, LumOffsetMask, LumGainMask;
+
+ int HALF_WIDTH, PROGRESSIVE_HEIGHT, INTERLACED_HEIGHT, DOUBLE_WIDTH;
+ int /*TWIDTH, SWIDTH,*/ HALF_WIDTH_D8, LUM_AREA, CLIP_AREA, HALF_CLIP_AREA, CLIP_STEP;
+ int DSTBYTES, DSTBYTES2; // these replace TWIDTH and SWIDTH
public:
- int Clip_Width, Clip_Height, Resize_Width, Resize_Height;
+ int Clip_Width, Clip_Height, Resize_Width, Resize_Height;
protected:
- int Coded_Picture_Width, Coded_Picture_Height, Chroma_Width, Chroma_Height;
- int block_count, Second_Field;
- int horizontal_size, vertical_size, mb_width, mb_height;
-
- /* ISO/IEC 13818-2 section 6.2.2.3: sequence_extension() */
- int progressive_sequence;
- int chroma_format;
-
- /* ISO/IEC 13818-2 section 6.2.3: picture_header() */
- int picture_coding_type;
- int temporal_reference;
-
- /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() header */
- int f_code[2][2];
- int picture_structure;
- int frame_pred_frame_dct;
- int progressive_frame;
- int concealment_motion_vectors;
- int intra_dc_precision;
- int top_field_first;
- int repeat_first_field;
- int intra_vlc_format;
-
- // interface
- typedef struct
- {
- DWORD number;
- int file;
- __int64 position;
- } GOPLIST;
- GOPLIST *GOPList[MAX_FRAME_NUMBER];
-
- typedef struct
- {
- DWORD top;
- DWORD bottom;
- char forward;
- char backward;
- } FRAMELIST;
- FRAMELIST *FrameList[MAX_FRAME_NUMBER];
-
- unsigned char *GOPBuffer[MAX_GOP_SIZE];
+ int Coded_Picture_Width, Coded_Picture_Height, Chroma_Width, Chroma_Height;
+ int block_count, Second_Field;
+ int horizontal_size, vertical_size, mb_width, mb_height;
+
+ /* ISO/IEC 13818-2 section 6.2.2.3: sequence_extension() */
+ int progressive_sequence;
+ int chroma_format;
+
+ /* ISO/IEC 13818-2 section 6.2.3: picture_header() */
+ int picture_coding_type;
+ int temporal_reference;
+
+ /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() header */
+ int f_code[2][2];
+ int picture_structure;
+ int frame_pred_frame_dct;
+ int progressive_frame;
+ int concealment_motion_vectors;
+ int intra_dc_precision;
+ int top_field_first;
+ int repeat_first_field;
+ int intra_vlc_format;
+
+ // interface
+ typedef struct {
+ DWORD number;
+ int file;
+ __int64 position;
+ } GOPLIST;
+ GOPLIST *GOPList[MAX_FRAME_NUMBER];
+
+ typedef struct {
+ DWORD top;
+ DWORD bottom;
+ char forward;
+ char backward;
+ } FRAMELIST;
+ FRAMELIST *FrameList[MAX_FRAME_NUMBER];
+
+ unsigned char *GOPBuffer[MAX_GOP_SIZE];
public:
- BOOL Field_Order, Full_Frame;
+ BOOL Field_Order, Full_Frame;
protected:
- HINSTANCE hLibrary;
+ HINSTANCE hLibrary;
- void Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward);
- void Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward);
+ void Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward);
+ void Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward);
public:
- FILE *VF_File;
- int VF_FrameRate;
- DWORD VF_FrameLimit;
- DWORD VF_FrameBound;
- DWORD VF_GOPLimit;
- DWORD VF_GOPNow;
- DWORD VF_GOPSize;
- int VF_FrameSize;
- DWORD VF_OldFrame;
- DWORD VF_OldRef;
-
- enum DstFormat
- {
- RGB24, YUY2
- };
- DstFormat m_dstFormat;
-
- CMPEG2Dec();
- ~CMPEG2Dec()
- {
- Close();
- }
- int Open(LPCTSTR path, DstFormat);
- void Close();
- void Decode(unsigned char *dst, DWORD frame, int pitch);
- bool dstRGB24() const
- {
- return m_dstFormat == RGB24;
- }
- bool dstYUY2() const
- {
- return m_dstFormat == YUY2;
- }
+ FILE *VF_File;
+ int VF_FrameRate;
+ DWORD VF_FrameLimit;
+ DWORD VF_FrameBound;
+ DWORD VF_GOPLimit;
+ DWORD VF_GOPNow;
+ DWORD VF_GOPSize;
+ int VF_FrameSize;
+ DWORD VF_OldFrame;
+ DWORD VF_OldRef;
+
+ enum DstFormat {
+ RGB24, YUY2
+ };
+ DstFormat m_dstFormat;
+
+ CMPEG2Dec();
+ ~CMPEG2Dec() {Close();}
+ int Open(LPCTSTR path, DstFormat);
+ void Close();
+ void Decode(unsigned char *dst, DWORD frame, int pitch);
+ bool dstRGB24() const { return m_dstFormat == RGB24; }
+ bool dstYUY2() const { return m_dstFormat == YUY2; }
};
diff --git a/src/filters/source/D2VSource/idctfpu.cpp b/src/filters/source/D2VSource/idctfpu.cpp
index 0b92b0315..92fcd3954 100644
--- a/src/filters/source/D2VSource/idctfpu.cpp
+++ b/src/filters/source/D2VSource/idctfpu.cpp
@@ -33,7 +33,7 @@
#define FLOAT double
-const static double RC = 1.0 * 1024 * 1024 * 1024 * 1024 * 256 * 16 + 1024; // magic + clip center
+const static double RC = 1.0*1024*1024*1024*1024*256*16 + 1024; // magic + clip center
static FLOAT W1; // /* sqrt(2)*cos(1*pi/16) */
static FLOAT W2; // /* sqrt(2)*cos(2*pi/16) */
@@ -56,7 +56,7 @@ static FLOAT W2mW6; // W2-W6
static FLOAT W2pW6; // W2+W6
static FLOAT S2; // 1/sqrt(2)
-static FLOAT D8 = 1.0 / 8;
+static FLOAT D8 = 1.0/8;
static FLOAT W7_8;
static FLOAT W1mW7_8;
@@ -78,62 +78,56 @@ static short *iclp;
void Initialize_FPU_IDCT()
{
- int i;
-
- S2 = sqrt(0.5); // 1.0/sqrt(2);
-
- W1 = sqrt(2.0) * cos(PI * (1.0 / 16));
- W1_8 = W1 / 8;
- W2 = sqrt(2.0) * cos(PI * (2.0 / 16));
- W2_8 = W2 / 8;
- W3 = sqrt(2.0) * cos(PI * (3.0 / 16));
- W3_8 = W3 / 8;
- W5 = sqrt(2.0) * cos(PI * (5.0 / 16));
- W5_8 = W5 / 8;
- W6 = sqrt(2.0) * cos(PI * (6.0 / 16));
- W6_8 = W6 / 8;
- W7 = sqrt(2.0) * cos(PI * (7.0 / 16));
- W7_8 = W7 / 8;
-
- W1mW7 = W1 - W7;
- W1mW7_8 = W1mW7 / 8;
- W1pW7 = W1 + W7;
- W1pW7_8 = W1pW7 / 8;
- W3mW5 = W3 - W5;
- W3mW5_8 = W3mW5 / 8;
- W3pW5 = W3 + W5;
- W3pW5_8 = W3pW5 / 8;
- W2mW6 = W2 - W6;
- W2mW6_8 = W2mW6 / 8;
- W2pW6 = W2 + W6;
- W2pW6_8 = W2pW6 / 8;
-
- iclp = iclip + 1024;
- for(i = -1024; i < 1024; i++)
- iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
+ int i;
+
+ S2 = sqrt(0.5); // 1.0/sqrt(2);
+
+ W1 = sqrt(2.0)*cos(PI*(1.0/16));
+ W1_8 = W1/8;
+ W2 = sqrt(2.0)*cos(PI*(2.0/16));
+ W2_8 = W2/8;
+ W3 = sqrt(2.0)*cos(PI*(3.0/16));
+ W3_8 = W3/8;
+ W5 = sqrt(2.0)*cos(PI*(5.0/16));
+ W5_8 = W5/8;
+ W6 = sqrt(2.0)*cos(PI*(6.0/16));
+ W6_8 = W6/8;
+ W7 = sqrt(2.0)*cos(PI*(7.0/16));
+ W7_8 = W7/8;
+
+ W1mW7 = W1-W7; W1mW7_8 = W1mW7/8;
+ W1pW7 = W1+W7; W1pW7_8 = W1pW7/8;
+ W3mW5 = W3-W5; W3mW5_8 = W3mW5/8;
+ W3pW5 = W3+W5; W3pW5_8 = W3pW5/8;
+ W2mW6 = W2-W6; W2mW6_8 = W2mW6/8;
+ W2pW6 = W2+W6; W2pW6_8 = W2pW6/8;
+
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
}
void FPU_IDCT(short *block)
{
- int *b = (int *) block;
- if(b[0] == 0 && (b[31] == 0x10000 || b[31] == 0))
- {
- if(b[ 1] | b[ 2] | b[ 3] | b[ 4] | b[ 5])
- goto normal;
- if(b[ 6] | b[ 7] | b[ 8] | b[ 9] | b[10])
- goto normal;
- if(b[11] | b[12] | b[13] | b[14] | b[15])
- goto normal;
- if(b[16] | b[17] | b[18] | b[19] | b[20])
- goto normal;
- if(b[21] | b[22] | b[23] | b[24] | b[25])
- goto normal;
- if(b[26] | b[27] | b[28] | b[29] | b[30])
- goto normal;
- b[31] = 0;
- ////empty++;
- return;
- }
+ int *b = (int *) block;
+ if( b[0]==0 && (b[31]==0x10000 || b[31]==0) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5] )
+ goto normal;
+ if( b[ 6]|b[ 7]|b[ 8]|b[ 9]|b[10] )
+ goto normal;
+ if( b[11]|b[12]|b[13]|b[14]|b[15] )
+ goto normal;
+ if( b[16]|b[17]|b[18]|b[19]|b[20] )
+ goto normal;
+ if( b[21]|b[22]|b[23]|b[24]|b[25] )
+ goto normal;
+ if( b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ ////empty++;
+ return;
+ }
normal:
#define tmp ebx
@@ -149,314 +143,314 @@ normal:
#define int6 ebx-3*8-7*4
#define int7 ebx-3*8-8*4
#define SIZE 8*8*8+3*8+8*4+16 // locals + 16-byte alignment area
- __asm
- {
- lea ebx, [esp-8*8*8]
- sub esp, SIZE
- and ebx, -16 // force 16-byte alignment of locals
+ __asm
+ {
+ lea ebx,[esp-8*8*8]
+ sub esp,SIZE
+ and ebx,-16 // force 16-byte alignment of locals
// rows
- mov esi, [block]
- lea edi, [tmp]
- mov ecx, 8
-
- align 16
- Lrows:
- movsx eax, word ptr [esi+2]
- or eax, [esi+4]
- or eax, [esi+8]
- or eax, [esi+12]
- jnz L1
-
- fild word ptr [esi+0*2]
- fst qword ptr [edi+7*8]
- fst qword ptr [edi+6*8]
- fst qword ptr [edi+5*8]
- fst qword ptr [edi+4*8]
- fst qword ptr [edi+3*8]
- fst qword ptr [edi+2*8]
- fst qword ptr [edi+1*8]
- fstp qword ptr [edi+0*8]
- jmp L2
-
- align 16
- L1:
-
- fild word ptr [esi+7*2]
- fld st(0)
- fild word ptr [esi+1*2]
- fadd st(1), st(0)
- fld qword ptr [W7]
- fxch st(1)
- fmul qword ptr [W1mW7]
- fxch st(1)
- fmulp st(2), st(0)
- fadd st(0), st(1)
- fstp qword ptr [tmp1]
- fild word ptr [esi+3*2]
- fld st(0)
- fxch st(3)
- fmul qword ptr [W1pW7]
- fild word ptr [esi+5*2]
- fadd st(4), st(0)
- fmul qword ptr [W3mW5]
- fxch st(1)
- fsubp st(3), st(0) //fsubrp
- fld qword ptr [W3]
- fmulp st(4), st(0)
- fsubr st(0), st(3)
- fstp qword ptr [tmp2]
- fmul qword ptr [W3pW5]
- fsubp st(2), st(0) //fsubrp
- fxch st(1)
- fstp qword ptr [tmp3]
- fild word ptr [esi+0*2]
- fild word ptr [esi+4*2]
- fild word ptr [esi+2*2]
- fld st(0)
- fmul qword ptr [W2mW6]
- fld st(3)
- fild word ptr [esi+6*2]
- fxch st(5)
- fsub st(0), st(4)
- fxch st(3)
- fadd st(0), st(5)
- fxch st(1)
- faddp st(4), st(0)
- fld qword ptr [W6]
- fmulp st(1), st(0)
- fxch st(4)
- fmul qword ptr [W2pW6]
- fld qword ptr [tmp1]
- fsub qword ptr [tmp2]
- fld st(5)
- fxch st(3)
- faddp st(6), st(0)
- fld qword ptr [tmp1]
- fxch st(1)
- fstp qword ptr [tmp1]
- fld st(6)
- fadd qword ptr [tmp3]
- fxch st(1)
- fadd qword ptr [tmp2]
- fxch st(7)
- fsub qword ptr [tmp3]
- fxch st(1)
- fstp qword ptr [tmp2]
- fld st(4)
- fxch st(3)
- fsubrp st(2), st(0) //fsubp
- fxch st(4)
- fsub st(0), st(5)
- fxch st(2)
- faddp st(5), st(0)
- fld st(2)
- fsub st(0), st(1)
- fxch st(5)
- fstp qword ptr [tmp3]
- fld qword ptr [tmp1]
- fld qword ptr [S2]
- fxch st(4)
- faddp st(2), st(0)
- fld st(3)
- fxch st(1)
- fadd st(0), st(5)
- fmulp st(1), st(0)
-
- fld qword ptr [tmp3]
- fadd st(0), st(7)
- fxch st(5)
- fsubr qword ptr [tmp1]
- fxch st(5)
- fstp qword ptr [edi+0*8]
- fxch st(6)
- fsubr qword ptr [tmp3]
- fld st(2)
- fxch st(1)
- fstp qword ptr [edi+7*8]
- fadd qword ptr [tmp2]
- fxch st(3)
- fmulp st(4), st(0)
- fxch st(2)
- fstp qword ptr [edi+3*8]
- fld st(1)
- fadd st(0), st(5)
- fxch st(1)
- fsub qword ptr [tmp2]
- fxch st(2)
- fsubrp st(5), st(0) //fsubp
- fstp qword ptr [edi+1*8]
- fld st(2)
- fxch st(1)
- fstp qword ptr [edi+4*8]
- fxch st(2)
- fsub st(0), st(1)
- fxch st(2)
- faddp st(1), st(0)
- fxch st(2)
- fstp qword ptr [edi+6*8]
- fstp qword ptr [edi+5*8]
- fstp qword ptr [edi+2*8]
- L2:
- add esi, 8*2
- add edi, 8*8
- dec ecx
- jnz Lrows
+ mov esi,[block]
+ lea edi,[tmp]
+ mov ecx,8
+
+ align 16
+Lrows:
+ movsx eax,word ptr [esi+2]
+ or eax, [esi+4]
+ or eax, [esi+8]
+ or eax, [esi+12]
+ jnz L1
+
+ fild word ptr [esi+0*2]
+ fst qword ptr [edi+7*8]
+ fst qword ptr [edi+6*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+1*8]
+ fstp qword ptr [edi+0*8]
+ jmp L2
+
+ align 16
+ L1:
+
+ fild word ptr [esi+7*2]
+ fld st(0)
+ fild word ptr [esi+1*2]
+ fadd st(1),st(0)
+ fld qword ptr [W7]
+ fxch st(1)
+ fmul qword ptr [W1mW7]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp1]
+ fild word ptr [esi+3*2]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7]
+ fild word ptr [esi+5*2]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp2]
+ fmul qword ptr [W3pW5]
+ fsubp st(2),st(0)//fsubrp
+ fxch st(1)
+ fstp qword ptr [tmp3]
+ fild word ptr [esi+0*2]
+ fild word ptr [esi+4*2]
+ fild word ptr [esi+2*2]
+ fld st(0)
+ fmul qword ptr [W2mW6]
+ fld st(3)
+ fild word ptr [esi+6*2]
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(3)
+ fadd st(0),st(5)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [W6]
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2pW6]
+ fld qword ptr [tmp1]
+ fsub qword ptr [tmp2]
+ fld st(5)
+ fxch st(3)
+ faddp st(6),st(0)
+ fld qword ptr [tmp1]
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(6)
+ fadd qword ptr [tmp3]
+ fxch st(1)
+ fadd qword ptr [tmp2]
+ fxch st(7)
+ fsub qword ptr [tmp3]
+ fxch st(1)
+ fstp qword ptr [tmp2]
+ fld st(4)
+ fxch st(3)
+ fsubrp st(2),st(0)//fsubp
+ fxch st(4)
+ fsub st(0),st(5)
+ fxch st(2)
+ faddp st(5),st(0)
+ fld st(2)
+ fsub st(0),st(1)
+ fxch st(5)
+ fstp qword ptr [tmp3]
+ fld qword ptr [tmp1]
+ fld qword ptr [S2]
+ fxch st(4)
+ faddp st(2),st(0)
+ fld st(3)
+ fxch st(1)
+ fadd st(0),st(5)
+ fmulp st(1),st(0)
+
+ fld qword ptr [tmp3]
+ fadd st(0),st(7)
+ fxch st(5)
+ fsubr qword ptr [tmp1]
+ fxch st(5)
+ fstp qword ptr [edi+0*8]
+ fxch st(6)
+ fsubr qword ptr [tmp3]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+7*8]
+ fadd qword ptr [tmp2]
+ fxch st(3)
+ fmulp st(4),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+3*8]
+ fld st(1)
+ fadd st(0),st(5)
+ fxch st(1)
+ fsub qword ptr [tmp2]
+ fxch st(2)
+ fsubrp st(5),st(0)//fsubp
+ fstp qword ptr [edi+1*8]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+4*8]
+ fxch st(2)
+ fsub st(0),st(1)
+ fxch st(2)
+ faddp st(1),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+6*8]
+ fstp qword ptr [edi+5*8]
+ fstp qword ptr [edi+2*8]
+ L2:
+ add esi,8*2
+ add edi,8*8
+ dec ecx
+ jnz Lrows
// columns
- lea esi, [tmp]
- mov edi, [block]
- lea edx, [iclip+1024*2]
- mov ecx, 8
-
- align 16
- Lcols:
- fld qword ptr [esi+7*8*8]
- fld st(0)
- fld qword ptr [esi+1*8*8]
- fadd st(1), st(0)
- fld qword ptr [W7_8]
- fxch st(1)
- fmul qword ptr [W1mW7_8]
- fxch st(1)
- fmulp st(2), st(0)
- fadd st(0), st(1)
- fstp qword ptr [tmp2]
- fld qword ptr [esi+3*8*8]
- fld st(0)
- fxch st(3)
- fmul qword ptr [W1pW7_8]
- fld qword ptr [esi+5*8*8]
- fadd st(4), st(0)
- fmul qword ptr [W3mW5_8]
- fxch st(1)
- fsubp st(3), st(0) //fsubrp
- fld qword ptr [W3_8]
- fmulp st(4), st(0)
- fsubr st(0), st(3)
- fstp qword ptr [tmp3]
- fld qword ptr [D8]
- fld qword ptr [esi+0*8*8]
- fmul st(0), st(1)
- fxch st(2)
- fmul qword ptr [W3pW5_8]
- fld qword ptr [esi+4*8*8]
- fmulp st(2), st(0)
- fld qword ptr [esi+6*8*8]
- fld st(3)
- fxch st(6)
- fsubrp st(2), st(0) //fsubp
- fld qword ptr [esi+2*8*8]
- fld st(0)
- fxch st(5)
- fsub st(0), st(4)
- fxch st(7)
- faddp st(4), st(0)
- fxch st(4)
- fadd st(0), st(1)
- fld qword ptr [W6_8]
- fxch st(2)
- fmul qword ptr [W2pW6_8]
- fxch st(2)
- fmulp st(1), st(0)
- fxch st(4)
- fmul qword ptr [W2mW6_8]
- fld qword ptr [tmp2]
- fsub qword ptr [tmp3]
- fxch st(2)
- fsubr st(0), st(5)
- fxch st(1)
- faddp st(5), st(0)
- fld qword ptr [tmp2]
- fxch st(2)
- fstp qword ptr [tmp2]
- fld st(5)
- fxch st(2)
- fadd qword ptr [tmp3]
- fxch st(6)
- fsub st(0), st(3)
- fxch st(2)
- faddp st(3), st(0)
- fld st(3)
- fsub st(0), st(5)
- fxch st(3)
- fstp qword ptr [tmp3]
- fxch st(3)
- faddp st(4), st(0)
- fld st(5)
- fld qword ptr [tmp2]
- fxch st(7)
- fsub st(0), st(4)
- fxch st(7)
- fadd st(0), st(2)
- fxch st(1)
- faddp st(4), st(0)
- fld qword ptr [S2]
- fmul st(1), st(0)
- fxch st(1)
- fstp qword ptr [tmp1]
- fld st(4)
- fadd st(0), st(6)
- fxch st(2)
- fsubr qword ptr [tmp2]
- fxch st(5)
- fsubrp st(6), st(0) //fsubp
- fxch st(1)
- fistp dword ptr [int0]
- fxch st(4)
- mov eax, [int0]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+0*8*2], ax
- fistp dword ptr [int7]
- mov eax, [int7]
- fld st(0)
- movsx eax, word ptr [edx+2*eax]
- mov [edi+7*8*2], ax
- fadd qword ptr [tmp3]
- fistp dword ptr [int3]
- mov eax, [int3]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+3*8*2], ax
- fsub qword ptr [tmp3]
- fld st(1)
- fxch st(1)
- fistp dword ptr [int4]
- mov eax, [int4]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+4*8*2], ax
- fadd qword ptr [tmp1]
- fxch st(3)
- fmulp st(2), st(0)
- fxch st(2)
- fistp dword ptr [int1]
- fxch st(1)
- mov eax, [int1]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+1*8*2], ax
- fsub qword ptr [tmp1]
- fld st(2)
- fsub st(0), st(2)
- fxch st(1)
- fistp dword ptr [int6]
- fxch st(2)
- mov eax, [int6]
- faddp st(1), st(0)
- movsx eax, word ptr [edx+2*eax]
- mov [edi+6*8*2], ax
- fistp dword ptr [int2]
- mov eax, [int2]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+2*8*2], ax
- fistp dword ptr [int5]
- mov eax, [int5]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+5*8*2], ax
-
- add esi, 8
- add edi, 2
- dec ecx
- jnz Lcols
-
- add esp, SIZE
- }
+ lea esi,[tmp]
+ mov edi,[block]
+ lea edx,[iclip+1024*2]
+ mov ecx,8
+
+ align 16
+Lcols:
+ fld qword ptr [esi+7*8*8]
+ fld st(0)
+ fld qword ptr [esi+1*8*8]
+ fadd st(1),st(0)
+ fld qword ptr [W7_8]
+ fxch st(1)
+ fmul qword ptr [W1mW7_8]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp2]
+ fld qword ptr [esi+3*8*8]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7_8]
+ fld qword ptr [esi+5*8*8]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5_8]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3_8]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp3]
+ fld qword ptr [D8]
+ fld qword ptr [esi+0*8*8]
+ fmul st(0),st(1)
+ fxch st(2)
+ fmul qword ptr [W3pW5_8]
+ fld qword ptr [esi+4*8*8]
+ fmulp st(2),st(0)
+ fld qword ptr [esi+6*8*8]
+ fld st(3)
+ fxch st(6)
+ fsubrp st(2),st(0)//fsubp
+ fld qword ptr [esi+2*8*8]
+ fld st(0)
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(7)
+ faddp st(4),st(0)
+ fxch st(4)
+ fadd st(0),st(1)
+ fld qword ptr [W6_8]
+ fxch st(2)
+ fmul qword ptr [W2pW6_8]
+ fxch st(2)
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2mW6_8]
+ fld qword ptr [tmp2]
+ fsub qword ptr [tmp3]
+ fxch st(2)
+ fsubr st(0),st(5)
+ fxch st(1)
+ faddp st(5),st(0)
+ fld qword ptr [tmp2]
+ fxch st(2)
+ fstp qword ptr [tmp2]
+ fld st(5)
+ fxch st(2)
+ fadd qword ptr [tmp3]
+ fxch st(6)
+ fsub st(0),st(3)
+ fxch st(2)
+ faddp st(3),st(0)
+ fld st(3)
+ fsub st(0),st(5)
+ fxch st(3)
+ fstp qword ptr [tmp3]
+ fxch st(3)
+ faddp st(4),st(0)
+ fld st(5)
+ fld qword ptr [tmp2]
+ fxch st(7)
+ fsub st(0),st(4)
+ fxch st(7)
+ fadd st(0),st(2)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [S2]
+ fmul st(1),st(0)
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(4)
+ fadd st(0),st(6)
+ fxch st(2)
+ fsubr qword ptr [tmp2]
+ fxch st(5)
+ fsubrp st(6),st(0)//fsubp
+ fxch st(1)
+ fistp dword ptr [int0]
+ fxch st(4)
+ mov eax,[int0]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+0*8*2],ax
+ fistp dword ptr [int7]
+ mov eax,[int7]
+ fld st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+7*8*2],ax
+ fadd qword ptr [tmp3]
+ fistp dword ptr [int3]
+ mov eax,[int3]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+3*8*2],ax
+ fsub qword ptr [tmp3]
+ fld st(1)
+ fxch st(1)
+ fistp dword ptr [int4]
+ mov eax,[int4]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+4*8*2],ax
+ fadd qword ptr [tmp1]
+ fxch st(3)
+ fmulp st(2),st(0)
+ fxch st(2)
+ fistp dword ptr [int1]
+ fxch st(1)
+ mov eax,[int1]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+1*8*2],ax
+ fsub qword ptr [tmp1]
+ fld st(2)
+ fsub st(0),st(2)
+ fxch st(1)
+ fistp dword ptr [int6]
+ fxch st(2)
+ mov eax,[int6]
+ faddp st(1),st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+6*8*2],ax
+ fistp dword ptr [int2]
+ mov eax,[int2]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+2*8*2],ax
+ fistp dword ptr [int5]
+ mov eax,[int5]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+5*8*2],ax
+
+ add esi,8
+ add edi,2
+ dec ecx
+ jnz Lcols
+
+ add esp,SIZE
+ }
}
diff --git a/src/filters/source/D2VSource/idctref.cpp b/src/filters/source/D2VSource/idctref.cpp
index 2c1024692..74b695ce1 100644
--- a/src/filters/source/D2VSource/idctref.cpp
+++ b/src/filters/source/D2VSource/idctref.cpp
@@ -40,323 +40,323 @@ static double c[8][8];
/* initialize DCT coefficient matrix */
void Initialize_REF_IDCT()
{
- int freq, time, i;
- double scale;
+ int freq, time, i;
+ double scale;
- for(freq = 0; freq < 8; freq++)
- {
- scale = (freq == 0) ? sqrt(0.125) : 0.5;
- for(time = 0; time < 8; time++)
- c[freq][time] = scale * cos((M_PI / 8.0) * freq * (time + 0.5));
- }
+ for (freq=0; freq < 8; freq++)
+ {
+ scale = (freq == 0) ? sqrt(0.125) : 0.5;
+ for (time=0; time<8; time++)
+ c[freq][time] = scale*cos((M_PI/8.0)*freq*(time + 0.5));
+ }
#ifdef ModelX
- iclp = iclip + 1024;
- for(i = -1024; i < 1024; i++)
- iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
#endif
}
void REF_IDCT(short *block)
{
- double tmp[64];
- double rnd[64];
- int int0, int1, int2, int3, int4, int5, int6, int7;
- unsigned short fpold;
- unsigned short fpnew;
-
- int *b = (int *) block;
-
- if(!(b[0] | (b[31]&~0x10000)))
- {
- if(b[ 1] | b[ 2] | b[ 3] | b[ 4] | b[ 5] | b[ 6])
- goto normal;
- if(b[ 7] | b[ 8] | b[ 9] | b[10] | b[11] | b[12])
- goto normal;
- if(b[13] | b[14] | b[15] | b[16] | b[17] | b[18])
- goto normal;
- if(b[19] | b[20] | b[21] | b[22] | b[23] | b[24])
- goto normal;
- if(b[25] | b[26] | b[27] | b[28] | b[29] | b[30])
- goto normal;
- b[31] = 0;
- return;
- }
+ double tmp[64];
+ double rnd[64];
+ int int0, int1, int2, int3, int4, int5, int6, int7;
+ unsigned short fpold;
+ unsigned short fpnew;
+
+ int *b = (int *) block;
+
+ if( !(b[0]|(b[31]&~0x10000)) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5]|b[ 6] )
+ goto normal;
+ if( b[ 7]|b[ 8]|b[ 9]|b[10]|b[11]|b[12] )
+ goto normal;
+ if( b[13]|b[14]|b[15]|b[16]|b[17]|b[18] )
+ goto normal;
+ if( b[19]|b[20]|b[21]|b[22]|b[23]|b[24] )
+ goto normal;
+ if( b[25]|b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ return;
+ }
normal:
- __asm
- {
- // do the IDCT
- mov esi, [block]
- lea eax, [c]
- lea edi, [tmp]
- //mov ebx,8
- mov ebx, 8 // 0x77000000 // 8
- align 16
- __col1:
- movzx edx, [esi+1*2]
- mov ecx, [esi+2*2]
- or edx, [esi+4*2]
- or ecx, [esi+6*2]
- or edx, ecx
- //mov ecx,8
- mov ecx, 8/2 // 0x77000000 // 8
-
- jnz __row1
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8]
- fst qword ptr [edi+0*8]
- fst qword ptr [edi+1*8]
- fst qword ptr [edi+2*8]
- fst qword ptr [edi+3*8]
- fst qword ptr [edi+4*8]
- fst qword ptr [edi+5*8]
- fst qword ptr [edi+6*8]
- fstp qword ptr [edi+7*8]
- add edi, 8*8
- jmp __next1
- align 16
- __row1:
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8]
- fild word ptr [esi+1*2]
- fmul qword ptr [eax+1*8*8]
- fadd
- fild word ptr [esi+2*2]
- fmul qword ptr [eax+2*8*8]
- fadd
- fild word ptr [esi+3*2]
- fmul qword ptr [eax+3*8*8]
- fadd
- fild word ptr [esi+4*2]
- fmul qword ptr [eax+4*8*8]
- fadd
- fild word ptr [esi+5*2]
- fmul qword ptr [eax+5*8*8]
- fadd
- fild word ptr [esi+6*2]
- fmul qword ptr [eax+6*8*8]
- fadd
- fild word ptr [esi+7*2]
- fmul qword ptr [eax+7*8*8]
- fadd
-
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8+8]
- fild word ptr [esi+1*2]
- fmul qword ptr [eax+1*8*8+8]
- fadd
- fild word ptr [esi+2*2]
- fmul qword ptr [eax+2*8*8+8]
- fadd
- fild word ptr [esi+3*2]
- fmul qword ptr [eax+3*8*8+8]
- fadd
- fild word ptr [esi+4*2]
- fmul qword ptr [eax+4*8*8+8]
- fadd
- fild word ptr [esi+5*2]
- fmul qword ptr [eax+5*8*8+8]
- fadd
- fild word ptr [esi+6*2]
- fmul qword ptr [eax+6*8*8+8]
- fadd
- fild word ptr [esi+7*2]
- fmul qword ptr [eax+7*8*8+8]
- fadd
- add eax, 8*2
- fxch st(1)
- fstp qword ptr [edi]//
- fstp qword ptr [edi+8]
- add edi, 8*2
- dec ecx
-
- jnz __row1
- add eax, -8*8
- //align 16
- __next1:
- add esi, +8*2
-
- sub ebx, 0x80000001 // add ebx,ebx
- js __col1
- //align 16
- test ebx, ebx // align jump &| redo flags
- jnz __col1
-
- lea esi, [tmp]
- lea eax, [c]
- lea edi, [rnd]
- //mov edi,[block]
- fld qword ptr [HALF]
- mov ebx, 8
- __row2:
- mov ecx, 8/2
- align 16
- __col2:
- fld qword ptr [esi+0*8*8]
- fmul qword ptr [eax+0*8*8]
- fld qword ptr [esi+1*8*8]
- fmul qword ptr [eax+1*8*8]
- fadd
- fld qword ptr [esi+2*8*8]
- fmul qword ptr [eax+2*8*8]
- fadd
- fld qword ptr [esi+3*8*8]
- fmul qword ptr [eax+3*8*8]
- fadd
- fld qword ptr [esi+4*8*8]
- fmul qword ptr [eax+4*8*8]
- fadd
- fld qword ptr [esi+5*8*8]
- fmul qword ptr [eax+5*8*8]
- fadd
- fld qword ptr [esi+6*8*8]
- fmul qword ptr [eax+6*8*8]
- fadd
- fld qword ptr [esi+7*8*8]
- fmul qword ptr [eax+7*8*8]
- fadd
- fadd st(0), st(1)
-
- fxch st(1)
-
- fld qword ptr [esi+0*8*8]
- fmul qword ptr [eax+0*8*8+8]
- fld qword ptr [esi+1*8*8]
- fmul qword ptr [eax+1*8*8+8]
- fadd
- fld qword ptr [esi+2*8*8]
- fmul qword ptr [eax+2*8*8+8]
- fadd
- fld qword ptr [esi+3*8*8]
- fmul qword ptr [eax+3*8*8+8]
- fadd
- fld qword ptr [esi+4*8*8]
- fmul qword ptr [eax+4*8*8+8]
- fadd
- fld qword ptr [esi+5*8*8]
- fmul qword ptr [eax+5*8*8+8]
- fadd
- fld qword ptr [esi+6*8*8]
- fmul qword ptr [eax+6*8*8+8]
- fadd
- fld qword ptr [esi+7*8*8]
- fmul qword ptr [eax+7*8*8+8]
- fadd
- fadd st(0), st(1)
- add eax, 8*2
-
- fxch st(2)
- fstp qword ptr [edi]
- fxch st(1)
- fstp qword ptr [edi+8*8]
- add edi, 8*8*2
-
- dec ecx
-
- jnz __col2
- add eax, -8*8
- add esi, +8
- add edi, 8-8*8*8
-
- sub ebx, 0x80000001
- js __row2
- //align 16
- test ebx, ebx // align jump &| redo flags
- jnz __row2
- ffree st(0) // bye bye 0.5
-
- // set x87 to floor mode
- fstcw [fpold]
- movzx eax, [fpold]
-
- or eax, 0x0400 // round down - floor
- mov [fpnew], ax
- fldcw [fpnew]
-
- // now floor the damn array
- lea esi, [rnd]
- mov edi, [block]
- mov ebx, -256 // clip min
- mov edx, +255 // clip max
- mov ecx, 8
- align 16
- __floor:
- fld qword ptr [esi+0*8]
- fistp dword ptr [int0]
- mov eax, [int0]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+1*8]
- fistp dword ptr [int1]
- mov word ptr [edi+0*2], ax
- mov eax, [int1]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+2*8]
- fistp dword ptr [int2]
- mov word ptr [edi+1*2], ax
- mov eax, [int2]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+3*8]
- fistp dword ptr [int3]
- mov word ptr [edi+2*2], ax
- mov eax, [int3]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+4*8]
- fistp dword ptr [int4]
- mov word ptr [edi+3*2], ax
- mov eax, [int4]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+5*8]
- fistp dword ptr [int5]
- mov word ptr [edi+4*2], ax
- mov eax, [int5]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+6*8]
- fistp dword ptr [int6]
- mov word ptr [edi+5*2], ax
- mov eax, [int6]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+7*8]
- fistp dword ptr [int7]
- mov word ptr [edi+6*2], ax
- mov eax, [int7]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- mov word ptr [edi+7*2], ax
-
- add esi, 8*8
- add edi, 8*2
-
- sub ecx, 0x80000001
- js __floor
- //align 16
- test ecx, ecx // align jump &| redo flags
- jnz __floor
-
- // set x87 to default mode
- fldcw [fpold]
- };
+ __asm
+ {
+ // do the IDCT
+ mov esi,[block]
+ lea eax,[c]
+ lea edi,[tmp]
+ //mov ebx,8
+ mov ebx,8 // 0x77000000 // 8
+ align 16
+ __col1:
+ movzx edx,[esi+1*2]
+ mov ecx,[esi+2*2]
+ or edx,[esi+4*2]
+ or ecx,[esi+6*2]
+ or edx,ecx
+ //mov ecx,8
+ mov ecx,8/2 // 0x77000000 // 8
+
+ jnz __row1
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fst qword ptr [edi+0*8]
+ fst qword ptr [edi+1*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+6*8]
+ fstp qword ptr [edi+7*8]
+ add edi,8*8
+ jmp __next1
+ align 16
+ __row1:
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8+8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ add eax,8*2
+ fxch st(1)
+ fstp qword ptr [edi]//
+ fstp qword ptr [edi+8]
+ add edi,8*2
+ dec ecx
+
+ jnz __row1
+ add eax,-8*8
+ //align 16
+ __next1:
+ add esi,+8*2
+
+ sub ebx,0x80000001 // add ebx,ebx
+ js __col1
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __col1
+
+ lea esi,[tmp]
+ lea eax,[c]
+ lea edi,[rnd]
+ //mov edi,[block]
+ fld qword ptr [HALF]
+ mov ebx,8
+ __row2:
+ mov ecx,8/2
+ align 16
+ __col2:
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+ fadd st(0),st(1)
+
+ fxch st(1)
+
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8+8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ fadd st(0),st(1)
+ add eax,8*2
+
+ fxch st(2)
+ fstp qword ptr [edi]
+ fxch st(1)
+ fstp qword ptr [edi+8*8]
+ add edi,8*8*2
+
+ dec ecx
+
+ jnz __col2
+ add eax,-8*8
+ add esi,+8
+ add edi,8-8*8*8
+
+ sub ebx,0x80000001
+ js __row2
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __row2
+ ffree st(0) // bye bye 0.5
+
+ // set x87 to floor mode
+ fstcw [fpold]
+ movzx eax, [fpold]
+
+ or eax, 0x0400 // round down - floor
+ mov [fpnew], ax
+ fldcw [fpnew]
+
+ // now floor the damn array
+ lea esi, [rnd]
+ mov edi, [block]
+ mov ebx, -256 // clip min
+ mov edx, +255 // clip max
+ mov ecx, 8
+ align 16
+ __floor:
+ fld qword ptr [esi+0*8]
+ fistp dword ptr [int0]
+ mov eax,[int0]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+1*8]
+ fistp dword ptr [int1]
+ mov word ptr [edi+0*2],ax
+ mov eax,[int1]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+2*8]
+ fistp dword ptr [int2]
+ mov word ptr [edi+1*2],ax
+ mov eax,[int2]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+3*8]
+ fistp dword ptr [int3]
+ mov word ptr [edi+2*2],ax
+ mov eax,[int3]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+4*8]
+ fistp dword ptr [int4]
+ mov word ptr [edi+3*2],ax
+ mov eax,[int4]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+5*8]
+ fistp dword ptr [int5]
+ mov word ptr [edi+4*2],ax
+ mov eax,[int5]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+6*8]
+ fistp dword ptr [int6]
+ mov word ptr [edi+5*2],ax
+ mov eax,[int6]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+7*8]
+ fistp dword ptr [int7]
+ mov word ptr [edi+6*2],ax
+ mov eax,[int7]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ mov word ptr [edi+7*2],ax
+
+ add esi, 8*8
+ add edi, 8*2
+
+ sub ecx,0x80000001
+ js __floor
+ //align 16
+ test ecx,ecx // align jump &| redo flags
+ jnz __floor
+
+ // set x87 to default mode
+ fldcw [fpold]
+ };
}
diff --git a/src/filters/source/D2VSource/resource.h b/src/filters/source/D2VSource/resource.h
index 98cb5e018..1d1658441 100644
--- a/src/filters/source/D2VSource/resource.h
+++ b/src/filters/source/D2VSource/resource.h
@@ -3,7 +3,7 @@
// Used by d2vsource.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101