Skip to content

Commit

Permalink
version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chikuzen committed Aug 31, 2016
1 parent df0dde8 commit be86554
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 39 deletions.
3 changes: 3 additions & 0 deletions build/msvcX/DGDecode/DGDecode.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -127,6 +128,8 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<StringPooling>true</StringPooling>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
30 changes: 11 additions & 19 deletions src/dgdecode/AVISynthAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "idct.h"


#define VERSION "MPEG2DecPlus 0.1.0"
#define VERSION "MPEG2DecPlus 0.1.1"


MPEG2Source::MPEG2Source(const char* d2v, int cpu, int idct, int iPP,
Expand All @@ -49,11 +49,6 @@ MPEG2Source::MPEG2Source(const char* d2v, int cpu, int idct, int iPP,
{
int status;

/* override */
m_decoder.refinit = false;
m_decoder.fpuinit = false;
m_decoder.luminit = false;

//if (iPP != -1 && iPP != 0 && iPP != 1)
// env->ThrowError("MPEG2Source: iPP must be set to -1, 0, or 1!");

Expand Down Expand Up @@ -214,9 +209,6 @@ void MPEG2Source::override(int ovr_idct)


constexpr uint32_t MAGIC_NUMBER = 0xdeadbeef;
constexpr uint32_t PROGRESSIVE = 0x00000001;
constexpr int COLORIMETRY_SHIFT = 2;


bool PutHintingData(uint8_t *video, uint32_t hint)
{
Expand Down Expand Up @@ -282,7 +274,7 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
PVideoFrame frame = env->NewVideoFrame(vi);
YV12PICT out = {};

if (m_decoder.upConv != 2) { // YV12 || YV16
if (m_decoder.upConv != 2) { // YV12 or YV16 output
out.y = frame->GetWritePtr(PLANAR_Y);
out.u = frame->GetWritePtr(PLANAR_U);
out.v = frame->GetWritePtr(PLANAR_V);
Expand All @@ -292,7 +284,7 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
out.uvwidth = frame->GetRowSize(PLANAR_U);
out.yheight = frame->GetHeight(PLANAR_Y);
out.uvheight = frame->GetHeight(PLANAR_V);
} else {
} else { // YV24 output
out.y = bufY;
out.u = bufU;
out.v = bufV;
Expand Down Expand Up @@ -354,8 +346,7 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
}
}

if (m_decoder.info == 1)
{
if (m_decoder.info == 1) {
char msg1[1024];
sprintf(msg1,"%s\n"
"---------------------------------------\n"
Expand Down Expand Up @@ -393,9 +384,8 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
Matrix_s, m_decoder.GOPList[gop]->matrix,
m_decoder.avgquant, m_decoder.minquant, m_decoder.maxquant);
env->ApplyMessage(&frame, vi, msg1, 150, 0xdfffbf, 0x0, 0x0);
}
else if (m_decoder.info == 2)
{

} else if (m_decoder.info == 2) {
dprintf("MPEG2DecPlus: %s\n", VERSION);
dprintf("MPEG2DecPlus: Source: %s\n", m_decoder.Infilename[m_decoder.GOPList[gop]->file]);
dprintf("MPEG2DecPlus: Frame Rate: %3.6f fps (%u/%u) %s\n",
Expand All @@ -414,9 +404,11 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
dprintf("MPEG2DecPlus: Progressive Frame: %s\n", m_decoder.FrameList[raw].pf ? "True" : "False");
dprintf("MPEG2DecPlus: Colorimetry: %s (%d)\n", Matrix_s, m_decoder.GOPList[gop]->matrix);
dprintf("MPEG2DecPlus: Quants: %d/%d/%d (avg/min/max)\n", m_decoder.avgquant, m_decoder.minquant, m_decoder.maxquant);
}
else if (m_decoder.info == 3)
{

} else if (m_decoder.info == 3) {
constexpr uint32_t PROGRESSIVE = 0x00000001;
constexpr int COLORIMETRY_SHIFT = 2;

hint = 0;
if (m_decoder.FrameList[raw].pf == 1) hint |= PROGRESSIVE;
hint |= ((m_decoder.GOPList[gop]->matrix & 7) << COLORIMETRY_SHIFT);
Expand Down
3 changes: 1 addition & 2 deletions src/dgdecode/MPEG2Decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class MPEG2DEC_API CMPEG2Decoder
friend class MPEG2Source;

protected:
bool refinit,fpuinit,luminit;
int moderate_h, moderate_v, pp_mode;

// getbit.cpp
Expand Down Expand Up @@ -282,7 +281,7 @@ class MPEG2DEC_API CMPEG2Decoder
// global values
uint8_t *backward_reference_frame[3], *forward_reference_frame[3];
uint8_t *auxframe[3], *current_frame[3];
uint8_t *u422, *v422;
// uint8_t *u422, *v422;
YV12PICT *auxFrame1;
YV12PICT *auxFrame2;
YV12PICT *saved_active;
Expand Down
4 changes: 4 additions & 0 deletions src/dgdecode/idct_llm_float_avx2.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef __AVX2__
#error arch:avx2 is not set.
#endif

#include <immintrin.h>
#include "idct.h"

Expand Down
5 changes: 3 additions & 2 deletions src/dgdecode/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ size_t __cdecl dprintf(char* fmt, ...)
}


void fast_copy(const uint8_t* src, const int src_stride, uint8_t* dst, const int dst_stride,
const int horizontal_size, int vertical_size) noexcept
void __stdcall
fast_copy(const uint8_t* src, const int src_stride, uint8_t* dst,
const int dst_stride, const int horizontal_size, int vertical_size) noexcept
{
if (vertical_size == 0) {
return;
Expand Down
7 changes: 4 additions & 3 deletions src/dgdecode/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#include <cstdint>
#include <cstdarg>

void fast_copy(const uint8_t *src, const int src_stride, uint8_t *dst,
const int dst_stride, const int horizontal_size,
const int vertical_size) noexcept;
void __stdcall
fast_copy(const uint8_t *src, const int src_stride, uint8_t *dst,
const int dst_stride, const int horizontal_size,
const int vertical_size) noexcept;

size_t __cdecl dprintf(char* fmt, ...);

Expand Down
23 changes: 10 additions & 13 deletions src/dgdecode/vfapidec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ CMPEG2Decoder::CMPEG2Decoder()
i420 = false;
pc_scale = 1;
maxquant = minquant = avgquant = 0;
u422 = v422 = NULL;
//u422 = v422 = NULL;
DirectAccess = NULL;
FrameList = NULL;
GOPList = NULL;
Expand Down Expand Up @@ -246,9 +246,9 @@ int CMPEG2Decoder::Open(const char *path)
// these are labeled u422 and v422, but I'm only using them as a temporary
// storage place for YV12 chroma before upsampling to 4:2:2 so that's why its
// /4 and not /2 -- (tritical - 1/05/2005)
int tpitch = (((Chroma_Width+15)>>4)<<4); // mod 16 chroma pitch needed to work with YV12PICTs
u422 = (unsigned char*)_aligned_malloc((tpitch * Coded_Picture_Height / 2)+2048, 32);
v422 = (unsigned char*)_aligned_malloc((tpitch * Coded_Picture_Height / 2)+2048, 32);
// int tpitch = (((Chroma_Width+15)>>4)<<4); // mod 16 chroma pitch needed to work with YV12PICTs
// u422 = (unsigned char*)_aligned_malloc((tpitch * Coded_Picture_Height / 2)+2048, 32);
// v422 = (unsigned char*)_aligned_malloc((tpitch * Coded_Picture_Height / 2)+2048, 32);
auxFrame1 = create_YV12PICT(Coded_Picture_Height,Coded_Picture_Width,chroma_format+1);
auxFrame2 = create_YV12PICT(Coded_Picture_Height,Coded_Picture_Width,chroma_format+1);
}
Expand Down Expand Up @@ -826,16 +826,13 @@ __except(EXCEPTION_EXECUTE_HANDLER)
void CMPEG2Decoder::Close()
{
int i;
CMPEG2Decoder* in = this;

if (in->VF_File)
{
fclose(in->VF_File);
in->VF_File = NULL;
if (VF_File) {
fclose(VF_File);
VF_File = NULL;
}

while (File_Limit)
{
while (File_Limit) {
File_Limit--;
_close(Infile[File_Limit]);
_aligned_free(Infilename[File_Limit]);
Expand All @@ -852,8 +849,8 @@ void CMPEG2Decoder::Close()
_aligned_free(backwardQP);
_aligned_free(auxQP);

if (u422 != NULL) _aligned_free(u422);
if (v422 != NULL) _aligned_free(v422);
// if (u422 != NULL) _aligned_free(u422);
// if (v422 != NULL) _aligned_free(v422);

destroy_YV12PICT(auxFrame1);
destroy_YV12PICT(auxFrame2);
Expand Down

0 comments on commit be86554

Please sign in to comment.