mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Sync libsimplewebm with fe57fd3 (but not the libwebm sub-lib)
This is to get the colourspace information commit in, but it also performs a bit of cleanup regarding the entry in the thirdparty README. The reason libwebm wasn't synced is because it has a bunch of unmarked changes, and it'd be better if the person responsible untangled that as they may know what they did and why they did it. Given this, it might be a good idea to disconnect libwebm from the libsimplewebm code.
This commit is contained in:
parent
c7ba1e210e
commit
006f6f5ba1
11
thirdparty/README.md
vendored
11
thirdparty/README.md
vendored
@ -178,18 +178,21 @@ Files extracted from upstream source:
|
||||
## libsimplewebm
|
||||
|
||||
- Upstream: https://github.com/zaps166/libsimplewebm
|
||||
- Version: git (05cfdc2, 2016)
|
||||
- License: MIT, BSD-3-Clause
|
||||
- Version: git (fe57fd3, 2019)
|
||||
- License: MIT (main), BSD-3-Clause (libwebm)
|
||||
|
||||
This contains libwebm, but the version in use is updated from the one used by libsimplewebm,
|
||||
and may have *unmarked* alterations from that.
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
||||
TODO.
|
||||
- all the .cpp, .hpp files in the main folder except `example.cpp`
|
||||
- LICENSE
|
||||
|
||||
Important: Some files have Godot-made changes.
|
||||
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
|
||||
comments.
|
||||
|
||||
|
||||
## libtheora
|
||||
|
||||
- Upstream: https://www.theora.org
|
||||
|
@ -122,6 +122,7 @@ bool OpusVorbisDecoder::getPCMS16(WebMFrame &frame, short *buffer, int &numOutSa
|
||||
return false;
|
||||
}
|
||||
|
||||
// -- GODOT begin --
|
||||
bool OpusVorbisDecoder::getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples) {
|
||||
if (m_vorbis) {
|
||||
m_vorbis->op.packet = frame.buffer;
|
||||
@ -158,6 +159,7 @@ bool OpusVorbisDecoder::getPCMF(WebMFrame &frame, float *buffer, int &numOutSamp
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
bool OpusVorbisDecoder::openVorbis(const WebMDemuxer &demuxer)
|
||||
{
|
||||
|
@ -44,8 +44,10 @@ public:
|
||||
{
|
||||
return m_numSamples;
|
||||
}
|
||||
bool getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples);
|
||||
bool getPCMS16(WebMFrame &frame, short *buffer, int &numOutSamples);
|
||||
// -- GODOT begin --
|
||||
bool getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples);
|
||||
// -- GODOT end --
|
||||
|
||||
private:
|
||||
bool openVorbis(const WebMDemuxer &demuxer);
|
||||
|
14
thirdparty/libsimplewebm/VPXDecoder.cpp
vendored
14
thirdparty/libsimplewebm/VPXDecoder.cpp
vendored
@ -33,7 +33,8 @@
|
||||
VPXDecoder::VPXDecoder(const WebMDemuxer &demuxer, unsigned threads) :
|
||||
m_ctx(NULL),
|
||||
m_iter(NULL),
|
||||
m_delay(0)
|
||||
m_delay(0),
|
||||
m_last_space(VPX_CS_UNKNOWN)
|
||||
{
|
||||
if (threads > 8)
|
||||
threads = 8;
|
||||
@ -86,6 +87,11 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
|
||||
IMAGE_ERROR err = NO_FRAME;
|
||||
if (vpx_image_t *img = vpx_codec_get_frame(m_ctx, &m_iter))
|
||||
{
|
||||
// It seems to be a common problem that UNKNOWN comes up a lot, yet FFMPEG is somehow getting accurate colour-space information.
|
||||
// After checking FFMPEG code, *they're* getting colour-space information, so I'm assuming something like this is going on.
|
||||
// It appears to work, at least.
|
||||
if (img->cs != VPX_CS_UNKNOWN)
|
||||
m_last_space = img->cs;
|
||||
if ((img->fmt & VPX_IMG_FMT_PLANAR) && !(img->fmt & (VPX_IMG_FMT_HAS_ALPHA | VPX_IMG_FMT_HIGHBITDEPTH)))
|
||||
{
|
||||
if (img->stride[0] && img->stride[1] && img->stride[2])
|
||||
@ -95,6 +101,7 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
|
||||
|
||||
image.w = img->d_w;
|
||||
image.h = img->d_h;
|
||||
image.cs = m_last_space;
|
||||
image.chromaShiftW = img->x_chroma_shift;
|
||||
image.chromaShiftH = img->y_chroma_shift;
|
||||
|
||||
@ -119,7 +126,9 @@ VPXDecoder::IMAGE_ERROR VPXDecoder::getImage(Image &image)
|
||||
|
||||
/**/
|
||||
|
||||
// -- GODOT begin --
|
||||
#if 0
|
||||
// -- GODOT end --
|
||||
|
||||
static inline int ceilRshift(int val, int shift)
|
||||
{
|
||||
@ -139,4 +148,7 @@ int VPXDecoder::Image::getHeight(int plane) const
|
||||
return ceilRshift(h, chromaShiftH);
|
||||
}
|
||||
|
||||
// -- GODOT begin --
|
||||
#endif
|
||||
// -- GODOT end --
|
||||
|
||||
|
6
thirdparty/libsimplewebm/VPXDecoder.hpp
vendored
6
thirdparty/libsimplewebm/VPXDecoder.hpp
vendored
@ -37,12 +37,17 @@ public:
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
// -- GODOT begin --
|
||||
#if 0
|
||||
// -- GODOT end --
|
||||
int getWidth(int plane) const;
|
||||
int getHeight(int plane) const;
|
||||
// -- GODOT begin --
|
||||
#endif
|
||||
// -- GODOT end --
|
||||
|
||||
int w, h;
|
||||
int cs;
|
||||
int chromaShiftW, chromaShiftH;
|
||||
unsigned char *planes[3];
|
||||
int linesize[3];
|
||||
@ -75,6 +80,7 @@ private:
|
||||
vpx_codec_ctx *m_ctx;
|
||||
const void *m_iter;
|
||||
int m_delay;
|
||||
int m_last_space;
|
||||
};
|
||||
|
||||
#endif // VPXDECODER_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user