KFR_SINTRIN expression_pointer<T> make_kfilter(int samplerate) { const biquad_params<T> bq[] = { biquad_highshelf(T(1681.81 / samplerate), T(+4.0)), biquad_highpass(T(38.1106678246655 / samplerate), T(0.5)).normalized_all() }; return to_pointer(biquad(bq, placeholder<T>())); }
void process_packet(const T* src) { substitute(m_kfilter, to_pointer(make_univector(src, m_packet_size) * m_input_gain)); const T filtered_sum_of_squares = sumsqr(truncate(m_kfilter, m_packet_size)); m_short_sum_of_squares.ringbuf_write(m_short_sum_of_squares_cursor, filtered_sum_of_squares); m_momentary_sum_of_squares.ringbuf_write(m_momentary_sum_of_squares_cursor, filtered_sum_of_squares); }
RefVector(InputIterator begin, InputIterator end) : pointers_() { size_type size = std::distance(begin, end); pointers_.reserve(size); for (; begin != end; ++begin) pointers_.push_back(to_pointer(begin)); }
/* * Class: com_asakusafw_m3bp_mirror_jni_FlowGraphMirrorImpl * Method: addVertex0 * Signature: (JLjava/lang/String;)J */ JNIEXPORT jlong JNICALL Java_com_asakusafw_m3bp_mirror_jni_FlowGraphMirrorImpl_addVertex0 (JNIEnv *env, jclass clazz, jlong _self, jstring _name) { try { FlowGraphMirror *self = (FlowGraphMirror *) _self; const char *name = env->GetStringUTFChars(_name, 0); VertexMirror *vertex = self->vertex(std::string(name)); env->ReleaseStringUTFChars(_name, name); return to_pointer(vertex); } catch (JavaException &e) { e.rethrow(env); return 0; } catch (std::exception &e) { handle_native_exception(env, e); return 0; } }
CMT_NOINLINE expression_pointer<T> window(size_t size, window_type type, identity<T> win_param, window_symmetry symmetry = window_symmetry::symmetric, ctype_t<T> = ctype_t<T>()) { return cswitch( cvals_t<window_type, window_type::rectangular, window_type::triangular, window_type::bartlett, window_type::cosine, window_type::hann, window_type::bartlett_hann, window_type::hamming, window_type::bohman, window_type::blackman, window_type::blackman_harris, window_type::kaiser, window_type::flattop, window_type::gaussian, window_type::lanczos>(), type, [size, win_param, symmetry](auto win) { constexpr window_type window = val_of(decltype(win)()); return to_pointer( typename internal::window_by_type<window>::template type<T>(size, win_param, symmetry)); }, fn_generic::returns<expression_pointer<T>>()); }
/** * @brief Allocate a contiguous range of blocks * @brief heap_state Pointer to the heap state related to the heap to use. * @brief block The starting block from where to originate the allocation. * @brief blocks The number of blocks to allocate. * @return A pointer to the first byte of the allocated blocks, or NULL. */ static void* allocate(heap_state_t* heap_state, register int32_t block, register int32_t blocks) { void* pointer=NULL; if ( valid(heap_state,block) ) { for(register int32_t n=0; n < blocks; n++) /* flag blocks in use... */ { set(heap_state,block+n); resetLast(heap_state,block+n); ++heap_state->heap_blocks_allocated; } setLast(heap_state,(block+blocks)-1); pointer = to_pointer(heap_state,block); /* fetch the base pointer */ notify_heap_alloc(blocks); } return pointer; }
// store information about Lua value present at the 'index' inside 'v' struct void lua_details::capture_value(lua_State* L, Value& v, int index, int recursive, size_t table_size_limit) { int i= index; char buf[100]; // temp output for fast number/pointer formatting int t= lua_type(L, i); switch (t) { case LUA_TSTRING: v.type = String; v.value = lua_tostring(L, i); break; case LUA_TBOOLEAN: v.type = Bool; v.value = lua_toboolean(L, i) ? "true" : "false"; break; case LUA_TNUMBER: v.type = Number; sprintf(buf, "%g", static_cast<double>(lua_tonumber(L, i))); v.value = buf; break; case LUA_TLIGHTUSERDATA: v.type = LightUserData; v.value = to_pointer(buf, lua_topointer(L, i)); break; case LUA_TUSERDATA: v.type = UserData; v.value = to_pointer(buf, lua_topointer(L, i)); break; case LUA_TTABLE: v.type = Table; if (recursive > 0) { TableInfo t; list_table(L, i, t, recursive - 1); v.value = table_as_string(t, table_size_limit); } else v.value = to_pointer(buf, lua_topointer(L, i)); break; case LUA_TFUNCTION: v.type = Function; v.value = to_pointer(buf, lua_topointer(L, i)); break; case LUA_TTHREAD: v.type = Thread; v.value = to_pointer(buf, lua_topointer(L, i)); break; case LUA_TNIL: v.type = Nil; v.value.clear(); break; default: v.type = None; v.value.clear(); break; } v.type_name = lua_typename(L, t); }