libbpg-0.9.6
This commit is contained in:
parent
3035b41edf
commit
35a8402710
248 changed files with 232891 additions and 100 deletions
25
x265/source/profile/CMakeLists.txt
Normal file
25
x265/source/profile/CMakeLists.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
# vim: syntax=cmake
|
||||
|
||||
option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
|
||||
if(ENABLE_PPA)
|
||||
add_definitions(-DENABLE_PPA)
|
||||
add_subdirectory(PPA)
|
||||
list(APPEND PLATFORM_LIBS PPA)
|
||||
if(UNIX)
|
||||
list(APPEND PLATFORM_LIBS dl)
|
||||
endif(UNIX)
|
||||
endif(ENABLE_PPA)
|
||||
|
||||
option(ENABLE_VTUNE "Enable Vtune profiling instrumentation" OFF)
|
||||
if(ENABLE_VTUNE)
|
||||
add_definitions(-DENABLE_VTUNE)
|
||||
add_subdirectory(vtune)
|
||||
list(APPEND PLATFORM_LIBS vtune)
|
||||
include_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/include)
|
||||
link_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/lib64)
|
||||
if(WIN32)
|
||||
list(APPEND PLATFORM_LIBS libittnotify.lib)
|
||||
else()
|
||||
list(APPEND PLATFORM_LIBS libittnotify.a dl)
|
||||
endif()
|
||||
endif(ENABLE_VTUNE)
|
1
x265/source/profile/PPA/CMakeLists.txt
Normal file
1
x265/source/profile/PPA/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
|||
add_library(PPA ppa.h ppaApi.h ppa.cpp ../cpuEvents.h)
|
147
x265/source/profile/PPA/ppa.cpp
Normal file
147
x265/source/profile/PPA/ppa.cpp
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (C) 2013 x265 project
|
||||
*
|
||||
* Authors: Steve Borho <steve@borho.org>
|
||||
*
|
||||
* 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 of the License, 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*
|
||||
* This program is also available under a commercial proprietary license.
|
||||
* For more information, contact us at license @ x265.com.
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(ENABLE_PPA)
|
||||
|
||||
#include "ppa.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PPA_REGISTER_CPU_EVENT2GROUP(x, y) # x, # y,
|
||||
#define CPU_EVENT(x) PPA_REGISTER_CPU_EVENT2GROUP(x, NoGroup)
|
||||
const char *PPACpuAndGroup[] =
|
||||
{
|
||||
#include "../cpuEvents.h"
|
||||
""
|
||||
};
|
||||
#undef CPU_EVENT
|
||||
#undef PPA_REGISTER_CPU_EVENT2GROUP
|
||||
|
||||
extern "C" {
|
||||
typedef ppa::Base *(FUNC_PPALibInit)(const char **, int);
|
||||
typedef void (FUNC_PPALibRelease)(ppa::Base* &);
|
||||
}
|
||||
|
||||
using namespace ppa;
|
||||
|
||||
static FUNC_PPALibRelease *_pfuncPpaRelease;
|
||||
ppa::Base *ppa::ppabase;
|
||||
|
||||
static void _ppaReleaseAtExit()
|
||||
{
|
||||
_pfuncPpaRelease(ppabase);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__)
|
||||
# ifdef UNICODE
|
||||
# define PPA_DLL_NAME L"ppa64.dll"
|
||||
# else
|
||||
# define PPA_DLL_NAME "ppa64.dll"
|
||||
# endif
|
||||
#else
|
||||
# ifdef UNICODE
|
||||
# define PPA_DLL_NAME L"ppa.dll"
|
||||
# else
|
||||
# define PPA_DLL_NAME "ppa.dll"
|
||||
# endif
|
||||
#endif // if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__)
|
||||
|
||||
void initializePPA(void)
|
||||
{
|
||||
if (ppabase)
|
||||
return;
|
||||
|
||||
HMODULE _ppaLibHandle = LoadLibrary(PPA_DLL_NAME);
|
||||
if (!_ppaLibHandle)
|
||||
return;
|
||||
|
||||
FUNC_PPALibInit *_pfuncPpaInit = (FUNC_PPALibInit*)GetProcAddress(_ppaLibHandle, "InitPpaUtil");
|
||||
_pfuncPpaRelease = (FUNC_PPALibRelease*)GetProcAddress(_ppaLibHandle, "DeletePpa");
|
||||
|
||||
if (!_pfuncPpaInit || !_pfuncPpaRelease)
|
||||
{
|
||||
FreeLibrary(_ppaLibHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
ppabase = _pfuncPpaInit(PPACpuAndGroup, PPACpuGroupNums);
|
||||
if (!ppabase)
|
||||
{
|
||||
FreeLibrary(_ppaLibHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
atexit(_ppaReleaseAtExit);
|
||||
}
|
||||
|
||||
#else /* linux & unix & cygwin */
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__)
|
||||
# define PPA_LIB_NAME "libppa64.so"
|
||||
#else
|
||||
# define PPA_LIB_NAME "libppa.so"
|
||||
#endif
|
||||
|
||||
void initializePPA(void)
|
||||
{
|
||||
if (ppabase)
|
||||
{
|
||||
printf("PPA: already initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void *_ppaDllHandle = dlopen(PPA_LIB_NAME, RTLD_LAZY);
|
||||
if (!_ppaDllHandle)
|
||||
{
|
||||
printf("PPA: Unable to load %s\n", PPA_LIB_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
FUNC_PPALibInit *_pfuncPpaInit = (FUNC_PPALibInit*)dlsym(_ppaDllHandle, "InitPpaUtil");
|
||||
_pfuncPpaRelease = (FUNC_PPALibRelease*)dlsym(_ppaDllHandle, "DeletePpa");
|
||||
|
||||
if (!_pfuncPpaInit || !_pfuncPpaRelease)
|
||||
{
|
||||
printf("PPA: Function bindings failed\n");
|
||||
dlclose(_ppaDllHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
ppabase = _pfuncPpaInit(PPACpuAndGroup, PPACpuGroupNums);
|
||||
if (!ppabase)
|
||||
{
|
||||
printf("PPA: Init failed\n");
|
||||
dlclose(_ppaDllHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
atexit(_ppaReleaseAtExit);
|
||||
}
|
||||
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
#endif /* defined(ENABLE_PPA) */
|
43
x265/source/profile/PPA/ppa.h
Normal file
43
x265/source/profile/PPA/ppa.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (C) 2013 x265 project
|
||||
*
|
||||
* Authors: Steve Borho <steve@borho.org>
|
||||
*
|
||||
* 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 of the License, 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*
|
||||
* This program is also available under a commercial proprietary license.
|
||||
* For more information, contact us at license @ x265.com.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef PPA_H
|
||||
#define PPA_H
|
||||
|
||||
/* declare enum list of users CPU events */
|
||||
#define CPU_EVENT(x) x,
|
||||
enum PPACpuEventEnum
|
||||
{
|
||||
#include "../cpuEvents.h"
|
||||
PPACpuGroupNums
|
||||
};
|
||||
#undef CPU_EVENT
|
||||
|
||||
#include "ppaApi.h"
|
||||
|
||||
void initializePPA();
|
||||
|
||||
#define PPA_INIT() initializePPA()
|
||||
#define PPAScopeEvent(e) ppa::ProfileScope ppaScope_(e)
|
||||
|
||||
#endif /* PPA_H */
|
70
x265/source/profile/PPA/ppaApi.h
Normal file
70
x265/source/profile/PPA/ppaApi.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (C) 2013 x265 project
|
||||
*
|
||||
* Authors: Steve Borho <steve@borho.org>
|
||||
*
|
||||
* 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 of the License, 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*
|
||||
* This program is also available under a commercial proprietary license.
|
||||
* For more information, contact us at license @ x265.com.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _PPA_API_H_
|
||||
#define _PPA_API_H_
|
||||
|
||||
namespace ppa {
|
||||
// PPA private namespace
|
||||
|
||||
typedef unsigned short EventID;
|
||||
typedef unsigned char GroupID;
|
||||
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Base() {}
|
||||
|
||||
virtual bool isEventFiltered(EventID eventId) const = 0;
|
||||
virtual bool configEventById(EventID eventId, bool filtered) const = 0;
|
||||
virtual int configGroupById(GroupID groupId, bool filtered) const = 0;
|
||||
virtual void configAllEvents(bool filtered) const = 0;
|
||||
virtual EventID registerEventByName(const char *pEventName) = 0;
|
||||
virtual GroupID registerGroupByName(const char *pGroupName) = 0;
|
||||
virtual EventID registerEventInGroup(const char *pEventName, GroupID groupId) = 0;
|
||||
virtual void triggerStartEvent(EventID eventId) = 0;
|
||||
virtual void triggerEndEvent(EventID eventId) = 0;
|
||||
virtual void triggerTidEvent(EventID eventId, unsigned int data) = 0;
|
||||
virtual void triggerDebugEvent(EventID eventId, unsigned int data0, unsigned int data1) = 0;
|
||||
|
||||
virtual EventID getEventId(int index) const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void init(const char **pNames, int eventCount) = 0;
|
||||
};
|
||||
|
||||
extern ppa::Base *ppabase;
|
||||
|
||||
struct ProfileScope
|
||||
{
|
||||
ppa::EventID id;
|
||||
|
||||
ProfileScope(int e) { if (ppabase) { id = ppabase->getEventId(e); ppabase->triggerStartEvent(id); } else id = 0; }
|
||||
~ProfileScope() { if (ppabase) ppabase->triggerEndEvent(id); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //_PPA_API_H_
|
11
x265/source/profile/cpuEvents.h
Normal file
11
x265/source/profile/cpuEvents.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
CPU_EVENT(frameRead)
|
||||
CPU_EVENT(bitstreamWrite)
|
||||
CPU_EVENT(frameThread)
|
||||
CPU_EVENT(encodeCTU)
|
||||
CPU_EVENT(filterCTURow)
|
||||
CPU_EVENT(slicetypeDecideEV)
|
||||
CPU_EVENT(prelookahead)
|
||||
CPU_EVENT(estCostSingle)
|
||||
CPU_EVENT(estCostCoop)
|
||||
CPU_EVENT(pmode)
|
||||
CPU_EVENT(pme)
|
2
x265/source/profile/vtune/CMakeLists.txt
Normal file
2
x265/source/profile/vtune/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
include_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/include)
|
||||
add_library(vtune vtune.h vtune.cpp ../cpuEvents.h)
|
58
x265/source/profile/vtune/vtune.cpp
Normal file
58
x265/source/profile/vtune/vtune.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (C) 2015 x265 project
|
||||
*
|
||||
* Authors: Steve Borho <steve@borho.org>
|
||||
*
|
||||
* 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 of the License, 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*
|
||||
* This program is also available under a commercial proprietary license.
|
||||
* For more information, contact us at license @ x265.com.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "vtune.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
|
||||
#define CPU_EVENT(x) #x,
|
||||
const char *stringNames[] =
|
||||
{
|
||||
#include "../cpuEvents.h"
|
||||
""
|
||||
};
|
||||
#undef CPU_EVENT
|
||||
|
||||
}
|
||||
|
||||
namespace X265_NS {
|
||||
|
||||
__itt_domain* domain;
|
||||
__itt_string_handle* taskHandle[NUM_VTUNE_TASKS];
|
||||
|
||||
void vtuneInit()
|
||||
{
|
||||
domain = __itt_domain_create("x265");
|
||||
for (size_t i = 0; i < sizeof(stringNames) / sizeof(const char *); i++)
|
||||
taskHandle[i] = __itt_string_handle_create(stringNames[i]);
|
||||
}
|
||||
|
||||
void vtuneSetThreadName(const char *name, int id)
|
||||
{
|
||||
char threadname[128];
|
||||
sprintf(threadname, "%s %d", name, id);
|
||||
__itt_thread_set_name(threadname);
|
||||
}
|
||||
|
||||
}
|
53
x265/source/profile/vtune/vtune.h
Normal file
53
x265/source/profile/vtune/vtune.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (C) 2015 x265 project
|
||||
*
|
||||
* Authors: Steve Borho <steve@borho.org>
|
||||
*
|
||||
* 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 of the License, 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*
|
||||
* This program is also available under a commercial proprietary license.
|
||||
* For more information, contact us at license @ x265.com.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef VTUNE_H
|
||||
#define VTUNE_H
|
||||
|
||||
#include "ittnotify.h"
|
||||
|
||||
namespace X265_NS {
|
||||
|
||||
#define CPU_EVENT(x) x,
|
||||
enum VTuneTasksEnum
|
||||
{
|
||||
#include "../cpuEvents.h"
|
||||
NUM_VTUNE_TASKS
|
||||
};
|
||||
#undef CPU_EVENT
|
||||
|
||||
extern __itt_domain* domain;
|
||||
extern __itt_string_handle* taskHandle[NUM_VTUNE_TASKS];
|
||||
|
||||
struct VTuneScopeEvent
|
||||
{
|
||||
VTuneScopeEvent(int e) { __itt_task_begin(domain, __itt_null, __itt_null, taskHandle[e]); }
|
||||
~VTuneScopeEvent() { __itt_task_end(domain); }
|
||||
};
|
||||
|
||||
void vtuneInit();
|
||||
void vtuneSetThreadName(const char *name, int id);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue