summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author20kdc <asdd2808@gmail.com>2019-02-21 20:36:43 +0000
committer20kdc <asdd2808@gmail.com>2019-02-21 20:43:41 +0000
commit006f6f5ba1df4f47f59a03b8eba3d4782c956a6b (patch)
tree7be345e0888090584191d89432090c6ba80a36ad
parentc7ba1e210e4148dbb2ab5cb3322a0fc9c4dce2d7 (diff)
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.
-rw-r--r--thirdparty/README.md11
-rw-r--r--thirdparty/libsimplewebm/OpusVorbisDecoder.cpp2
-rw-r--r--thirdparty/libsimplewebm/OpusVorbisDecoder.hpp4
-rw-r--r--thirdparty/libsimplewebm/VPXDecoder.cpp14
-rw-r--r--thirdparty/libsimplewebm/VPXDecoder.hpp6
5 files changed, 31 insertions, 6 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 738835c70a..f36b53f1e3 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -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
diff --git a/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp b/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
index c9e71eb733..b5824b17be 100644
--- a/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
+++ b/thirdparty/libsimplewebm/OpusVorbisDecoder.cpp
@@ -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)
{
diff --git a/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp b/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
index b7619d6a25..f285b3fbd6 100644
--- a/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
+++ b/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
@@ -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);
diff --git a/thirdparty/libsimplewebm/VPXDecoder.cpp b/thirdparty/libsimplewebm/VPXDecoder.cpp
index 3f77b8f5cd..e2606f83ba 100644
--- a/thirdparty/libsimplewebm/VPXDecoder.cpp
+++ b/thirdparty/libsimplewebm/VPXDecoder.cpp
@@ -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 --
+
diff --git a/thirdparty/libsimplewebm/VPXDecoder.hpp b/thirdparty/libsimplewebm/VPXDecoder.hpp
index 6108395871..5071b069cb 100644
--- a/thirdparty/libsimplewebm/VPXDecoder.hpp
+++ b/thirdparty/libsimplewebm/VPXDecoder.hpp
@@ -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