New search.c/.h files and changed department name on all files

This commit is contained in:
Marko Viitanen 2013-04-16 11:23:03 +03:00
parent 01c7f267d7
commit a737e8660c
29 changed files with 102 additions and 44 deletions

View file

@ -140,7 +140,7 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>X64;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<InlineFunctionExpansion>Default</InlineFunctionExpansion> <InlineFunctionExpansion>Default</InlineFunctionExpansion>
@ -167,6 +167,7 @@
<ClCompile Include="..\..\src\intra.c" /> <ClCompile Include="..\..\src\intra.c" />
<ClCompile Include="..\..\src\nal.c" /> <ClCompile Include="..\..\src\nal.c" />
<ClCompile Include="..\..\src\picture.c" /> <ClCompile Include="..\..\src\picture.c" />
<ClCompile Include="..\..\src\search.c" />
<ClCompile Include="..\..\src\transform.c" /> <ClCompile Include="..\..\src\transform.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -180,6 +181,7 @@
<ClInclude Include="..\..\src\intra.h" /> <ClInclude Include="..\..\src\intra.h" />
<ClInclude Include="..\..\src\nal.h" /> <ClInclude Include="..\..\src\nal.h" />
<ClInclude Include="..\..\src\picture.h" /> <ClInclude Include="..\..\src\picture.h" />
<ClInclude Include="..\..\src\search.h" />
<ClInclude Include="..\..\src\transform.h" /> <ClInclude Include="..\..\src\transform.h" />
<ClInclude Include="..\..\src\x64\test64.h" /> <ClInclude Include="..\..\src\x64\test64.h" />
<ClInclude Include="..\..\src\x86\test.h" /> <ClInclude Include="..\..\src\x86\test.h" />

View file

