12 changed files with 11156 additions and 7 deletions
@ -0,0 +1,97 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
|
||||
#include "plPlanarImage.h" |
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static uint8_t Clip(int32_t val) { |
||||
if (val < 0) { |
||||
return 0; |
||||
} else if (val > 255) { |
||||
return 255; |
||||
} |
||||
return static_cast<uint8_t>(val); |
||||
} |
||||
|
||||
#define YG 74 /* static_cast<int8>(1.164 * 64 + 0.5) */ |
||||
|
||||
#define UB 127 /* min(63,static_cast<int8>(2.018 * 64)) */ |
||||
#define UG -25 /* static_cast<int8>(-0.391 * 64 - 0.5) */ |
||||
#define UR 0 |
||||
|
||||
#define VB 0 |
||||
#define VG -52 /* static_cast<int8>(-0.813 * 64 - 0.5) */ |
||||
#define VR 102 /* static_cast<int8>(1.596 * 64 + 0.5) */ |
||||
|
||||
// Bias
|
||||
#define BB UB * 128 + VB * 128 |
||||
#define BG UG * 128 + VG * 128 |
||||
#define BR UR * 128 + VR * 128 |
||||
|
||||
void plPlanarImage::Yuv420ToRgba(uint32_t w, uint32_t h, const int32_t* stride, uint8_t** planes, uint8_t* const dest) |
||||
{ |
||||
const uint8_t* y_src = planes[0]; |
||||
const uint8_t* u_src = planes[1]; |
||||
const uint8_t* v_src = planes[2]; |
||||
|
||||
for (uint32_t i = 0; i < h; ++i) |
||||
{ |
||||
for (uint32_t j = 0; j < w; ++j) |
||||
{ |
||||
size_t y_idx = stride[0] * i + j; |
||||
size_t u_idx = stride[1] * (i/2) + (j/2); |
||||
size_t v_idx = stride[2] * (i/2) + (j/2); |
||||
size_t dest_idx = w * i + j; |
||||
|
||||
int32_t y = static_cast<int32_t>(y_src[y_idx]); |
||||
int32_t u = static_cast<int32_t>(u_src[u_idx]); |
||||
int32_t v = static_cast<int32_t>(v_src[v_idx]); |
||||
int32_t y1 = (y - 16) * YG; |
||||
|
||||
dest[dest_idx*4+0] = Clip(((u * UB + v * VB) - (BB) + y1) >> 6); |
||||
dest[dest_idx*4+1] = Clip(((u * UG + v * VG) - (BG) + y1) >> 6); |
||||
dest[dest_idx*4+2] = Clip(((u * UR + v * VR) - (BR) + y1) >> 6); |
||||
dest[dest_idx*4+3] = 0xff; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools |
||||
Copyright (C) 2011 Cyan Worlds, Inc. |
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7 |
||||
|
||||
If you modify this Program, or any covered work, by linking or |
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, |
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent |
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK |
||||
(or a modified version of those libraries), |
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, |
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG |
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the |
||||
licensors of this Program grant you additional |
||||
permission to convey the resulting work. Corresponding Source for a |
||||
non-source form of such a combination shall include the source code for |
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered |
||||
work. |
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com |
||||
or by snail mail at: |
||||
Cyan Worlds, Inc. |
||||
14617 N Newport Hwy |
||||
Mead, WA 99021 |
||||
|
||||
*==LICENSE==*/ |
||||
|
||||
#ifndef _plPlanarImage_inc |
||||
#define _plPlanarImage_inc |
||||
|
||||
#include "HeadSpin.h" |
||||
|
||||
namespace plPlanarImage |
||||
{ |
||||
void Yuv420ToRgba(uint32_t w, uint32_t h, const int32_t* stride, uint8_t** planes, uint8_t* const dest); |
||||
}; |
||||
|
||||
#endif // _plPlanarImage_inc
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,128 @@
|
||||
// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
// tree. An additional intellectual property rights grant can be found
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
#include "mkvreader.hpp" |
||||
|
||||
#include <cassert> |
||||
|
||||
namespace mkvparser |
||||
{ |
||||
|
||||
MkvReader::MkvReader() : |
||||
m_file(NULL) |
||||
{ |
||||
} |
||||
|
||||
MkvReader::~MkvReader() |
||||
{ |
||||
Close(); |
||||
} |
||||
|
||||
int MkvReader::Open(const char* fileName) |
||||
{ |
||||
if (fileName == NULL) |
||||
return -1; |
||||
|
||||
if (m_file) |
||||
return -1; |
||||
|
||||
#ifdef WIN32 |
||||
const errno_t e = fopen_s(&m_file, fileName, "rb"); |
||||
|
||||
if (e) |
||||
return -1; //error
|
||||
#else |
||||
m_file = fopen(fileName, "rb"); |
||||
|
||||
if (m_file == NULL) |
||||
return -1; |
||||
#endif |
||||
|
||||
#ifdef WIN32 |
||||
int status = _fseeki64(m_file, 0L, SEEK_END); |
||||
|
||||
if (status) |
||||
return -1; //error
|
||||
|
||||
m_length = _ftelli64(m_file); |
||||
#else |
||||
fseek(m_file, 0L, SEEK_END); |
||||
m_length = ftell(m_file); |
||||
#endif |
||||
assert(m_length >= 0); |
||||
|
||||
#ifdef WIN32 |
||||
status = _fseeki64(m_file, 0L, SEEK_SET); |
||||
|
||||
if (status) |
||||
return -1; //error
|
||||
#else |
||||
fseek(m_file, 0L, SEEK_SET); |
||||
#endif |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
void MkvReader::Close() |
||||
{ |
||||
if (m_file != NULL) |
||||
{ |
||||
fclose(m_file); |
||||
m_file = NULL; |
||||
} |
||||
} |
||||
|
||||
int MkvReader::Length(long long* total, long long* available) |
||||
{ |
||||
if (m_file == NULL) |
||||
return -1; |
||||
|
||||
if (total) |
||||
*total = m_length; |
||||
|
||||
if (available) |
||||
*available = m_length; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int MkvReader::Read(long long offset, long len, unsigned char* buffer) |
||||
{ |
||||
if (m_file == NULL) |
||||
return -1; |
||||
|
||||
if (offset < 0) |
||||
return -1; |
||||
|
||||
if (len < 0) |
||||
return -1; |
||||
|
||||
if (len == 0) |
||||
return 0; |
||||
|
||||
if (offset >= m_length) |
||||
return -1; |
||||
|
||||
#ifdef WIN32 |
||||
const int status = _fseeki64(m_file, offset, SEEK_SET); |
||||
|
||||
if (status) |
||||
return -1; //error
|
||||
#else |
||||
fseek(m_file, offset, SEEK_SET); |
||||
#endif |
||||
|
||||
const size_t size = fread(buffer, 1, len, m_file); |
||||
|
||||
if (size < size_t(len)) |
||||
return -1; //error
|
||||
|
||||
return 0; //success
|
||||
} |
||||
|
||||
} //end namespace mkvparser
|
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
// tree. An additional intellectual property rights grant can be found
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
#ifndef MKVREADER_HPP |
||||
#define MKVREADER_HPP |
||||
|
||||
#include "mkvparser.hpp" |
||||
#include <cstdio> |
||||
|
||||
namespace mkvparser |
||||
{ |
||||
|
||||
class MkvReader : public IMkvReader |
||||
{ |
||||
MkvReader(const MkvReader&); |
||||
MkvReader& operator=(const MkvReader&); |
||||
public: |
||||
MkvReader(); |
||||
virtual ~MkvReader(); |
||||
|
||||
int Open(const char*); |
||||
void Close(); |
||||
bool IsOpen() const; |
||||
|
||||
virtual int Read(long long position, long length, unsigned char* buffer); |
||||
virtual int Length(long long* total, long long* available); |
||||
private: |
||||
long long m_length; |
||||
FILE* m_file; |
||||
}; |
||||
|
||||
} //end namespace mkvparser
|
||||
|
||||
#endif //MKVREADER_HPP
|
@ -0,0 +1,18 @@
|
||||
if(VPX_INCLUDE_DIR AND VPX_LIBRARY) |
||||
set(VPX_FIND_QUIETLY TRUE) |
||||
endif() |
||||
|
||||
find_path(VPX_INCLUDE_DIR vpx/vp8.h |
||||
/usr/local/include |
||||
/usr/include |
||||
) |
||||
|
||||
find_library(VPX_LIBRARY NAMES vpxmt vpx |
||||
PATHS /usr/local/lib /usr/lib |
||||
) |
||||
|
||||
# If everything has been found, we have movie support! |
||||
if (VPX_INCLUDE_DIR AND VPX_LIBRARY) |
||||
set(VPX_AVAILABLE TRUE) |
||||
add_definitions(-DVPX_AVAILABLE) |
||||
endif() |
Loading…
Reference in new issue