mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
update to libvpx b46243d from repo https://chromium.googlesource.com/webm/libvpx
This commit is contained in:
@@ -51,7 +51,7 @@ static std::string GetDataPath() {
|
||||
#undef TO_STRING
|
||||
#undef STRINGIFY
|
||||
|
||||
inline FILE *OpenTestDataFile(const std::string& file_name) {
|
||||
inline FILE *OpenTestDataFile(const std::string &file_name) {
|
||||
const std::string path_to_source = GetDataPath() + "/" + file_name;
|
||||
return fopen(path_to_source.c_str(), "rb");
|
||||
}
|
||||
@@ -76,21 +76,15 @@ static FILE *GetTempOutFile(std::string *file_name) {
|
||||
|
||||
class TempOutFile {
|
||||
public:
|
||||
TempOutFile() {
|
||||
file_ = GetTempOutFile(&file_name_);
|
||||
}
|
||||
TempOutFile() { file_ = GetTempOutFile(&file_name_); }
|
||||
~TempOutFile() {
|
||||
CloseFile();
|
||||
if (!file_name_.empty()) {
|
||||
EXPECT_EQ(0, remove(file_name_.c_str()));
|
||||
}
|
||||
}
|
||||
FILE *file() {
|
||||
return file_;
|
||||
}
|
||||
const std::string& file_name() {
|
||||
return file_name_;
|
||||
}
|
||||
FILE *file() { return file_; }
|
||||
const std::string &file_name() { return file_name_; }
|
||||
|
||||
protected:
|
||||
void CloseFile() {
|
||||
@@ -134,14 +128,10 @@ class VideoSource {
|
||||
virtual unsigned int limit() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class DummyVideoSource : public VideoSource {
|
||||
public:
|
||||
DummyVideoSource()
|
||||
: img_(NULL),
|
||||
limit_(100),
|
||||
width_(80),
|
||||
height_(64),
|
||||
: img_(NULL), limit_(100), width_(80), height_(64),
|
||||
format_(VPX_IMG_FMT_I420) {
|
||||
ReallocImage();
|
||||
}
|
||||
@@ -158,9 +148,7 @@ class DummyVideoSource : public VideoSource {
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual vpx_image_t *img() const {
|
||||
return (frame_ < limit_) ? img_ : NULL;
|
||||
}
|
||||
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
|
||||
|
||||
// Models a stream where Timebase = 1/FPS, so pts == frame.
|
||||
virtual vpx_codec_pts_t pts() const { return frame_; }
|
||||
@@ -168,7 +156,7 @@ class DummyVideoSource : public VideoSource {
|
||||
virtual unsigned long duration() const { return 1; }
|
||||
|
||||
virtual vpx_rational_t timebase() const {
|
||||
const vpx_rational_t t = {1, 30};
|
||||
const vpx_rational_t t = { 1, 30 };
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -176,9 +164,7 @@ class DummyVideoSource : public VideoSource {
|
||||
|
||||
virtual unsigned int limit() const { return limit_; }
|
||||
|
||||
void set_limit(unsigned int limit) {
|
||||
limit_ = limit;
|
||||
}
|
||||
void set_limit(unsigned int limit) { limit_ = limit; }
|
||||
|
||||
void SetSize(unsigned int width, unsigned int height) {
|
||||
if (width != width_ || height != height_) {
|
||||
@@ -196,7 +182,9 @@ class DummyVideoSource : public VideoSource {
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); }
|
||||
virtual void FillFrame() {
|
||||
if (img_) memset(img_->img_data, 0, raw_sz_);
|
||||
}
|
||||
|
||||
void ReallocImage() {
|
||||
vpx_img_free(img_);
|
||||
@@ -205,7 +193,7 @@ class DummyVideoSource : public VideoSource {
|
||||
}
|
||||
|
||||
vpx_image_t *img_;
|
||||
size_t raw_sz_;
|
||||
size_t raw_sz_;
|
||||
unsigned int limit_;
|
||||
unsigned int frame_;
|
||||
unsigned int width_;
|
||||
@@ -213,12 +201,10 @@ class DummyVideoSource : public VideoSource {
|
||||
vpx_img_fmt_t format_;
|
||||
};
|
||||
|
||||
|
||||
class RandomVideoSource : public DummyVideoSource {
|
||||
public:
|
||||
RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
|
||||
: rnd_(seed),
|
||||
seed_(seed) { }
|
||||
: rnd_(seed), seed_(seed) {}
|
||||
|
||||
protected:
|
||||
// Reset the RNG to get a matching stream for the second pass
|
||||
@@ -232,11 +218,11 @@ class RandomVideoSource : public DummyVideoSource {
|
||||
// than holding previous frames to encourage keyframes to be thrown.
|
||||
virtual void FillFrame() {
|
||||
if (img_) {
|
||||
if (frame_ % 30 < 15)
|
||||
for (size_t i = 0; i < raw_sz_; ++i)
|
||||
img_->img_data[i] = rnd_.Rand8();
|
||||
else
|
||||
if (frame_ % 30 < 15) {
|
||||
for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
|
||||
} else {
|
||||
memset(img_->img_data, 0, raw_sz_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user