@ -60,6 +60,9 @@
<ClCompile Include="..\..\src\filter.c"> <ClCompile Include="..\..\src\filter.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\search.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\src\global.h"> <ClInclude Include="..\..\src\global.h">
@ -99,7 +102,10 @@
<Filter>Header Files\x86</Filter> <Filter>Header Files\x86</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\x64\test64.h"> <ClInclude Include="..\..\src\x64\test64.h">
<Filter>Header Files\x86</Filter> <Filter>Header Files\x64</Filter>
</ClInclude>
<ClInclude Include="..\..\src\search.h">
<Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file bitstream.c /*! \file bitstream.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file cabac.c /*! \file cabac.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file cabac.h /*! \file cabac.h

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file config.c /*! \file config.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file config.h /*! \file config.h

View file

@ -1,6 +1,6 @@
/** /**
* Part of HEVC Encoder * Part of HEVC Encoder
* By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file context.c /*! \file context.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file context.h /*! \file context.h

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file decmain.c /*! \file decmain.c
@ -61,7 +61,8 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int ecx = 0,edx =0; int ecx = 0,edx =0;
enum { BIT_SSSE3 = 9, BIT_SSE41 = 19, BIT_SSE42 = 20, BIT_MMX = 24, BIT_SSE = 25, BIT_SSE2 = 26}; /* CPU feature bits */
enum { BIT_SSE3 = 0,BIT_SSSE3 = 9, BIT_SSE41 = 19, BIT_SSE42 = 20, BIT_MMX = 24, BIT_SSE = 25, BIT_SSE2 = 26, BIT_AVX = 28};
uint32_t curFrame = 0; uint32_t curFrame = 0;
config *cfg = NULL; /* Global configuration */ config *cfg = NULL; /* Global configuration */
FILE *input = NULL; FILE *input = NULL;
@ -74,20 +75,22 @@
/* CPU id */ /* CPU id */
printf("Checking for CPU features...\r\n");
#ifndef X64 #ifndef X64
cpuId(&ecx,&edx); //cpuId32(&ecx,&edx);
#else #else
cpuId64(&ecx,&edx); //cpuId64(&ecx,&edx);
#endif #endif
//printf("CPUID ECX: %X EDX: %X\r\n", ecx, edx);
printf("CPU features enabled: "); printf("CPU features enabled: ");
if(edx & (1<<BIT_MMX)) printf("MMX "); /* EDX */
if(edx & (1<<BIT_SSE)) printf("SSE "); if(edx & (1<<BIT_MMX)) printf("MMX ");
if(edx & (1<<BIT_SSE)) printf("SSE ");
if(edx & (1<<BIT_SSE2)) printf("SSE2 "); if(edx & (1<<BIT_SSE2)) printf("SSE2 ");
/* ECX */
if(ecx & (1<<BIT_SSE3)) printf("SSE3 ");
if(ecx & (1<<BIT_SSSE3)) printf("SSSE3 "); if(ecx & (1<<BIT_SSSE3)) printf("SSSE3 ");
if(ecx & (1<<BIT_SSE41)) printf("SSE4.1 "); if(ecx & (1<<BIT_SSE41)) printf("SSE4.1 ");
if(ecx & (1<<BIT_SSE42)) printf("SSE4.2 "); if(ecx & (1<<BIT_SSE42)) printf("SSE4.2 ");
if(ecx & (1<<BIT_AVX)) printf("AVX ");
printf("\r\n"); printf("\r\n");
@ -192,7 +195,7 @@
temp_PSNR[1] = imagePSNR(encoder->in.cur_pic.uData,encoder->in.cur_pic.uRecData,cfg->width>>1,cfg->height>>1); temp_PSNR[1] = imagePSNR(encoder->in.cur_pic.uData,encoder->in.cur_pic.uRecData,cfg->width>>1,cfg->height>>1);
temp_PSNR[2] = imagePSNR(encoder->in.cur_pic.vData,encoder->in.cur_pic.vRecData,cfg->width>>1,cfg->height>>1); temp_PSNR[2] = imagePSNR(encoder->in.cur_pic.vData,encoder->in.cur_pic.vRecData,cfg->width>>1,cfg->height>>1);
printf("[%d] %c-frame PSNR: %2.4f %2.4f %2.4f\n", encoder->frame, "IPB"[encoder->in.cur_pic.type%3], printf("[%d] %c-frame PSNR: %2.4f %2.4f %2.4f\n", encoder->frame, "IPB"[encoder->in.cur_pic.slicetype%3],
temp_PSNR[0],temp_PSNR[1],temp_PSNR[2]); temp_PSNR[0],temp_PSNR[1],temp_PSNR[2]);
PSNR[0]+=temp_PSNR[0]; PSNR[0]+=temp_PSNR[0];
PSNR[1]+=temp_PSNR[1]; PSNR[1]+=temp_PSNR[1];

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file encoder.c /*! \file encoder.c
@ -1061,7 +1061,7 @@ void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t d
{ {
int16_t val = block[i++]+pred[x+y*pred_stride]; int16_t val = block[i++]+pred[x+y*pred_stride];
//ToDo: support 10+bits //ToDo: support 10+bits
recbase[x+y*recbase_stride] = (uint8_t)CLIP(0,255,val); recbase[x+y*recbase_stride] = (uint8_t)(val&0xff);//CLIP(0,255,val);
} }
} }
/* END RECONTRUCTION */ /* END RECONTRUCTION */

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file encoder.h /*! \file encoder.h
@ -87,6 +87,7 @@ typedef struct
int32_t split[4]; int32_t split[4];
} transform_info; } transform_info;
void init_tables(void);
void init_encoder_control(encoder_control* control,bitstream* output); void init_encoder_control(encoder_control* control,bitstream* output);
void init_encoder_input(encoder_input* input,FILE* inputfile, int32_t width, int32_t height); void init_encoder_input(encoder_input* input,FILE* inputfile, int32_t width, int32_t height);
void encode_one_frame(encoder_control* encoder); void encode_one_frame(encoder_control* encoder);
@ -102,7 +103,6 @@ void encode_lastSignificantXY(encoder_control* encoder,uint8_t lastpos_x, uint8_
void encode_CoeffNxN(encoder_control* encoder,int16_t* coeff, uint8_t width, uint8_t type, int8_t scanMode); void encode_CoeffNxN(encoder_control* encoder,int16_t* coeff, uint8_t width, uint8_t type, int8_t scanMode);
void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t depth); void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t depth);
void encode_transform_coeff(encoder_control* encoder,transform_info* ti,int8_t depth, int8_t trDepth); void encode_transform_coeff(encoder_control* encoder,transform_info* ti,int8_t depth, int8_t trDepth);
void init_tables(void);
static uint32_t* g_auiSigLastScan[3][7]; static uint32_t* g_auiSigLastScan[3][7];
int8_t g_aucConvertToBit[LCU_WIDTH+1]; int8_t g_aucConvertToBit[LCU_WIDTH+1];
@ -146,8 +146,8 @@ static const uint8_t g_toBits[129] =
#define TOBITS(len) g_toBits[len] #define TOBITS(len) g_toBits[len]
#define C1FLAG_NUMBER 8 // maximum number of largerThan1 flag coded in one chunk #define C1FLAG_NUMBER 8 /*!< maximum number of largerThan1 flag coded in one chunk */
#define C2FLAG_NUMBER 1 // maximum number of largerThan2 flag coded in one chunk #define C2FLAG_NUMBER 1 /*!< maximum number of largerThan2 flag coded in one chunk */
enum COEFF_SCAN_TYPE enum COEFF_SCAN_TYPE
{ {

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file filter.c /*! \file filter.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems 2012. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing 2013.
*/ */
/*! \file filter.h /*! \file filter.h

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file global.h /*! \file global.h

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file intra.c /*! \file intra.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file intra.h /*! \file intra.h

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file nal.c /*! \file nal.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems 2012. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing 2013.
*/ */
/*! \file nal.h /*! \file nal.h

View file

@ -1,6 +1,6 @@
/** /**
* Part of HEVC Encoder * Part of HEVC Encoder
* By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file picture.c /*! \file picture.c
@ -70,7 +70,7 @@
//allocate space for the new list //allocate space for the new list
list->pics = (picture**)malloc(sizeof(picture*)*size); list->pics = (picture**)malloc(sizeof(picture*)*size);
//Copy everthing from the old list to the new if needed. //Copy everything from the old list to the new if needed.
if(old_pics != NULL) if(old_pics != NULL)
{ {
for(i = 0; i < list->used_size; i++) for(i = 0; i < list->used_size; i++)

View file

@ -1,6 +1,6 @@
/** /**
* Part of HEVC Encoder * Part of HEVC Encoder
* By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file picture.h /*! \file picture.h

24
src/search.c Normal file
View file

@ -0,0 +1,24 @@
/**
* HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/
/*! \file search.c
\brief searching
\author Marko Viitanen
\date 2013-04
Search related functions
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "config.h"
#include "bitstream.h"
#include "picture.h"
#include "cabac.h"
#include "encoder.h"
#include "filter.h"

18
src/search.h Normal file
View file

@ -0,0 +1,18 @@
/**
* HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing 2013.
*/
/*! \file search.h
\brief searching
\author Marko Viitanen
\date 2013-04
Search related function headers
*/
#ifndef __SEARCH_H
#define __SEARCH_H
#endif

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file transform.c /*! \file transform.c

View file

@ -1,6 +1,6 @@
/** /**
* HEVC Encoder * HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file transform.h /*! \file transform.h

View file

@ -3,6 +3,8 @@ bits 64
section .code section .code
global cpuId64 global cpuId64
;void __cdecl cpuId64(int* ecx, int *edx );
cpuId64: cpuId64:
mov r8, rcx ; pointer to ecx-output mov r8, rcx ; pointer to ecx-output
mov r9, rdx ; pointer to edx-output mov r9, rdx ; pointer to edx-output

View file

@ -1,6 +1,6 @@
/** /**
* Part of HEVC Encoder * Part of HEVC Encoder
* By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file test.h /*! \file test.h

View file

@ -1,13 +1,16 @@
; Function to get CPUID for identifying CPU capabilities ; Function to get CPUID for identifying CPU capabilities
bits 32 bits 32
global _cpuId section .code
global cpuId32
_cpuId: ;void __cdecl cpuId(int* ecx, int *edx );
cpuId32:
mov eax,1 mov eax,1
cpuid cpuid
mov eax, dword [esp+4] mov eax, dword [esp+4] ; pointer to ecx-output, pushed second to the stack
mov dword [eax], ecx mov dword [eax], ecx
mov eax, dword [esp+8] mov eax, dword [esp+8] ; pointer to edx-output, pushed first to the stack
mov dword [eax], edx mov dword [eax], edx
mov eax,0 mov eax,0
ret ret

View file

@ -1,6 +1,6 @@
/** /**
* Part of HEVC Encoder * Part of HEVC Encoder
* By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems. * By Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/ */
/*! \file test.h /*! \file test.h
@ -13,7 +13,7 @@
#ifndef _TEST_H_ #ifndef _TEST_H_
#define _TEST_H_ #define _TEST_H_
void __cdecl cpuId(int* ecx, int *edx ); void __cdecl cpuId32(int* ecx, int *edx );
#endif #endif