#include "filter.h"
+using namespace std;
+
#ifdef __SSE__
// For SSE, we set the denormals-as-zero flag instead.
float sn, cs;
float cutoff_freq = omega;
- cutoff_freq = std::min(cutoff_freq, (float)M_PI);
- cutoff_freq = std::max(cutoff_freq, 0.001f);
+ cutoff_freq = min(cutoff_freq, (float)M_PI);
+ cutoff_freq = max(cutoff_freq, 0.001f);
calcSinCos(cutoff_freq, &sn, &cs);
if (resonance <= 0) resonance = 0.001f;
we need to raise the answer to the Nth power.
*/
-std::complex<double> Filter::evaluate_transfer_function(float omega)
+complex<double> Filter::evaluate_transfer_function(float omega)
{
- std::complex<float> z = exp(std::complex<float>(0.0f, omega));
- std::complex<float> z2 = z * z;
- return std::pow((b0 * z2 + b1 * z + b2) / (1.0f * z2 + a1 * z + a2), filter_order);
+ complex<float> z = exp(complex<float>(0.0f, omega));
+ complex<float> z2 = z * z;
+ return pow((b0 * z2 + b1 * z + b2) / (1.0f * z2 + a1 * z + a2), filter_order);
}
void GLWidget::initializeGL()
{
- static std::once_flag flag;
- std::call_once(flag, [this]{
+ static once_flag flag;
+ call_once(flag, [this]{
global_mixer = new Mixer(QGLFormat::toSurfaceFormat(format()), global_flags.num_cards);
global_mainwindow->mixer_created(global_mixer);
global_mixer->start();
#include "httpd.h"
#include "timebase.h"
+using namespace std;
+
class QOpenGLContext;
class QSurface;
// Encode and add all audio frames up to and including the pts of this video frame.
for ( ;; ) {
int64_t audio_pts;
- std::vector<float> audio;
+ vector<float> audio;
{
unique_lock<mutex> lock(frame_queue_mutex);
frame_queue_nonempty.wait(lock, [this]{ return copy_thread_should_quit || !pending_audio_frames.empty(); });
// this is weird. but it seems to put a new frame onto the queue
void H264Encoder::storage_task_enqueue(storage_task task)
{
- std::unique_lock<std::mutex> lock(storage_task_queue_mutex);
+ unique_lock<mutex> lock(storage_task_queue_mutex);
storage_task_queue.push(move(task));
srcsurface_status[task.display_order % SURFACE_NUM] = SRC_SURFACE_IN_ENCODING;
storage_task_queue_changed.notify_all();
storage_task current;
{
// wait until there's an encoded frame
- std::unique_lock<std::mutex> lock(storage_task_queue_mutex);
+ unique_lock<mutex> lock(storage_task_queue_mutex);
storage_task_queue_changed.wait(lock, [this]{ return storage_thread_should_quit || !storage_task_queue.empty(); });
if (storage_thread_should_quit) return;
current = move(storage_task_queue.front());
save_codeddata(move(current));
{
- std::unique_lock<std::mutex> lock(storage_task_queue_mutex);
+ unique_lock<mutex> lock(storage_task_queue_mutex);
srcsurface_status[current.display_order % SURFACE_NUM] = SRC_SURFACE_FREE;
storage_task_queue_changed.notify_all();
}
memset(&pic_param, 0, sizeof(pic_param));
memset(&slice_param, 0, sizeof(slice_param));
- storage_thread = std::thread(&H264Encoder::storage_task_thread, this);
+ storage_thread = thread(&H264Encoder::storage_task_thread, this);
- copy_thread = std::thread([this]{
+ copy_thread = thread([this]{
//SDL_GL_MakeCurrent(window, context);
QOpenGLContext *context = create_context(this->surface);
eglBindAPI(EGL_OPENGL_API);
{
{
// Wait until this frame slot is done encoding.
- std::unique_lock<std::mutex> lock(storage_task_queue_mutex);
+ unique_lock<mutex> lock(storage_task_queue_mutex);
storage_task_queue_changed.wait(lock, [this]{ return storage_thread_should_quit || (srcsurface_status[current_storage_frame % SURFACE_NUM] == SRC_SURFACE_FREE); });
if (storage_thread_should_quit) return false;
}
return true;
}
-void H264Encoder::add_audio(int64_t pts, std::vector<float> audio)
+void H264Encoder::add_audio(int64_t pts, vector<float> audio)
{
{
unique_lock<mutex> lock(frame_queue_mutex);
frame_queue_nonempty.notify_all();
}
-void H264Encoder::end_frame(RefCountedGLsync fence, int64_t pts, const std::vector<RefCountedFrame> &input_frames)
+void H264Encoder::end_frame(RefCountedGLsync fence, int64_t pts, const vector<RefCountedFrame> &input_frames)
{
{
unique_lock<mutex> lock(frame_queue_mutex);
transition_btn1 = ui->transition_btn1;
transition_btn2 = ui->transition_btn2;
transition_btn3 = ui->transition_btn3;
- qRegisterMetaType<std::vector<std::string>>("std::vector<std::string>");
+ qRegisterMetaType<vector<string>>("std::vector<std::string>");
connect(ui->me_preview, &GLWidget::transition_names_updated, this, &MainWindow::set_transition_names);
qRegisterMetaType<Mixer::Output>("Mixer::Output");
}
// The previews will be constrained by the remaining height, and the width.
double preview_label_height = previews[0]->title_bar->geometry().height() + ui->preview_displays->spacing(); // Wrong spacing?
int preview_total_width = ui->preview_displays->geometry().width();
- double preview_height = std::min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * 9.0 / 16.0);
+ double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * 9.0 / 16.0);
remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing();
ui->vertical_layout->setStretch(0, lrintf(me_height));
ui->vertical_layout->setStretch(1, 0); // Don't stretch the audiostrip.
- ui->vertical_layout->setStretch(2, std::max<int>(1, remaining_height)); // Spacer.
+ ui->vertical_layout->setStretch(2, max<int>(1, remaining_height)); // Spacer.
ui->vertical_layout->setStretch(3, lrintf(preview_height + preview_label_height));
// Set the widths for the previews.
{
float m = fabs(samples[0]);
for (size_t i = 1; i < num_samples; ++i) {
- m = std::max(m, fabs(samples[i]));
+ m = max(m, fabs(samples[i]));
}
return m;
}
{
Frame vf;
- std::unique_lock<std::mutex> lock(freelist_mutex); // Meh.
+ unique_lock<mutex> lock(freelist_mutex); // Meh.
if (freelist.empty()) {
printf("Frame overrun (no more spare PBO frames), dropping frame!\n");
} else {
printf("%d bytes overflow after last (PBO) frame\n", int(frame.overflow));
}
- std::unique_lock<std::mutex> lock(freelist_mutex);
+ unique_lock<mutex> lock(freelist_mutex);
freelist.push(frame);
//--sumsum;
}
#include "stereocompressor.h"
+using namespace std;
+
namespace {
// Implement a less accurate but faster pow(x, y). We use the standard identity
if (fabs(*right_ptr) > peak_level) peak_level = float(fabs(*right_ptr));
if (peak_level > compr_level) {
- compr_level = std::min(compr_level * attack_increment, peak_level);
+ compr_level = min(compr_level * attack_increment, peak_level);
} else {
- compr_level = std::max(compr_level * release_increment, 0.0001f);
+ compr_level = max(compr_level * release_increment, 0.0001f);
}
float scalefactor_with_gain = compressor_knee(compr_level, threshold, inv_threshold, inv_ratio_minus_one, makeup_gain);
*right_ptr *= scalefactor_with_gain;
right_ptr += 2;
- peak_level = std::max(peak_level * peak_increment, 0.0001f);
+ peak_level = max(peak_level * peak_increment, 0.0001f);
}
// Store attenuation level for debug/visualization.
{
// Construct the C++ object and put it on the stack.
void *mem = lua_newuserdata(L, sizeof(T));
- new(mem) T(std::forward<Args>(args)...);
+ new(mem) T(forward<Args>(args)...);
// Look up the metatable named <class_name>, and set it on the new object.
luaL_getmetatable(L, class_name);
{
// Construct the pointer ot the C++ object and put it on the stack.
T **obj = (T **)lua_newuserdata(L, sizeof(T *));
- *obj = new T(std::forward<Args>(args)...);
+ *obj = new T(forward<Args>(args)...);
// Look up the metatable named <class_name>, and set it on the new object.
luaL_getmetatable(L, class_name);
return lua_toboolean(L, idx);
}
-std::string checkstdstring(lua_State *L, int index)
+string checkstdstring(lua_State *L, int index)
{
size_t len;
const char* cstr = lua_tolstring(L, index, &len);
- return std::string(cstr, len);
+ return string(cstr, len);
}
int EffectChain_new(lua_State* L)
int ImageInput_new(lua_State* L)
{
assert(lua_gettop(L) == 1);
- std::string filename = checkstdstring(L, 1);
+ string filename = checkstdstring(L, 1);
return wrap_lua_object_nonowned<ImageInput>(L, "ImageInput", filename);
}
{
assert(lua_gettop(L) == 3);
Effect *effect = (Effect *)get_effect(L, 1);
- std::string key = checkstdstring(L, 2);
+ string key = checkstdstring(L, 2);
float value = luaL_checknumber(L, 3);
if (!effect->set_float(key, value)) {
luaL_error(L, "Effect refused set_float(\"%s\", %d) (invalid key?)", key.c_str(), int(value));
{
assert(lua_gettop(L) == 3);
Effect *effect = (Effect *)get_effect(L, 1);
- std::string key = checkstdstring(L, 2);
+ string key = checkstdstring(L, 2);
float value = luaL_checknumber(L, 3);
if (!effect->set_int(key, value)) {
luaL_error(L, "Effect refused set_int(\"%s\", %d) (invalid key?)", key.c_str(), int(value));
{
assert(lua_gettop(L) == 5);
Effect *effect = (Effect *)get_effect(L, 1);
- std::string key = checkstdstring(L, 2);
+ string key = checkstdstring(L, 2);
float v[3];
v[0] = luaL_checknumber(L, 3);
v[1] = luaL_checknumber(L, 4);
{
assert(lua_gettop(L) == 6);
Effect *effect = (Effect *)get_effect(L, 1);
- std::string key = checkstdstring(L, 2);
+ string key = checkstdstring(L, 2);
float v[4];
v[0] = luaL_checknumber(L, 3);
v[1] = luaL_checknumber(L, 4);
return chain;
}
-std::string Theme::get_channel_name(unsigned channel)
+string Theme::get_channel_name(unsigned channel)
{
unique_lock<mutex> lock(m);
lua_getglobal(L, "channel_name");
exit(1);
}
- std::string ret = lua_tostring(L, -1);
+ string ret = lua_tostring(L, -1);
lua_pop(L, 1);
assert(lua_gettop(L) == 0);
return ret;
assert(lua_gettop(L) == 0);
}
-std::vector<std::string> Theme::get_transition_names(float t)
+vector<string> Theme::get_transition_names(float t)
{
unique_lock<mutex> lock(m);
lua_getglobal(L, "get_transitions");
exit(1);
}
- std::vector<std::string> ret;
+ vector<string> ret;
lua_pushnil(L);
while (lua_next(L, -2) != 0) {
ret.push_back(lua_tostring(L, -1));
}
int y = lrintf(height * (level_lu - min_level) / (max_level - min_level));
- y = std::max(y, 0);
- y = std::min(y, height - 1);
+ y = max(y, 0);
+ y = min(y, height - 1);
return y;
}
int max_y = lufs_to_pos(level, height) - 1;
painter.fillRect(margin, min_y, width - 2 * margin, max_y - min_y, off);
- int min_draw_y = std::max(min_y, min_on_y);
- int max_draw_y = std::min(max_y, max_on_y);
+ int min_draw_y = max(min_y, min_on_y);
+ int max_draw_y = min(max_y, max_on_y);
if (min_draw_y < max_draw_y) {
painter.fillRect(margin, min_draw_y, width - 2 * margin, max_draw_y - min_draw_y, on);
}