hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
a0f4b36f1c500051c8d0e46aa197fc94a85052d0
14,731
cpp
C++
test/iterator/iterator.cpp
bmanga/cmcstl2
0d9fc51a4ede0d36ddf664be55289aa34ca48560
[ "MIT" ]
1
2019-04-22T05:53:46.000Z
2019-04-22T05:53:46.000Z
test/iterator/iterator.cpp
bmanga/cmcstl2
0d9fc51a4ede0d36ddf664be55289aa34ca48560
[ "MIT" ]
null
null
null
test/iterator/iterator.cpp
bmanga/cmcstl2
0d9fc51a4ede0d36ddf664be55289aa34ca48560
[ "MIT" ]
null
null
null
// cmcstl2 - A concept-enabled C++ standard library // // Copyright Casey Carter 2015 // Copyright Eric Niebler 2015 // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Project home: https://github.com/caseycarter/cmcstl2 // #include <cstring> #include <iostream> #include <stl2/iterator.hpp> #include <stl2/memory.hpp> #include <stl2/detail/raw_ptr.hpp> #include "../simple_test.hpp" namespace ranges = __stl2; template<class T> struct reference_wrapper { ranges::detail::raw_ptr<T> ptr_; reference_wrapper() = default; reference_wrapper(T& t) noexcept : ptr_{std::addressof(t)} {} reference_wrapper(T&&) = delete; T& get() const noexcept { return *ptr_; } reference_wrapper & operator=(const T& t) noexcept(std::is_nothrow_copy_assignable<T>::value) { get() = t; return *this; } reference_wrapper & operator=(T&& t) noexcept(std::is_nothrow_move_assignable<T>::value) { get() = std::move(t); return *this; } reference_wrapper const& operator=(const T& t) const noexcept(std::is_nothrow_copy_assignable<T>::value) { get() = t; return *this; } reference_wrapper const& operator=(T&& t) const noexcept(std::is_nothrow_move_assignable<T>::value) { get() = std::move(t); return *this; } operator T&() const noexcept { return get(); } }; template<class T, std::size_t N> struct array { T e_[N]; using reference = reference_wrapper<T>; using const_reference = reference_wrapper<const T>; reference operator[](const std::size_t n) noexcept { return {e_[n]}; } const_reference operator[](const std::size_t n) const noexcept { return {e_[n]}; } struct iterator { using iterator_category = ranges::random_access_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = T; T* ptr_; iterator() = default; iterator(T* p) noexcept : ptr_{p} {} reference operator*() const noexcept { STL2_EXPECT(ptr_); return {*ptr_}; } T* operator->() const noexcept requires std::is_class<T>::value || std::is_union<T>::value { STL2_EXPECT(ptr_); return ptr_; } iterator& operator++() noexcept { ++ptr_; return *this; } iterator operator++(int) noexcept { auto tmp = *this; ++*this; return tmp; } bool operator==(const iterator& other) const noexcept { return ptr_ == other.ptr_; } bool operator!=(const iterator& other) const noexcept { return !(*this == other); } iterator operator+(std::ptrdiff_t n) const noexcept { return {ptr_ + n}; } friend T&& iter_move(iterator i) noexcept { //std::cout << "iter_move(" << static_cast<void*>(i.ptr_) << ")\n"; STL2_EXPECT(i.ptr_); return static_cast<T&&>(*i.ptr_); } }; iterator begin() { return {&e_[0]}; } iterator end() { return {&e_[0] + N}; } }; enum class category { none, output, input, forward, bidirectional, random_access, contiguous }; std::ostream& operator<<(std::ostream& sout, category c) { switch(c) { case category::output: return sout << "category::output"; case category::input: return sout << "category::input"; case category::forward: return sout << "category::forward"; case category::bidirectional: return sout << "category::bidirectional"; case category::random_access: return sout << "category::random_access"; case category::contiguous: return sout << "category::contiguous"; default: return sout << "category::none"; } } template<class> constexpr category iterator_dispatch() { return category::none; } template<ranges::OutputIterator<const int&> I> requires !ranges::InputIterator<I> constexpr category iterator_dispatch() { return category::output; } template<ranges::InputIterator> constexpr category iterator_dispatch() { return category::input; } template<ranges::ForwardIterator> constexpr category iterator_dispatch() { return category::forward; } template<ranges::BidirectionalIterator> constexpr category iterator_dispatch() { return category::bidirectional; } template<ranges::RandomAccessIterator> constexpr category iterator_dispatch() { return category::random_access; } template<ranges::ContiguousIterator> constexpr category iterator_dispatch() { return category::contiguous; } template<class C, bool EC, class R = int&> struct arbitrary_iterator { using difference_type = std::ptrdiff_t; arbitrary_iterator& operator*(); arbitrary_iterator& operator=(std::remove_reference_t<R>); arbitrary_iterator& operator++(); arbitrary_iterator& operator++(int); bool operator==(arbitrary_iterator) const requires EC; bool operator!=(arbitrary_iterator) const requires EC; }; template<ranges::DerivedFrom<ranges::input_iterator_tag> C, bool EC, class R> struct arbitrary_iterator<C, EC, R> { using iterator_category = C; using value_type = std::remove_reference_t<R>; using difference_type = std::ptrdiff_t; R operator*() const; arbitrary_iterator& operator++(); arbitrary_iterator operator++(int); bool operator==(arbitrary_iterator) const requires EC || ranges::DerivedFrom<C, ranges::forward_iterator_tag>; bool operator!=(arbitrary_iterator) const requires EC || ranges::DerivedFrom<C, ranges::forward_iterator_tag>; arbitrary_iterator& operator--() requires ranges::DerivedFrom<C, ranges::bidirectional_iterator_tag>; arbitrary_iterator operator--(int) requires ranges::DerivedFrom<C, ranges::bidirectional_iterator_tag>; bool operator<(arbitrary_iterator) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; bool operator>(arbitrary_iterator) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; bool operator<=(arbitrary_iterator) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; bool operator>=(arbitrary_iterator) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; arbitrary_iterator& operator+=(difference_type) requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; arbitrary_iterator& operator-=(difference_type) requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; arbitrary_iterator operator-(difference_type) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; difference_type operator-(arbitrary_iterator) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; value_type& operator[](difference_type) const requires ranges::DerivedFrom<C, ranges::random_access_iterator_tag>; }; template<ranges::DerivedFrom<ranges::random_access_iterator_tag> C, bool B, class R> arbitrary_iterator<C, B, R> operator+( arbitrary_iterator<C, B, R>, typename arbitrary_iterator<C, B, R>::difference_type); template<ranges::DerivedFrom<ranges::random_access_iterator_tag> C, bool B, class R> arbitrary_iterator<C, B, R> operator+( typename arbitrary_iterator<C, B, R>::difference_type, arbitrary_iterator<C, B, R>); void test_iterator_dispatch() { CHECK(iterator_dispatch<void>() == category::none); static_assert(ranges::ContiguousIterator<int*>); CHECK(iterator_dispatch<int*>() == category::contiguous); { static_assert(ranges::Readable<int* const>); } { using I = arbitrary_iterator<ranges::input_iterator_tag, false>; static_assert(ranges::InputIterator<I>); CHECK(iterator_dispatch<I>() == category::input); } { using I = arbitrary_iterator<ranges::input_iterator_tag, true>; static_assert(ranges::InputIterator<I>); static_assert(ranges::EqualityComparable<I>); CHECK(iterator_dispatch<I>() == category::input); } { using I = arbitrary_iterator<ranges::forward_iterator_tag, true>; static_assert(ranges::ForwardIterator<I>); CHECK(iterator_dispatch<I>() == category::forward); } { using I = arbitrary_iterator<ranges::bidirectional_iterator_tag, true>; static_assert(ranges::BidirectionalIterator<I>); CHECK(iterator_dispatch<I>() == category::bidirectional); } { using I = arbitrary_iterator<ranges::random_access_iterator_tag, true>; static_assert(ranges::RandomAccessIterator<I>); CHECK(iterator_dispatch<I>() == category::random_access); } { using I = arbitrary_iterator<ranges::contiguous_iterator_tag, true>; static_assert(ranges::ContiguousIterator<I>); CHECK(iterator_dispatch<I>() == category::contiguous); } { using I = arbitrary_iterator<void, false>; static_assert(ranges::OutputIterator<I, const int&>); static_assert(!ranges::InputIterator<I>); CHECK(iterator_dispatch<I>() == category::output); } { using I = arbitrary_iterator<void, true>; static_assert(ranges::OutputIterator<I, const int&>); static_assert(ranges::EqualityComparable<I>); static_assert(!ranges::InputIterator<I>); CHECK(iterator_dispatch<I>() == category::output); } } template<ranges::InputIterator I, ranges::Sentinel<I> S, class O> requires ranges::IndirectlyCopyable<I, O> bool copy(I first, S last, O o) { for (; first != last; ++first, ++o) { *o = *first; } return false; } template<ranges::ContiguousIterator I, ranges::SizedSentinel<I> S, ranges::ContiguousIterator O> requires ranges::IndirectlyCopyable<I, O> && ranges::Same<ranges::iter_value_t<I>, ranges::iter_value_t<O>> && std::is_trivially_copyable<ranges::iter_value_t<I>>::value bool copy(I first, S last, O o) { auto n = last - first; STL2_EXPECT(n >= 0); if (n) { std::memmove(std::addressof(*o), std::addressof(*first), n * sizeof(ranges::iter_value_t<I>)); } return true; } void test_copy() { { struct A { int value; A(int i) : value{i} {} A(const A& that) : value{that.value} {} A& operator=(const A&) = default; }; A a[] = {0,1,2,3}, b[] = {4,5,6,7}; CHECK(!copy(ranges::begin(a) + 1, ranges::end(a) - 1, ranges::begin(b) + 1)); CHECK(b[0].value == 4); CHECK(b[1].value == 1); CHECK(b[2].value == 2); CHECK(b[3].value == 7); } { int a[] = {0,1,2,3,4,5,6,7}, b[] = {7,6,5,4,3,2,1,0}; CHECK(copy(ranges::begin(a) + 2, ranges::end(a) - 2, ranges::begin(b) + 2)); CHECK(b[0] == 7); CHECK(b[1] == 6); CHECK(b[2] == 2); CHECK(b[3] == 3); CHECK(b[4] == 4); CHECK(b[5] == 5); CHECK(b[6] == 1); CHECK(b[7] == 0); } } void test_iter_swap2() { { int a[] = { 42, 13 }; ranges::iter_swap(a + 0, a + 1); CHECK(a[0] == 13); CHECK(a[1] == 42); ranges::iter_swap(a + 0, a + 1); CHECK(a[0] == 42); CHECK(a[1] == 13); } { auto a = std::make_unique<int>(42); auto b = std::make_unique<int>(13); using I = decltype(a); static_assert(ranges::Same<I, decltype(b)>); static_assert(ranges::Readable<I>); using R = ranges::iter_reference_t<I>; static_assert(ranges::Same<int&, R>); using RR = ranges::iter_rvalue_reference_t<I>; static_assert(ranges::Same<int&&, RR>); static_assert(ranges::SwappableWith<R, R>); // Swappable<R, R> is true, calls the first overload of // iter_swap (which delegates to swap(*a, *b)): ranges::iter_swap(a, b); CHECK(*a == 13); CHECK(*b == 42); ranges::iter_swap(a, b); CHECK(*a == 42); CHECK(*b == 13); } { auto a = array<int, 4>{0,1,2,3}; using I = decltype(a.begin()); static_assert(ranges::Readable<I>); using V = ranges::iter_value_t<I>; static_assert(ranges::Same<int, V>); using R = ranges::iter_reference_t<I>; static_assert(ranges::Same<reference_wrapper<int>, R>); using RR = ranges::iter_rvalue_reference_t<I>; static_assert(ranges::Same<int&&, RR>); static_assert(ranges::Same<I, decltype(a.begin() + 2)>); static_assert(ranges::CommonReference<const R&, const R&>); static_assert(!ranges::SwappableWith<R, R>); static_assert(ranges::IndirectlyMovableStorable<I, I>); // Swappable<R, R> is not satisfied, and // IndirectlyMovableStorable<I, I> is satisfied, // so this should resolve to the second overload of iter_swap. ranges::iter_swap(a.begin() + 1, a.begin() + 3); CHECK(a[0] == 0); CHECK(a[1] == 3); CHECK(a[2] == 2); CHECK(a[3] == 1); } } template<class T> constexpr bool has_category = false; template<class T> requires requires { typename T::iterator_category; } constexpr bool has_category<T> = true; void test_std_traits() { using WO = arbitrary_iterator<void, false>; static_assert(ranges::Same<std::iterator_traits<WO>::iterator_category, std::output_iterator_tag>); using O = arbitrary_iterator<void, true>; static_assert(ranges::Same<std::iterator_traits<O>::iterator_category, std::output_iterator_tag>); using WI = arbitrary_iterator<ranges::input_iterator_tag, false>; static_assert(!has_category<std::iterator_traits<WI>>); using I = arbitrary_iterator<ranges::input_iterator_tag, true>; static_assert(ranges::Same<std::iterator_traits<I>::iterator_category, std::input_iterator_tag>); using F = arbitrary_iterator<ranges::forward_iterator_tag, true>; static_assert(ranges::Same<std::iterator_traits<F>::iterator_category, std::forward_iterator_tag>); using B = arbitrary_iterator<ranges::bidirectional_iterator_tag, true>; static_assert(ranges::Same<std::iterator_traits<B>::iterator_category, std::bidirectional_iterator_tag>); using R = arbitrary_iterator<ranges::random_access_iterator_tag, true>; static_assert(ranges::Same<std::iterator_traits<R>::iterator_category, std::random_access_iterator_tag>); using C = arbitrary_iterator<ranges::contiguous_iterator_tag, true>; static_assert(ranges::Same<std::iterator_traits<C>::iterator_category, std::random_access_iterator_tag>); using IV = arbitrary_iterator<ranges::input_iterator_tag, true, int>; static_assert(ranges::Same<std::iterator_traits<IV>::iterator_category, std::input_iterator_tag>); using FV = arbitrary_iterator<ranges::forward_iterator_tag, true, int>; static_assert(ranges::Same<std::iterator_traits<FV>::iterator_category, std::input_iterator_tag>); using BV = arbitrary_iterator<ranges::bidirectional_iterator_tag, true, int>; static_assert(ranges::Same<std::iterator_traits<BV>::iterator_category, std::input_iterator_tag>); using RV = arbitrary_iterator<ranges::random_access_iterator_tag, true, int>; static_assert(ranges::Same<std::iterator_traits<RV>::iterator_category, std::input_iterator_tag>); } struct MakeString { using value_type = std::string; std::string operator*() const; }; static_assert(ranges::Readable<MakeString>); static_assert(!ranges::Writable<MakeString, std::string>); static_assert(!ranges::Writable<MakeString, const std::string &>); static_assert(!ranges::IndirectlyMovable<MakeString, MakeString>); static_assert(!ranges::IndirectlyCopyable<MakeString, MakeString>); static_assert(!ranges::IndirectlySwappable<MakeString, MakeString>); int main() { test_iter_swap2(); test_iterator_dispatch(); test_copy(); test_std_traits(); return ::test_result(); }
30.373196
85
0.718078
bmanga
a0f863acd8044c19ee7424d39029ec71c97377ea
871
hpp
C++
include/quote/direct2d/traits.hpp
quartorz/quote
610f891fb8be6993b0db773f718ae5e7f24b1f40
[ "MIT" ]
null
null
null
include/quote/direct2d/traits.hpp
quartorz/quote
610f891fb8be6993b0db773f718ae5e7f24b1f40
[ "MIT" ]
null
null
null
include/quote/direct2d/traits.hpp
quartorz/quote
610f891fb8be6993b0db773f718ae5e7f24b1f40
[ "MIT" ]
null
null
null
#pragma once #include <quote/direct2d/base_types.hpp> #include <quote/direct2d/resource.hpp> #include <quote/direct2d/object.hpp> #include <quote/direct2d/solid_brush.hpp> #include <quote/direct2d/font.hpp> #include <quote/direct2d/text.hpp> #include <quote/direct2d/userdefined_object.hpp> namespace quote{ namespace direct2d{ struct traits{ using creation_params = creation_params; using paint_params = paint_params; using color = color; using point = point; using size = size; using rect = rect; using line = line; using circle = circle; using polygon = polygon; using resource = resource; using object = object; using brush = brush; using solid_brush = solid_brush; using font = font; using text = text; template <class Derived> using userdefined_object = userdefined_object<Derived>; }; } }
24.885714
58
0.709529
quartorz
a0fbe6cb74850bf49539406d5222088c139daf02
14,644
cc
C++
src/vt/trace/trace.cc
rbuch/vt
74c2e0cae3201dfbcbfda7644c354703ddaed6bb
[ "BSD-3-Clause" ]
26
2019-11-26T08:36:15.000Z
2022-02-15T17:13:21.000Z
src/vt/trace/trace.cc
rbuch/vt
74c2e0cae3201dfbcbfda7644c354703ddaed6bb
[ "BSD-3-Clause" ]
1,215
2019-09-09T14:31:33.000Z
2022-03-30T20:20:14.000Z
src/vt/trace/trace.cc
rbuch/vt
74c2e0cae3201dfbcbfda7644c354703ddaed6bb
[ "BSD-3-Clause" ]
12
2019-09-08T00:03:05.000Z
2022-02-23T21:28:35.000Z
/* //@HEADER // ***************************************************************************** // // trace.cc // DARMA/vt => Virtual Transport // // Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC // (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. // Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Questions? Contact darma@sandia.gov // // ***************************************************************************** //@HEADER */ #include "vt/collective/collective_alg.h" #include "vt/config.h" #include "vt/scheduler/scheduler.h" #include "vt/timing/timing.h" #include "vt/trace/trace.h" #include "vt/trace/trace_user.h" #include "vt/trace/file_spec/spec.h" #include "vt/objgroup/headers.h" #include "vt/utils/memory/memory_usage.h" #include "vt/phase/phase_manager.h" #include "vt/runtime/runtime.h" #include <cinttypes> #include <fstream> #include <iostream> #include <map> #include <sys/stat.h> #include <unistd.h> #include <stack> #include <queue> #include <mpi.h> #include <zlib.h> namespace vt { namespace trace { using TraceContainersType = TraceContainers; using LogType = Trace::LogType; Trace::Trace(std::string const& in_prog_name) : TraceLite(in_prog_name) {} void Trace::initialize() /*override*/ { #if vt_check_enabled(trace_enabled) setupNames(prog_name_); between_sched_event_type_ = trace::TraceRegistry::registerEventHashed( "Scheduler", "Between_Schedulers" ); // Register a trace user event to demarcate flushes that occur flush_event_ = trace::registerEventCollective("trace_flush"); #endif } void Trace::startup() /*override*/ { #if vt_check_enabled(trace_enabled) theSched()->registerTrigger( sched::SchedulerEvent::PendingSchedulerLoop, [this]{ pendingSchedulerLoop(); } ); theSched()->registerTrigger( sched::SchedulerEvent::BeginSchedulerLoop, [this]{ beginSchedulerLoop(); } ); theSched()->registerTrigger( sched::SchedulerEvent::EndSchedulerLoop, [this]{ endSchedulerLoop(); } ); theSched()->registerTrigger( sched::SchedulerEvent::BeginIdle, [this]{ beginIdle(); } ); theSched()->registerTrigger( sched::SchedulerEvent::EndIdle, [this]{ endIdle(); } ); thePhase()->registerHookRooted(phase::PhaseHook::End, [] { auto const phase = thePhase()->getCurrentPhase(); theTrace()->setTraceEnabledCurrentPhase(phase + 1); }); thePhase()->registerHookCollective(phase::PhaseHook::EndPostMigration, [] { theTrace()->flushTracesFile(false); }); #endif } void Trace::finalize() /*override*/ { // Always end any between-loop event left open. endProcessing(between_sched_event_); between_sched_event_ = TraceProcessingTag{}; } void Trace::loadAndBroadcastSpec() { if (theConfig()->vt_trace_spec) { auto spec_proxy = file_spec::TraceSpec::construct(); theTerm()->produce(); if (theContext()->getNode() == 0) { auto spec_ptr = spec_proxy.get(); spec_ptr->parse(); spec_ptr->broadcastSpec(); } theSched()->runSchedulerWhile([&spec_proxy]{ return not spec_proxy.get()->specReceived(); }); theTerm()->consume(); spec_proxy_ = spec_proxy.getProxy(); // Set enabled for the initial phase setTraceEnabledCurrentPhase(0); } } bool Trace::inIdleEvent() const { return idle_begun_; } /*virtual*/ Trace::~Trace() { // Not good - not much to do in late destruction. vtWarnIf( not open_events_.empty(), "Trying to dump traces with open events?" ); cleanupTracesFile(); } void Trace::addUserNote(std::string const& note) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserNote: note={}\n", note ); auto const type = TraceConstantsType::UserSuppliedNote; auto const time = getCurrentTime(); logEvent( LogType{time, type, note, Log::UserDataType{}} ); } void Trace::addUserData(int32_t data) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserData: data={}\n", data ); auto const type = TraceConstantsType::UserSupplied; auto const time = getCurrentTime(); logEvent( LogType{time, type, std::string{}, data} ); } UserEventIDType Trace::registerUserEventRoot(std::string const& name) { return user_event_.rooted(name); } UserEventIDType Trace::registerUserEventHash(std::string const& name) { return user_event_.hash(name); } void Trace::registerUserEventManual( std::string const& name, UserSpecEventIDType id ) { user_event_.user(name, id); } void insertNewUserEvent(UserEventIDType event, std::string const& name) { #if vt_check_enabled(trace_enabled) theTrace()->user_event_.insertEvent(event, name); #endif } void Trace::addUserEvent(UserEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserEvent: event={:x}\n", event ); auto const type = TraceConstantsType::UserEvent; auto const time = getCurrentTime(); NodeType const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} ); } void Trace::addUserEventManual(UserSpecEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserEventManual: event={:x}\n", event ); auto id = user_event_.createEvent(true, false, 0, event); addUserEvent(id); } void Trace::addUserEventBracketedBegin(UserEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserEventBracketedBegin: event={:x}\n", event ); auto const type = TraceConstantsType::BeginUserEventPair; auto const time = getCurrentTime(); NodeType const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} ); } void Trace::addUserEventBracketedEnd(UserEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserEventBracketedEnd: event={:x}\n", event ); auto const type = TraceConstantsType::EndUserEventPair; auto const time = getCurrentTime(); NodeType const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} ); } void Trace::addUserEventBracketedManualBegin(UserSpecEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } auto id = user_event_.createEvent(true, false, 0, event); addUserEventBracketedBegin(id); } void Trace::addUserEventBracketedManualEnd(UserSpecEventIDType event) { if (not checkDynamicRuntimeEnabled()) { return; } auto id = user_event_.createEvent(true, false, 0, event); addUserEventBracketedEnd(id); } void Trace::addUserEventBracketedManual( UserSpecEventIDType event, double begin, double end ) { if (not checkDynamicRuntimeEnabled()) { return; } vt_debug_print( normal, trace, "Trace::addUserEventBracketedManual: event={:x}, begin={}, end={}\n", event, begin, end ); auto id = user_event_.createEvent(true, false, 0, event); addUserEventBracketed(id, begin, end); } void Trace::addMemoryEvent(std::size_t memory, double time) { auto const type = TraceConstantsType::MemoryUsageCurrent; logEvent(LogType{time, type, memory}); } TraceProcessingTag Trace::beginProcessing( TraceEntryIDType const ep, TraceMsgLenType const len, TraceEventIDType const event, NodeType const from_node, uint64_t const idx1, uint64_t const idx2, uint64_t const idx3, uint64_t const idx4, double const time ) { if (not checkDynamicRuntimeEnabled()) { return TraceProcessingTag{}; } vt_debug_print( normal, trace, "event_start: ep={}, event={}, time={}, from={}, entry chare={}\n", ep, event, time, from_node, TraceRegistry::getEvent(ep).theEventSeq() ); auto const type = TraceConstantsType::BeginProcessing; emitTraceForTopProcessingEvent(time, TraceConstantsType::EndProcessing); TraceEventIDType loggedEvent = logEvent( LogType{ time, ep, type, event, len, from_node, idx1, idx2, idx3, idx4 } ); if (theConfig()->vt_trace_memory_usage) { addMemoryEvent(theMemUsage()->getFirstUsage()); } return TraceProcessingTag{ep, loggedEvent}; } void Trace::endProcessing( TraceProcessingTag const& processing_tag, double const time ) { // End event honored even if tracing is disabled in this phase. // This ensures proper stack unwinding in all contexts. if (not checkDynamicRuntimeEnabled(true)) { return; } TraceEntryIDType ep = processing_tag.ep_; TraceEventIDType event = processing_tag.event_; // Allow no-op cases (ie. beginProcessing disabled) if (ep == trace::no_trace_entry_id) { return; } if (idle_begun_) { // TODO: This should be a prohibited case - vt 1.1? endIdle(time); } vt_debug_print( normal, trace, "event_stop: ep={}, event={}, time={}, from_node={}, entry chare={}\n", ep, event, time, open_events_.back().node, TraceRegistry::getEvent(ep).theEventSeq() ); vtAssert( not open_events_.empty() // This is current contract expectations; however it precludes async closing. and open_events_.back().ep == ep and open_events_.back().event == event, "Event being closed must be on the top of the open event stack." ); if (theConfig()->vt_trace_memory_usage) { addMemoryEvent(theMemUsage()->getFirstUsage()); } // Final event is same as original with a few .. tweaks. // Always done PRIOR TO restarts. traces_.push( LogType{open_events_.back(), time, TraceConstantsType::EndProcessing} ); open_events_.pop_back(); emitTraceForTopProcessingEvent(time, TraceConstantsType::BeginProcessing); // Unlike logEvent there is currently no flush here. } void Trace::pendingSchedulerLoop() { // Always end between-loop event. endProcessing(between_sched_event_); between_sched_event_ = TraceProcessingTag{}; } void Trace::beginSchedulerLoop() { // Always end between-loop event. The pending case is not always triggered. endProcessing(between_sched_event_); between_sched_event_ = TraceProcessingTag{}; // Capture the current open event depth. event_holds_.push_back(open_events_.size()); } void Trace::endSchedulerLoop() { vtAssert( event_holds_.size() >= 1, "Too many endSchedulerLoop calls." ); vtAssert( event_holds_.back() == open_events_.size(), "Processing events opened in a scheduler loop must be closed by loop end." ); event_holds_.pop_back(); // Start an event representing time outside of top-level scheduler. if (event_holds_.size() == 1) { between_sched_event_ = beginProcessing( between_sched_event_type_, 0, trace::no_trace_event, 0 ); } } TraceEventIDType Trace::messageCreation( TraceEntryIDType const ep, TraceMsgLenType const len, double const time ) { if (not checkDynamicRuntimeEnabled()) { return no_trace_event; } auto const type = TraceConstantsType::Creation; NodeType const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} ); } TraceEventIDType Trace::messageCreationBcast( TraceEntryIDType const ep, TraceMsgLenType const len, double const time ) { if (not checkDynamicRuntimeEnabled()) { return no_trace_event; } auto const type = TraceConstantsType::CreationBcast; NodeType const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} ); } TraceEventIDType Trace::messageRecv( TraceEntryIDType const ep, TraceMsgLenType const len, NodeType const from_node, double const time ) { if (not checkDynamicRuntimeEnabled()) { return no_trace_event; } auto const type = TraceConstantsType::MessageRecv; NodeType const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} ); } void Trace::setTraceEnabledCurrentPhase(PhaseType cur_phase) { if (spec_proxy_ != vt::no_obj_group) { // SpecIndex is signed due to negative/positive, phase is not signed auto spec_index = static_cast<file_spec::TraceSpec::SpecIndex>(cur_phase); vt::objgroup::proxy::Proxy<file_spec::TraceSpec> proxy(spec_proxy_); bool ret = proxy.get()->checkTraceEnabled(spec_index); if (trace_enabled_cur_phase_ != ret) { // N.B. Future endProcessing calls are required to close the current // open event stack, even after the tracing is disabled for the phase. // This ensures valid stack unwinding in all cases. // Go ahead and perform a trace flush when tracing is disabled (and was // previously enabled) to reduce memory footprint. if (not ret and theConfig()->vt_trace_flush_size != 0) { writeTracesFile(incremental_flush_mode, true); } } trace_enabled_cur_phase_ = ret; vt_debug_print( terse, gen, "setTraceEnabledCurrentPhase: phase={}, enabled={}\n", cur_phase, trace_enabled_cur_phase_ ); } } }} //end namespace vt::trace
27.526316
82
0.701243
rbuch
9d02df3fd2d07b96e82c8df03a674cb306218ca9
4,341
cpp
C++
component/oai-amf/src/nas/ies/Rejected_NSSAI.cpp
kukkalli/oai-cn5g-fed
15634fac935ac8671b61654bdf75bf8af07d3c3a
[ "Apache-2.0" ]
null
null
null
component/oai-amf/src/nas/ies/Rejected_NSSAI.cpp
kukkalli/oai-cn5g-fed
15634fac935ac8671b61654bdf75bf8af07d3c3a
[ "Apache-2.0" ]
null
null
null
component/oai-amf/src/nas/ies/Rejected_NSSAI.cpp
kukkalli/oai-cn5g-fed
15634fac935ac8671b61654bdf75bf8af07d3c3a
[ "Apache-2.0" ]
null
null
null
/* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The OpenAirInterface Software Alliance licenses this file to You under * the OAI Public License, Version 1.1 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the * License at * * http://www.openairinterface.org/?page_id=698 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *------------------------------------------------------------------------------- * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ /*! \file \brief \author Keliang DU, BUPT \date 2020 \email: contact@openairinterface.org */ #include "Rejected_NSSAI.hpp" #include "logger.hpp" using namespace nas; //------------------------------------------------------------------------------ Rejected_NSSAI::Rejected_NSSAI(uint8_t iei) { _iei = iei; length = 0; _s_nssai_SST = 0; _s_nssai_length = 0; _cause = 0; } //------------------------------------------------------------------------------ Rejected_NSSAI::Rejected_NSSAI(const uint8_t iei, uint8_t cause, uint8_t SST) { _iei = iei; length = 4; _s_nssai_SST = SST; _s_nssai_length = 2; _cause = cause; } //------------------------------------------------------------------------------ Rejected_NSSAI::Rejected_NSSAI() { _iei = 0; length = 0; _s_nssai_SST = 0; _s_nssai_length = 0; _cause = 0; } //------------------------------------------------------------------------------ Rejected_NSSAI::~Rejected_NSSAI() {} //------------------------------------------------------------------------------ void Rejected_NSSAI::setSST(uint8_t SST) { _s_nssai_SST = SST; } //------------------------------------------------------------------------------ void Rejected_NSSAI::setCause(uint8_t SST) { _s_nssai_SST = SST; } //------------------------------------------------------------------------------ uint8_t Rejected_NSSAI::getCause() { return _cause; } //------------------------------------------------------------------------------ uint8_t Rejected_NSSAI::getSST() { return _s_nssai_SST; } //------------------------------------------------------------------------------ int Rejected_NSSAI::encode2buffer(uint8_t* buf, int len) { Logger::nas_mm().debug("encoding Rejected_NSSAI iei(0x%x)", _iei); if (len < length) { Logger::nas_mm().error("len is less than %d", length); return 0; } int encoded_size = 0; if (_iei) { *(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = length - 2; encoded_size++; *(buf + encoded_size) = ((_s_nssai_length & 0x0f) << 4) | (_cause & 0x0f); encoded_size++; *(buf + encoded_size) = _s_nssai_SST; encoded_size++; } else { // *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++; } Logger::nas_mm().debug("encoded Rejected_NSSAI len(%d)", encoded_size); return encoded_size; } //------------------------------------------------------------------------------ int Rejected_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) { Logger::nas_mm().debug("decoding Rejected_NSSAI iei(0x%x)", *buf); int decoded_size = 0; if (is_option) { decoded_size++; } length = *(buf + decoded_size); decoded_size++; _s_nssai_length = (*(buf + decoded_size) & 0xf0) >> 4; _cause = *(buf + decoded_size) & 0x0f; decoded_size++; _s_nssai_SST = *(buf + decoded_size); decoded_size++; Logger::nas_mm().debug( "decoded Rejected_NSSAI value_length(0x%x),cause(0x%x),value_SST(0x%x)", _s_nssai_length, _cause, _s_nssai_SST); Logger::nas_mm().debug("decoded Rejected_NSSAI len(%d)", decoded_size); return decoded_size; }
33.651163
81
0.534209
kukkalli
9d04c9955d252b0ab02488940f34120d14acd294
367
cpp
C++
Recursion/9. Check a string accoring to rules (automata type).cpp
Ashwanigupta9125/code-DS-ALGO
49f6cf7d0c682da669db23619aef3f80697b352b
[ "MIT" ]
36
2019-12-27T08:23:08.000Z
2022-01-24T20:35:47.000Z
Recursion/9. Check a string accoring to rules (automata type).cpp
Ashwanigupta9125/code-DS-ALGO
49f6cf7d0c682da669db23619aef3f80697b352b
[ "MIT" ]
10
2019-11-13T02:55:18.000Z
2021-10-13T23:28:09.000Z
Recursion/9. Check a string accoring to rules (automata type).cpp
Ashwanigupta9125/code-DS-ALGO
49f6cf7d0c682da669db23619aef3f80697b352b
[ "MIT" ]
53
2020-08-15T11:08:40.000Z
2021-10-09T15:51:38.000Z
#include<iostream> using namespace std; /*Suppose you have a string made up of only the letters 'a' and 'b'. Write a recursive function that checks if the string was generated using the following rules: a) the string begins with an 'a' b) each 'a' is followed by nothing or an 'a' or "bb" c) each "bb" is followed by nothing or an 'a’ */ int main(){ return 0; }
19.315789
48
0.708447
Ashwanigupta9125
9d0526b54ba603056e3fabf9aaa44782a3d68292
1,109
cpp
C++
atcoder/abc/abc144_e.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
1
2018-11-12T15:18:55.000Z
2018-11-12T15:18:55.000Z
atcoder/abc/abc144_e.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
null
null
null
atcoder/abc/abc144_e.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; //typedef tuple<int, int, int> T; #define FOR(i,s,x) for(int i=s;i<(int)(x);i++) #define REP(i,x) FOR(i,0,x) #define ALL(c) c.begin(), c.end() #define DUMP( x ) cerr << #x << " = " << ( x ) << endl #define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end()) const int dr[4] = {-1, 0, 1, 0}; const int dc[4] = {0, 1, 0, -1}; bool ok(ll ans, ll rest, vector<ll> &A, vector<ll> &F) { REP(i, A.size()) { ll need = ans / F[i]; rest -= max(0LL, A[A.size() - i - 1] - need); } return rest >= 0; } int main() { // use scanf in CodeForces! cin.tie(0); ios_base::sync_with_stdio(false); int N; ll K; cin >> N >> K; vector<ll> A(N), F(N); REP(i, N) cin >> A[i]; REP(i, N) cin >> F[i]; sort(ALL(A)); sort(ALL(F)); ll left = -1, right = 1e13; while (left + 1 < right) { int mid = (left + right) / 2; if (ok(mid, K, A, F)) { right = mid; } else { left = mid; } } cout << right << endl; return 0; }
23.104167
70
0.532011
knuu
9d056c2a6acb712d1476125784a9993a47878cab
6,023
cpp
C++
IMG/IMG_PXD.cpp
agalod/ipop
b14353e7d2af5fd3f80a1bc76efe59f86ab22e00
[ "MIT" ]
null
null
null
IMG/IMG_PXD.cpp
agalod/ipop
b14353e7d2af5fd3f80a1bc76efe59f86ab22e00
[ "MIT" ]
null
null
null
IMG/IMG_PXD.cpp
agalod/ipop
b14353e7d2af5fd3f80a1bc76efe59f86ab22e00
[ "MIT" ]
null
null
null
// // Class: IMG_PXC (: public MtqGrabber) // // File: IMG_PXC.cpp // // Modul: MtqLib: IP_Grabber // // Purpose: Encapsuling of the framegrabber functions // of the fpxc200 ImaScan fframegrabber // // Author: Alex Roehnisch (glo-ar) // WZL - RWTH Aachen // // Version: // Status: WORKING // #include "stdafx.h" #include "IMG_PXC.h" IMG_PXC::IMG_PXC( int aResWidth, int aResHeight ) { fImageMaxX = aResWidth; fImageMaxY = aResHeight; fStatus = kGrabberUndefined; fFastDisplayEnabled = FALSE; } IMG_PXC::~IMG_PXC() { Disable(); } int IMG_PXC::Init() { if(GetGrabberStatus()==kGrabberInitialized) return 1; ffgh = 0; ffrh = 0; BOOL small_size = 0; /*------------------------------------------------------------------------- initialize the library -------------------------------------------------------------------------*/ if (!imagenation_OpenLibrary("pxc2_95.dll",&fpxc200,sizeof(fpxc200))) if (!imagenation_OpenLibrary("pxc2_nt.dll",&fpxc200,sizeof(fpxc200))) { MessageBox(0,"Couldn't find pxc200 DLL or Driver.",0,MB_ICONSTOP); return 0; } if (!imagenation_OpenLibrary("pxcdd.dll",&fpxcdd,sizeof(fpxcdd))) { MessageBox( 0, "Couldn't find pxcdd DLL and DirectDraw.", 0, MB_ICONSTOP ); imagenation_CloseLibrary(&fpxc200); return 0; } if (!imagenation_OpenLibrary("frame_32.dll",&fframe,sizeof(fframe))) { MessageBox(0, "couldn't load frame_32.dll", 0, MB_OK); return FALSE; } /* allocate a fframe grabber */ ffgh=fpxc200.AllocateFG(-1); if (!ffgh) { MessageBox(0,"Couldn't allocate a frame grabber.",0,MB_ICONSTOP); imagenation_CloseLibrary(&fpxc200); imagenation_CloseLibrary(&fpxcdd); return 0; } // fImageMaxX = 768; fImageMaxY = 576; // fImageMaxX = 768; fImageMaxY = 576; /* allocate a fframe from fpxcdd. Try a half sized image if a full one doesn't work, in case the system's low on video memory. */ // ffrh=fpxcdd.CreateSurface(752,576); ffrh=fpxcdd.CreateSurface(fImageMaxX,fImageMaxY); int i = fpxcdd.GetError(); if (!ffrh) { small_size = TRUE; ffrh=fpxcdd.CreateSurface(320,243); } if (!ffrh) { MessageBox(0,"Couldn't allocate a video fframe.",0,MB_ICONSTOP); fpxc200.FreeFG(ffgh); imagenation_CloseLibrary(&fpxc200); imagenation_CloseLibrary(&fpxcdd); return 0; } /* Configure the fpxc200 settings to match the size of the fframe we configured. */ if (small_size) { fpxc200.SetWidth (ffgh, 320); fpxc200.SetHeight (ffgh, 243); fpxc200.SetXResolution (ffgh, 320); fpxc200.SetYResolution (ffgh, 243); } else /* full-size image */ { fpxc200.SetWidth (ffgh, fImageMaxX); fpxc200.SetHeight (ffgh, fImageMaxY); fpxc200.SetXResolution (ffgh, fImageMaxX); fpxc200.SetYResolution (ffgh, fImageMaxY); } /*------------------------------------------------------------------------- allocate a fframe buffer -------------------------------------------------------------------------*/ fStatus = kGrabberInitialized; return TRUE;} int IMG_PXC::Disable() { if(fStatus==kGrabberInitialized) { fpxc200.GrabContinuous(ffgh,ffrh,0,0); fpxc200.FreeFrame(ffrh); fpxc200.FreeFG(ffgh); imagenation_CloseLibrary(&fpxcdd); imagenation_CloseLibrary(&fpxc200); } return 0; } //; SEND THE LIVE IMAGE TO AWND int IMG_PXC::StartLiveVideo( CWnd * apfframeWnd, HWND hwnd, CView * apView) { /* Set up fpxcdd display */ int i=0; if( fFastDisplayEnabled ) { if ( !fpxcdd.EnableFastDisplay(hwnd,ffrh,ffgh,FALSE) ) return 0; fFastDisplayEnabled = FALSE; } //; disable display before turning it on. Error if turned on display is turned on! if (!fpxcdd.EnableFastDisplay(hwnd,ffrh,ffgh,TRUE)) { i = fpxcdd.GetError(); MessageBox(0,"Couldn't start fpxcdd display.",0,MB_ICONSTOP); fpxc200.FreeFrame(ffrh); fpxc200.FreeFG(ffgh); imagenation_CloseLibrary(&fpxc200); imagenation_CloseLibrary(&fpxcdd); return 0; } else fFastDisplayEnabled = TRUE; if( !fpxc200.GrabContinuous(ffgh,ffrh,-1,0) ) return 0; //; parameter 3 = 0 means on, parameter 3 = -1 means stop return 1; } int IMG_PXC::StopLiveVideo( HWND hwnd ) { if(GetGrabberStatus()!=kGrabberInitialized) return 0; if( fFastDisplayEnabled ) { fpxcdd.EnableFastDisplay(hwnd,ffrh,ffgh,FALSE); fFastDisplayEnabled = FALSE; } if( !fpxc200.GrabContinuous(ffgh,ffrh,0,0) ) return 0; //; parameter 3 = 0 means on, parameter 3 = -1 means stop return 1; } int IMG_PXC::SnapShot() { int width = fpxc200.GetWidth(ffgh); int height = fpxc200.GetHeight(ffgh); ftagQ = fpxc200.Grab(ffgh, ffrh, QUEUED); fpxc200.WaitFinished(ffgh, ftagQ); //; blacken the top line ( it is white otherwise, for some reason ) //for( short x=0; x<width; x++ ) aImg(x, height-1)=0; for( short y=2; y<=height; y++ ) for( short x=0; x<width; x++ ) //fframe.GetPixel( ffrh, &aImg(x,height-y), x, y ); return 0; } int IMG_PXC::SelectCamera( int const aCamNr ) { //; camera index is zero- based -> aCamNr minus one fpxc200.SetCamera( ffgh, aCamNr-1, 0 ); return 1; } bool const IMG_PXC::IsInitialised(){ //; Check, if the grabber was initialized properly return 1; } void IMG_PXC::SaveBmp(char* str) { if( fframe.WriteBMP(ffrh, str, 1) != SUCCESS ) AfxMessageBox("Das Bild konnte nicht gespeichert werden."); } int IMG_PXC::FitWindow( CView * apView ) { CWnd * pMainFrm = AfxGetMainWnd(); WINDOWPLACEMENT WndP; pMainFrm->GetWindowPlacement( & WndP ); if (WndP.showCmd != SW_SHOWMAXIMIZED ) { WndP.showCmd = SW_SHOWMAXIMIZED; pMainFrm->SetWindowPlacement( & WndP ); } WINDOWPLACEMENT WndPl; CFrameWnd * pChildFrame = (CFrameWnd*) apView->GetParentFrame(); pChildFrame->GetWindowPlacement( & WndPl ); if( WndPl.showCmd != SW_SHOWMAXIMIZED ) { apView->GetParent()->SetWindowPos( NULL, 0, 0, fpxc200.GetWidth(ffgh)+10, fpxc200.GetHeight(ffgh)+30, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOZORDER ); apView->GetParentOwner()->Invalidate( FALSE ); } return 0; }
34.417143
153
0.651004
agalod
9d05a909cbb545852de4f98a9a73cd739cc0b727
4,911
cpp
C++
navigation_cli/src/velocity_smoother.cpp
l756302098/ros_practice
4da8b4ddb25ada2e6f1adb3c0f8b34576aedf6b7
[ "MIT" ]
null
null
null
navigation_cli/src/velocity_smoother.cpp
l756302098/ros_practice
4da8b4ddb25ada2e6f1adb3c0f8b34576aedf6b7
[ "MIT" ]
null
null
null
navigation_cli/src/velocity_smoother.cpp
l756302098/ros_practice
4da8b4ddb25ada2e6f1adb3c0f8b34576aedf6b7
[ "MIT" ]
null
null
null
#include <boost/thread.hpp> #include <iostream> #include <vector> #include <cstdlib> #include <ctime> #include <math.h> #include <ros/ros.h> #include <geometry_msgs/PoseStamped.h> #include <geometry_msgs/Twist.h> #include <nav_msgs/Odometry.h> #include <c2_algorithm.h> #include <velocity_smoother.h> velocity_smoother::velocity_smoother() { nh.param<double>("/velocity_smoother_node/v_max_vel", v_max_vel, 0.3); nh.param<double>("/velocity_smoother_node/v_min_vel", v_min_vel, 0.0); nh.param<double>("/velocity_smoother_node/v_max_acc", v_max_acc, 0.0); nh.param<double>("/velocity_smoother_node/v_min_acc", v_min_acc, 0.0); nh.param<double>("/velocity_smoother_node/v_jeck", v_jeck, 0.0); nh.param<double>("/velocity_smoother_node/a_max_vel", a_max_vel, 0.3); nh.param<double>("/velocity_smoother_node/a_min_vel", a_min_vel, 0.0); nh.param<double>("/velocity_smoother_node/a_max_acc", a_max_acc, 0.0); nh.param<double>("/velocity_smoother_node/a_min_acc", a_min_acc, 0.0); nh.param<double>("/velocity_smoother_node/a_jeck", a_jeck, 0.0); nh.param<std::string>("/velocity_smoother_node/raw_cmd_vel_topic", raw_vel_topic, ""); nh.param<std::string>("/velocity_smoother_node/smooth_cmd_vel_topic", smooth_vel_topic, ""); //feedback_topic nh.param<std::string>("/velocity_smoother_node/robot_feedback_topic", feedback_topic, ""); cout << "smooth_vel_topic:" << smooth_vel_topic << endl; cout << "raw_vel_topic:" << raw_vel_topic << endl; cout << "feedback_topic:" << feedback_topic << endl; cout << "v_max_vel:" << v_max_vel << endl; cout << "v_min_vel:" << v_min_vel << endl; cout << "v_max_acc:" << v_max_acc << endl; cout << "v_min_acc:" << v_min_acc << endl; cout << "v_jeck:" << v_jeck << endl; v_last_pos = 0; v_last_vel = 0; v_last_acc = 0; a_last_acc = 0; a_last_pos = 0; a_last_vel = 0; vel_c2.init(v_min_vel, v_max_vel, v_min_acc, v_max_acc, v_jeck, 100); ang_c2.init(a_min_vel, a_max_vel, a_min_acc, a_max_acc, a_jeck, 100); cmd_pub = nh.advertise<geometry_msgs::Twist>(smooth_vel_topic, 1, true); vel_sub = nh.subscribe(raw_vel_topic, 1, &velocity_smoother::velocity_cb, this); if (!feedback_topic.empty()) { ROS_INFO("node add subscribe feedback_topic"); odom_sub = nh.subscribe(feedback_topic, 1, &velocity_smoother::odom_cb, this); } } velocity_smoother ::~velocity_smoother() { } void velocity_smoother::velocity_cb(const geometry_msgs::Twist::ConstPtr &msg) { ROS_DEBUG_STREAM("get raw x:" << v_t_vel << " z:" << a_t_vel << endl); //cout << "get raw x:" << v_t_vel << " z:" << a_t_vel << endl; if (is_use_odom >= 1) { mutex.lock(); //set linear //v_vel = v_last_vel; v_t_vel = msg->linear.x; v_acc = v_last_acc; v_t_acc = 0; vel_c2.start(v_vel, v_t_vel, v_acc, v_t_acc); //set angular //a_vel = a_last_vel; a_t_vel = msg->angular.z; a_acc = a_last_acc; a_t_acc = 0; ang_c2.start(a_vel, a_t_vel, a_acc, a_t_acc); mutex.unlock(); } else { mutex.lock(); //set linear v_vel = v_last_vel; v_t_vel = msg->linear.x; v_acc = v_last_acc; v_t_acc = 0; vel_c2.start(v_vel, v_t_vel, v_acc, v_t_acc); //set angular a_vel = a_last_vel; a_t_vel = msg->angular.z; a_acc = a_last_acc; a_t_acc = 0; ang_c2.start(a_vel, a_t_vel, a_acc, a_t_acc); mutex.unlock(); } } void velocity_smoother::odom_cb(const geometry_msgs::TwistStamped::ConstPtr &msg) { mutex.lock(); v_last_vel = (msg->twist.linear.x) / 1000; a_last_vel = (msg->twist.angular.z)/1000; mutex.unlock(); } void velocity_smoother::update() { //calc twist mutex.lock(); vel_c2.get_qk(v_last_acc, v_last_vel, v_acc, v_vel); v_last_pos = v_pos; //v_last_vel = v_vel; v_last_acc = v_acc; ang_c2.get_qk(a_last_acc, a_last_vel, a_acc, a_vel); a_last_pos = a_pos; //a_last_vel = a_vel; a_last_acc = a_acc; if (feedback_topic.empty()){ v_last_vel = v_vel; a_last_vel = a_vel; } mutex.unlock(); geometry_msgs::Twist twist; twist.linear.x = v_vel; twist.angular.z = a_vel; cmd_pub.publish(twist); ROS_DEBUG_STREAM("deal smooth x:" << v_vel << " z:" << a_vel << endl); } void velocity_smoother::reset() { v_last_vel = 0; v_last_acc = 0; a_last_vel = 0; a_last_acc = 0; v_t_vel = 0; v_t_acc = 0; a_t_vel = 0; a_t_acc = 0; } int main(int argc, char **argv) { ros::init(argc, argv, "velocity_smoother_node"); velocity_smoother vs; //set frequency ros::Rate rate(100); while (ros::ok()) { vs.update(); ros::spinOnce(); rate.sleep(); } return 0; }
28.552326
113
0.633069
l756302098
9d0838342c598bb951bee57e5918516c54746e18
1,272
hxx
C++
Legolas/Matrix/tst/HeatEquationTest/SpaceSourceVectorDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/HeatEquationTest/SpaceSourceVectorDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/HeatEquationTest/SpaceSourceVectorDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
1
2021-02-11T14:43:25.000Z
2021-02-11T14:43:25.000Z
/** * project DESCARTES * * @file SpaceSourceVectorDefinition.hxx * * @author Laurent PLAGNE * @date june 2004 - january 2005 * * @par Modifications * - author date object * * (c) Copyright EDF R&D - CEA 2001-2005 */ #ifndef __LEGOLAS_SPACESOURCEVECTORDEFINITION_HXX__ #define __LEGOLAS_SPACESOURCEVECTORDEFINITION_HXX__ #include "UTILITES.hxx" #include "SpaceVectorPrivateData.hxx" #include "VectorOptions.hxx" #include "NoGenericVector.hxx" template <class REAL_TYPE> class SpaceSourceVectorDefinition{ public: typedef NoGenericVector< RealDataDriver<REAL_TYPE> > SubVectorDefinition; typedef typename SubVectorDefinition::RealType RealType; typedef typename SubVectorDefinition::Data GetElement; typedef SpaceVectorPrivateData<RealType> Data; typedef VectorOptions< Actual > Options; inline static GetElement getElement(int i, const Data & data){ RealType x=RealType(i+1)*data.deltaX(); RealType t=data.time(); RealType value=x*cos(x)*cos(t)+2*sin(x)*sin(t)+x*cos(x)*sin(t) ; //RealType value=x*cos(x)*cos(t)-2*sin(x)*sin(t)-x*cos(x)*sin(t) ; return value; } static inline int size ( const Data & data ) { return data.size(); } }; #endif
22.714286
75
0.691038
LaurentPlagne
9d09ec4c8fad62f422dc3fe9993429a8ddee8870
241
cpp
C++
test/test_shaders.cpp
valentingalea/mathlib
23ae9766e552f96dfcebe9a561b40002ccdeb942
[ "MIT" ]
176
2018-08-26T19:56:36.000Z
2022-02-22T09:09:13.000Z
test/test_shaders.cpp
valentingalea/mathlib
23ae9766e552f96dfcebe9a561b40002ccdeb942
[ "MIT" ]
2
2022-01-04T09:40:39.000Z
2022-01-16T20:18:11.000Z
test/test_shaders.cpp
valentingalea/mathlib
23ae9766e552f96dfcebe9a561b40002ccdeb942
[ "MIT" ]
4
2019-08-25T07:23:04.000Z
2022-01-19T09:43:50.000Z
#include "c4droid.h" #include "shader/sandbox.h" vec3 sandbox::iResolution = vec3(100, 100, 0); float sandbox::iTime = 0.f; float sandbox::iTimeDelta = 0.f; int main() { sandbox::fragment_shader ps; ps.main(ps.gl_FragColor, vec2(0)); }
18.538462
47
0.697095
valentingalea
9d0bba7a1e997ed6de552a133bf93b643d829f6d
1,194
cpp
C++
simple_numbers_10^6_2.cpp
webkadiz/olympiad-problems
620912815904c0f95b91ccd193ca3db0ea20e507
[ "MIT" ]
null
null
null
simple_numbers_10^6_2.cpp
webkadiz/olympiad-problems
620912815904c0f95b91ccd193ca3db0ea20e507
[ "MIT" ]
null
null
null
simple_numbers_10^6_2.cpp
webkadiz/olympiad-problems
620912815904c0f95b91ccd193ca3db0ea20e507
[ "MIT" ]
null
null
null
#include <iostream> #include <math.h> using namespace std; template <typename T> void print_arr(T arr[], int len) { for (int i = 0; i < len; i++) cout << arr[i] << endl; } bool detSimple(int num) { int sqrtN = sqrt(num); for (int i = 2; i <= sqrtN; i++) { if (num % i == 0) return false; } return true; } int main() { int m, n, k = 0, sqrtN; bool wasSimple = false; cin >> m >> n; n++; sqrtN = sqrt(n); bool primesRaw[sqrtN]; primesRaw[0] = primesRaw[1] = false; for (int i = 2; i <= sqrtN; i++) { bool isSimple = detSimple(i); k += isSimple; primesRaw[i] = isSimple; } int primes[k]; for (int i = 2, j = 0; i <= sqrtN; i++) { if (primesRaw[i]) { primes[j] = i; j++; } } if (m <= sqrtN) { for (int i = m; i <= sqrtN; i++) { bool isSimple = detSimple(i); if (isSimple) { cout << i << endl; wasSimple = true; } } } for (int i = max(m, sqrtN + 1); i < n; i++) { bool isSimple = true; for (int j = 0; j < k; j++) { if (i % primes[j] == 0) { isSimple = false; break; } } if (isSimple) { wasSimple = true; cout << i << endl; } } if (!wasSimple) cout << "Absent"; }
13.41573
55
0.502513
webkadiz
9d0de6b1e32a60c53f6c32c5f3260ccae9687e91
2,752
cpp
C++
vkconfig_core/test/test_util.cpp
ncesario-lunarg/VulkanTools
3ea8ac1d278a4412e34e443063cad90632bbbc3b
[ "Apache-2.0" ]
1
2021-03-04T03:33:44.000Z
2021-03-04T03:33:44.000Z
vkconfig_core/test/test_util.cpp
ncesario-lunarg/VulkanTools
3ea8ac1d278a4412e34e443063cad90632bbbc3b
[ "Apache-2.0" ]
null
null
null
vkconfig_core/test/test_util.cpp
ncesario-lunarg/VulkanTools
3ea8ac1d278a4412e34e443063cad90632bbbc3b
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2020 Valve Corporation * Copyright (c) 2020 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: * - Richard S. Wright Jr. * - Christophe Riccio */ #include "../util.h" #include <array> #include <QDir> #include <gtest/gtest.h> TEST(test_util, countof_int_2) { const int test_data[]{8, 9}; static_assert(countof(test_data) == 2, "countof for 2 ints is broken"); EXPECT_EQ(2, countof(test_data)); } TEST(test_util, countof_int_1) { const int test_data[]{7}; static_assert(countof(test_data) == 1, "countof for 1 int is broken"); EXPECT_EQ(1, countof(test_data)); } TEST(test_util, countof_cstring_3) { const char* test_data[]{"GNI", "GNA", "GNE"}; static_assert(countof(test_data) == 3, "countof for cstring is broken"); EXPECT_EQ(3, countof(test_data)); } TEST(test_util, countof_string_3) { const std::string test_data[]{"GNI", "GNA", "GNE"}; static_assert(countof(test_data) == 3, "countof for string is broken"); EXPECT_EQ(3, countof(test_data)); } TEST(test_util, countof_array_2) { const std::array<int, 2> test_data{6, 7}; static_assert(countof(test_data) == 2, "countof for array is broken"); EXPECT_EQ(2, countof(test_data)); } TEST(test_util, countof_array_3) { const std::array<std::string, 3> test_data{"GNI", "GNA", "GNE"}; EXPECT_EQ(3, countof(test_data)); } TEST(test_util, countof_vector_2) { const std::vector<int> test_data{6, 7}; EXPECT_EQ(2, countof(test_data)); } TEST(test_util, countof_vector_3) { const std::vector<std::string> test_data{"GNI", "GNA", "GNE"}; EXPECT_EQ(3, countof(test_data)); } TEST(test_util_format, int_1) { EXPECT_EQ("Test 1", format("Test %d", 1)); } TEST(test_util, validate_path) { const std::string validated_path = ValidatePath("/waotsra/aflkshjaksl/test.txt"); const QString ref_path = QDir::toNativeSeparators(QDir().homePath() + "/vulkan-sdk/test.txt"); EXPECT_STREQ(ref_path.toStdString().c_str(), validated_path.c_str()); } TEST(test_util, replace_path) { const std::string replaced_path = ReplacePathBuiltInVariables("$HOME/test.txt"); EXPECT_TRUE(replaced_path.find_first_of("$HOME") > replaced_path.size()); }
28.081633
98
0.694041
ncesario-lunarg
9d0dfe83e5ca604bd5baefa4a5c50cf1730c0fa1
2,285
cpp
C++
test/mover.cpp
srjilarious/termable
7995e6e2b6ee80f43956d8c4966ff68f5c4d3777
[ "MIT" ]
null
null
null
test/mover.cpp
srjilarious/termable
7995e6e2b6ee80f43956d8c4966ff68f5c4d3777
[ "MIT" ]
1
2021-05-27T18:26:35.000Z
2021-05-27T18:26:35.000Z
test/mover.cpp
srjilarious/termable
7995e6e2b6ee80f43956d8c4966ff68f5c4d3777
[ "MIT" ]
null
null
null
// Set of tests, blocking out how I want the API to look. #include <termable/termable.hpp> #include <cstdio> #include <chrono> #include <thread> int main(int argc, char** argv) { termable::termableLinux term; term.clear(); term.showCursor(false); auto sz = term.displaySize(); termable::termBuffer buffer1(sz), buffer2(sz); buffer1.fill({' '}, termable::color::basic::BoldWhite, termable::color::basic::Black); buffer2.fill({'.'}, termable::color::basic::BoldWhite, termable::color::basic::Black); term.eventHandler = [&] (termable::TermableEvent e) { if(e == termable::TermableEvent::Resized) { sz = term.displaySize(); buffer1.resize(sz); buffer2.resize(sz); } }; termable::termBuffer *currBuffer = &buffer1; termable::termBuffer *oldBuffer = &buffer2; termable::vec2i pos = {sz.x/2,sz.y/2}; termable::KeyResult c = std::monostate{}; while(true) { c = term.getch(); if(std::holds_alternative<char>(c)) { auto ch = std::get<char>(c); if(ch == 'q') { break; } } else if(std::holds_alternative<termable::NonAsciiChar>(c)) { auto nac = std::get<termable::NonAsciiChar>(c); switch(nac) { case termable::NonAsciiChar::Up: pos.y--; if(pos.y <= 0) pos.y = 0; break; case termable::NonAsciiChar::Left: pos.x--; if(pos.x <= 0) pos.x = 0; break; case termable::NonAsciiChar::Down: pos.y++; if(pos.y >= sz.y-1) pos.y = sz.y-1; break; case termable::NonAsciiChar::Right: pos.x++; if(pos.x >= sz.x-1) pos.x = sz.x-1; break; } currBuffer->fill({' '}); currBuffer->writeChar(pos, {'*'}); term.renderBuffer(*currBuffer, *oldBuffer); // Swap the buffers. std::swap(currBuffer, oldBuffer); fflush(stdout); } } term.showCursor(true); return 0; }
30.878378
90
0.48884
srjilarious
9d0e143aaf9d560e9d4cb5e5412e01cb109a05b7
1,213
cc
C++
0200_Number_of_Islands/0200.cc
LuciusKyle/LeetCode
66c9090e5244b10eca0be50398764da2b4b48a6c
[ "Apache-2.0" ]
null
null
null
0200_Number_of_Islands/0200.cc
LuciusKyle/LeetCode
66c9090e5244b10eca0be50398764da2b4b48a6c
[ "Apache-2.0" ]
null
null
null
0200_Number_of_Islands/0200.cc
LuciusKyle/LeetCode
66c9090e5244b10eca0be50398764da2b4b48a6c
[ "Apache-2.0" ]
null
null
null
#include <vector> #include <assert.h> using std::vector; class Solution { public: int numIslands(vector<vector<char>>& grid) { int rtn = 0; for (size_t row = 0; row < grid.size(); ++row) for (size_t column = 0; column < grid[0].size(); ++column) if (grid[row][column] == '1') { markIsland(grid, row, column); ++rtn; } return rtn; } private: void markIsland(vector<vector<char>>& grid, const size_t row, const size_t column) { grid[row][column] = '2'; if (row + 1 < grid.size() && grid[row + 1][column] == '1') markIsland(grid, row + 1, column); if (0 < row && grid[row - 1][column] == '1') markIsland(grid, row - 1, column); if (0 < column && grid[row][column - 1] == '1') markIsland(grid, row, column - 1); if (column + 1 < grid[0].size() && grid[row][column + 1] == '1') markIsland(grid, row, column + 1); } }; int main(void) { Solution sln; vector test_sample{ vector{'1', '1', '1', '1', '0'}, vector{'1', '1', '0', '1', '0'}, vector{'1', '1', '0', '0', '0'}, vector{'0', '0', '0', '0', '0'}}; assert(1==sln.numIslands(test_sample)); return 0; }
26.369565
68
0.515251
LuciusKyle
9d0e5b4fe87229b8ce2cc693336b34c139f6f6fd
3,957
cpp
C++
src/InOut.cpp
ahfakt/Stream
c3a1ddcd904e0f15246db34ad71f85748312cbaf
[ "MIT" ]
null
null
null
src/InOut.cpp
ahfakt/Stream
c3a1ddcd904e0f15246db34ad71f85748312cbaf
[ "MIT" ]
null
null
null
src/InOut.cpp
ahfakt/Stream
c3a1ddcd904e0f15246db34ad71f85748312cbaf
[ "MIT" ]
null
null
null
#include "Stream/InOut.h" #include <cstring> namespace Stream { Input& Input::read(void* dest, std::size_t size) try { for (std::size_t outl; size; reinterpret_cast<std::byte*&>(dest) += outl, size -= outl) outl = readBytes(reinterpret_cast<std::byte*>(dest), size); return *this; } catch (Exception& exc) { exc.mDest = dest; exc.mSize = size; throw; } std::size_t Input::readSome(void* dest, std::size_t size) { std::size_t outl; while (!(outl = readBytes(reinterpret_cast<std::byte*>(dest), size))); return outl; } void* Input::Exception::getUnreadBuffer() const noexcept { return mDest; } std::size_t Input::Exception::getUnreadSize() const noexcept { return mSize; } void Output::flush() {} Output& Output::write(void const* src, std::size_t size) try { for (std::size_t inl; size; reinterpret_cast<std::byte const*&>(src) += inl, size -= inl) inl = writeBytes(reinterpret_cast<std::byte const*>(src), size); return *this; } catch (Exception& exc) { exc.mSrc = src; exc.mSize = size; throw; } std::size_t Output::writeSome(void const* src, std::size_t size) { std::size_t inl; while (!(inl = writeBytes(reinterpret_cast<std::byte const*>(src), size))); return inl; } Output& Output::operator<<(std::nullptr_t) { flush(); return *this; } void const* Output::Exception::getUnwrittenBuffer() const noexcept { return mSrc; } std::size_t Output::Exception::getUnwrittenSize() const noexcept { return mSize; } InputFilter::InputFilter() noexcept { nullptr >> *this; } void swap(InputFilter& a, InputFilter& b) noexcept { std::swap(a.mSource, b.mSource); } InputFilter& operator>>(Input& input, InputFilter& inputFilter) noexcept { inputFilter.mSource = &input; return inputFilter; } InputFilter& operator>>(std::nullptr_t, InputFilter& inputFilter) noexcept { static class : public Input { std::size_t readBytes(std::byte* dest, std::size_t size) override { throw Exception(std::make_error_code(static_cast<std::errc>(ENODATA))); } } instance; inputFilter.mSource = &instance; return inputFilter; } OutputFilter::OutputFilter() noexcept { nullptr << *this; } void swap(OutputFilter& a, OutputFilter& b) noexcept { std::swap(a.mSink, b.mSink); } OutputFilter& operator<<(Output& output, OutputFilter& outputFilter) noexcept { outputFilter.mSink = &output; return outputFilter; } OutputFilter& operator<<(std::nullptr_t, OutputFilter& outputFilter) noexcept { static class : public Output { std::size_t writeBytes(std::byte const* src, std::size_t size) override { throw Exception(std::make_error_code(static_cast<std::errc>(ENOSPC))); } } instance; outputFilter.mSink = &instance; return outputFilter; } Input& operator>>(Input& input, std::string& str) { str.clear(); char c; input.read(&c, 1); while (c) { str.push_back(c); input.read(&c, 1); } return input; } Input& operator>>(Input& input, char* str) { do { input.read(str, 1); } while(*str++); return input; } Output& operator<<(Output& output, std::string const& str) { return output.write(str.c_str(), str.size() + 1); } Output& operator<<(Output& output, char const* str) { return output.write(str, std::strlen(str) + 1); } std::error_code make_error_code(Input::Exception::Code e) noexcept { static struct : std::error_category { [[nodiscard]] char const* name() const noexcept override { return "Stream::Input"; } [[nodiscard]] std::string message(int ev) const noexcept override { return ev == 1 ? "Uninitialized" : "Unknown Error"; } } instance; return {static_cast<int>(e), instance}; } std::error_code make_error_code(Output::Exception::Code e) noexcept { static struct : std::error_category { [[nodiscard]] char const* name() const noexcept override { return "Stream::Output"; } [[nodiscard]] std::string message(int ev) const noexcept override { return ev == 1 ? "Uninitialized" : "Unknown Error"; } } instance; return {static_cast<int>(e), instance}; } }//namespace Stream
21.274194
90
0.697498
ahfakt
9d104bcaadefc6ccbc51cca877ed954d6df2a564
3,440
hpp
C++
engine/src/Graphics/Scene.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
engine/src/Graphics/Scene.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
engine/src/Graphics/Scene.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
#pragma once #include "Core/HashMap.hpp" #include "Core/Array.hpp" #include "Core/SortedArray.hpp" #include "Core/StringView.hpp" #include "Engine/Entity.hpp" #include "Math/Mat4x4.hpp" class Camera; class Allocator; class TransformUpdateReceiver; struct SceneObjectId { unsigned int i; bool operator==(SceneObjectId other) { return i == other.i; } bool operator!=(SceneObjectId other) { return !operator==(other); } static const SceneObjectId Null; }; struct SceneEditTransform { Vec3f translation; Vec3f rotation; Vec3f scale; SceneEditTransform() : scale(1.0f, 1.0f, 1.0f) { } SceneEditTransform(const Vec3f& pos) : translation(pos), scale(1.0f, 1.0f, 1.0f) { } }; class Scene { private: Allocator* allocator; struct InstanceData { unsigned int count; unsigned int allocated; void *buffer; Entity* entity; Mat4x4f* local; Mat4x4f* world; SceneObjectId* parent; SceneObjectId* firstChild; SceneObjectId* nextSibling; SceneObjectId* prevSibling; SceneEditTransform* editTransform; } data; HashMap<unsigned int, SceneObjectId> entityMap; SortedArray<unsigned int> updatedEntities; Array<Mat4x4f> updatedTransforms; Entity activeCamera; void Reallocate(unsigned int required); // The specified object and all its children are updated // The world transform is calculated and the objects are marked as updated void UpdateWorldTransforms(SceneObjectId id); public: Scene(Allocator* allocator); Scene(const Scene& other) = delete; Scene(Scene&& other) = delete; ~Scene(); Scene& operator=(const Scene& other) = delete; Scene& operator=(Scene&& other) = delete; SceneObjectId Lookup(Entity e) { auto* pair = entityMap.Lookup(e.id); return pair != nullptr ? pair->second : SceneObjectId::Null; } SceneObjectId AddSceneObject(Entity e) { SceneObjectId id; this->AddSceneObject(1, &e, &id); return id; } void AddSceneObject(unsigned int count, Entity* entities, SceneObjectId* idsOut); void RemoveSceneObject(SceneObjectId id); void Clear(); Entity GetEntity(SceneObjectId id) const { return data.entity[id.i]; } SceneObjectId GetParent(SceneObjectId id) const { return data.parent[id.i]; } SceneObjectId GetFirstChild(SceneObjectId id) const { return data.firstChild[id.i]; } SceneObjectId GetNextSibling(SceneObjectId id) const { return data.nextSibling[id.i]; } void SetParent(SceneObjectId id, SceneObjectId parent); void SetLocalTransform(SceneObjectId id, const Mat4x4f& transform); void SetLocalAndEditTransform(SceneObjectId id, const Mat4x4f& local, const SceneEditTransform& edit); const Mat4x4f& GetWorldTransform(SceneObjectId id) { return data.world[id.i]; } const Mat4x4f& GetLocalTransform(SceneObjectId id) { return data.local[id.i]; } const SceneEditTransform& GetEditTransform(SceneObjectId id); void SetEditTransform(SceneObjectId id, const SceneEditTransform& editTransform); // This can be used to manually add the entity to the updated transforms queue. // This is useful when the transform hasn't changed but other relevant info, // such as the bounding box has changed. // Only the specified object is marked, but not its children void MarkUpdated(SceneObjectId id); void NotifyUpdatedTransforms(size_t receiverCount, TransformUpdateReceiver** updateReceivers); void SetActiveCameraEntity(Entity camera) { activeCamera = camera; } Entity GetActiveCameraEntity() const { return activeCamera; } };
26.060606
103
0.757267
aleksigron
9d108bb0f98bc7316b76553969ea82353d969d04
225
cpp
C++
sample/asrDemo2/src/asrdemo/StatusListener.cpp
formattor/asr-linux-cpp-change
630c54daf78f4f0f68e51f7aa996298ee517f2b1
[ "MIT" ]
6
2019-06-10T12:57:32.000Z
2020-11-27T10:56:13.000Z
sample/asrDemo2/src/asrdemo/StatusListener.cpp
formattor/asr-linux-cpp-change
630c54daf78f4f0f68e51f7aa996298ee517f2b1
[ "MIT" ]
1
2021-02-19T02:39:47.000Z
2021-02-19T02:39:47.000Z
sample/asrDemo2/src/asrdemo/StatusListener.cpp
formattor/asr-linux-cpp-change
630c54daf78f4f0f68e51f7aa996298ee517f2b1
[ "MIT" ]
null
null
null
// // Created by fu on 3/13/18. // #include "StatusListener.hpp" namespace asrdemo { void StatusListener::on_last_status(int status){ finished = true; } bool StatusListener::is_finished() const{ return finished; } }
16.071429
48
0.706667
formattor
9d132a5ca1a501a6a305e5adb00597456286780a
919
hpp
C++
cpp/tests/mock-objects/slot-buffer-mock.hpp
luckiday/ndnrtc
ea224ce8d9f01d164925448c7424cf0f0caa4b07
[ "BSD-2-Clause" ]
null
null
null
cpp/tests/mock-objects/slot-buffer-mock.hpp
luckiday/ndnrtc
ea224ce8d9f01d164925448c7424cf0f0caa4b07
[ "BSD-2-Clause" ]
null
null
null
cpp/tests/mock-objects/slot-buffer-mock.hpp
luckiday/ndnrtc
ea224ce8d9f01d164925448c7424cf0f0caa4b07
[ "BSD-2-Clause" ]
null
null
null
// // slot-buffer-mock.hpp // // Created by Peter Gusev on 07 April 2016. // Copyright 2013-2016 Regents of the University of California // #ifndef __slot_buffer_mock_h__ #define __slot_buffer_mock_h__ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "src/slot-buffer.hpp" class MockSlotBuffer : public ndnrtc::ISlotBuffer { public: MOCK_METHOD3(accessSlotExclusively, void(const std::string&, const ndnrtc::OnSlotAccess&, const ndnrtc::OnNotFound&)); void callOnSlotAccess(const std::string&, const ndnrtc::OnSlotAccess& onSlotAccess, const ndnrtc::OnNotFound&) { onSlotAccess(slot_); } void callOnSlotNotFound(const std::string&, const ndnrtc::OnSlotAccess&, const ndnrtc::OnNotFound& onNotFound) { onNotFound(); } boost::shared_ptr<ndnrtc::ISlot> slot_; }; class MockSlot : public ndnrtc::ISlot { public: MOCK_METHOD2(markVerified, void(const std::string&, bool)); }; #endif
21.880952
70
0.743199
luckiday
9d15cd6fb681f2a422e30cb3a6daa193469d1157
8,373
hh
C++
src/sge_fixed.hh
sungiant/sge
89692d4376cb4374e0936b5373878e59dc9a68bb
[ "MIT" ]
6
2020-09-04T10:19:29.000Z
2021-05-07T05:21:37.000Z
src/sge_fixed.hh
sungiant/sge
89692d4376cb4374e0936b5373878e59dc9a68bb
[ "MIT" ]
null
null
null
src/sge_fixed.hh
sungiant/sge
89692d4376cb4374e0936b5373878e59dc9a68bb
[ "MIT" ]
null
null
null
#pragma once namespace sge::fixed { //--------------------------------------------------------------------------------------------------------------------// // just some of this: https://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a00752_source.html // with minor changes template<typename TP, size_t SZ> struct array { typedef TP value_type; typedef TP* pointer; typedef const TP* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; void fill (const value_type& x) { std::fill_n (begin (), size (), x); } void swap (array& x) { std::swap_ranges (begin (), end (), x.begin ()); } iterator begin () { return iterator (std::addressof (content[0])); } const_iterator begin () const { return const_iterator (std::addressof (content[0])); } iterator end () { return iterator (std::addressof (content[SZ])); } const_iterator end () const { return const_iterator (std::addressof (content[SZ])); } reverse_iterator rbegin () { return reverse_iterator (end ()); } const_reverse_iterator rbegin () const { return const_reverse_iterator (end ()); } reverse_iterator rend () { return reverse_iterator (begin ()); } const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } const_iterator cbegin () const { return const_iterator (std::addressof (content[0])); } const_iterator cend () const { return const_iterator (std::addressof (content[SZ])); } const_reverse_iterator crbegin () const { return const_reverse_iterator (end ()); } const_reverse_iterator crend () const { return const_reverse_iterator (begin ()); } constexpr size_type size () const { return SZ; } constexpr size_type max_size () const { return SZ; } constexpr bool empty () const { return size () == 0; } reference operator[] (size_type n) { return content[n]; } const_reference operator[] (size_type n) const { return content[n]; } reference at (size_type n) { assert (n < SZ); return content[n]; } const_reference at (size_type n) const { assert (n < SZ); return content[n]; } reference front () { return *begin (); } const_reference front () const { return *begin (); } reference back () { return SZ ? *(end () - 1) : *end (); } const_reference back () const { return SZ ? *(end () - 1) : *end (); } TP* data () { return std::addressof (content[0]); } const TP* data () const { return std::addressof (content[0]); } private: value_type content[SZ ? SZ : 1]; }; template<typename TP, size_t SZ> inline bool operator==(const array<TP, SZ>& left, const array<TP, SZ>& right) { return std::equal (left.begin (), left.end (), right.begin ()); } template<typename TP, size_t SZ> inline bool operator!=(const array<TP, SZ>& left, const array<TP, SZ>& right) { return !(left == right); } template<typename TP, size_t SZ> inline bool operator< (const array<TP, SZ>& left, const array<TP, SZ>& right) { return std::lexicographical_compare (left.begin (), left.end (), right.begin (), right.end ()); } template<typename TP, size_t SZ> inline bool operator> (const array<TP, SZ>& left, const array<TP, SZ>& right) { return right < left; } template<typename TP, size_t SZ> inline bool operator<=(const array<TP, SZ>& left, const array<TP, SZ>& right) { return !(left > right); } template<typename TP, size_t SZ> inline bool operator>=(const array<TP, SZ>& left, const array<TP, SZ>& right) { return !(left < right); } template<typename TP, size_t SZ> inline void swap (array<TP, SZ>& left, array<TP, SZ>& right) { left.swap (right); } //--------------------------------------------------------------------------------------------------------------------// template<typename TP, size_t SZ> struct vector { typedef TP value_type; typedef TP* pointer; typedef const TP* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; ~vector () { clear(); } void fill (const value_type& x) { std::fill_n (begin (), SZ, x); current_size = SZ; } void swap (vector& x) { assert (false); } iterator begin () { return iterator (std::addressof (content[0])); } const_iterator begin () const { return const_iterator (std::addressof (content[0])); } iterator end () { return iterator (std::addressof (content[current_size])); } const_iterator end () const { return const_iterator (std::addressof (content[current_size])); } reverse_iterator rbegin () { return reverse_iterator (end ()); } const_reverse_iterator rbegin () const { return const_reverse_iterator (end ()); } reverse_iterator rend () { return reverse_iterator (begin ()); } const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } const_iterator cbegin () const { return const_iterator (std::addressof (content[0])); } const_iterator cend () const { return const_iterator (std::addressof (content[current_size])); } const_reverse_iterator crbegin () const { return const_reverse_iterator (end ()); } const_reverse_iterator crend () const { return const_reverse_iterator (begin ()); } constexpr size_type size () const { return current_size; } constexpr size_type max_size () const { return SZ; } constexpr bool empty () const { return current_size == 0; } reference operator[] (size_type n) { assert (n < current_size); return content[n]; } const_reference operator[] (size_type n) const { assert (n < current_size); return content[n]; } reference at (size_type n) { assert (n < current_size); return content[n]; } const_reference at (size_type n) const { assert (n < current_size); return content[n]; } reference front () { return *begin (); } const_reference front () const { return *begin (); } reference back () { return SZ ? *(end () - 1) : *end (); } const_reference back () const { return SZ ? *(end () - 1) : *end (); } TP* data () { return std::addressof (content[0]); } const TP* data () const { return std::addressof (content[0]); } private: size_type current_size; value_type content[SZ ? SZ : 1]; }; }
65.929134
210
0.52514
sungiant
1dd6d3c5bcbd014cebf4c82be4499d2a2710e1d4
3,465
cpp
C++
Study Material/CP/06.ch6/01.basic string.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
1
2019-12-19T06:51:20.000Z
2019-12-19T06:51:20.000Z
Study Material/CP/06.ch6/01.basic string.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
null
null
null
Study Material/CP/06.ch6/01.basic string.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; // input handle #define iln() scanf("\n") //scan new line #define in(n) scanf("%d",&n) //scan int #define ins(n) scanf("%s",n) //scan char[] #define inc(n) scanf("%c ",&n) //scan char #define inf(n) scanf("%lf",&n) //scan double/float #define inl(n) scanf("%lld",&n) //scan long long int #define ot(x) printf("%d", x) //output int #define sp() printf(" ") //output single space #define ots(x) printf("%s", x) //output char[] ( be careful using it may have some issue ) #define otc(x) printf("%c", x) //output char #define ln() printf("\n") //output new line #define otl(x) printf("%lld", x)//output long long int #define otf(x) printf("%.12lf", x)// output double/float with 0.00 // helpers defines #define all(v) v.begin(), v.end() #define sz(v) ((int)((v).size())) // eg... vector<int> v; sz(v) #define ssz(s) ((int)strlen(s)) // eg... char s[10]; ssz(s) #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)) #define max3(a,b,c) max(a , max(b , c)) #define min3(a,b,c) min(a , min(b , c)) #define ff first #define ss second //helpers void file() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); // freopen("ot.txt", "w", stdout); #else // freopen("jumping.in", "r", stdin); // HERE #endif } // constants const int MN = 1e6 + 1e1; typedef long long int lli; const int OO = 1e9 + 5; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ii> vii; int i, j, k; #define forr(i,j, n) for(i = j;i < n;i++) #define frr(i,j, n) for(i = j;i >= n;i--) void split(const string &s, const char* delim, vector<string> & v) { char * dup = strdup(s.c_str()); char * token = strtok(dup, delim); while (token != NULL) v.push_back(string(token)), token = strtok(NULL, delim); free(dup); } int main() { file(); //TODO return 0; /* I love CS3233 Competitive Programming. i also love AlGoRiThM */ string ss; getline(cin, ss); vector<string> tkns, ans; map<string, int> mpC; int mx = 0; transform(all(ss), ss.begin(), ::tolower), split(ss, " ,.", tkns); for (auto s : tkns) { mpC[s]++; if (mpC[s] > mx) ans.clear(), ans.pb(s), mx = mpC[s]; else if (mpC[s] == mx) ans.pb(s); } ot(mx), puts(" is the max"); for (auto s : ans) cout << s, sp(); return 0; /* I love CS3233 Competitive Programming. i also love AlGoRiThM */ string inp; map<char, int> vow; int cons = 0, v = 0; vow['a'] = 1, vow['e'] = 1, vow['i'] = 1, vow['o'] = 1, vow['u'] = 1; getline(cin, inp), transform(all(inp), inp.begin(), ::tolower); for (auto ch : inp) if (vow[ch]) v++; else cons++; ot(v), sp(), ot(cons), ln(); vector<string> tokkens; split(inp, " ,.", tokkens), sort(all(tokkens)), cout << tokkens[0]; return 0; /* I love CS3233 Competitive Programming. i also love AlGoRiThM love */ string line, tF; getline(cin, line), cin >> tF; auto id = line.find(tF); while (id != string::npos) ot((int)id), id = line.find(tF, id + 1), sp(); ln(), line.replace(line.find(tF), tF.length(), "replaced correctly"), cout << line; return 0; /* I love CS3233 Competitive Programming. i also love AlGoRiThM .......you must stop after reading this line as it starts with 7 dots after the first input block, there will be one loooooooooooong line... */ string lin, Lstring; while (getline(cin, lin) and lin.substr(0, 7) != ".......") if (sz(Lstring)) Lstring += " " + lin; else Lstring = lin; cout << Lstring; return 0; }
27.943548
91
0.609812
mohamedGamalAbuGalala
1ddb51468b551f069bf768431e3d3e5e738e45ef
25,211
cpp
C++
newton-4.00/applications/ndSandbox/demos/ndBasicVehicle.cpp
MADEAPPS/newton-dynamics
e346eec9d19ffb1c995b09417400167d3c52a635
[ "Zlib" ]
1,031
2015-01-02T14:08:47.000Z
2022-03-29T02:25:27.000Z
newton-4.00/applications/ndSandbox/demos/ndBasicVehicle.cpp
MADEAPPS/newton-dynamics
e346eec9d19ffb1c995b09417400167d3c52a635
[ "Zlib" ]
240
2015-01-11T04:27:19.000Z
2022-03-30T00:35:57.000Z
newton-4.00/applications/ndSandbox/demos/ndBasicVehicle.cpp
MADEAPPS/newton-dynamics
e346eec9d19ffb1c995b09417400167d3c52a635
[ "Zlib" ]
224
2015-01-05T06:13:54.000Z
2022-02-25T14:39:51.000Z
/* Copyright (c) <2003-2021> <Newton Game Dynamics> * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely */ #include "ndSandboxStdafx.h" #include "ndSkyBox.h" #include "ndDemoMesh.h" #include "ndVehicleUI.h" #include "ndDemoCamera.h" #include "ndLoadFbxMesh.h" #include "ndSoundManager.h" #include "ndPhysicsUtils.h" #include "ndPhysicsWorld.h" #include "ndCompoundScene.h" #include "ndVehicleCommon.h" #include "ndMakeStaticMap.h" #include "ndTargaToOpenGl.h" #include "ndDemoEntityManager.h" #include "ndDemoInstanceEntity.h" #include "ndBasicPlayerCapsule.h" #include "ndHeightFieldPrimitive.h" class ndVehicleDectriptorViper : public ndVehicleDectriptor { public: ndVehicleDectriptorViper() :ndVehicleDectriptor("viper.fbx") { m_useHardSolverMode = true; //m_useHardSolverMode = false; m_comDisplacement = dVector(0.25f, -0.35f, 0.0f, 0.0f); dFloat32 fuelInjectionRate = 10.0f; dFloat32 idleTorquePoundFoot = 100.0f; dFloat32 idleRmp = 700.0f; dFloat32 horsePower = 400.0f; dFloat32 rpm0 = 5000.0f; dFloat32 rpm1 = 6200.0f; dFloat32 horsePowerAtRedLine = 100.0f; dFloat32 redLineRpm = 8000.0f; m_engine.Init(fuelInjectionRate, idleTorquePoundFoot, idleRmp, horsePower, rpm0, rpm1, horsePowerAtRedLine, redLineRpm); } }; class ndVehicleDectriptorJeep : public ndVehicleDectriptor { public: ndVehicleDectriptorJeep() :ndVehicleDectriptor("jeep.fbx") { //m_useHardSolverMode = true; m_useHardSolverMode = false; //m_comDisplacement = dVector(0.0f, -0.55f, 0.0f, 0.0f); m_comDisplacement = dVector(0.0f, -0.35f, 0.0f, 0.0f); dFloat32 fuelInjectionRate = 10.0f; dFloat32 idleTorquePoundFoot = 200.0f; dFloat32 idleRmp = 800.0f; dFloat32 horsePower = 400.0f; dFloat32 rpm0 = 5000.0f; dFloat32 rpm1 = 6200.0f; dFloat32 horsePowerAtRedLine = 400.0f; dFloat32 redLineRpm = 8000.0f; m_engine.Init(fuelInjectionRate, idleTorquePoundFoot, idleRmp, horsePower, rpm0, rpm1, horsePowerAtRedLine, redLineRpm); m_frontTire.m_mass = 100.0f; m_frontTire.m_verticalOffset = -0.15f; m_frontTire.m_steeringAngle = 35.0f * dDegreeToRad; m_frontTire.m_springK = 800.0f; m_frontTire.m_damperC = 50.0f; m_frontTire.m_regularizer = 0.3f; m_frontTire.m_upperStop = -0.05f; m_frontTire.m_lowerStop = 0.4f; m_frontTire.m_brakeTorque = 1500.0f; m_frontTire.m_handBrakeTorque = 0.0f; m_frontTire.m_laterialStiffness = 1.0f / 1000.0f; m_frontTire.m_longitudinalStiffness = 50.0f / 1000.0f; m_rearTire.m_mass = 100.0f; m_rearTire.m_verticalOffset = -0.15f; m_rearTire.m_steeringAngle = 0.0f; m_rearTire.m_springK = 800.0f; m_rearTire.m_damperC = 50.0f; m_rearTire.m_regularizer = 0.3f; m_rearTire.m_upperStop = -0.05f; m_rearTire.m_lowerStop = 0.4f; m_rearTire.m_brakeTorque = 3000.0f; m_rearTire.m_handBrakeTorque = 4000.0f; m_rearTire.m_laterialStiffness = 0.3f / 1000.0f; m_rearTire.m_longitudinalStiffness = 50.0f / 1000.0f; m_frictionCoefficientScale = 1.2f; m_torsionBarType = m_fourWheelAxle; m_differentialType = m_fourWheeldrive; } }; class ndVehicleDectriptorMonsterTruck: public ndVehicleDectriptor { public: ndVehicleDectriptorMonsterTruck() :ndVehicleDectriptor("monsterTruck.fbx") { m_comDisplacement = dVector(0.0f, -0.55f, 0.0f, 0.0f); dFloat32 fuelInjectionRate = 10.0f; dFloat32 idleTorquePoundFoot = 250.0f; dFloat32 idleRmp = 800.0f; dFloat32 horsePower = 400.0f; dFloat32 rpm0 = 5000.0f; dFloat32 rpm1 = 6200.0f; dFloat32 horsePowerAtRedLine = 150.0f; dFloat32 redLineRpm = 8000.0f; m_engine.Init(fuelInjectionRate, idleTorquePoundFoot, idleRmp, horsePower, rpm0, rpm1, horsePowerAtRedLine, redLineRpm); m_frontTire.m_mass = 100.0f; m_frontTire.m_verticalOffset = 0.0f; m_frontTire.m_steeringAngle = 35.0f * dDegreeToRad; m_frontTire.m_springK = 500.0f; m_frontTire.m_damperC = 50.0f; m_frontTire.m_regularizer = 0.2f; m_frontTire.m_upperStop = -0.05f; m_frontTire.m_lowerStop = 0.4f; m_frontTire.m_brakeTorque = 1000.0f; m_frontTire.m_handBrakeTorque = 0.0f; m_frontTire.m_laterialStiffness = 1.0f / 1000.0f; m_frontTire.m_longitudinalStiffness = 50.0f / 1000.0f; m_rearTire.m_mass = 100.0f; m_rearTire.m_verticalOffset = 0.0f; m_rearTire.m_steeringAngle = 0.0f; m_rearTire.m_springK = 500.0f; m_rearTire.m_damperC = 50.0f; m_rearTire.m_regularizer = 0.2f; m_rearTire.m_upperStop = -0.05f; m_rearTire.m_lowerStop = 0.4f; m_rearTire.m_brakeTorque = 2000.0f; m_rearTire.m_handBrakeTorque = 3000.0f; m_rearTire.m_laterialStiffness = 1.0f / 1000.0f; m_rearTire.m_longitudinalStiffness = 50.0f / 1000.0f; m_frictionCoefficientScale = 1.3f; m_torsionBarType = m_fourWheelAxle; m_differentialType = m_fourWheeldrive; } }; static ndVehicleDectriptorJeep jeepDesc; static ndVehicleDectriptorViper viperDesc; static ndVehicleDectriptorMonsterTruck monterTruckDesc; static const char* engineSounds[] = { "engine_start.wav", "engine_rpm.wav", "tire_skid.wav", }; class ndBasicMultiBodyVehicle : public ndBasicVehicle { public: ndBasicMultiBodyVehicle(ndDemoEntityManager* const scene, const ndVehicleDectriptor& desc, const dMatrix& matrix) :ndBasicVehicle(desc) ,m_vehicleUI(nullptr) { m_vehicleUI = new ndVehicleUI(); m_vehicleUI->CreateBufferUI(); ndDemoEntity* const vehicleEntity = LoadMeshModel(scene, desc.m_name); vehicleEntity->ResetMatrix(vehicleEntity->CalculateGlobalMatrix() * matrix); ndPhysicsWorld* const world = scene->GetWorld(); // create the vehicle chassis as a normal rigid body ndBodyDynamic* const chassis = CreateChassis(scene, vehicleEntity, m_configuration.m_chassisMass); chassis->SetAngularDamping(dVector(m_configuration.m_chassisAngularDrag)); // lower vehicle com; dVector com(chassis->GetCentreOfMass()); com += m_localFrame.m_up.Scale(m_configuration.m_comDisplacement.m_y); com += m_localFrame.m_front.Scale(m_configuration.m_comDisplacement.m_x); com += m_localFrame.m_right.Scale(m_configuration.m_comDisplacement.m_z); chassis->SetCentreOfMass(com); // 1- add chassis to the vehicle mode AddChassis(chassis); // 2- each tire to the model, // create the tire as a normal rigid body // and attach them to the chassis with a tire joints ndBodyDynamic* const rr_tire_body = CreateTireBody(scene, chassis, m_configuration.m_rearTire, "rr_tire"); ndBodyDynamic* const rl_tire_body = CreateTireBody(scene, chassis, m_configuration.m_rearTire, "rl_tire"); ndMultiBodyVehicleTireJoint* const rr_tire = AddTire(m_configuration.m_rearTire, rr_tire_body); ndMultiBodyVehicleTireJoint* const rl_tire = AddTire(m_configuration.m_rearTire, rl_tire_body); ndBodyDynamic* const fr_tire_body = CreateTireBody(scene, chassis, m_configuration.m_frontTire, "fr_tire"); ndBodyDynamic* const fl_tire_body = CreateTireBody(scene, chassis, m_configuration.m_frontTire, "fl_tire"); ndMultiBodyVehicleTireJoint* const fr_tire = AddTire(m_configuration.m_frontTire, fr_tire_body); ndMultiBodyVehicleTireJoint* const fl_tire = AddTire(m_configuration.m_frontTire, fl_tire_body); m_gearMap[sizeof(m_configuration.m_transmission.m_forwardRatios) / sizeof(m_configuration.m_transmission.m_forwardRatios[0]) + 0] = 1; m_gearMap[sizeof(m_configuration.m_transmission.m_forwardRatios) / sizeof(m_configuration.m_transmission.m_forwardRatios[0]) + 1] = 0; for (int i = 0; i < m_configuration.m_transmission.m_gearsCount; i++) { m_gearMap[i] = i + 2; } m_currentGear = sizeof(m_configuration.m_transmission.m_forwardRatios) / sizeof(m_configuration.m_transmission.m_forwardRatios[0]) + 1; // add the slip differential ndMultiBodyVehicleDifferential* differential = nullptr; switch (m_configuration.m_differentialType) { case ndVehicleDectriptor::m_rearWheelDrive: { differential = AddDifferential(m_configuration.m_differentialMass, m_configuration.m_differentialRadius, rl_tire, rr_tire, m_configuration.m_slipDifferentialRmpLock / dRadPerSecToRpm); break; } case ndVehicleDectriptor::m_frontWheelDrive: { differential = AddDifferential(m_configuration.m_differentialMass, m_configuration.m_differentialRadius, fl_tire, fr_tire, m_configuration.m_slipDifferentialRmpLock / dRadPerSecToRpm); break; } case ndVehicleDectriptor::m_fourWheeldrive: { ndMultiBodyVehicleDifferential* const rearDifferential = AddDifferential(m_configuration.m_differentialMass, m_configuration.m_differentialRadius, rl_tire, rr_tire, m_configuration.m_slipDifferentialRmpLock / dRadPerSecToRpm); ndMultiBodyVehicleDifferential* const frontDifferential = AddDifferential(m_configuration.m_differentialMass, m_configuration.m_differentialRadius, fl_tire, fr_tire, m_configuration.m_slipDifferentialRmpLock / dRadPerSecToRpm); differential = AddDifferential(m_configuration.m_differentialMass, m_configuration.m_differentialRadius, rearDifferential, frontDifferential, m_configuration.m_slipDifferentialRmpLock / dRadPerSecToRpm); break; } case ndVehicleDectriptor::m_eightWheeldrive: { dAssert(0); break; } } // add a motor ndMultiBodyVehicleMotor* const motor = AddMotor(m_configuration.m_motorMass, m_configuration.m_motorRadius); motor->SetRpmLimits(m_configuration.m_engine.GetIdleRadPerSec() * 9.55f, m_configuration.m_engine.GetRedLineRadPerSec() * dRadPerSecToRpm); // add the gear box AddGearBox(m_motor, differential); switch (m_configuration.m_torsionBarType) { case ndVehicleDectriptor::m_noWheelAxle: { // no torsion bar break; } case ndVehicleDectriptor::m_rearWheelAxle: { ndMultiBodyVehicleTorsionBar* const torsionBar = AddTorsionBar(world->GetSentinelBody()); torsionBar->AddAxel(rl_tire->GetBody0(), rr_tire->GetBody0()); torsionBar->SetTorsionTorque(m_configuration.m_torsionBarSpringK, m_configuration.m_torsionBarDamperC, m_configuration.m_torsionBarRegularizer); break; } case ndVehicleDectriptor::m_frontWheelAxle: { ndMultiBodyVehicleTorsionBar* const torsionBar = AddTorsionBar(world->GetSentinelBody()); torsionBar->AddAxel(fl_tire->GetBody0(), fr_tire->GetBody0()); torsionBar->SetTorsionTorque(m_configuration.m_torsionBarSpringK, m_configuration.m_torsionBarDamperC, m_configuration.m_torsionBarRegularizer); break; } case ndVehicleDectriptor::m_fourWheelAxle: { ndMultiBodyVehicleTorsionBar* const torsionBar = AddTorsionBar(world->GetSentinelBody()); torsionBar->AddAxel(rl_tire->GetBody0(), rr_tire->GetBody0()); torsionBar->AddAxel(fl_tire->GetBody0(), fr_tire->GetBody0()); torsionBar->SetTorsionTorque(m_configuration.m_torsionBarSpringK, m_configuration.m_torsionBarDamperC, m_configuration.m_torsionBarRegularizer); break; } } // set a soft or hard mode SetVehicleSolverModel(m_configuration.m_useHardSolverMode ? true : false); // prepare data for animating suspension m_rearAxlePivot = vehicleEntity->Find("rearAxlePivot"); m_frontAxlePivot = vehicleEntity->Find("frontAxlePivot"); m_rr_tire = rr_tire; m_rl_tire = rl_tire; m_fr_tire = fr_tire; m_fl_tire = fl_tire; // load all engine sound channels ndSoundManager* const soundManager = world->GetSoundManager(); m_startEngine = false; m_startSound = soundManager->CreateSoundChannel(engineSounds[0]); m_engineRpmSound = soundManager->CreateSoundChannel(engineSounds[1]); m_skipMarks = soundManager->CreateSoundChannel(engineSounds[2]); m_startSound->SetAttenuationRefDistance(20.0f, 40.0f, 50.0f); m_engineRpmSound->SetAttenuationRefDistance(20.0f, 40.0f, 50.0f); m_engineRpmSound->SetLoop(true); m_skipMarks->SetLoop(true); } ~ndBasicMultiBodyVehicle() { ReleaseTexture(m_gears); ReleaseTexture(m_odometer); ReleaseTexture(m_redNeedle); ReleaseTexture(m_tachometer); ReleaseTexture(m_greenNeedle); delete m_skipMarks; delete m_startSound; delete m_engineRpmSound; if (m_vehicleUI) { delete m_vehicleUI; } } ndDemoEntity* LoadMeshModel(ndDemoEntityManager* const scene, const char* const filename) { fbxDemoEntity* const vehicleEntity = scene->LoadFbxMesh(filename); scene->AddEntity(vehicleEntity); // load 2d display assets m_gears = LoadTexture("gears_font.tga"); m_odometer = LoadTexture("kmh_dial.tga"); m_tachometer = LoadTexture("rpm_dial.tga"); m_redNeedle = LoadTexture("needle_red.tga"); m_greenNeedle = LoadTexture("needle_green.tga"); return vehicleEntity; } void SetAsPlayer(ndDemoEntityManager* const scene, bool mode = true) { ndBasicVehicle::SetAsPlayer(scene, mode); scene->SetSelectedModel(this); scene->SetUpdateCameraFunction(UpdateCameraCallback, this); scene->Set2DDisplayRenderFunction(RenderHelp, RenderUI, this); } static void RenderUI(ndDemoEntityManager* const scene, void* const context) { ndBasicMultiBodyVehicle* const me = (ndBasicMultiBodyVehicle*)context; me->RenderUI(scene); } static void RenderHelp(ndDemoEntityManager* const scene, void* const context) { ndBasicMultiBodyVehicle* const me = (ndBasicMultiBodyVehicle*)context; me->RenderHelp(scene); } private: ndBodyDynamic* CreateChassis(ndDemoEntityManager* const scene, ndDemoEntity* const chassisEntity, dFloat32 mass) { dMatrix matrix(chassisEntity->CalculateGlobalMatrix(nullptr)); ndShapeInstance* const chassisCollision = chassisEntity->CreateCollisionFromchildren(); ndBodyDynamic* const body = new ndBodyDynamic(); body->SetNotifyCallback(new ndDemoEntityNotify(scene, chassisEntity)); body->SetMatrix(matrix); body->SetCollisionShape(*chassisCollision); body->SetMassMatrix(mass, *chassisCollision); delete chassisCollision; return body; } static void UpdateCameraCallback(ndDemoEntityManager* const manager, void* const context, dFloat32 timestep) { ndBasicMultiBodyVehicle* const me = (ndBasicMultiBodyVehicle*)context; me->SetCamera(manager, timestep); } void SetCamera(ndDemoEntityManager* const manager, dFloat32) { ndDemoCamera* const camera = manager->GetCamera(); ndDemoEntity* const chassisEntity = (ndDemoEntity*)m_chassis->GetNotifyCallback()->GetUserData(); dMatrix camMatrix(camera->GetNextMatrix()); dMatrix playerMatrix(chassisEntity->GetNextMatrix()); dVector frontDir(camMatrix[0]); dVector camOrigin(0.0f); camOrigin = playerMatrix.m_posit + dVector(0.0f, 1.0f, 0.0f, 0.0f); camOrigin -= frontDir.Scale(10.0f); camera->SetNextMatrix(camMatrix, camOrigin); } void RenderHelp(ndDemoEntityManager* const scene) { dVector color(1.0f, 1.0f, 0.0f, 0.0f); scene->Print(color, "Vehicle driving keyboard control"); scene->Print(color, "change vehicle : 'c'"); scene->Print(color, "accelerator : 'w'"); scene->Print(color, "brakes : 's'"); scene->Print(color, "turn left : 'a'"); scene->Print(color, "turn right : 'd'"); scene->Print(color, "hand brakes : 'space'"); ImGui::Separator(); scene->Print(color, "gear box"); scene->Print(color, "ignition : 'i'"); scene->Print(color, "manual transmission : '?'"); scene->Print(color, "neutral gear : 'n'"); scene->Print(color, "forward gear up : '>'"); scene->Print(color, "forward gear down : '<'"); scene->Print(color, "reverse gear : 'r'"); scene->Print(color, "parking gear : 'p'"); } void RenderUI(ndDemoEntityManager* const scene) { ndMultiBodyVehicleMotor* const motor = m_motor; if (motor) { dAssert(motor); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); dFloat32 gageSize = 200.0f; dFloat32 y = scene->GetHeight() - (gageSize / 2.0f + 20.0f); // draw the tachometer dFloat32 x = gageSize / 2 + 20.0f; dFloat32 maxRpm = m_configuration.m_engine.GetRedLineRadPerSec() * dRadPerSecToRpm; maxRpm += 500.0f; //printf("%.3f \n", m_configuration.m_transmission.m_forwardRatios[m_currentGear]); //dFloat32 rpm = (motor->GetRpm() / maxRpm) * m_configuration.m_transmission.m_forwardRatios[m_currentGear]; dFloat32 rpm = (motor->GetRpm() / maxRpm) * 2.85f; if (m_vehicleUI) { if (m_vehicleUI->m_shaderHandle) { glUseProgram(m_vehicleUI->m_shaderHandle); // glActiveTexture(GL_TEXTURE0); // m_vehicleUI->RenderGageUI(scene, m_tachometer, -x, -y, gageSize * 0.5f, 0.0f, -180.0f, 90.0f); dFloat32 s = gageSize * 0.7f; m_vehicleUI->RenderGageUI(scene, m_redNeedle, -x, -y, s * 0.5f, rpm, -0.0f, 90.0f); x += gageSize; m_vehicleUI->RenderGageUI(scene, m_odometer, -x, -y, gageSize * 0.5f, 0.0f, -180.0f, 90.0f); dFloat32 speed = (GetSpeed() / 100.0f) * 2.85f; m_vehicleUI->RenderGageUI(scene, m_greenNeedle, -x, -y, s * 0.5f, dAbs(speed), -0.0f, 90.0f); // draw the current gear m_vehicleUI->RenderGearUI(scene, m_gearMap[m_currentGear], m_gears, -x, -y, gageSize); glUseProgram(0); } } } } void ApplyInputs(ndWorld* const world, dFloat32 timestep) { ndBasicVehicle::ApplyInputs(world, timestep); if (m_motor) { bool startEngine = m_motor->GetStart(); if (m_startEngine ^ startEngine) { m_startEngine = startEngine; if (startEngine) { m_startSound->Play(); m_engineRpmSound->Play(); m_engineRpmSound->SetPitch(0.5f); m_engineRpmSound->SetVolume(0.25f); } else { m_startSound->Stop(); m_engineRpmSound->Stop(); } } dFloat32 maxRpm = 9000.0f; dFloat32 rpm = m_motor->GetRpm() / maxRpm; dFloat32 pitchFactor = 0.5f + 0.7f * rpm; m_engineRpmSound->SetPitch(pitchFactor); // up to two decibels of volume dFloat32 volumeFactor = 0.25f + 0.75f * rpm; m_engineRpmSound->SetVolume(volumeFactor); //dTrace(("%f\n", volumeFactor)); // apply positional sound const dMatrix& location = m_chassis->GetMatrix(); m_engineRpmSound->SetPosition(location.m_posit); m_engineRpmSound->SetVelocity(m_chassis->GetVelocity()); } // test convex cast for now if (0) { // test convex cast ndMultiBodyVehicleTireJoint* const tire = m_tireList.GetCount() ? m_tireList.GetFirst()->GetInfo() : nullptr; if (tire) { const ndWheelDescriptor& info = tire->GetInfo(); const dMatrix tireUpperBumperMatrix(tire->CalculateUpperBumperMatrix()); const dVector dest(tireUpperBumperMatrix.m_posit - tireUpperBumperMatrix.m_up.Scale(info.m_lowerStop - info.m_upperStop)); class ndConvexCastNotifyTest : public ndConvexCastNotify { public: ndConvexCastNotifyTest() :ndConvexCastNotify() { } virtual dUnsigned32 OnRayPrecastAction(const ndBody* const body, const ndShapeInstance* const) { return !((body == m_chassis) || (body == m_tire)); } ndBodyKinematic* m_tire; ndBodyKinematic* m_chassis; }; ndConvexCastNotifyTest convexCast; convexCast.m_tire = tire->GetBody0(); convexCast.m_chassis = m_chassis; //convexCast.CastShape(tire->GetBody0()->GetCollisionShape(), tireUpperBumperMatrix, dest, otherBody->GetCollisionShape(), otherBody->GetMatrix()); m_chassis->GetScene()->ConvexCast(convexCast, tire->GetBody0()->GetCollisionShape(), tireUpperBumperMatrix, dest); convexCast.m_param = 0.0f; } } } void PostTransformUpdate(ndWorld* const, dFloat32) { // play body part animations ndDemoEntityNotify* const notify = (ndDemoEntityNotify*)m_chassis->GetNotifyCallback(); if (m_rearAxlePivot && m_frontAxlePivot) { const dMatrix rearPivotMatrix((m_rearAxlePivot->CalculateGlobalMatrix(notify->m_entity) * m_chassis->GetMatrix()).Inverse()); const dMatrix rearLeftTireMatrix(m_rl_tire->GetBody0()->GetMatrix() * rearPivotMatrix); const dMatrix rearRightTireMatrix(m_rr_tire->GetBody0()->GetMatrix() * rearPivotMatrix); const dVector rearOrigin(dVector::m_half * (rearRightTireMatrix.m_posit + rearLeftTireMatrix.m_posit)); const dVector rearStep(rearRightTireMatrix.m_posit - rearLeftTireMatrix.m_posit); const dFloat32 rearAxleAngle = dAtan2(-rearStep.m_y, rearStep.m_z); const dQuaternion rearAxelRotation(dVector(dFloat32(1.0f), dFloat32(0.0f), dFloat32(0.0f), dFloat32(0.0f)), rearAxleAngle); m_rearAxlePivot->GetChild()->SetNextMatrix(rearAxelRotation, rearOrigin); const dMatrix frontPivotMatrix((m_frontAxlePivot->CalculateGlobalMatrix(notify->m_entity) * m_chassis->GetMatrix()).Inverse()); const dMatrix frontLeftTireMatrix(m_fl_tire->GetBody0()->GetMatrix() * frontPivotMatrix); const dMatrix frontRightTireMatrix(m_fr_tire->GetBody0()->GetMatrix() * frontPivotMatrix); const dVector frontOrigin(dVector::m_half * (frontRightTireMatrix.m_posit + frontLeftTireMatrix.m_posit)); const dVector frontStep(frontRightTireMatrix.m_posit - frontLeftTireMatrix.m_posit); const dFloat32 frontAxleAngle = dAtan2(-frontStep.m_y, frontStep.m_z); const dQuaternion frontAxelRotation(dVector(dFloat32(1.0f), dFloat32(0.0f), dFloat32(0.0f), dFloat32(0.0f)), frontAxleAngle); m_frontAxlePivot->GetChild()->SetNextMatrix(frontAxelRotation, frontOrigin); } } GLuint m_gears; GLuint m_odometer; GLuint m_redNeedle; GLuint m_tachometer; GLuint m_greenNeedle; dInt32 m_gearMap[8]; ndSoundChannel* m_skipMarks; ndSoundChannel* m_startSound; ndSoundChannel* m_engineRpmSound; bool m_startEngine; ndVehicleUI* m_vehicleUI; ndDemoEntity* m_rearAxlePivot; ndDemoEntity* m_frontAxlePivot; ndMultiBodyVehicleTireJoint* m_rr_tire; ndMultiBodyVehicleTireJoint* m_rl_tire; ndMultiBodyVehicleTireJoint* m_fr_tire; ndMultiBodyVehicleTireJoint* m_fl_tire; }; static void TestPlayerCapsuleInteaction(ndDemoEntityManager* const scene, const dMatrix& location) { dMatrix localAxis(dGetIdentityMatrix()); localAxis[0] = dVector(0.0, 1.0f, 0.0f, 0.0f); localAxis[1] = dVector(1.0, 0.0f, 0.0f, 0.0f); localAxis[2] = localAxis[0].CrossProduct(localAxis[1]); dFloat32 height = 1.9f; dFloat32 radio = 0.5f; dFloat32 mass = 100.0f; ndDemoEntity* const entity = scene->LoadFbxMesh("whiteMan.fbx"); new ndBasicPlayerCapsule(scene, entity, localAxis, location, mass, radio, height, height / 4.0f); delete entity; } void ndBasicVehicle (ndDemoEntityManager* const scene) { dMatrix sceneLocation(dGetIdentityMatrix()); //BuildFloorBox(scene, sceneLocation); //BuildFlatPlane(scene, true); //BuildGridPlane(scene, 120, 4.0f, 0.0f); //BuildStaticMesh(scene, "track.fbx", true); BuildCompoundScene(scene, dGetIdentityMatrix()); //BuildStaticMesh(scene, "playerarena.fbx", true); //BuildSplineTrack(scene, "playerarena.fbx", true); sceneLocation.m_posit.m_x = -200.0f; sceneLocation.m_posit.m_z = -200.0f; //BuildHeightFieldTerrain(scene, sceneLocation); ndPhysicsWorld* const world = scene->GetWorld(); dVector location(0.0f, 2.0f, 0.0f, 1.0f); dMatrix matrix(dGetIdentityMatrix()); dVector floor(FindFloor(*world, location + dVector(0.0f, 100.0f, 0.0f, 0.0f), 200.0f)); matrix.m_posit = floor; matrix.m_posit.m_y += 0.5f; //dVector location(0.0f, 1.75f, 0.0f, 1.0f); //dMatrix matrix(dGetIdentityMatrix()); //matrix = dYawMatrix(180.0f * dDegreeToRad); //matrix = matrix * dRollMatrix(-70.0f * dDegreeToRad); //matrix.m_posit = location; ndSoundManager* const soundManager = world->GetSoundManager(); for (int i = 0; i < dInt32 (sizeof(engineSounds) / sizeof(engineSounds[0])); i++) { soundManager->CreateSoundAsset(engineSounds[i]); } #if 0 // use a test tone dVector testPosit(20.0f, 0.25f, 0.0f, 1.0f); soundManager->CreateSoundAsset("ctone.wav"); ndSoundChannel* xxxx = soundManager->CreateSoundChannel("ctone.wav"); xxxx->SetPosition(testPosit); xxxx->SetVolume(1.0f); xxxx->SetLoop(true); xxxx->SetAttenuationRefDistance(10.0f, 40.0f, 60.0f); xxxx->Play(); ndBodyKinematic* xxxx1 = AddBox(scene, testPosit, 0.0f, 4.0f, 0.5f, 5.0f); //xxxx1->GetCollisionShape().SetCollisionMode(false); #endif // add a model for general controls ndVehicleSelector* const controls = new ndVehicleSelector(); scene->GetWorld()->AddModel(controls); //ndBasicMultiBodyVehicle* const vehicle = new ndBasicMultiBodyVehicle(scene, viperDesc, matrix); ndBasicMultiBodyVehicle* const vehicle = new ndBasicMultiBodyVehicle(scene, jeepDesc, matrix); scene->GetWorld()->AddModel(vehicle); vehicle->SetAsPlayer(scene); scene->Set2DDisplayRenderFunction(ndBasicMultiBodyVehicle::RenderHelp, ndBasicMultiBodyVehicle::RenderUI, vehicle); matrix.m_posit.m_x += 5.0f; TestPlayerCapsuleInteaction(scene, matrix); //matrix.m_posit.m_x += 8.0f; //matrix.m_posit.m_z += 6.0f; //scene->GetWorld()->AddModel(new ndBasicMultiBodyVehicle(scene, jeepDesc, matrix)); // //matrix.m_posit.m_z -= 14.0f; //scene->GetWorld()->AddModel(new ndBasicMultiBodyVehicle(scene, monterTruckDesc, matrix)); // //matrix.m_posit.m_x += 15.0f; //AddPlanks(scene, matrix.m_posit, 60.0f, 5); dQuaternion rot; dVector origin(-10.0f, 2.0f, 0.0f, 0.0f); scene->SetCameraMatrix(rot, origin); //ndLoadSave loadScene; //loadScene.SaveModel("xxxxxx", vehicle); }
36.015714
231
0.74527
MADEAPPS
1ddbeebd271c366f119b7fb90db807eebca11b04
2,712
hpp
C++
tools/coredump.hpp
kobi-ca/hogl
19cd7262ed22a46cc06346d9d592ff278db5266b
[ "BSD-2-Clause" ]
null
null
null
tools/coredump.hpp
kobi-ca/hogl
19cd7262ed22a46cc06346d9d592ff278db5266b
[ "BSD-2-Clause" ]
null
null
null
tools/coredump.hpp
kobi-ca/hogl
19cd7262ed22a46cc06346d9d592ff278db5266b
[ "BSD-2-Clause" ]
null
null
null
/* Copyright (c) 2015, Max Krasnyansky <max.krasnyansky@gmail.com> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef HOGL_COREDUMP_H #define HOGL_COREDUMP_H #include <stdint.h> #include <string> #include <list> #include <map> #include <set> #include <bfd.h> namespace hogl { /** * Core dump file */ class coredump { public: /** * Core dump section */ class section { public: uint64_t vma; uint8_t *addr; unsigned long size; bfd *abfd; bool inside(void *ptr, unsigned long n) { const uint8_t *start = (uint8_t *) ptr; const uint8_t *end = start + n; if (start >= addr && end <= addr + size) return true; return false; } section(uint64_t vma, unsigned long size, bfd *b); ~section(); void alloc(); }; struct section_sorter { bool operator()(const section* s1, const section* s2) const { return s1->vma < s2->vma; } }; typedef std::set<section *, section_sorter> section_set; section_set sections; bool failed; coredump(const char *corefile, const char *execfile = 0, unsigned int flags = 0); ~coredump(); void* remap(const void *ptr, unsigned long n = 0); private: void load(bfd *b); void load_section(coredump::section *s); void coalesce_and_load_sections(); static void add_section(bfd *b, asection *sect, void *_self); bfd *_core_bfd; bfd *_exec_bfd; }; } // namespace hogl #endif
27.393939
85
0.705752
kobi-ca
1dde81947d86004525242dcd438f3463d604603c
2,672
cpp
C++
annotator/ForAnnotator.cpp
bright-tools/coverage
e4b99d46fef4e93c3fc508ff836f11b3f5f45786
[ "Apache-2.0" ]
1
2015-08-05T12:42:36.000Z
2015-08-05T12:42:36.000Z
annotator/ForAnnotator.cpp
bright-tools/coverage
e4b99d46fef4e93c3fc508ff836f11b3f5f45786
[ "Apache-2.0" ]
null
null
null
annotator/ForAnnotator.cpp
bright-tools/coverage
e4b99d46fef4e93c3fc508ff836f11b3f5f45786
[ "Apache-2.0" ]
null
null
null
/* Copyright 2013 John Bailey Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #if 0 #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Rewrite/Core/Rewriter.h" #include "clang/Rewrite/Frontend/Rewriters.h" #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/Tooling.h" #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #endif #include "clang/Basic/SourceManager.h" #include <sstream> #include "ForAnnotator.hpp" #include "AnnotationGenerator.hpp" using namespace std; using namespace clang; using namespace clang::ast_matchers; using namespace clang::tooling; ForAnnotator::ForAnnotator(Replacements *Replace) : Annotator(Replace) { } void ForAnnotator::run(const MatchFinder::MatchResult &Result) { const ForStmt *FS; llvm::errs() << "ForAnnotator::run ~ Found 'for' match\n"; if (FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop")) { llvm::errs() << "ForAnnotator::run ~ Matched statement\n"; const Stmt* forBody = FS->getBody(); if( forBody->getStmtClass() != Stmt::CompoundStmtClass ) { llvm::errs() << "ForAnnotator::run ~ Non-compound 'then': " << forBody->getStmtClassName() << "\n"; HandleNonCompound( Result, forBody, FS ); } HandleFlowChange( Result, forBody ); const Stmt* forInc = FS->getInc(); if(( forInc != NULL ) && ( forInc->getStmtClass() != Stmt::NullStmtClass )) { llvm::errs() << "ForAnnotator::run ~ Found increment/decrement term\n"; HandleFlowChange( Result, forInc, true ); } #if 0 for( Stmt::const_child_iterator x = FS->child_begin(); x!= FS->child_end(); x++ ) { if(( *x != NULL ) && ( x->getStmtClass() != Stmt::NullStmtClass )) { x->dump(); SourceLocation loc = x->getLocEnd().getLocWithOffset(1); Replace->insert(Replacement(*Result.SourceManager, loc, 0, "formoxy")); } //break; } #endif /* Get the location just after the for loop and instrument that. This is so that we can detect that the for loop exited. */ //SourceLocation loc = FS->getLocEnd().getLocWithOffset(1); //Replace->insert(Replacement(*Result.SourceManager, loc, 0, "moxy")); } }
28.425532
102
0.694237
bright-tools
1de097ff8a690c828d6b2327917bc879fa0a1cf8
3,348
cpp
C++
Classes/yaadv/CharLabel.cpp
gadget114514/yaadv
5b9ad77e2361ddcaa0e9b0f8457e9a02c7ece68b
[ "MIT" ]
3
2019-12-21T09:53:22.000Z
2020-12-29T17:55:58.000Z
Classes/yaadv/CharLabel.cpp
gadget114514/yaadv
5b9ad77e2361ddcaa0e9b0f8457e9a02c7ece68b
[ "MIT" ]
4
2019-03-11T09:47:23.000Z
2019-03-11T09:49:43.000Z
Classes/yaadv/CharLabel.cpp
gadget114514/yaadv
5b9ad77e2361ddcaa0e9b0f8457e9a02c7ece68b
[ "MIT" ]
null
null
null
#include "CharLabel.h" USING_NS_CC; USING_NS_CC; using namespace yaadv; namespace yaadv { CharLabel::CharLabel() : _pos(0), _defaultDelayTime(1.0f), _fadeTime(0.5f), _lineHeight(0), _charLabel(nullptr), _x(0), _y(0), _defaultFontSize(20), _showFinishCallback(nullptr), _defaultFontColor(Color3B::WHITE), _isRunning(false) {} CharLabel::~CharLabel() {} CharLabel *CharLabel::create(const std::string text, int fontSize, std::function<void()> callback) { CharLabel *ret = new CharLabel(); if (ret && ret->init(text, fontSize)) { ret->_showFinishCallback = callback; ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; } bool CharLabel::init(const std::string text, int fontSize) { _text = text; _defaultFontSize = fontSize; showNextChar(); return true; } void CharLabel::setString(const std::string text) { Node::removeAllChildren(); _charLabel = nullptr; _text = text; _pos = 0; _x = 0; _y = 0; _isRunning = true; showNextChar(); } void CharLabel::finishShow() { removeAllChildren(); _charLabel = Label::createWithSystemFont(_text, "arial", _defaultFontSize); _charLabel->setDimensions(this->getContentSize().width, this->getContentSize().height); _charLabel->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); _charLabel->setColor(_defaultFontColor); _charLabel->enableShadow(Color4B(0, 0, 0, 200), Size(2, -2), 1); Node::addChild(_charLabel); _isRunning = false; if (_showFinishCallback) { _showFinishCallback(); } } void CharLabel::showNextChar() { if ((_text.length() > 0 && _text[_text.length() - 1] == 13) || _pos >= (int)_text.length()) { _isRunning = false; if (_showFinishCallback) { _showFinishCallback(); } return; } auto charString = getNextChar(_text, _pos); if (_charLabel && _lineHeight < _charLabel->getContentSize().height) { _lineHeight = _charLabel->getContentSize().height; } while (charString.compare("\n") == 0) { _y -= _lineHeight; _x = 0; _pos += charString.length(); charString = getNextChar(_text, _pos); } auto tmpLabel = Label::createWithSystemFont(charString, "arial", _defaultFontSize); tmpLabel->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); Node::addChild(tmpLabel); tmpLabel->setColor(_defaultFontColor); tmpLabel->enableShadow(Color4B(0, 0, 0, 200), Size(2, -2), 1); _pos += charString.length(); tmpLabel->setPosition(_x, _y); if (_x + tmpLabel->getContentSize().width > this->getContentSize().width) { _y -= tmpLabel->getContentSize().height; _x = 0; } else { _x += tmpLabel->getContentSize().width; } tmpLabel->runAction(Sequence::createWithTwoActions(DelayTime::create(_defaultDelayTime), CallFunc::create(CC_CALLBACK_0(CharLabel::showNextChar, this)))); _charLabel = tmpLabel; } std::string CharLabel::getNextChar(const std::string src, int pos) { if (src.length() < 1) { return std::string(""); } int len = 0; char c = src[pos]; if (c >= 0 && c <= 127) { len++; } else if (c < 0 && c >= -32) { len += 3; } else if (c < 0 && c >= -64) { len += 2; } else if (c < 0) { len += 1; } std::string subString = src.substr(pos, len); return subString; } } // namespace yaadv
24.8
118
0.641278
gadget114514
1de67b2d79dc361e5ead72c50b5709122987a820
1,837
cxx
C++
rrl/examples/location_registration.cxx
msofka/LRR
8c04ab9d27980c98a201943c1fe46e7e451df367
[ "Apache-2.0" ]
2
2018-01-09T00:33:42.000Z
2018-01-09T00:33:53.000Z
rrl/examples/location_registration.cxx
msofka/LRR
8c04ab9d27980c98a201943c1fe46e7e451df367
[ "Apache-2.0" ]
null
null
null
rrl/examples/location_registration.cxx
msofka/LRR
8c04ab9d27980c98a201943c1fe46e7e451df367
[ "Apache-2.0" ]
null
null
null
#include <vul/vul_file.h> #include <vul/vul_arg.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #include <fstream> #include <rrl/itkLocationRegistration.h> //: // \file // \brief Register and recognize volume location using itkLocationRegistration object. // \author Michal Sofka // \date Oct 2007 int main( int argc, char* argv[] ) { // e.g. location_registration.exe 1089/000002cropped 1091/000002cropped -trans 1089_000002cropped-1091_000002cropped.vtk // e.g. location_registration.exe 4748/2whole4747/2whole -matches nodules -segment watershed // vul_arg< const char* > fixedImageDir ( 0, "Fixed Dicom volume directory" ); vul_arg< const char* > movingImageDir ( 0, "Moving Dicom volume directory" ); vul_arg< const char* > transformFile ( "-trans", "ITK transform file (transform used to warp moving points)", 0 ); vul_arg< std::string > prefix ( "-matches", "Prefix of the matches folder", "matches" ); vul_arg< std::string > segmentationSuffix ( "-segment", "Suffix of the oversegmentation of fixed and moving Dicom volumes", "" ); vul_arg_parse( argc, argv ); vcl_cout << "Command: "; for( int i = 0; i < argc; ++i ) vcl_cout << argv[i] << " "; vcl_cout << vcl_endl; typedef itk::LocationRegistration LocationRegistrationType; LocationRegistrationType::Pointer locreg = LocationRegistrationType::New(); locreg->SetFixedImageDir( fixedImageDir() ); locreg->SetMovingImageDir( movingImageDir() ); if( transformFile.set() ) locreg->SetTransformFile( transformFile() ); locreg->SetPrefix( prefix() ); locreg->SetSegmentationSuffix( segmentationSuffix() ); int exit_status = locreg->Run(); return exit_status; }
34.660377
145
0.658138
msofka
1de6c1b39c89e999691e1750dfb8b934f98160ed
2,449
cpp
C++
src/services/pcn-bridge/src/PortsStp.cpp
francescomessina/polycube
38f2fb4ffa13cf51313b3cab9994be738ba367be
[ "ECL-2.0", "Apache-2.0" ]
337
2018-12-12T11:50:15.000Z
2022-03-15T00:24:35.000Z
src/services/pcn-bridge/src/PortsStp.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
253
2018-12-17T21:36:15.000Z
2022-01-17T09:30:42.000Z
src/services/pcn-bridge/src/PortsStp.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
90
2018-12-19T15:49:38.000Z
2022-03-27T03:56:07.000Z
/* * Copyright 2019 The Polycube Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "PortsStp.h" #include "Bridge.h" #include "stp/stp.h" PortsStp::PortsStp(Ports &parent, const PortsStpJsonObject &conf) : PortsStpBase(parent) { logger()->debug("Creating PortsStp instance"); vlan_ = conf.getVlan(); if (conf.pathCostIsSet()) { path_cost_ = conf.getPathCost(); } if (conf.portPriorityIsSet()) { priority_ = conf.getPortPriority(); } stp_ = parent.parent_.getStpCreate(vlan_); stp_.lock()->incrementCounter(); port_ = stp_get_port(stp_.lock()->getStpInstance(), parent_.index()); stp_port_enable(port_); stp_port_set_speed(port_, 1000000); stp_port_set_name(port_, parent_.name().c_str()); } PortsStp::~PortsStp() { logger()->debug("Destroying PortsStp instance for vlan {0}", vlan_); stp_port_disable(port_); if (!stp_.expired()) stp_.lock()->decrementCounter(); } uint16_t PortsStp::getVlan() { return vlan_; } PortsStpStateEnum PortsStp::getState() { auto state = stp_port_get_state(port_); return convertState(state); } uint32_t PortsStp::getPathCost() { return path_cost_; } void PortsStp::setPathCost(const uint32_t &value) { if (path_cost_ == value) return; path_cost_ = value; stp_port_set_path_cost(port_, value); } uint8_t PortsStp::getPortPriority() { return priority_; } void PortsStp::setPortPriority(const uint8_t &value) { if (priority_ == value) return; priority_ = value; stp_port_set_priority(port_, value); } PortsStpStateEnum PortsStp::convertState(enum stp_state state) { switch (state) { case STP_DISABLED: return PortsStpStateEnum::DISABLED; case STP_LISTENING: return PortsStpStateEnum::LISTENING; case STP_LEARNING: return PortsStpStateEnum::LEARNING; case STP_FORWARDING: return PortsStpStateEnum::FORWARDING; case STP_BLOCKING: return PortsStpStateEnum::BLOCKING; } }
24.247525
75
0.722336
francescomessina
1de9540885fa0d0e3fe6300ef53917eca970a9dc
3,501
cpp
C++
src/fastcd/image_sequence_extension.cpp
InterDigitalInc/ObjectRemovalDetection
14ccff9792e2ab006377dc02b8260897465db988
[ "Apache-2.0" ]
1
2021-08-10T21:06:46.000Z
2021-08-10T21:06:46.000Z
src/fastcd/image_sequence_extension.cpp
InterDigitalInc/ObjectRemovalDetection
14ccff9792e2ab006377dc02b8260897465db988
[ "Apache-2.0" ]
null
null
null
src/fastcd/image_sequence_extension.cpp
InterDigitalInc/ObjectRemovalDetection
14ccff9792e2ab006377dc02b8260897465db988
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2021 InterDigital * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * License is avaiable on the root under license.txt and you may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #ifndef NOLIVIER #include "fastcd/image_sequence.h" #include <algorithm> #include <unordered_map> #include <utility> #include "fastcd/regions_matcher_hist.h" #include "example.h" namespace fastcd { void ImageSequence::AddImage2(std::shared_ptr<ProcessedImage> image, int kernel_size) { if (sequence_.size() == cache_size_) { sequence_.pop_front(); } if (!sequence_.empty()) { for (int i = sequence_.size() - 1; i >= 0; i--) { if (sequence_[i].ImageCompared() < max_comparisons_ /*&& sequence_[i].ImageCompared2() < max_comparisons_*/) { #if defined(PALAZZOLO) sequence_[i].UpdateInconsistencies(image->Warp(sequence_[i]),kernel_size); #else cv::Mat visible(image->Height(), image->Width(), image->GetRawImage().type(), cv::Scalar(0, 0, 0)); cv::Mat occluded(image->Height(), image->Width(), image->GetRawImage().type(), cv::Scalar(0, 0, 0)); /*cv::Mat mask = */image->Warp2(sequence_[i], visible, occluded); sequence_[i].UpdateInconsistencies(*image, visible, occluded, kernel_size); #endif //PALAZZOLO } if (image->ImageCompared() < max_comparisons_ /*&& image->ImageCompared2() < max_comparisons_*/) { #if defined(PALAZZOLO) image->UpdateInconsistencies(sequence_[i].Warp(*image),kernel_size); #else cv::Mat visible(sequence_[i].Height(), sequence_[i].Width(), sequence_[i].GetRawImage().type(), cv::Scalar(0, 0, 0)); cv::Mat occluded(sequence_[i].Height(), sequence_[i].Width(), sequence_[i].GetRawImage().type(), cv::Scalar(0, 0, 0)); /*cv::Mat mask = */sequence_[i].Warp2(*image, visible, occluded); image->UpdateInconsistencies(sequence_[i], visible, occluded, kernel_size); #endif //PALAZZOLO } } } sequence_.push_back(*image); } void ImageSequence::ComputeAndMatchRegions(int threshold_change_area, int threshold_change_value) { for (size_t i = 0; i < sequence_.size(); i++) { sequence_[i].ComputeRegions(threshold_change_area, threshold_change_value); } int label = 0; int label2 = 0; RegionsMatcherHist regions_matcher; RegionsMatcherHist regions_matcher2; for (size_t i = 0; i < sequence_.size(); i++) { for (size_t j = i + 1; j < sequence_.size(); j++) { regions_matcher.Match(sequence_[i], sequence_[j], label); sequence_[i].UpdateLabels(regions_matcher.GetLabelsImg1()); sequence_[j].UpdateLabels(regions_matcher.GetLabelsImg2()); label = regions_matcher.GetMaxLabel(); regions_matcher2.Match2(sequence_[i], sequence_[j], label2); sequence_[i].UpdateLabels2(regions_matcher2.GetLabelsImg1()); sequence_[j].UpdateLabels2(regions_matcher2.GetLabelsImg2()); label2 = regions_matcher2.GetMaxLabel(); } } //} } } // namespace fastcd #endif //NOLIVIER
38.054348
99
0.652956
InterDigitalInc
1dea5f9c4787a85b6ee2f4cee015cf5ba968676c
538
hpp
C++
smart_tales_ii/game/player/upgrades.hpp
TijmenUU/smarttalesii
c3a9c90bc2385e21e6fe4aa1cfda550edf6e20ba
[ "CC-BY-3.0", "CC-BY-4.0" ]
null
null
null
smart_tales_ii/game/player/upgrades.hpp
TijmenUU/smarttalesii
c3a9c90bc2385e21e6fe4aa1cfda550edf6e20ba
[ "CC-BY-3.0", "CC-BY-4.0" ]
11
2018-02-08T14:50:16.000Z
2022-01-21T19:54:24.000Z
smart_tales_ii/game/player/upgrades.hpp
TijmenUU/smarttalesii
c3a9c90bc2385e21e6fe4aa1cfda550edf6e20ba
[ "CC-BY-3.0", "CC-BY-4.0" ]
null
null
null
/* upgrades.hpp These utility functions define the available upgrades and the obstacles affected by them. Upgrades are of type enum class Sensor */ #pragma once #include "../obstacle/obstacletype.hpp" #include <cstdint> #include <string> namespace Upgrade { enum class Sensor : uint8_t { Unknown = 0, PassiveInfrared = 1, ActiveInfrared = 2, HealthBand = 4, LiveTile = 8 }; Sensor ToEnum(std::string str); Obstacle::Type GetObstacleCounter(const Sensor s); Sensor GetCounteringSensor(const Obstacle::Type t); }
16.8125
54
0.728625
TijmenUU
1decf42631f3c99c1dc74b098006d796f5c63c2a
7,343
tcc
C++
libraries/nodes/tcc/NeuralNetworkLayerNode.tcc
kernhanda/ELL
370c0de4e4c190ca0cb43654b4246b3686bca464
[ "MIT" ]
null
null
null
libraries/nodes/tcc/NeuralNetworkLayerNode.tcc
kernhanda/ELL
370c0de4e4c190ca0cb43654b4246b3686bca464
[ "MIT" ]
null
null
null
libraries/nodes/tcc/NeuralNetworkLayerNode.tcc
kernhanda/ELL
370c0de4e4c190ca0cb43654b4246b3686bca464
[ "MIT" ]
1
2020-12-10T17:49:07.000Z
2020-12-10T17:49:07.000Z
//////////////////////////////////////////////////////////////////////////////////////////////////// // // Project: Embedded Learning Library (ELL) // File: NeuralNetworkLayerNode.tcc (nodes) // Authors: Chuck Jacobs // //////////////////////////////////////////////////////////////////////////////////////////////////// namespace ell { namespace nodes { // // NeuralNetworkLayerNodeBase // template <typename ValueType> NeuralNetworkLayerNodeBase<ValueType>::NeuralNetworkLayerNodeBase() : CompilableNode({ &_input }, { &_output }), _input(this, {}, defaultInputPortName), _output(this, defaultOutputPortName, 0) { _parameters.includePaddingInInputData = true; } template <typename ValueType> NeuralNetworkLayerNodeBase<ValueType>::NeuralNetworkLayerNodeBase(const model::PortElements<ValueType>& input, const NeuralNetworkLayerNodeParameters& parameters, size_t outputSize) : CompilableNode({ &_input }, { &_output }), _input(this, input, defaultInputPortName), _output(this, defaultOutputPortName, outputSize), _parameters(parameters) { } template <typename ValueType> void NeuralNetworkLayerNodeBase<ValueType>::WriteToArchive(utilities::Archiver& archiver) const { CompilableNode::WriteToArchive(archiver); archiver[defaultInputPortName] << _input; } template <typename ValueType> void NeuralNetworkLayerNodeBase<ValueType>::ReadFromArchive(utilities::Unarchiver& archiver) { CompilableNode::ReadFromArchive(archiver); archiver[defaultInputPortName] >> _input; } // // NeuralNetworkLayerNode // template <typename DerivedType, typename LayerType, typename ValueType> NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::NeuralNetworkLayerNode() : NeuralNetworkLayerNodeBase<ValueType>(), _inputShape(0,0,0) { } template <typename DerivedType, typename LayerType, typename ValueType> NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::NeuralNetworkLayerNode(const model::PortElements<ValueType>& input, const LayerType& layer) : NeuralNetworkLayerNodeBase<ValueType>(input, {}, layer.GetOutput().Size()), _inputTensor(layer.GetInputShape()), _layer(layer), _inputShape(layer.GetInputShape()) { _layer.GetLayerParameters().input = _inputTensor; const auto& layerParameters = this->GetLayerParameters(); // Calculate input dimension parameters size_t inputPaddingSize = layerParameters.inputPaddingParameters.paddingSize; auto inputShape = this->GetLayer().GetInputShape(); _inputLayout = CalculateMemoryLayout(inputPaddingSize, inputShape); // Calculate output dimension parameters size_t outputPaddingSize = layerParameters.outputPaddingParameters.paddingSize; auto outputShape = this->_layer.GetOutputShape(); _outputLayout = CalculateMemoryLayout(outputPaddingSize, outputShape); } template <typename DerivedType, typename LayerType, typename ValueType> model::PortMemoryLayout NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::CalculateMemoryLayout(size_t padding, typename predictors::neural::Layer<ValueType>::Shape dataBufferSize) { // Calculate dimension parameters math::IntegerTriplet dataSizeArray = dataBufferSize; model::Shape stride{ dataSizeArray.begin(), dataSizeArray.end() }; model::Shape offset{ static_cast<int>(padding), static_cast<int>(padding), 0 }; model::Shape size(stride.size()); for (size_t dimensionIndex = 0; dimensionIndex < offset.size(); ++dimensionIndex) { if(stride[dimensionIndex] < (2 * offset[dimensionIndex])) { throw utilities::InputException(utilities::InputExceptionErrors::sizeMismatch, "Data size not large enough to accommodate padding"); } size[dimensionIndex] = stride[dimensionIndex] - (2 * offset[dimensionIndex]); } return { size, stride, offset }; } template <typename DerivedType, typename LayerType, typename ValueType> utilities::ArchiveVersion NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::GetArchiveVersion() const { constexpr utilities::ArchiveVersion archiveVersion = { utilities::ArchiveVersionNumbers::v5_refined_nodes }; return archiveVersion; } template <typename DerivedType, typename LayerType, typename ValueType> bool NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::CanReadArchiveVersion(const utilities::ArchiveVersion& version) const { constexpr utilities::ArchiveVersion archiveVersion = { utilities::ArchiveVersionNumbers::v5_refined_nodes }; return version >= archiveVersion; } template <typename DerivedType, typename LayerType, typename ValueType> void NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::WriteToArchive(utilities::Archiver& archiver) const { NeuralNetworkLayerNodeBase<ValueType>::WriteToArchive(archiver); archiver["inputLayout"] << _inputLayout; archiver["outputLayout"] << _outputLayout; std::vector<size_t> inputShape = _inputShape; archiver["inputShape"] << inputShape; archiver["layer"] << _layer; } template <typename DerivedType, typename LayerType, typename ValueType> void NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::ReadFromArchive(utilities::Unarchiver& archiver) { NeuralNetworkLayerNodeBase<ValueType>::ReadFromArchive(archiver); archiver["inputLayout"] >> _inputLayout; archiver["outputLayout"] >> _outputLayout; std::vector<size_t> inputShape; archiver["inputShape"] >> inputShape; _inputShape = math::TensorShape{ inputShape }; _inputTensor = typename LayerType::TensorType(_inputShape); _layer.GetLayerParameters().input = _inputTensor; archiver["layer"] >> _layer; } template <typename DerivedType, typename LayerType, typename ValueType> void NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::Copy(model::ModelTransformer& transformer) const { auto newPortElements = transformer.TransformPortElements(_input.GetPortElements()); auto newNode = transformer.AddNode<DerivedType>(newPortElements, _layer); transformer.MapNodeOutput(_output, newNode->output); } template <typename DerivedType, typename LayerType, typename ValueType> void NeuralNetworkLayerNode<DerivedType, LayerType, ValueType>::Compute() const { auto inputVector = _input.GetValue(); auto inputTensor = typename LayerType::ConstTensorReferenceType{ inputVector.data(), _inputTensor.GetShape() }; _inputTensor.CopyFrom(inputTensor); _layer.Compute(); const auto& outputTensor = _layer.GetOutput(); _output.SetOutput(outputTensor.ToArray()); } template <typename LayerType> typename LayerType::LayerParameters GetLayerNodeParameters(const typename LayerType::TensorType& inputTensor, const typename LayerType::LayerParameters& layerParameters) { return { inputTensor, layerParameters.inputPaddingParameters, layerParameters.outputShape, layerParameters.outputPaddingParameters }; } } }
45.04908
193
0.702574
kernhanda
1df5bd8057e14196520937dc7b8a487ab2373593
11,925
cpp
C++
Examples_5_4/Sticktrace/UtilDlg.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
12
2020-04-26T11:38:00.000Z
2021-11-02T21:13:27.000Z
Examples_5_4/Sticktrace/UtilDlg.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
null
null
null
Examples_5_4/Sticktrace/UtilDlg.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "LeException.h" #include "UtilStr.h" #include "UtilDlg.h" // This header. #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif int UtilDlg::GetCurSel (const CListCtrl* pListCtrl) { POSITION pos = pListCtrl->GetFirstSelectedItemPosition(); if (pos == NULL) return -1; return pListCtrl->GetNextSelectedItem(pos); } // int FfGetCurSel (const CListCtrl* pListCtrl) int UtilDlg::InsertColumn(CListCtrl* pCtrl, int nCol, const wchar_t* lpszColumnHeading, int nFormat, int nWidth, int nSubItem) { return pCtrl->InsertColumn(nCol, lpszColumnHeading, nFormat, nWidth, nSubItem); } // UNICODEで文字列を取得。 std::wstring& UtilDlg::GetDlgItemText(const CWnd* pWnd, DWORD dwCtrl, std::wstring& wstr) { CString str; pWnd->GetDlgItemText(dwCtrl, str); wstr = str; return wstr; } // UTF-8で文字列を取得。 std::string& UtilDlg::GetDlgItemText(const CWnd* pWnd, DWORD dwCtrl, std::string& astr) { std::wstring wstr; UtilDlg::GetDlgItemText(pWnd, dwCtrl, wstr); Astrwstr::wstr_to_astr(astr, wstr); return astr; } //******************************************************************************************** /*! * @brief EditコントロールにUndoを実行する。 * @author Fukushiro M. * @date 2014/09/22(月) 09:51:25 * * @param[in] CEdit* edit Undo対象のEditコントロール。 * @param[in] const std::vector<FCDiffRecW>& vUndoBuffer Undoバッファ。 * @param[in] int iCurUndoBuffer Undoバッファの現在位置。Undo対象の * バッファの1つ後を指す。 * * @return int 新しいUndoバッファの位置。 */ //******************************************************************************************** void UtilDlg::UndoEdit (CEdit* edit, const std::vector<FCDiffRecW>& vUndoBuffer) { for (auto irec = vUndoBuffer.rbegin(); irec != vUndoBuffer.rend(); irec++) { if (irec->cmd == FCDiffRecW::INS) { //----- 挿入の場合 ----- edit->SetSel(irec->begin, irec->begin + irec->text.length()); edit->ReplaceSel(L""); } else { //----- 削除の場合 ----- edit->SetSel(irec->begin, irec->begin); edit->ReplaceSel(irec->text.c_str()); } } } // FFUndoEdit //******************************************************************************************** /*! * @brief EditコントロールにRedoを実行する。 * @author Fukushiro M. * @date 2014/09/22(月) 09:51:25 * * @param[in] CEdit* edit Redo対象のEditコントロール。 * @param[in] const std::vector<FCDiffRecW>& vUndoBuffer Undoバッファ。 * @param[in] int iCurUndoBuffer Undoバッファの現在位置。Redo対象の * バッファの1つ前を指す。 * * @return int 新しいUndoバッファの位置。 */ //******************************************************************************************** void UtilDlg::RedoEdit (CEdit* edit, const std::vector<FCDiffRecW>& vUndoBuffer) { for (auto irec = vUndoBuffer.begin(); irec != vUndoBuffer.end(); irec++) { if (irec->cmd == FCDiffRecW::INS) { //----- 挿入の場合 ----- edit->SetSel(irec->begin, irec->begin); edit->ReplaceSel(irec->text.c_str()); } else { //----- 削除の場合 ----- edit->SetSel(irec->begin, irec->begin + irec->text.length()); edit->ReplaceSel(L""); } } } // FFRedoEdit /************************************************************************* * <関数> FFInitDlgLayout * * <機能> ダイアログのコントロールの初期位置によって、レイアウト情報 * mpLayoutInfo を設定する。 * * <引数> mpLayoutInfo :レイアウト情報。設定して返す。 * pWnd :ダイアログウィンドウを指定。 * lControlSize :コントロールの数を指定。 * aControlId :コントロールのID配列を指定。 * dwOffsetFlag :コントロールがダイアログのどの辺に追従するか * 指定。 * * <解説> FFInitDlgLayout関数、FFInitDlgLayout関数は、リサイズ可能な * ダイアログにおいて、リサイズ時のコントロールの再配置を * 自動化する。 * FFInitDlgLayout関数は、コントロールの再配置に必要な * レイアウト情報をIdToDlgLayoutRecMap型変数に蓄積する。 * FFInitDlg関数は、コントロールの再配置を実行する。 * 下図の場合を考える。 * * ┏━━━━━━━━━━━━━━━━━┓ * ┃┌───────────────┐┃ * ┃│ │┃ * ┃│ IDC_A │┃ * ┃│ │┃ * ┃└───────────────┘┃ * ┃┌───┐ ┌───┐┌───┐┃ * ┃│IDC_B │ │IDC_C ││IDC_D │┃ * ┃└───┘ └───┘└───┘┃ * ┗━━━━━━━━━━━━━━━━━┛ * ┌─┐ * ┌┘ └┐ * \ / * \/ * ┏━━━━━━━━━━━━━━━━━━━━━┓ * ┃┌───────────────────┐┃ * ┃│ │┃ * ┃│ │┃ * ┃│ │┃ * ┃│ IDC_A │┃ * ┃│ │┃ * ┃│ │┃ * ┃│ │┃ * ┃└───────────────────┘┃ * ┃┌───┐ ┌───┐┌───┐┃ * ┃│IDC_B │ │IDC_C ││IDC_D │┃ * ┃└───┘ └───┘└───┘┃ * ┗━━━━━━━━━━━━━━━━━━━━━┛ * * IDC_A:ダイアログの四方に合わせてリサイズ * IDC_B:ダイアログの左下に合わせて移動 * IDC_C:ダイアログの右下に合わせて移動 * IDC_D:ダイアログの右下に合わせて移動 * * この場合は、以下のように、FFInitDlgLayout関数を3回実行する。 * -------------------------------------------------------- * OnInitDialog () * { * const long aId1[] = { IDC_A } * const long aId2[] = { IDC_B } * const long aId3[] = { IDC_C, IDC_D } * FFInitDlgLayout(mpInfo, pWnd, lSize1, aId1, * FCDlgLayoutRec::HOOK_LEFT | * FCDlgLayoutRec::HOOK_TOP | * FCDlgLayoutRec::HOOK_RIGHT | * FCDlgLayoutRec::HOOK_BOTTOM); * FFInitDlgLayout(mpInfo, pWnd, lSize2, aId2, * FCDlgLayoutRec::HOOK_LEFT | * FCDlgLayoutRec::HOOK_BOTTOM); * FFInitDlgLayout(mpInfo, pWnd, lSize3, aId3, * FCDlgLayoutRec::HOOK_RIGHT | * FCDlgLayoutRec::HOOK_BOTTOM); * } * -------------------------------------------------------- * * コントロールの再配置は以下のようにFFDlgLayout関数を1回実行する。 * -------------------------------------------------------- * OnSize (int cx, int cy) * { * FFDlgLayout(mpInfo, pWnd, CSize(cx, cy)); * } * -------------------------------------------------------- * * <履歴> 05.11.11 Fukushiro M. 作成 *************************************************************************/ void UtilDlg::InitDlgLayout ( IdToDlgLayoutRecMap& mpLayoutInfo, HWND hWnd, long lControlSize, const long aControlId[], DWORD dwOffsetFlag ) { const CWnd* pWnd = CWnd::FromHandle(hWnd); // ダイアログのウィンドウ領域を取得。 CRect rtParent; pWnd->GetClientRect(rtParent); pWnd->ClientToScreen(rtParent); long lC; for (lC = 0; lC != lControlSize; lC++) { FCDlgLayoutRec rec(dwOffsetFlag, CRect(LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX)); // コントロールのウィンドウ領域をスクリーン座標系で取得。 CRect rtControl; pWnd->GetDlgItem(aControlId[lC])->GetWindowRect(rtControl); if (dwOffsetFlag & FCDlgLayoutRec::HOOK_LEFT) rec.m_rtDistance.left = rtControl.left - rtParent.left; if (dwOffsetFlag & FCDlgLayoutRec::HOOK_TOP) rec.m_rtDistance.top = rtControl.top - rtParent.top; if (dwOffsetFlag & FCDlgLayoutRec::HOOK_RIGHT) rec.m_rtDistance.right = rtParent.right - rtControl.right; if (dwOffsetFlag & FCDlgLayoutRec::HOOK_BOTTOM) rec.m_rtDistance.bottom = rtParent.bottom - rtControl.bottom; mpLayoutInfo[aControlId[lC]] = rec; } } // InitDlgLayout. /************************************************************************* * <関数> FFDlgLayout * * <機能> ダイアログのコントロールを再配置する。 * * <引数> mpLayoutInfo :レイアウト情報を指定。 * pWnd :ダイアログウィンドウを指定。 * szWnd :新しいダイアログウィンドウサイズを指定 * * <解説> FFInitDlgLayout関数、FFInitDlgLayout関数は、リサイズ可能な * ダイアログにおいて、リサイズ時のコントロールの再配置を * 自動化する。 * 詳しくはFFInitDlgLayout関数の解説を参照。 * * <履歴> 05.11.11 Fukushiro M. 作成 *************************************************************************/ void UtilDlg::DlgLayout (const IdToDlgLayoutRecMap& mpLayoutInfo, HWND hWnd) { CWnd* pWnd = CWnd::FromHandle(hWnd); // ダイアログのウィンドウ領域を取得。 CRect rtParent; pWnd->GetClientRect(rtParent); IdToDlgLayoutRecMap::const_iterator iInfo; for (iInfo = mpLayoutInfo.begin(); iInfo != mpLayoutInfo.end(); iInfo++) { // コントロールの矩形サイズを取得。 CRect rtControl; pWnd->GetDlgItem(iInfo->first)->GetWindowRect(rtControl); pWnd->ScreenToClient(rtControl); const CSize szControl(rtControl.Width(), rtControl.Height()); // コントロールの矩形を設定。 rtControl.SetRect(LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX); if (iInfo->second.m_rtDistance.left != LONG_MAX) rtControl.left = rtParent.left + iInfo->second.m_rtDistance.left; if (iInfo->second.m_rtDistance.top != LONG_MAX) rtControl.top = rtParent.top + iInfo->second.m_rtDistance.top; if (iInfo->second.m_rtDistance.right != LONG_MAX) rtControl.right = rtParent.right - iInfo->second.m_rtDistance.right; if (iInfo->second.m_rtDistance.bottom != LONG_MAX) rtControl.bottom = rtParent.bottom - iInfo->second.m_rtDistance.bottom; // デフォルトの座標を補正。 if (rtControl.left == LONG_MAX) rtControl.left = rtControl.right - szControl.cx; else if (rtControl.right == LONG_MAX) rtControl.right = rtControl.left + szControl.cx; if (rtControl.top == LONG_MAX) rtControl.top = rtControl.bottom - szControl.cy; else if (rtControl.bottom == LONG_MAX) rtControl.bottom = rtControl.top + szControl.cy; // コントロールをダイアログサイズ変更に合わせて移動。 pWnd->GetDlgItem(iInfo->first)->MoveWindow(rtControl); // コントロールを再描画。MoveWindow では、サイズが変わらない場合、 // 中身の再描画をしないよう(移動前の場所の再描画はする)なので、 // ここで強制的に再描画する。 pWnd->GetDlgItem(iInfo->first)->RedrawWindow(); } } // DlgLayout. std::wstring UtilDlg::GetItemText(CTabCtrl* tabCtrl, int index) { wchar_t textBuff[200]; TCITEM item; item.mask = TCIF_TEXT; item.pszText = textBuff; item.cchTextMax = _countof(textBuff); tabCtrl->GetItem(index, &item); return textBuff; } void UtilDlg::GetMonitorRect (std::vector<CRect> & vMonitorRect) { vMonitorRect.clear(); struct My { static BOOL CALLBACK MonitorEnumProc ( HMONITOR hMonitor, // ディスプレイモニタのハンドル。 HDC hdcMonitor, // モニタに適したデバイスコンテキストのハンドル。 LPRECT lprcMonitor, // モニタ上の交差部分を表す長方形領域へのポインタ。 LPARAM dwData // EnumDisplayMonitors から渡されたデータ。 ) { auto vMonitorRect = (std::vector<CRect> *)dwData; MONITORINFO monitorInfo; memset(&monitorInfo, 0, sizeof(monitorInfo)); monitorInfo.cbSize = sizeof(monitorInfo); if (::GetMonitorInfo(hMonitor, &monitorInfo)) { //----- モニターのワーク領域(タスクバーを除いた領域)を取得 ----- vMonitorRect->emplace_back(monitorInfo.rcWork); } else { //----- モニターのワーク領域(タスクバーを除いた領域)を取得できない場合 ----- vMonitorRect->emplace_back(*lprcMonitor); } return TRUE; // 列挙を続行。 }; // MonitorEnumProc. }; ::EnumDisplayMonitors(NULL, nullptr, My::MonitorEnumProc, LPARAM(&vMonitorRect)); } // UtilDlg::GetMonitorRect. CSize UtilDlg::JustifyToMonitor (const CRect & winRect) { auto POW2 = [](__int64 x) { return x * x; }; const CPoint winPoint = winRect.TopLeft() + CSize(50, 50); //----- 20.07.19 Fukushiro M. 削除始 ()----- // /// <summary> // /// CRect::PtInRect regards the point as outside if point is on rect.right or rect.bottom. // /// This function regards it as inside. // /// </summary> // /// <param name="rect"></param> // /// <param name="point"></param> // /// <returns></returns> // auto PtInRect = [](const CRect & rect, const CPoint & point) // { // return ( // rect.left <= point.x && // point.x <= rect.right && // rect.top <= point.y && // point.y <= rect.bottom // ); // }; //----- 20.07.19 Fukushiro M. 削除終 ()----- // モニター領域の配列を取得。 std::vector<CRect> vMonitorRect; UtilDlg::GetMonitorRect(vMonitorRect); BOOL isOK = FALSE; CRect oneMonRect; __int64 powLen = _I64_MAX; for (const auto & monRect : vMonitorRect) { if (monRect.PtInRect(winPoint)) { isOK = TRUE; break; } else { auto sz = monRect.TopLeft() - winRect.TopLeft(); auto tmp = POW2(sz.cx) + POW2(sz.cy); if (tmp < powLen) { powLen = tmp; oneMonRect = monRect; } } } return isOK ? CSize(0, 0) : (oneMonRect.TopLeft() - winRect.TopLeft()); } // UtilDlg::JustifyToMonitor.
31.715426
126
0.558239
hukushirom
1dfa244581c29e671e556e4c2867d69c878d69d9
799
cpp
C++
Acmicpc/C++/BOJ1149.cpp
sungmen/Acmicpc_Solve
0298a6aec84993a4d8767bd2c00490b7201e06a4
[ "MIT" ]
1
2020-07-08T23:16:19.000Z
2020-07-08T23:16:19.000Z
Acmicpc/C++/BOJ1149.cpp
sungmen/Acmicpc_Solve
0298a6aec84993a4d8767bd2c00490b7201e06a4
[ "MIT" ]
1
2020-05-16T03:12:24.000Z
2020-05-16T03:14:42.000Z
Acmicpc/C++/BOJ1149.cpp
sungmen/Acmicpc_Solve
0298a6aec84993a4d8767bd2c00490b7201e06a4
[ "MIT" ]
2
2020-05-16T03:25:16.000Z
2021-02-10T16:51:25.000Z
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; scanf("%d", &n); vector<vector<int>> v(n, vector<int>(3)); vector<vector<int>> d(n, vector<int>(3)); for (int i = 0; i < n; i++) for (int j = 0; j < 3; j++){ scanf("%d", &v[i][j]); if(i == 0) d[0][j] = v[0][j]; } for (int i = 1; i < n; i++) { d[i][0] = min(d[i-1][1], d[i-1][2]) + v[i][0]; d[i][1] = min(d[i-1][0], d[i-1][2]) + v[i][1]; d[i][2] = min(d[i-1][0], d[i-1][1]) + v[i][2]; } int MIN = d[n-1][0]; for(int i = 0; i < 3; i++) { if (d[n-1][i] < MIN) MIN = d[n-1][i]; } printf("%d\n", MIN); return 0; }
22.194444
55
0.364205
sungmen
1dfaf6a8ae20cb03d52c3d5c6e3b530e8aa2532e
246
cpp
C++
solutions/405.convert-a-number-to-hexadecimal.242445862.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
78
2020-10-22T11:31:53.000Z
2022-02-22T13:27:49.000Z
solutions/405.convert-a-number-to-hexadecimal.242445862.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
null
null
null
solutions/405.convert-a-number-to-hexadecimal.242445862.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
26
2020-10-23T15:10:44.000Z
2021-11-07T16:13:50.000Z
class Solution { public: string toHex(unsigned int num) { string map = "0123456789abcdef"; string ans; do { ans += map[num % 16]; num /= 16; } while (num); reverse(ans.begin(), ans.end()); return ans; } };
17.571429
36
0.544715
satu0king
1dfb32a92f3bbb94d925b6b069348cdbb954dda4
4,822
cpp
C++
lldb/source/Commands/CommandObjectMemoryTag.cpp
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
2
2019-04-11T16:25:43.000Z
2020-12-09T10:22:01.000Z
lldb/source/Commands/CommandObjectMemoryTag.cpp
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
null
null
null
lldb/source/Commands/CommandObjectMemoryTag.cpp
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
null
null
null
//===-- CommandObjectMemoryTag.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "CommandObjectMemoryTag.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Target/Process.h" using namespace lldb; using namespace lldb_private; #define LLDB_OPTIONS_memory_tag_read #include "CommandOptions.inc" class CommandObjectMemoryTagRead : public CommandObjectParsed { public: CommandObjectMemoryTagRead(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "tag", "Read memory tags for the given range of memory.", nullptr, eCommandRequiresTarget | eCommandRequiresProcess | eCommandProcessMustBePaused) { // Address m_arguments.push_back( CommandArgumentEntry{CommandArgumentData(eArgTypeAddressOrExpression)}); // Optional end address m_arguments.push_back(CommandArgumentEntry{ CommandArgumentData(eArgTypeAddressOrExpression, eArgRepeatOptional)}); } ~CommandObjectMemoryTagRead() override = default; protected: bool DoExecute(Args &command, CommandReturnObject &result) override { if ((command.GetArgumentCount() < 1) || (command.GetArgumentCount() > 2)) { result.AppendError( "wrong number of arguments; expected at least <address-expression>, " "at most <address-expression> <end-address-expression>"); return false; } Status error; addr_t start_addr = OptionArgParser::ToAddress( &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error); if (start_addr == LLDB_INVALID_ADDRESS) { result.AppendErrorWithFormatv("Invalid address expression, {0}", error.AsCString()); return false; } // Default 1 byte beyond start, rounds up to at most 1 granule later addr_t end_addr = start_addr + 1; if (command.GetArgumentCount() > 1) { end_addr = OptionArgParser::ToAddress(&m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, &error); if (end_addr == LLDB_INVALID_ADDRESS) { result.AppendErrorWithFormatv("Invalid end address expression, {0}", error.AsCString()); return false; } } Process *process = m_exe_ctx.GetProcessPtr(); llvm::Expected<const MemoryTagManager *> tag_manager_or_err = process->GetMemoryTagManager(); if (!tag_manager_or_err) { result.SetError(Status(tag_manager_or_err.takeError())); return false; } const MemoryTagManager *tag_manager = *tag_manager_or_err; MemoryRegionInfos memory_regions; // If this fails the list of regions is cleared, so we don't need to read // the return status here. process->GetMemoryRegions(memory_regions); llvm::Expected<MemoryTagManager::TagRange> tagged_range = tag_manager->MakeTaggedRange(start_addr, end_addr, memory_regions); if (!tagged_range) { result.SetError(Status(tagged_range.takeError())); return false; } llvm::Expected<std::vector<lldb::addr_t>> tags = process->ReadMemoryTags( tagged_range->GetRangeBase(), tagged_range->GetByteSize()); if (!tags) { result.SetError(Status(tags.takeError())); return false; } result.AppendMessageWithFormatv("Logical tag: {0:x}", tag_manager->GetLogicalTag(start_addr)); result.AppendMessage("Allocation tags:"); addr_t addr = tagged_range->GetRangeBase(); for (auto tag : *tags) { addr_t next_addr = addr + tag_manager->GetGranuleSize(); // Showing tagged adresses here until we have non address bit handling result.AppendMessageWithFormatv("[{0:x}, {1:x}): {2:x}", addr, next_addr, tag); addr = next_addr; } result.SetStatus(eReturnStatusSuccessFinishResult); return true; } }; CommandObjectMemoryTag::CommandObjectMemoryTag(CommandInterpreter &interpreter) : CommandObjectMultiword( interpreter, "tag", "Commands for manipulating memory tags", "memory tag <sub-command> [<sub-command-options>]") { CommandObjectSP read_command_object( new CommandObjectMemoryTagRead(interpreter)); read_command_object->SetCommandName("memory tag read"); LoadSubCommand("read", read_command_object); } CommandObjectMemoryTag::~CommandObjectMemoryTag() = default;
37.379845
80
0.653256
acidburn0zzz
380193a01ea21d09daceeba698105d3cfa778f89
1,377
cpp
C++
main.cpp
platonische/cpp-abstractQueue
27378dc5b472e2485b2f388f1dd22474d0e081a6
[ "Unlicense" ]
null
null
null
main.cpp
platonische/cpp-abstractQueue
27378dc5b472e2485b2f388f1dd22474d0e081a6
[ "Unlicense" ]
null
null
null
main.cpp
platonische/cpp-abstractQueue
27378dc5b472e2485b2f388f1dd22474d0e081a6
[ "Unlicense" ]
null
null
null
#include <iostream> //#include "src/exted/Int/QueueIntValue.h" #include "src/exted/Any/QueueAnyValue.h" using namespace std; int main() { int *array = new int[6] { 1, 2, 3, 4, 5, '\0' }; QueueAnyValue<int>* queue = new QueueAnyValue<int>(); queue->sampleData(array); queue->addElement(queue->createElement(12),queue->getLastElement()); queue->addElement(queue->createElement(56),queue->getLastElement()); queue->addElement(queue->createElement(85),NULL); queue->addElement(queue->createElement(40),queue->getHead()); cout << queue->toString() << endl; queue->changeElements(queue->findElement(56),queue->getHead()); cout << queue->toString() << endl; } // //QueueIntValue* queue = new QueueIntValue(array); //AbstractQueue<Element>* queue = new AbstractQueue(array); // printQueue(queue); // queue->addElement(queue->createElement(12),queue->getLastElement()); // printQueue(queue); // queue->addElement(queue->createElement(150),queue->findElement(4)); // printQueue(queue); // queue->changeElements(queue->findElement(150),queue->findElement(4)); // printQueue(queue); // queue->deleteElement(queue->findElement(150)); // printQueue(queue); // queue->deleteAll(); // printQueue(queue); // queue->addElement(queue->createElement(12),queue->getLastElement()); // printQueue(queue);
28.102041
75
0.672476
platonische
3801aa9db2b9713fc5c3c039c66fb9fb242b807a
274
cpp
C++
src/Jacobi.cpp
EthanHowellUKY/linear-algebra
b71756655c7bc2351e8084ecaf89298f747ce9af
[ "Apache-2.0" ]
null
null
null
src/Jacobi.cpp
EthanHowellUKY/linear-algebra
b71756655c7bc2351e8084ecaf89298f747ce9af
[ "Apache-2.0" ]
null
null
null
src/Jacobi.cpp
EthanHowellUKY/linear-algebra
b71756655c7bc2351e8084ecaf89298f747ce9af
[ "Apache-2.0" ]
null
null
null
#include "LinearAlgebra/Jacobi.h" Jacobi::Jacobi() {} Jacobi::~Jacobi() {} Matrix Jacobi::solve(Matrix &A, Matrix &b) { return Matrix(); } Matrix Jacobi::solve(Matrix &A, std::vector<double> &b) { return Matrix(); } void Jacobi::print() { std::cout << "Jacobi" << '\n'; }
30.444444
76
0.638686
EthanHowellUKY
38020ea11c08f5129ed5f7ccae0d071375a4d378
2,157
cpp
C++
tgfx/src/gpu/DualIntervalGradientColorizer.cpp
cy-j/libpag
9b1636a0a67ad5e009d60c6c348034790d247692
[ "BSL-1.0", "CC0-1.0", "MIT" ]
2
2022-02-26T16:10:30.000Z
2022-03-18T01:28:40.000Z
tgfx/src/gpu/DualIntervalGradientColorizer.cpp
cy-j/libpag
9b1636a0a67ad5e009d60c6c348034790d247692
[ "BSL-1.0", "CC0-1.0", "MIT" ]
null
null
null
tgfx/src/gpu/DualIntervalGradientColorizer.cpp
cy-j/libpag
9b1636a0a67ad5e009d60c6c348034790d247692
[ "BSL-1.0", "CC0-1.0", "MIT" ]
null
null
null
///////////////////////////////////////////////////////////////////////////////////////////////// // // Tencent is pleased to support the open source community by making libpag available. // // Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // unless required by applicable law or agreed to in writing, software distributed under the // license is distributed on an "as is" basis, without warranties or conditions of any kind, // either express or implied. see the license for the specific language governing permissions // and limitations under the license. // ///////////////////////////////////////////////////////////////////////////////////////////////// #include "DualIntervalGradientColorizer.h" #include "opengl/GLDualIntervalGradientColorizer.h" namespace pag { std::unique_ptr<DualIntervalGradientColorizer> DualIntervalGradientColorizer::Make( Color4f c0, Color4f c1, Color4f c2, Color4f c3, float threshold) { Color4f scale01; // Derive scale and biases from the 4 colors and threshold for (int i = 0; i < 4; ++i) { auto vc0 = c0.vec()[i]; auto vc1 = c1.vec()[i]; scale01.vec()[i] = (vc1 - vc0) / threshold; } // bias01 = c0 Color4f scale23; Color4f bias23; for (int i = 0; i < 4; ++i) { auto vc2 = c2.vec()[i]; auto vc3 = c3.vec()[i]; scale23.vec()[i] = (vc3 - vc2) / (1 - threshold); bias23.vec()[i] = vc2 - threshold * scale23.vec()[i]; } return std::unique_ptr<DualIntervalGradientColorizer>( new DualIntervalGradientColorizer(scale01, c0, scale23, bias23, threshold)); } void DualIntervalGradientColorizer::onComputeProcessorKey(BytesKey* bytesKey) const { static auto Type = UniqueID::Next(); bytesKey->write(Type); } std::unique_ptr<GLFragmentProcessor> DualIntervalGradientColorizer::onCreateGLInstance() const { return std::make_unique<GLDualIntervalGradientColorizer>(); } } // namespace pag
38.517857
97
0.646732
cy-j
38029cc83604fcd2320a6603c26209fc0d7a3dce
963
cpp
C++
save.cpp
januwA/winreg-example
9ddd27c281c772efe969bc82877c5e31741c913f
[ "MIT" ]
null
null
null
save.cpp
januwA/winreg-example
9ddd27c281c772efe969bc82877c5e31741c913f
[ "MIT" ]
null
null
null
save.cpp
januwA/winreg-example
9ddd27c281c772efe969bc82877c5e31741c913f
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <sstream> #include <iomanip> #include <Windows.h> #include "ModifyPrivilege.hpp" int main() { // 备份注册表信息 // 获取权限 if (!SUCCEEDED(ModifyPrivilege(SE_BACKUP_NAME, true))) return 1; // 保存 HKEY hKey; LSTATUS retCode; retCode = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"*\\shell\\ffplay", NULL, KEY_ALL_ACCESS, &hKey); if (retCode != ERROR_SUCCESS) { if (retCode == ERROR_FILE_NOT_FOUND) printf("Key not found.\n"); else printf("Error opening key.\n"); return 1; } // 保存的是二进制文件 retCode = RegSaveKeyW( hKey, L"C:\\Users\\ajanuw\\Desktop\\save.txt", NULL); if (retCode != ERROR_SUCCESS) { printf("Error save key (%d)\n", retCode); return 1; } if (RegCloseKey(hKey) != ERROR_SUCCESS) { printf("Error close.\n"); return 1; } return 0; }
19.26
97
0.561786
januwA
380459a54f6dbe558dcefdb60505a2236fe555b9
37,382
cpp
C++
NoFTL_v1.0/shoreMT-KIT/src/workload/tm1/shore_tm1_xct.cpp
DBlabRT/NoFTL
cba8b5a6d9c422bdd39b01575244e557cbd12e43
[ "Unlicense" ]
4
2019-01-24T02:00:23.000Z
2021-03-17T11:56:59.000Z
NoFTL_v1.0/shoreMT-KIT/src/workload/tm1/shore_tm1_xct.cpp
DBlabRT/NoFTL
cba8b5a6d9c422bdd39b01575244e557cbd12e43
[ "Unlicense" ]
null
null
null
NoFTL_v1.0/shoreMT-KIT/src/workload/tm1/shore_tm1_xct.cpp
DBlabRT/NoFTL
cba8b5a6d9c422bdd39b01575244e557cbd12e43
[ "Unlicense" ]
4
2019-01-22T10:35:55.000Z
2021-03-17T11:57:23.000Z
/* -*- mode:C++; c-basic-offset:4 -*- Shore-kits -- Benchmark implementations for Shore-MT Copyright (c) 2007-2009 Data Intensive Applications and Systems Labaratory (DIAS) Ecole Polytechnique Federale de Lausanne All Rights Reserved. Permission to use, copy, modify and distribute this software and its documentation is hereby granted, provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works or modified versions, and any portions thereof, and that both notices appear in supporting documentation. This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. */ /** @file: shore_tm1_xct.cpp * * @brief: Implementation of the Baseline Shore TM1 transactions * * @author: Ippokratis Pandis, Feb 2009 */ #include "workload/tm1/shore_tm1_env.h" #include "workload/tm1/tm1_input.h" #include <vector> #include <numeric> #include <algorithm> using namespace shore; ENTER_NAMESPACE(tm1); template<class T, class M> struct tuple_guard { T* ptr; M* manager; tuple_guard(M* m) : ptr(m->get_tuple()), manager(m) { assert(ptr); } ~tuple_guard() { manager->give_tuple(ptr); } T* operator->() { return ptr; } operator T*() { return ptr; } private: // no you copy! tuple_guard(tuple_guard&); void operator=(tuple_guard&); }; /******************************************************************** * * Thread-local TM1 TRXS Stats * ********************************************************************/ static __thread ShoreTM1TrxStats my_stats; void ShoreTM1Env::env_thread_init() { CRITICAL_SECTION(stat_mutex_cs, _statmap_mutex); _statmap[pthread_self()] = &my_stats; } void ShoreTM1Env::env_thread_fini() { CRITICAL_SECTION(stat_mutex_cs, _statmap_mutex); _statmap.erase(pthread_self()); } /******************************************************************** * * @fn: _get_stats * * @brief: Returns a structure with the currently stats * ********************************************************************/ ShoreTM1TrxStats ShoreTM1Env::_get_stats() { CRITICAL_SECTION(cs, _statmap_mutex); ShoreTM1TrxStats rval; rval -= rval; // dirty hack to set all zeros for (statmap_t::iterator it=_statmap.begin(); it != _statmap.end(); ++it) rval += *it->second; return (rval); } /******************************************************************** * * @fn: reset_stats * * @brief: Updates the last gathered statistics * ********************************************************************/ void ShoreTM1Env::reset_stats() { CRITICAL_SECTION(last_stats_cs, _last_stats_mutex); _last_stats = _get_stats(); } /******************************************************************** * * @fn: print_throughput * * @brief: Prints the throughput given measurement delay * ********************************************************************/ void ShoreTM1Env::print_throughput(const double iQueriedSF, const int iSpread, const int iNumOfThreads, const double delay, const ulong_t mioch, const double avgcpuusage) { CRITICAL_SECTION(last_stats_cs, _last_stats_mutex); // get the current statistics ShoreTM1TrxStats current_stats = _get_stats(); // now calculate the diff current_stats -= _last_stats; uint trxs_att = current_stats.attempted.total(); uint trxs_abt = current_stats.failed.total(); uint trxs_dld = current_stats.deadlocked.total(); TRACE( TRACE_ALWAYS, "*******\n" \ "SF: (%.1f)\n" \ "Spread: (%s)\n" \ "Threads: (%d)\n" \ "Trxs Att: (%d)\n" \ "Trxs Abt: (%d)\n" \ "Trxs Dld: (%d)\n" \ "Success Rate: (%.1f%%)\n" \ "Secs: (%.2f)\n" \ "IOChars: (%.2fM/s)\n" \ "AvgCPUs: (%.1f) (%.1f%%)\n" \ "MQTh/s: (%.2f)\n", iQueriedSF, (iSpread ? "Yes" : "No"), iNumOfThreads, trxs_att, trxs_abt, trxs_dld, ((double)100*(trxs_att-trxs_abt-trxs_dld))/(double)trxs_att, delay, mioch/delay, avgcpuusage, 100*avgcpuusage/get_max_cpu_count(), (trxs_att-trxs_abt-trxs_dld)/delay); } /******************************************************************** * * TM1 TRXS * * (1) The run_XXX functions are wrappers to the real transactions * (2) The xct_XXX functions are the implementation of the transactions * ********************************************************************/ /********************************************************************* * * @fn: run_one_xct * * @brief: Initiates the execution of one TM1 xct * * @note: The execution of this trx will not be stopped even if the * measure internal has expired. * *********************************************************************/ w_rc_t ShoreTM1Env::run_one_xct(Request* prequest) { assert (prequest); if(_start_imbalance > 0 && !_bAlarmSet) { CRITICAL_SECTION(alarm_cs, _alarm_lock); if(!_bAlarmSet) { alarm(_start_imbalance); _bAlarmSet = true; } } // if BASELINE TM1 MIX if (prequest->type() == XCT_TM1_MIX) { prequest->set_type(random_tm1_xct_type(abs(smthread_t::me()->rand()%100))); } switch (prequest->type()) { // TM1 BASELINE case XCT_TM1_GET_SUB_DATA: return (run_get_sub_data(prequest)); case XCT_TM1_GET_NEW_DEST: return (run_get_new_dest(prequest)); case XCT_TM1_GET_ACC_DATA: return (run_get_acc_data(prequest)); case XCT_TM1_UPD_SUB_DATA: return (run_upd_sub_data(prequest)); case XCT_TM1_UPD_LOCATION: return (run_upd_loc(prequest)); case XCT_TM1_INS_CALL_FWD: return (run_ins_call_fwd(prequest)); case XCT_TM1_DEL_CALL_FWD: return (run_del_call_fwd(prequest)); case XCT_TM1_CALL_FWD_MIX: // evenly pick one of the {Ins/Del}CallFwd if (URand(1,100)>50) return (run_ins_call_fwd(prequest)); else return (run_del_call_fwd(prequest)); case XCT_TM1_GET_SUB_NBR: return (run_get_sub_nbr(prequest)); default: assert (0); // UNKNOWN TRX-ID } return (RCOK); } /******************************************************************** * * TPC-C TRXs Wrappers * * @brief: They are wrappers to the functions that execute the transaction * body. Their responsibility is to: * * 1. Prepare the corresponding input * 2. Check the return of the trx function and abort the trx, * if something went wrong * 3. Update the tm1 db environment statistics * ********************************************************************/ DEFINE_TRX(ShoreTM1Env,get_sub_data); DEFINE_TRX(ShoreTM1Env,get_new_dest); DEFINE_TRX(ShoreTM1Env,get_acc_data); DEFINE_TRX(ShoreTM1Env,upd_sub_data); DEFINE_TRX(ShoreTM1Env,upd_loc); DEFINE_TRX(ShoreTM1Env,ins_call_fwd); DEFINE_TRX(ShoreTM1Env,del_call_fwd); DEFINE_TRX(ShoreTM1Env,get_sub_nbr); // uncomment the line below if want to dump (part of) the trx results //#define PRINT_TRX_RESULTS /******************************************************************** * * TM1 POPULATE_ONE * * @brief: Inserts a Subscriber with the specific SUB_ID and all the * corresponding AI, SF, and CF entries (according to the * benchmark specification. * ********************************************************************/ w_rc_t ShoreTM1Env::xct_populate_one(const int sub_id) { assert (sub_id>=0); w_rc_t e = RCOK; // get table tuples from the caches table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); table_row_t* prai = _pai_man->get_tuple(); assert (prai); table_row_t* prsf = _psf_man->get_tuple(); assert (prsf); table_row_t* prcf = _pcf_man->get_tuple(); assert (prcf); rep_row_t areprow(_psub_man->ts()); rep_row_t areprow_key(_psub_man->ts()); // allocate space for the biggest of the 4 table representations areprow.set(_psub_desc->maxsize()); areprow_key.set(_psub_desc->maxsize()); prsub->_rep = &areprow; prai->_rep = &areprow; prsf->_rep = &areprow; prcf->_rep = &areprow; prsub->_rep_key = &areprow_key; prai->_rep_key = &areprow_key; prsf->_rep_key = &areprow_key; prcf->_rep_key = &areprow_key; short i,j=0; // determine how many AI records to have short num_ai = URand(TM1_MIN_AI_PER_SUBSCR, TM1_MAX_AI_PER_SUBSCR); // determine how many SF records to have short num_sf = URand(TM1_MIN_SF_PER_SUBSCR, TM1_MAX_SF_PER_SUBSCR); short num_cf = 0; { // make gotos safe // POPULATE SUBSCRIBER prsub->set_value(0, sub_id); char asubnbr[STRSIZE(TM1_SUB_NBR_SZ)]; memset(asubnbr,0,STRSIZE(TM1_SUB_NBR_SZ)); sprintf(asubnbr,"%015d",sub_id); prsub->set_value(1, asubnbr); // BIT_XX prsub->set_value(2, URandBool()); prsub->set_value(3, URandBool()); prsub->set_value(4, URandBool()); prsub->set_value(5, URandBool()); prsub->set_value(6, URandBool()); prsub->set_value(7, URandBool()); prsub->set_value(8, URandBool()); prsub->set_value(9, URandBool()); prsub->set_value(10, URandBool()); prsub->set_value(11, URandBool()); // HEX_XX prsub->set_value(12, URandShort(0,15)); prsub->set_value(13, URandShort(0,15)); prsub->set_value(14, URandShort(0,15)); prsub->set_value(15, URandShort(0,15)); prsub->set_value(16, URandShort(0,15)); prsub->set_value(17, URandShort(0,15)); prsub->set_value(18, URandShort(0,15)); prsub->set_value(19, URandShort(0,15)); prsub->set_value(20, URandShort(0,15)); prsub->set_value(21, URandShort(0,15)); // BYTE2_XX prsub->set_value(22, URandShort(0,255)); prsub->set_value(23, URandShort(0,255)); prsub->set_value(24, URandShort(0,255)); prsub->set_value(25, URandShort(0,255)); prsub->set_value(26, URandShort(0,255)); prsub->set_value(27, URandShort(0,255)); prsub->set_value(28, URandShort(0,255)); prsub->set_value(29, URandShort(0,255)); prsub->set_value(30, URandShort(0,255)); prsub->set_value(31, URandShort(0,255)); prsub->set_value(32, URand(0,(2<<16)-1)); prsub->set_value(33, URand(0,(2<<16)-1)); #ifdef CFG_HACK prsub->set_value(34, "padding"); // PADDING #endif e = _psub_man->add_tuple(_pssm, prsub); if (e.is_error()) { goto done; } TRACE (TRACE_TRX_FLOW, "Added SUB - (%d)\n", sub_id); short type; // POPULATE ACCESS_INFO for (i=0; i<num_ai; ++i) { prai->set_value(0, sub_id); // AI_TYPE type = i+1; prai->set_value(1, type); // DATA 1,2 prai->set_value(2, URandShort(0,255)); prai->set_value(3, URandShort(0,255)); // DATA 3,4 char data3[TM1_AI_DATA3_SZ]; URandFillStrCaps(data3,TM1_AI_DATA3_SZ); prai->set_value(4, data3); char data4[TM1_AI_DATA4_SZ]; URandFillStrCaps(data4,TM1_AI_DATA4_SZ); prai->set_value(5, data4); #ifdef CFG_HACK prai->set_value(6, "padding"); // PADDING #endif e = _pai_man->add_tuple(_pssm, prai); if (e.is_error()) { goto done; } TRACE (TRACE_TRX_FLOW, "Added AI-%d - (%d|%d|%s|%s)\n", i,sub_id,i+1,data3,data4); } // POPULATE SPECIAL_FACILITY for (i=0; i<num_sf; ++i) { prsf->set_value(0, sub_id); // SF_TYPE type = i+1; prsf->set_value(1, type); prsf->set_value(2, (URand(1,100)<85? true : false)); prsf->set_value(3, URandShort(0,255)); prsf->set_value(4, URandShort(0,255)); // DATA_B char datab[TM1_SF_DATA_B_SZ]; URandFillStrCaps(datab,TM1_SF_DATA_B_SZ); prsf->set_value(5, datab); #ifdef CFG_HACK prsf->set_value(6, "padding"); // PADDING #endif e = _psf_man->add_tuple(_pssm, prsf); if (e.is_error()) { goto done; } TRACE (TRACE_TRX_FLOW, "Added SF-%d - (%d|%d|%s)\n", i,sub_id,i+1,datab); // POPULATE CALL_FORWARDING // decide how many CF to have for this SF num_cf = URand(TM1_MIN_CF_PER_SF, TM1_MAX_CF_PER_SF); short atime; for (j=0; j<num_cf; ++j) { prcf->set_value(0, sub_id); type = i+1; prcf->set_value(1, type); atime = j*8; prcf->set_value(2, atime); atime = j*8 + URandShort(1,8); prcf->set_value(3, atime); char numbx[TM1_CF_NUMBERX_SZ]; URandFillStrNumbx(numbx,TM1_CF_NUMBERX_SZ); prcf->set_value(4, numbx); #ifdef CFG_HACK prcf->set_value(5, "padding"); // PADDING #endif e = _pcf_man->add_tuple(_pssm, prcf); if (e.is_error()) { goto done; } TRACE (TRACE_TRX_FLOW, "Added CF-%d - (%d|%d|%d)\n", i,sub_id,i+1,j*8); } } } // goto done: // return the tuples to the cache _psub_man->give_tuple(prsub); _pai_man->give_tuple(prai); _psf_man->give_tuple(prsf); _pcf_man->give_tuple(prcf); return (e); } /******************************************************************** * * TM1 GET_SUB_DATA * ********************************************************************/ w_rc_t ShoreTM1Env::xct_get_sub_data(const int xct_id, get_sub_data_input_t& gsdin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 1 table: // Subscriber table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); rep_row_t areprow(_psub_man->ts()); // allocate space for the table representations areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; /* SELECT s_id, sub_nbr, * bit_XX, hex_XX, byte2_XX, * msc_location, vlr_location * FROM Subscriber * WHERE s_id = <s_id> * * plan: index probe on "S_IDX" */ { // make gotos safe /* 1. retrieve Subscriber (read-only) */ TRACE( TRACE_TRX_FLOW, "App: %d GSD:sub-idx-probe (%d)\n", xct_id, gsdin._s_id); e = _psub_man->sub_idx_probe(_pssm, prsub, gsdin._s_id); if (e.is_error()) { goto done; } tm1_sub_t asub; // READ SUBSCRIBER prsub->get_value(0, asub.S_ID); prsub->get_value(1, asub.SUB_NBR, 17); // BIT_XX prsub->get_value(2, asub.BIT_XX[0]); prsub->get_value(3, asub.BIT_XX[1]); prsub->get_value(4, asub.BIT_XX[2]); prsub->get_value(5, asub.BIT_XX[3]); prsub->get_value(6, asub.BIT_XX[4]); prsub->get_value(7, asub.BIT_XX[5]); prsub->get_value(8, asub.BIT_XX[6]); prsub->get_value(9, asub.BIT_XX[7]); prsub->get_value(10, asub.BIT_XX[8]); prsub->get_value(11, asub.BIT_XX[9]); // HEX_XX prsub->get_value(12, asub.HEX_XX[0]); prsub->get_value(13, asub.HEX_XX[1]); prsub->get_value(14, asub.HEX_XX[2]); prsub->get_value(15, asub.HEX_XX[3]); prsub->get_value(16, asub.HEX_XX[4]); prsub->get_value(17, asub.HEX_XX[5]); prsub->get_value(18, asub.HEX_XX[6]); prsub->get_value(19, asub.HEX_XX[7]); prsub->get_value(20, asub.HEX_XX[8]); prsub->get_value(21, asub.HEX_XX[9]); // BYTE2_XX prsub->get_value(22, asub.BYTE2_XX[0]); prsub->get_value(23, asub.BYTE2_XX[1]); prsub->get_value(24, asub.BYTE2_XX[2]); prsub->get_value(25, asub.BYTE2_XX[3]); prsub->get_value(26, asub.BYTE2_XX[4]); prsub->get_value(27, asub.BYTE2_XX[5]); prsub->get_value(28, asub.BYTE2_XX[6]); prsub->get_value(29, asub.BYTE2_XX[7]); prsub->get_value(30, asub.BYTE2_XX[8]); prsub->get_value(31, asub.BYTE2_XX[9]); prsub->get_value(32, asub.MSC_LOCATION); prsub->get_value(33, asub.VLR_LOCATION); } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsub->print_tuple(); #endif done: // return the tuples to the cache _psub_man->give_tuple(prsub); return (e); } // EOF: GET_SUB_DATA /******************************************************************** * * TM1 GET_NEW_DEST * ********************************************************************/ w_rc_t ShoreTM1Env::xct_get_new_dest(const int xct_id, get_new_dest_input_t& gndin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 2 tables: // SpecialFacility and CallForwarding table_row_t* prsf = _psf_man->get_tuple(); assert (prsf); table_row_t* prcf = _pcf_man->get_tuple(); assert (prcf); // allocate space for the larger of the 2 table representations rep_row_t areprow(_pcf_man->ts()); areprow.set(_pcf_desc->maxsize()); prsf->_rep = &areprow; prcf->_rep = &areprow; rep_row_t lowrep(_pcf_man->ts()); rep_row_t highrep(_pcf_man->ts()); lowrep.set(_pcf_desc->maxsize()); highrep.set(_pcf_desc->maxsize()); tm1_sf_t asf; tm1_cf_t acf; bool eof; bool bFound = false; /* SELECT cf.numberx * FROM Special_Facility AS sf, Call_Forwarding AS cf * WHERE * (sf.s_id = <s_id rnd> * AND sf.sf_type = <sf_type rnd> * AND sf.is_active = 1) * AND * (cf.s_id = sf.s_id * AND cf.sf_type = sf.sf_type) * * AND (cf.start_time \<= <start_time rnd> * AND <end_time rnd> \< cf.end_time); * * plan: index probe on "SF_IDX" * iter on index "CF_IDX" */ { // make gotos safe // 1. Retrieve SpecialFacility (read-only) TRACE( TRACE_TRX_FLOW, "App: %d GND:sf-idx-probe (%d) (%d)\n", xct_id, gndin._s_id, gndin._sf_type); e = _psf_man->sf_idx_probe(_pssm, prsf, gndin._s_id, gndin._sf_type); if (e.is_error()) { goto done; } prsf->get_value(2, asf.IS_ACTIVE); // If it is and active special facility // 2. Retrieve the call forwarding destination (read-only) if (asf.IS_ACTIVE) { guard<index_scan_iter_impl<call_forwarding_t> > cf_iter; { index_scan_iter_impl<call_forwarding_t>* tmp_cf_iter; TRACE( TRACE_TRX_FLOW, "App: %d GND:cf-idx-iter\n", xct_id); e = _pcf_man->cf_get_idx_iter(_pssm, tmp_cf_iter, prcf, lowrep, highrep, gndin._s_id, gndin._sf_type, gndin._s_time); if (e.is_error()) { goto done; } cf_iter = tmp_cf_iter; } e = cf_iter->next(_pssm, eof, *prcf); if (e.is_error()) { goto done; } while (!eof) { // check the retrieved CF e_time prcf->get_value(3, acf.END_TIME); if (acf.END_TIME > gndin._e_time) { prcf->get_value(4, acf.NUMBERX, 17); TRACE( TRACE_TRX_FLOW, "App: %d GND: found (%d) (%d) (%s)\n", xct_id, gndin._e_time, acf.END_TIME, acf.NUMBERX); bFound = true; } TRACE( TRACE_TRX_FLOW, "App: %d GND:cf-idx-iter-next\n", xct_id); e = cf_iter->next(_pssm, eof, *prcf); if (e.is_error()) { goto done; } } } if (!bFound) { e = RC(se_NO_CURRENT_TUPLE); } } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsf->print_tuple(); prcf->print_tuple(); #endif done: // return the tuples to the cache _psf_man->give_tuple(prsf); _pcf_man->give_tuple(prcf); return (e); } // EOF: GET_NEW_DEST /******************************************************************** * * TM1 GET_ACC_DATA * ********************************************************************/ w_rc_t ShoreTM1Env::xct_get_acc_data(const int xct_id, get_acc_data_input_t& gadin) { // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 1 table: // AccessInfo tuple_guard<table_row_t, ai_man_impl> prai(_pai_man); rep_row_t areprow(_pai_man->ts()); // allocate space for the table representations areprow.set(_pai_desc->maxsize()); prai->_rep = &areprow; /* SELECT data1, data2, data3, data4 * FROM Access_Info * WHERE s_id = <s_id rnd> * AND ai_type = <ai_type rnd> * * plan: index probe on "AI_IDX" */ { // make gotos safe /* 1. retrieve AccessInfo (read-only) */ TRACE( TRACE_TRX_FLOW, "App: %d GAD:ai-idx-probe (%d) (%d)\n", xct_id, gadin._s_id, gadin._ai_type); W_DO(_pai_man->ai_idx_probe(_pssm, prai, gadin._s_id, gadin._ai_type)); tm1_ai_t aai; // READ ACCESS-INFO prai->get_value(2, aai.DATA1); prai->get_value(3, aai.DATA2); prai->get_value(4, aai.DATA3, 5); prai->get_value(5, aai.DATA4, 9); } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prai->print_tuple(); #endif return RCOK; } // EOF: GET_ACC_DATA /******************************************************************** * * TM1 UPD_SUB_DATA * ********************************************************************/ w_rc_t ShoreTM1Env::xct_upd_sub_data(const int xct_id, upd_sub_data_input_t& usdin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 2 tables: // Subscriber, SpecialFacility table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); table_row_t* prsf = _psf_man->get_tuple(); assert (prsf); rep_row_t areprow(_psub_man->ts()); // allocate space for the larger table representation areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; prsf->_rep = &areprow; /* UPDATE Subscriber * SET bit_1 = <bit_rnd> * WHERE s_id = <s_id rnd subid>; * * plan: index probe on "S_IDX" * * UPDATE Special_Facility * SET data_a = <data_a rnd> * WHERE s_id = <s_id value subid> * AND sf_type = <sf_type rnd>; * * plan: index probe on "SF_IDX" */ { // make gotos safe // IP: Moving the Upd(SF) first because it is the only // operation on this trx that may fail //#warning baseline::upd_sub_data does first the Upd(SF) and then Upd(Sub) // 1. Update SpecialFacility TRACE( TRACE_TRX_FLOW, "App: %d USD:sf-idx-upd (%d) (%d)\n", xct_id, usdin._s_id, usdin._sf_type); e = _psf_man->sf_idx_upd(_pssm, prsf, usdin._s_id, usdin._sf_type); if (e.is_error()) { goto done; } prsf->set_value(4, usdin._a_data); e = _psf_man->update_tuple(_pssm, prsf); if (e.is_error()) { goto done; } // 2. Update Subscriber TRACE( TRACE_TRX_FLOW, "App: %d USD:sub-idx-upd (%d)\n", xct_id, usdin._s_id); e = _psub_man->sub_idx_upd(_pssm, prsub, usdin._s_id); if (e.is_error()) { goto done; } prsub->set_value(2, usdin._a_bit); e = _psub_man->update_tuple(_pssm, prsub); } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsub->print_tuple(); prsf->print_tuple(); #endif done: // return the tuples to the cache _psub_man->give_tuple(prsub); _psf_man->give_tuple(prsf); return (e); } // EOF: UPD_SUB_DATA /******************************************************************** * * TM1 UPD_LOC * ********************************************************************/ w_rc_t ShoreTM1Env::xct_upd_loc(const int xct_id, upd_loc_input_t& ulin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 1 table: // Subscriber table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); rep_row_t areprow(_psub_man->ts()); // allocate space for the larger table representation areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; /* UPDATE Subscriber * SET vlr_location = <vlr_location rnd> * WHERE sub_nbr = <sub_nbr rndstr>; * * plan: index probe on "SUB_NBR_IDX" */ { // make gotos safe /* 1. Update Subscriber */ TRACE( TRACE_TRX_FLOW, "App: %d UL:sub-nbr-idx-upd (%d)\n", xct_id, ulin._s_id); e = _psub_man->sub_nbr_idx_upd(_pssm, prsub, ulin._sub_nbr); if (e.is_error()) { goto done; } prsub->set_value(33, ulin._vlr_loc); e = _psub_man->update_tuple(_pssm, prsub); } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsub->print_tuple(); #endif done: // return the tuples to the cache _psub_man->give_tuple(prsub); return (e); } // EOF: UPD_LOC /******************************************************************** * * TM1 INS_CALL_FWD * ********************************************************************/ w_rc_t ShoreTM1Env::xct_ins_call_fwd(const int xct_id, ins_call_fwd_input_t& icfin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 3 tables: // Subscriber, SpecialFacility, CallForwarding table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); table_row_t* prsf = _psf_man->get_tuple(); assert (prsf); table_row_t* prcf = _pcf_man->get_tuple(); assert (prcf); rep_row_t areprow(_psub_man->ts()); // allocate space for the larger table representation areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; prsf->_rep = &areprow; prcf->_rep = &areprow; rep_row_t lowrep(_psf_man->ts()); rep_row_t highrep(_psf_man->ts()); lowrep.set(_psf_desc->maxsize()); highrep.set(_psf_desc->maxsize()); tm1_sf_t asf; bool bFound = false; bool eof; /* SELECT <s_id bind subid s_id> * FROM Subscriber * WHERE sub_nbr = <sub_nbr rndstr>; * * plan: index probe on "SUB_NBR_IDX" * * SELECT sf_type bind sfid sf_type> * FROM Special_Facility * WHERE s_id = <s_id value subid> * * plan: iter index on "SF_IDX" * * INSERT INTO Call_Forwarding * VALUES (<s_id value subid>, <sf_type rnd sf_type>, * <start_time rnd>, <end_time rnd>, * <numberx rndstr>); */ { // make gotos safe // 1. Retrieve Subscriber (Read-only) TRACE( TRACE_TRX_FLOW, "App: %d ICF:sub-nbr-idx (%d)\n", xct_id, icfin._s_id); e = _psub_man->sub_nbr_idx_probe(_pssm, prsub, icfin._sub_nbr); if (e.is_error()) { goto done; } prsub->get_value(0, icfin._s_id); // 2. Retrieve SpecialFacility (Read-only) guard<index_scan_iter_impl<special_facility_t> > sf_iter; { index_scan_iter_impl<special_facility_t>* tmp_sf_iter; TRACE( TRACE_TRX_FLOW, "App: %d ICF:sf-idx-iter\n", xct_id); e = _psf_man->sf_get_idx_iter(_pssm, tmp_sf_iter, prsf, lowrep, highrep, icfin._s_id); sf_iter = tmp_sf_iter; if (e.is_error()) { goto done; } } e = sf_iter->next(_pssm, eof, *prsf); if (e.is_error()) { goto done; } while (!eof) { // check the retrieved SF sf_type prsf->get_value(1, asf.SF_TYPE); if (asf.SF_TYPE == icfin._sf_type) { TRACE( TRACE_TRX_FLOW, "App: %d ICF: found (%d) (%d)\n", xct_id, icfin._s_id, asf.SF_TYPE); bFound = true; break; } TRACE( TRACE_TRX_FLOW, "App: %d ICF:sf-idx-iter-next\n", xct_id); e = sf_iter->next(_pssm, eof, *prsf); if (e.is_error()) { goto done; } } if (bFound == false) { e = RC(se_NO_CURRENT_TUPLE); goto done; } // 3. Check if it can successfully insert TRACE( TRACE_TRX_FLOW, "App: %d ICF:cf-idx-probe (%d) (%d) (%d)\n", xct_id, icfin._s_id, icfin._sf_type, icfin._s_time); e = _pcf_man->cf_idx_probe(_pssm, prcf, icfin._s_id, icfin._sf_type, icfin._s_time); // idx probes return se_TUPLE_NOT_FOUND if (e.err_num() == se_TUPLE_NOT_FOUND) { // 4. Insert Call Forwarding record prcf->set_value(0, icfin._s_id); prcf->set_value(1, icfin._sf_type); prcf->set_value(2, icfin._s_time); prcf->set_value(3, icfin._e_time); prcf->set_value(4, icfin._numberx); #ifdef CFG_HACK prcf->set_value(5, "padding"); // PADDING #endif TRACE (TRACE_TRX_FLOW, "App: %d ICF:ins-cf\n", xct_id); e = _pcf_man->add_tuple(_pssm, prcf); } else { // in any other case it should fail e = RC(se_CANNOT_INSERT_TUPLE); } } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsub->print_tuple(); prsf->print_tuple(); prcf->print_tuple(); #endif done: // return the tuples to the cache _psub_man->give_tuple(prsub); _psf_man->give_tuple(prsf); _pcf_man->give_tuple(prcf); return (e); } // EOF: INS_CALL_FWD /******************************************************************** * * TM1 DEL_CALL_FWD * ********************************************************************/ w_rc_t ShoreTM1Env::xct_del_call_fwd(const int xct_id, del_call_fwd_input_t& dcfin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 2 tables: // Subscriber, CallForwarding table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); table_row_t* prcf = _pcf_man->get_tuple(); assert (prcf); rep_row_t areprow(_psub_man->ts()); // allocate space for the larger table representation areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; prcf->_rep = &areprow; /* SELECT <s_id bind subid s_id> * FROM Subscriber * WHERE sub_nbr = <sub_nbr rndstr>; * * plan: index probe on "SUB_NBR_IDX" * * DELETE FROM Call_Forwarding * WHERE s_id = <s_id value subid> * AND sf_type = <sf_type rnd> * AND start_time = <start_time rnd>; * * plan: index probe on "CF_IDX" */ { // make gotos safe /* 1. Retrieve Subscriber (Read-only) */ TRACE( TRACE_TRX_FLOW, "App: %d DCF:sub-nbr-idx (%d)\n", xct_id, dcfin._s_id); e = _psub_man->sub_nbr_idx_probe(_pssm, prsub, dcfin._sub_nbr); if (e.is_error()) { goto done; } prsub->get_value(0, dcfin._s_id); /* 2. Delete CallForwarding record */ TRACE( TRACE_TRX_FLOW, "App: %d DCF:cf-idx-upd (%d) (%d) (%d)\n", xct_id, dcfin._s_id, dcfin._sf_type, dcfin._s_time); e = _pcf_man->cf_idx_upd(_pssm, prcf, dcfin._s_id, dcfin._sf_type, dcfin._s_time); if (e.is_error()) { goto done; } TRACE (TRACE_TRX_FLOW, "App: %d DCF:del-cf\n", xct_id); e = _pcf_man->delete_tuple(_pssm, prcf); } // goto #ifdef PRINT_TRX_RESULTS // at the end of the transaction // dumps the status of all the table rows used prsub->print_tuple(); prcf->print_tuple(); #endif done: // return the tuples to the cache _psub_man->give_tuple(prsub); _pcf_man->give_tuple(prcf); return (e); } // EOF: DEL_CALL_FWD /******************************************************************** * * TM1 GET_SUB_NBR * ********************************************************************/ w_rc_t ShoreTM1Env::xct_get_sub_nbr(const int xct_id, get_sub_nbr_input_t& gsnin) { w_rc_t e = RCOK; // ensure a valid environment assert (_pssm); assert (_initialized); assert (_loaded); // Touches 1 table: // Subscriber table_row_t* prsub = _psub_man->get_tuple(); assert (prsub); rep_row_t areprow(_psub_man->ts()); // allocate space for the larger table representation areprow.set(_psub_desc->maxsize()); prsub->_rep = &areprow; rep_row_t lowrep(_psub_man->ts()); rep_row_t highrep(_psub_man->ts()); lowrep.set(_psub_desc->maxsize()); highrep.set(_psub_desc->maxsize()); bool eof; uint range = get_rec_to_access(); int sid, vlrloc; /* SELECT s_id, msc_location * FROM Subscriber * WHERE sub_nbr >= <sub_nbr rndstr as s1> * AND sub_nbr < (s1 + <range>); * * plan: index probe on "SUB_NBR_IDX" */ { // make gotos safe // 1. Secondary index access to Subscriber using sub_nbr and range guard<index_scan_iter_impl<subscriber_t> > sub_iter; { index_scan_iter_impl<subscriber_t>* tmp_sub_iter; TRACE( TRACE_TRX_FLOW, "App: %d GSN:sub-nbr-idx-iter (%d) (%d)\n", xct_id, gsnin._s_id, range); e = _psub_man->sub_get_idx_iter(_pssm, tmp_sub_iter, prsub, lowrep,highrep, gsnin._s_id,range, SH, /* read-only access */ true); /* retrieve record */ if (e.is_error()) { goto done; } sub_iter = tmp_sub_iter; } // 2. Read all the returned records e = sub_iter->next(_pssm, eof, *prsub); if (e.is_error()) { goto done; } while (!eof) { prsub->get_value(0, sid); prsub->get_value(33, vlrloc); TRACE( TRACE_TRX_FLOW, "App: %d GSN: read (%d) (%d)\n", xct_id, sid, vlrloc); e = sub_iter->next(_pssm, eof, *prsub); } } // goto done: // return the tuples to the cache _psub_man->give_tuple(prsub); return (e); } // EOF: GET_SUB_NBR EXIT_NAMESPACE(tm1);
27.938714
83
0.525467
DBlabRT
3804715db8b8eee96fa51b1a0acdd716a4cd23ea
386
cpp
C++
pat-b/1037.cpp
brucegua/pat_exer
8ac7c21d829f5ef12d3cc05b82e80b5bf2923519
[ "Apache-2.0" ]
null
null
null
pat-b/1037.cpp
brucegua/pat_exer
8ac7c21d829f5ef12d3cc05b82e80b5bf2923519
[ "Apache-2.0" ]
null
null
null
pat-b/1037.cpp
brucegua/pat_exer
8ac7c21d829f5ef12d3cc05b82e80b5bf2923519
[ "Apache-2.0" ]
null
null
null
#include "stdio.h" int main() { long long P[3], pks, A[3], aks, ks; scanf("%lld.%lld.%lld %lld.%lld.%lld", P, P+1, P+2, A, A+1, A+2); pks = P[0]*17*29 + P[1]*29 + P[2]; aks = A[0]*17*29 + A[1]*29 + A[2]; ks = aks - pks; if (ks < 0) { printf("-"); ks = -ks; } printf("%d.%d.%d", ks/29/17, ks/29%17, ks%29); return 0; }
20.315789
69
0.409326
brucegua
3805b3f0d3a387a4bd70e1c053c0da7eb0edfa53
5,276
hpp
C++
include/cppdevtk/base/stack_frame.hpp
CoSoSys/cppdevtk
99d6c3d328c05a55dae54e82fcbedad93d0cfaa0
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
include/cppdevtk/base/stack_frame.hpp
CoSoSys/cppdevtk
99d6c3d328c05a55dae54e82fcbedad93d0cfaa0
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
include/cppdevtk/base/stack_frame.hpp
CoSoSys/cppdevtk
99d6c3d328c05a55dae54e82fcbedad93d0cfaa0
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file /// /// \copyright Copyright (C) 2015 - 2020 CoSoSys Ltd <info@cososys.com>\n /// Licensed under the Apache License, Version 2.0 (the "License");\n /// you may not use this file except in compliance with the License.\n /// You may obtain a copy of the License at\n /// http://www.apache.org/licenses/LICENSE-2.0\n /// Unless required by applicable law or agreed to in writing, software\n /// distributed under the License is distributed on an "AS IS" BASIS,\n /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n /// See the License for the specific language governing permissions and\n /// limitations under the License.\n /// Please see the file COPYING. /// /// \authors Cristian ANITA <cristian.anita@cososys.com>, <cristian_anita@yahoo.com> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef CPPDEVTK_BASE_STACK_FRAME_HPP_INCLUDED_ #define CPPDEVTK_BASE_STACK_FRAME_HPP_INCLUDED_ #include "config.hpp" #if (CPPDEVTK_DISABLE_CPPDEVTK_WARNINGS && CPPDEVTK_COMPILER_MSVC) # pragma warning(push) # pragma warning(disable: 4265) // C4265: 'class' : class has virtual functions, but destructor is not virtual #endif #include "stringizable.hpp" #include "architecture_types.hpp" #include "string_utils.hpp" #include <vector> namespace cppdevtk { namespace base { class CPPDEVTK_BASE_API StackFrame: public QStringizable { public: StackFrame(); StackFrame(const char* moduleName, char* functionName, ::cppdevtk::base::dword64 offset, ::cppdevtk::base::dword64 returnAddress); StackFrame(const QString& moduleName, const QString& functionName, ::cppdevtk::base::dword64 offset, ::cppdevtk::base::dword64 returnAddress); bool IsEmpty() const; void Clear(); void SetModuleName(const char* moduleName); void SetModuleName(const QString& moduleName); QString GetModuleName() const; void SetFunctionName(const char* functionName); void SetFunctionName(const QString& functionName); QString GetFunctionName() const; void SetOffset(::cppdevtk::base::dword64 offset); ::cppdevtk::base::dword64 GetOffset() const; void SetReturnAddress(::cppdevtk::base::dword64 returnAddress); ::cppdevtk::base::dword64 GetReturnAddress() const; virtual QString ToString() const; private: QString moduleName_; QString functionName_; ::cppdevtk::base::dword64 offset_; ::cppdevtk::base::dword64 returnAddress_; }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inline functions inline StackFrame::StackFrame(): QStringizable(), moduleName_(), functionName_(), offset_(0), returnAddress_(0) {} inline StackFrame::StackFrame(const QString& moduleName, const QString& functionName, ::cppdevtk::base::dword64 offset, ::cppdevtk::base::dword64 returnAddress): QStringizable(), moduleName_(moduleName), functionName_(functionName), offset_(offset), returnAddress_(returnAddress) {} inline bool StackFrame::IsEmpty() const { return (moduleName_.isEmpty() && functionName_.isEmpty() && (offset_ == 0) && (returnAddress_ == 0)); } inline void StackFrame::Clear() { moduleName_.clear(); functionName_.clear(); offset_ = 0; returnAddress_ = 0; } inline void StackFrame::SetModuleName(const QString& moduleName) { moduleName_ = moduleName; } inline QString StackFrame::GetModuleName() const { return moduleName_; } inline void StackFrame::SetFunctionName(const QString& functionName) { functionName_ = functionName; } inline QString StackFrame::GetFunctionName() const { return functionName_; } inline void StackFrame::SetOffset(::cppdevtk::base::dword64 offset) { offset_ = offset; } inline ::cppdevtk::base::dword64 StackFrame::GetOffset() const { return offset_; } inline void StackFrame::SetReturnAddress(::cppdevtk::base::dword64 returnAddress) { returnAddress_ = returnAddress; } inline ::cppdevtk::base::dword64 StackFrame::GetReturnAddress() const { return returnAddress_; } inline QString StackFrame::ToString() const { return QString("(%1 + %2) [%3] %4").arg((functionName_.isEmpty() ? "unknown_function" : functionName_), NumToHexStr(offset_), NumToHexStr(returnAddress_), (moduleName_.isEmpty() ? "unknown_module" : moduleName_)); } } // namespace base } // namespace cppdevtk ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Templates explicit instantiation declaration. #ifndef CPPDEVTK_BASE_STACK_FRAME_CPP namespace std { CPPDEVTK_BASE_TMPL_EXPL_INST template class CPPDEVTK_BASE_API allocator< ::cppdevtk::base::StackFrame>; CPPDEVTK_BASE_TMPL_EXPL_INST template class CPPDEVTK_BASE_API vector< ::cppdevtk::base::StackFrame, allocator< ::cppdevtk::base::StackFrame> >; } #endif #if (CPPDEVTK_DISABLE_CPPDEVTK_WARNINGS && CPPDEVTK_COMPILER_MSVC) # pragma warning(pop) #endif #endif // CPPDEVTK_BASE_STACK_FRAME_HPP_INCLUDED_
31.975758
126
0.662813
CoSoSys
38079ec9993eb6eb20efec0a45357d2c5aafe93c
3,681
cc
C++
src/content/browser/gpu/gpu_client.cc
yang-guangliang/osv-free
b81fee48bc8898fdc641a2e3c227957ed7e6445e
[ "Apache-2.0" ]
2
2021-05-24T13:52:28.000Z
2021-05-24T13:53:10.000Z
src/content/browser/gpu/gpu_client.cc
yang-guangliang/osv-free
b81fee48bc8898fdc641a2e3c227957ed7e6445e
[ "Apache-2.0" ]
null
null
null
src/content/browser/gpu/gpu_client.cc
yang-guangliang/osv-free
b81fee48bc8898fdc641a2e3c227957ed7e6445e
[ "Apache-2.0" ]
3
2018-03-12T07:58:10.000Z
2019-08-31T04:53:58.000Z
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/gpu/gpu_client.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/common/child_process_host_impl.h" #include "content/public/browser/browser_thread.h" #include "gpu/ipc/client/gpu_channel_host.h" #include "gpu/ipc/client/gpu_memory_buffer_impl.h" #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" namespace content { GpuClient::GpuClient(int render_process_id) : render_process_id_(render_process_id), weak_factory_(this) { bindings_.set_connection_error_handler( base::Bind(&GpuClient::OnError, base::Unretained(this))); } GpuClient::~GpuClient() { bindings_.CloseAllBindings(); OnError(); } void GpuClient::Add(ui::mojom::GpuRequest request) { bindings_.AddBinding(this, std::move(request)); } void GpuClient::OnError() { if (!bindings_.empty()) return; BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); if (gpu_memory_buffer_manager) gpu_memory_buffer_manager->ProcessRemoved(render_process_id_); } void GpuClient::OnEstablishGpuChannel( const EstablishGpuChannelCallback& callback, const IPC::ChannelHandle& channel, const gpu::GPUInfo& gpu_info, GpuProcessHost::EstablishChannelStatus status) { mojo::ScopedMessagePipeHandle channel_handle; channel_handle.reset(channel.mojo_handle); callback.Run(render_process_id_, std::move(channel_handle), gpu_info); } void GpuClient::OnCreateGpuMemoryBuffer( const CreateGpuMemoryBufferCallback& callback, const gfx::GpuMemoryBufferHandle& handle) { callback.Run(handle); } void GpuClient::EstablishGpuChannel( const EstablishGpuChannelCallback& callback) { GpuProcessHost* host = GpuProcessHost::Get(); if (!host) { OnEstablishGpuChannel( callback, IPC::ChannelHandle(), gpu::GPUInfo(), GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED); return; } bool preempts = false; bool allow_view_command_buffers = false; bool allow_real_time_streams = false; host->EstablishGpuChannel( render_process_id_, ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( render_process_id_), preempts, allow_view_command_buffers, allow_real_time_streams, base::Bind(&GpuClient::OnEstablishGpuChannel, weak_factory_.GetWeakPtr(), callback)); } void GpuClient::CreateGpuMemoryBuffer( gfx::GpuMemoryBufferId id, const gfx::Size& size, gfx::BufferFormat format, gfx::BufferUsage usage, const ui::mojom::Gpu::CreateGpuMemoryBufferCallback& callback) { DCHECK(BrowserGpuMemoryBufferManager::current()); base::CheckedNumeric<int> bytes = size.width(); bytes *= size.height(); if (!bytes.IsValid()) { OnCreateGpuMemoryBuffer(callback, gfx::GpuMemoryBufferHandle()); return; } BrowserGpuMemoryBufferManager::current() ->AllocateGpuMemoryBufferForChildProcess( id, size, format, usage, render_process_id_, base::Bind(&GpuClient::OnCreateGpuMemoryBuffer, weak_factory_.GetWeakPtr(), callback)); } void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, const gpu::SyncToken& sync_token) { DCHECK(BrowserGpuMemoryBufferManager::current()); BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( id, render_process_id_, sync_token); } } // namespace content
33.463636
79
0.746265
yang-guangliang
380873761274ed62e6b5a1c2181e29a84cbe854a
359
hh
C++
src/parse/scantiger.hh
MrMaDGaME/Tiger
f31f73cd386b3ccb3e02abe7b23a3de09d70bd0f
[ "MIT" ]
null
null
null
src/parse/scantiger.hh
MrMaDGaME/Tiger
f31f73cd386b3ccb3e02abe7b23a3de09d70bd0f
[ "MIT" ]
null
null
null
src/parse/scantiger.hh
MrMaDGaME/Tiger
f31f73cd386b3ccb3e02abe7b23a3de09d70bd0f
[ "MIT" ]
null
null
null
#pragma once #include <parse/parsetiger.hh> #include <parse/tiger-parser.hh> // Set parameters for Flex header, and include it. #define YY_FLEX_NAMESPACE_BEGIN \ namespace parse \ { #define YY_FLEX_NAMESPACE_END } #include <misc/flex-lexer.hh>
27.615385
80
0.526462
MrMaDGaME
38098de5f1124d0914deec5a7fc3642d7b0670e8
1,603
cc
C++
services/network/resource_scheduler_client.cc
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
services/network/resource_scheduler_client.cc
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
services/network/resource_scheduler_client.cc
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "services/network/resource_scheduler_client.h" #include "net/url_request/url_request_context.h" #include "services/network/network_context.h" namespace network { ResourceSchedulerClient::ResourceSchedulerClient( int child_id, int route_id, ResourceScheduler* resource_scheduler, net::NetworkQualityEstimator* estimator) : child_id_(child_id), route_id_(route_id), resource_scheduler_(resource_scheduler) { resource_scheduler_->OnClientCreated(child_id_, route_id_, estimator); } ResourceSchedulerClient::~ResourceSchedulerClient() { resource_scheduler_->OnClientDeleted(child_id_, route_id_); } std::unique_ptr<ResourceScheduler::ScheduledResourceRequest> ResourceSchedulerClient::ScheduleRequest(bool is_async, net::URLRequest* url_request) { return resource_scheduler_->ScheduleRequest(child_id_, route_id_, is_async, url_request); } void ResourceSchedulerClient::ReprioritizeRequest( net::URLRequest* request, net::RequestPriority new_priority, int intra_priority_value) { resource_scheduler_->ReprioritizeRequest(request, new_priority, intra_priority_value); } void ResourceSchedulerClient::OnReceivedSpdyProxiedHttpResponse() { resource_scheduler_->OnReceivedSpdyProxiedHttpResponse(child_id_, route_id_); } } // namespace network
34.847826
79
0.737991
zipated
3809bd3f2ed4893c0f56c46f1e407666c70d3c94
6,139
cpp
C++
field_map/2020field.cpp
FRC900/2020RobotCode
e5d5f8f9f0ea2dc0e1139e776989ccb5a05896de
[ "BSD-3-Clause" ]
4
2020-11-25T18:30:33.000Z
2021-11-14T04:50:16.000Z
utility/field_map/2020field.cpp
FRC900/2020Offseason
36ccd74667d379b07d9b7a1e937307c6d8119229
[ "BSD-3-Clause" ]
19
2021-03-20T01:10:04.000Z
2022-01-17T22:51:05.000Z
utility/field_map/2020field.cpp
FRC900/2020Offseason
36ccd74667d379b07d9b7a1e937307c6d8119229
[ "BSD-3-Clause" ]
2
2021-04-13T22:48:25.000Z
2021-11-14T06:13:06.000Z
#include <iostream> #include <opencv2/opencv.hpp> // https://stackoverflow.com/questions/43342199/draw-rotated-rectangle-in-opencv-c // Include center point of your rectangle, size of your rectangle and the degrees of rotation void drawRotatedRectangle(cv::Mat& image, const cv::Point &centerPoint, const cv::Size &rectangleSize, const double rotationDegrees, const cv::Scalar &color) { // Create the rotated rectangle cv::RotatedRect rotatedRectangle(centerPoint, rectangleSize, rotationDegrees); // We take the edges that OpenCV calculated for us cv::Point2f vertices2f[4]; rotatedRectangle.points(vertices2f); // Convert them so we can use them in a fillConvexPoly cv::Point vertices[4]; for(int i = 0; i < 4; ++i){ vertices[i] = vertices2f[i]; } // Now we can fill the rotated rectangle with our specified color cv::fillConvexPoly(image, vertices, 4, color); } int main(void) { // In inches constexpr double field_width = 52. * 12. + 5. + 1./4.; constexpr double field_height = 26. * 12. + 11. + 1./4.; // In pixels constexpr int width = 1200; constexpr int height = width / (field_width / field_height); constexpr double border = width * .05; // Inches constexpr double ds_wall_slope_height = 69.5; constexpr double ds_wall_slope_width = (field_width - 557.84) / 2.; constexpr double trench_to_ds_wall = 344.453; constexpr double trench_to_side_wall = 53.5; constexpr double trench_width = 2; constexpr double trench_length = 30; // Create mat large enough to hold field plus a border cv::Mat image(cv::Size(width + 2 * border, height + 2 * border), CV_8UC1, cv::Scalar(255)); std::cout << image.size() << " " << image.depth() << " " << image.channels() << std::endl; const double inches_per_pixel = field_width / width; std::cout << "inches per pixel = " << inches_per_pixel << std::endl; for (int row = 0; row < image.rows; row++) { for (int col = 0; col < image.cols; col++) { const double xpos_in_inches = static_cast<double>(col - border) * inches_per_pixel; const double ypos_in_inches = static_cast<double>(row - border) * inches_per_pixel; if ((xpos_in_inches < 0) || (ypos_in_inches < 0)) { image.at<uchar>(row, col) = 0; } if (xpos_in_inches > field_width) { image.at<uchar>(row, col) = 0; } if (ypos_in_inches > field_height) { image.at<uchar>(row, col) = 0; } // Angled DS wall if (ypos_in_inches < ds_wall_slope_height) { const double near_x_intercept = ds_wall_slope_width - ypos_in_inches * (ds_wall_slope_width / ds_wall_slope_height); if ((xpos_in_inches < near_x_intercept) || (xpos_in_inches > (field_width - near_x_intercept))) { image.at<uchar>(row, col) = 0; } } // Angled DS wall if ((field_height - ypos_in_inches) < ds_wall_slope_height) { const double near_x_intercept = ds_wall_slope_width - (field_height - ypos_in_inches) * (ds_wall_slope_width / ds_wall_slope_height); if ((xpos_in_inches < near_x_intercept) || (xpos_in_inches > (field_width - near_x_intercept))) { image.at<uchar>(row, col) = 0; } } // Trench if ((xpos_in_inches > trench_to_ds_wall) && (xpos_in_inches < (trench_to_ds_wall + trench_length)) && (ypos_in_inches > trench_to_side_wall) && (ypos_in_inches < (trench_to_side_wall + trench_width))) { image.at<uchar>(row, col) = 0; } if ((xpos_in_inches < (field_width - trench_to_ds_wall)) && (xpos_in_inches > (field_width - (trench_to_ds_wall + trench_length))) && (ypos_in_inches < (field_height - trench_to_side_wall)) && (ypos_in_inches > (field_height - (trench_to_side_wall + trench_width)))) { image.at<uchar>(row, col) = 0; } //std::cout << xpos_in_inches << ", " << ypos_in_inches << std::endl; } } // Draw pillars as rotated rects const double pillar_dx = 4.629 / inches_per_pixel; const double pillar_dy = 11.150 / inches_per_pixel; const double pillar_hypot = hypot(pillar_dy, pillar_dy); const double pillar_corner_to_center_x = 8.471; const double pillar_corner_to_center_y = 3.28l; const double pillar_1_x = (205.897 + pillar_corner_to_center_x) / inches_per_pixel + border; const double pillar_1_y = (121.155 + pillar_corner_to_center_y) / inches_per_pixel + border; drawRotatedRectangle(image, cv::Point(pillar_1_x, pillar_1_y), cv::Size(pillar_hypot, pillar_hypot), atan2(pillar_dy, pillar_dx) * 180. / M_PI, cv::Scalar(0,0,0)); const double pillar_2_x = (350.715 + pillar_corner_to_center_x) / inches_per_pixel + border; const double pillar_2_y = (61.169 + pillar_corner_to_center_y) / inches_per_pixel + border; drawRotatedRectangle(image, cv::Point(pillar_2_x, pillar_2_y), cv::Size(pillar_hypot, pillar_hypot), atan2(pillar_dy, pillar_dx) * 180. / M_PI, cv::Scalar(0,0,0)); const double pillar_3_x = (406.905 + pillar_corner_to_center_x) / inches_per_pixel + border; const double pillar_3_y = (195.651 + pillar_corner_to_center_y) / inches_per_pixel + border; drawRotatedRectangle(image, cv::Point(pillar_3_x, pillar_3_y), cv::Size(pillar_hypot, pillar_hypot), atan2(pillar_dy, pillar_dx) * 180. / M_PI, cv::Scalar(0,0,0)); const double pillar_4_x = (262.087 + pillar_corner_to_center_x) / inches_per_pixel + border; const double pillar_4_y = (255.637 + pillar_corner_to_center_y) / inches_per_pixel + border; drawRotatedRectangle(image, cv::Point(pillar_4_x, pillar_4_y), cv::Size(pillar_hypot, pillar_hypot), atan2(pillar_dy, pillar_dx) * 180. / M_PI, cv::Scalar(0,0,0)); // Calculations for various inputs to stage and map_server double meter_per_pixel = (field_width * .0254) / width; std::cout << "meters per pixel = " << meter_per_pixel << std::endl; std::cout << "width x height " << meter_per_pixel * image.cols << " " << meter_per_pixel * image.rows << std::endl; std::cout << "pose " << (meter_per_pixel * image.cols) / 2. - border * meter_per_pixel << " " << (meter_per_pixel * image.rows) / 2. - border * meter_per_pixel << std::endl; cv::imwrite("2020Field.png", image); cv::imshow("Input", image); cv::waitKey(0); return 0; }
37.895062
174
0.697345
FRC900
380b3270a252950662f6e5ac8920339166e7d470
1,091
cc
C++
codeforces/629_#343_Div2/C/main.cc
jinzhao1994/ACM
5846032df31ab000deb57d8cbb8cb4c27c0e955b
[ "WTFPL" ]
2
2015-07-22T01:26:47.000Z
2015-08-30T11:33:19.000Z
codeforces/629_#343_Div2/C/main.cc
jinzhao1994/ACM
5846032df31ab000deb57d8cbb8cb4c27c0e955b
[ "WTFPL" ]
null
null
null
codeforces/629_#343_Div2/C/main.cc
jinzhao1994/ACM
5846032df31ab000deb57d8cbb8cb4c27c0e955b
[ "WTFPL" ]
null
null
null
#include <cstdio> const int mod = 1000000007; const int N = 100001; const int M = 2001; int c[M][M]; int n, m, tot, pre; char s[N]; inline int regular(int x) { if (x >= mod) { return x - mod; } if (x < 0) { return x + mod; } return x; } inline int cal(int i, int j) { if (j == 0) { return 1; } return regular(c[i + j][j] - c[i + j][j - 1]); } int main() { c[0][0] = 1; for (int i = 1; i < M; i++) { c[i][0] = c[i][i] = 1; for (int j = 1; j < i; j++) { c[i][j] = regular(c[i - 1][j - 1] + c[i - 1][j]); } } scanf("%d%d", &n, &m); scanf("%s", s); for (int i = 0; i < m; i++) { if (s[i] == '(') { tot++; } else { tot--; } if (tot < -pre) { pre = -tot; } } int ans = 0; for (int l = 0; l <= n - m; l++) { int r = n - m - l; for (int k = 0; k <= l; k++) { int ll = k, lr = l - ll; int rl = ll - lr + tot, rr; if (ll - lr >= pre && r >= rl && ((r - rl) & 1) == 0) { rl = rl + ((r - rl) >> 1); rr = r - rl; ans = regular(ans + (long long)cal(ll, lr) * cal(rl, rr) % mod); } } } printf("%d\n", ans); return 0; }
17.596774
68
0.418882
jinzhao1994
380bc7f7a9aa43cfbfbf93c7174483a42ce6543d
5,380
cpp
C++
Microsoft/SAMPLES/Ole2View/IViewers/IUnknown.cpp
mdileep/Tigger
8e06d117a5b520c5fc9e37a710bf17aa51a9958c
[ "MIT", "Unlicense" ]
1
2022-01-04T21:13:05.000Z
2022-01-04T21:13:05.000Z
Microsoft/SAMPLES/Ole2View/IViewers/IUnknown.cpp
mdileep/Tigger
8e06d117a5b520c5fc9e37a710bf17aa51a9958c
[ "MIT", "Unlicense" ]
null
null
null
Microsoft/SAMPLES/Ole2View/IViewers/IUnknown.cpp
mdileep/Tigger
8e06d117a5b520c5fc9e37a710bf17aa51a9958c
[ "MIT", "Unlicense" ]
1
2022-01-04T21:13:01.000Z
2022-01-04T21:13:01.000Z
// IUnknown.cpp : implementation file // // // This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) 1992-1993 Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and Microsoft // QuickHelp and/or WinHelp documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #include "stdafx.h" #include "iviewers.h" #include "iview.h" #include "iviewer.h" #include "IUnknown.h" #include "util.h" #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CIUnknownViewer IMPLEMENT_DYNCREATE(CIUnknownViewer, CInterfaceViewer) #define new DEBUG_NEW CIUnknownViewer::CIUnknownViewer() { } CIUnknownViewer::~CIUnknownViewer() { } BEGIN_MESSAGE_MAP(CIUnknownViewer, CInterfaceViewer) //{{AFX_MSG_MAP(CIUnknownViewer) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() // {7CE551EA-F85C-11ce-9059-080036F12502} IMPLEMENT_OLECREATE(CIUnknownViewer, "Ole2View Default Interface Viewer", 0x7ce551ea, 0xf85c, 0x11ce, 0x90, 0x59, 0x8, 0x0, 0x36, 0xf1, 0x25, 0x2) ; ///////////////////////////////////////////////////////////////////////////// // CIUnknownViewer View imp. // HRESULT CIUnknownViewer::OnView(HWND hwndParent, REFIID riid, LPUNKNOWN punk) { SCODE sc = NOERROR ; ASSERT(hwndParent); // ASSERT(punk); CIUnknownDlg dlg(CWnd::FromHandle(hwndParent)) ; dlg.m_punk = punk ; dlg.m_iid = riid ; OLECHAR wcsIID[40] ; ::StringFromGUID2(riid, wcsIID, 40); dlg.m_strIID = wcsIID ; TCHAR szName[256] ; TCHAR szKey[256] ; LONG cb = sizeof(szName)/sizeof(TCHAR); wsprintf(szKey, _T("Interface\\%s"), dlg.m_strIID) ; if (RegQueryValue(HKEY_CLASSES_ROOT, szKey, szName, &cb) != ERROR_SUCCESS) lstrcpy(szName, _T("<no name in registry>")) ; dlg.m_strName = szName ; dlg.DoModal() ; return sc ; } ///////////////////////////////////////////////////////////////////////////// // CIUnknownDlg dialog CIUnknownDlg::CIUnknownDlg(CWnd* pParent /*=NULL*/) : CDialog(CIUnknownDlg::IDD, pParent) { m_punk = NULL ; m_iid = GUID_NULL ; //{{AFX_DATA_INIT(CIUnknownDlg) m_strIID = _T(""); m_strName = _T(""); //}}AFX_DATA_INIT } void CIUnknownDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CIUnknownDlg) DDX_Control(pDX, IDC_VIEWTYPEINFO, m_btnViewTypeInfo); DDX_Text(pDX, IDC_IID, m_strIID); DDX_Text(pDX, IDC_INTERFACENAME, m_strName); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CIUnknownDlg, CDialog) //{{AFX_MSG_MAP(CIUnknownDlg) ON_BN_CLICKED(IDC_VIEWTYPEINFO, OnViewTypeInfo) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CIUnknownDlg message handlers BOOL CIUnknownDlg::OnInitDialog() { CDialog::OnInitDialog(); CenterWindow() ; // Check to see if this interface has a TypeLib associated with it. // If it does, then enable the View Type Info button. // CString str("Interface\\") ; str += m_strIID + _T("\\TypeLib"); LONG cb = 0; if (RegQueryValue(HKEY_CLASSES_ROOT, str, NULL, &cb) == ERROR_SUCCESS) m_btnViewTypeInfo.EnableWindow(TRUE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CIUnknownDlg::OnViewTypeInfo() { USES_CONVERSION; GUID tlibid ; TCHAR szid[40] ; CString str("Interface\\") ; str += m_strIID + _T("\\TypeLib"); LONG cb = sizeof(szid)/sizeof(TCHAR); if (RegQueryValue(HKEY_CLASSES_ROOT, str, szid, &cb) != ERROR_SUCCESS) { AfxMessageBox(_T("Could not read TypeLib key in registry.")); return ; } ::CLSIDFromString(T2OLE(szid), &tlibid); HRESULT hr; ITypeLib* ptlb = NULL ; LCID lcid = GetUserDefaultLCID() ; SHORT wVerMajor = -1; while (FAILED(hr = LoadRegTypeLib(tlibid, wVerMajor, 0, lcid, &ptlb))) { if (wVerMajor == -1) wVerMajor = 64 ; if (wVerMajor == 0) { TCHAR szTemp[256] ; wsprintf(szTemp, _T("LoadRegTypeLib(%s, [-1 through 64], %u, %lu, ...) failed."), szid, 0, lcid); ErrorMessage( szTemp, hr ) ; return ; } wVerMajor--; } ASSERT(ptlb); // Find our IID coclass... // ITypeInfo* pti = NULL ; if (SUCCEEDED(hr = ptlb->GetTypeInfoOfGuid(m_iid, &pti))) { IInterfaceViewer* pview = NULL ; hr = CoCreateInstance(CLSID_ITypeLibViewer, NULL, CLSCTX_SERVER, IID_IInterfaceViewer, (void**)&pview); if (SUCCEEDED(hr)) { pview->View(GetSafeHwnd(), IID_ITypeInfo, pti) ; pview->Release() ; } pti->Release(); } else { ErrorMessage(_T("ITypeLib::GetTypeInfoOfGuid failed."), hr ) ; } ptlb->Release(); }
27.309645
149
0.594238
mdileep
380c40f37e8adaf01161fd5c654afe62986c3d9a
1,702
cpp
C++
ext/UiaDll/UiaDll/SelectionItemMethods.cpp
leoniv/uia
eafe3dd5f27cbc5b3c73a9c9342af234f6e5f309
[ "MIT" ]
11
2015-04-16T18:20:35.000Z
2021-10-07T00:48:41.000Z
ext/UiaDll/UiaDll/SelectionItemMethods.cpp
leoniv/uia
eafe3dd5f27cbc5b3c73a9c9342af234f6e5f309
[ "MIT" ]
7
2016-01-14T10:04:02.000Z
2020-02-24T12:55:09.000Z
ext/UiaDll/UiaDll/SelectionItemMethods.cpp
leoniv/uia
eafe3dd5f27cbc5b3c73a9c9342af234f6e5f309
[ "MIT" ]
4
2015-10-26T16:18:46.000Z
2018-08-11T00:45:17.000Z
#include "Stdafx.h" extern "C" { __declspec(dllexport) void SelectionItem_Release(SelectionItemInformationPtr selectionItemInfo) { delete selectionItemInfo; } __declspec(dllexport) SelectionItemInformationPtr SelectionItem_Information(ElementInformationPtr element, char* errorInfo, const int errorInfoLength) { try { auto info = ElementFrom(element)->As<SelectionItemPattern^>(SelectionItemPattern::Pattern)->Current; return new SelectionItemInformation(info); } catch(Exception^ e) { StringHelper::CopyToUnmanagedString(e, errorInfo, errorInfoLength); return NULL; } } __declspec(dllexport) void SelectionItem_Select(ElementInformationPtr element, char* errorInfo, const int errorInfoLength) { try { ElementFrom(element)->As<SelectionItemPattern^>(SelectionItemPattern::Pattern)->Select(); } catch(Exception^ e) { StringHelper::CopyToUnmanagedString(e, errorInfo, errorInfoLength); } } __declspec(dllexport) void SelectionItem_AddToSelection(ElementInformationPtr element, char* errorInfo, const int errorInfoLength) { try { ElementFrom(element)->As<SelectionItemPattern^>(SelectionItemPattern::Pattern)->AddToSelection(); } catch(Exception^ e) { StringHelper::CopyToUnmanagedString(e, errorInfo, errorInfoLength); } } __declspec(dllexport) void SelectionItem_RemoveFromSelection(ElementInformationPtr element, char* errorInfo, const int errorInfoLength) { try { ElementFrom(element)->As<SelectionItemPattern^>(SelectionItemPattern::Pattern)->RemoveFromSelection(); } catch(Exception^ e) { StringHelper::CopyToUnmanagedString(e, errorInfo, errorInfoLength); } } }
41.512195
154
0.753231
leoniv
380e901290ac1694f19f26588defab9c1e10a2d4
10,920
cpp
C++
src/fanfoukit.cpp
zccrs/meefan
7dcea7d368bf2235b6216d96d249a9b6be6d96d9
[ "MIT" ]
null
null
null
src/fanfoukit.cpp
zccrs/meefan
7dcea7d368bf2235b6216d96d249a9b6be6d96d9
[ "MIT" ]
null
null
null
src/fanfoukit.cpp
zccrs/meefan
7dcea7d368bf2235b6216d96d249a9b6be6d96d9
[ "MIT" ]
null
null
null
#include "fanfoukit.h" #include "httprequest.h" #include <QPair> #include <QNetworkAccessManager> #include <QNetworkReply> #include <QRegExp> #include <QStringList> #include <QFile> #include <QDir> #include <QDateTime> #include <QSettings> #include <QCryptographicHash> #include <QUuid> #include <QtFeedback/QFeedbackHapticsEffect> #include <QtFeedback/QFeedbackActuator> #include <QFileInfo> #include <QTextDocument> #include <QDeclarativeItem> #include <QPainter> #include <QDesktopServices> #include <QCoreApplication> #include <QDebug> #define ACCESS_TOKEN_URL "http://fanfou.com/oauth/access_token" #define SPLASH_URL "http://api.zccrs.com/splash/meefan/n9/" #define SPLASH_PATH QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + QDir::separator() + "splash" + QDir::separator() FanfouKit::FanfouKit(QObject *parent) : OAuth(parent) , m_accessManager(new QNetworkAccessManager(this)) , m_httpRequest(new HttpRequest(m_accessManager, this)) , m_settings(new QSettings(this)) , m_rumble(0) { updateSplash(); } FanfouKit::FanfouKit(QNetworkAccessManager *manager, QObject *parent) : OAuth(parent) , m_accessManager(manager) , m_httpRequest(new HttpRequest(m_accessManager, this)) , m_settings(new QSettings(this)) , m_rumble(0) { updateSplash(); } FanfouKit::FanfouKit(const QByteArray &consumerKey, const QByteArray &consumerSecret, QObject *parent) : OAuth(consumerKey, consumerSecret, parent) , m_accessManager(new QNetworkAccessManager(this)) , m_httpRequest(new HttpRequest(m_accessManager, this)) , m_settings(new QSettings(this)) , m_rumble(0) { updateSplash(); } HttpRequest *FanfouKit::httpRequest() const { return m_httpRequest; } QByteArray FanfouKit::readFile(const QString &filePath) const { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { return file.readAll(); } return QByteArray(); } QString FanfouKit::fileName(const QString &filePath) const { QFileInfo info(filePath); return info.fileName(); } QString FanfouKit::fromUtf8(const QByteArray &data) const { return QString::fromUtf8(data); } QByteArray FanfouKit::toUtf8(const QString &string) const { return string.toUtf8(); } QString FanfouKit::datetimeFormatFromISO(const QString &dt) const { return QDateTime::fromString(dt, Qt::ISODate).toLocalTime().toString("yyyy-MM-dd hh:mm"); } QString FanfouKit::getCurrentDateTime(const QString &format) const { return QDateTime::currentDateTime().toString(format); } void FanfouKit::setSettingValue(const QString &name, const QVariant &value) { m_settings->setValue(name, value); } QVariant FanfouKit::settingValue(const QString &name, const QVariant &defaultValue) const { return m_settings->value(name, defaultValue); } void FanfouKit::clearSettings() { m_settings->clear(); } QByteArray FanfouKit::objectClassName(QObject *object) const { return object->metaObject()->className(); } QString FanfouKit::createUuid() const { return QUuid::createUuid().toString(); } void FanfouKit::vibrationDevice(qreal intensity, int duration) { ensureVibraRumble(); m_rumble->setIntensity(intensity); m_rumble->setDuration(duration); m_rumble->start(); } QString FanfouKit::stringSimplified(const QString &string) const { return string.simplified(); } QByteArray FanfouKit::byteArrayJoin(const QByteArray &a1, const QByteArray &a2, const QByteArray &a3, const QByteArray &a4, const QByteArray &a5, const QByteArray &a6) const { return a1 + a2 + a3 + a4 + a5 + a6; } int FanfouKit::byteArraySize(const QByteArray &data) const { return data.size(); } QString FanfouKit::toPlainText(const QString &text) const { QTextDocument document; document.setHtml(text); return document.toPlainText(); } bool FanfouKit::saveImage(const QScriptValue object, const QString &toPath) const { if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object.toQObject())) { QImage image(item->implicitWidth(), item->implicitHeight(), QImage::Format_ARGB32_Premultiplied); QPainter p(&image); item->paint(&p, 0, 0); if (image.isNull()) { qWarning("FanfouKit::saveImage: Image data is null"); return false; } return image.save(toPath); } qWarning("FanfouKit::saveImage: Image object is null"); return false; } QString FanfouKit::picturesStorageLocation() const { return QDesktopServices::storageLocation(QDesktopServices::PicturesLocation); } QString FanfouKit::applicationVersion() const { return qApp->applicationVersion(); } QString FanfouKit::dateConvert(const QString &date, const QString &fromFormat, const QString &toFormat) const { return QDate::fromString(date, fromFormat).toString(toFormat); } QString FanfouKit::qmlRootPath() const { return QML_ROOT_PATH; } void FanfouKit::clearAppConfig() const { m_settings->clear(); m_settings->sync(); } bool FanfouKit::isZhihu() const { return qApp->arguments().value(1) == "--zhihu"; } QByteArray FanfouKit::generateXAuthorizationHeader(const QString &username, const QString &password) { QUrl url(ACCESS_TOKEN_URL); url.addEncodedQueryItem("x_auth_username", username.toUtf8().toPercentEncoding()); url.addEncodedQueryItem("x_auth_password", password.toUtf8().toPercentEncoding()); url.addQueryItem("x_auth_mode", "client_auth"); QByteArray oauthHeader = OAuth::generateAuthorizationHeader(url, OAuth::POST); const QList<QPair<QByteArray, QByteArray> > urlItems = url.encodedQueryItems(); for (int i = 0; i < urlItems.count(); ++i) { const QPair<QByteArray, QByteArray> &item = urlItems.at(i); oauthHeader.append("," + item.first + "=\"" + item.second + "\""); } return oauthHeader; } void FanfouKit::requestAccessToken(const QString &username, const QString &password) { QNetworkRequest request; request.setUrl(QUrl(ACCESS_TOKEN_URL)); request.setRawHeader("Authorization", generateXAuthorizationHeader(username, password)); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); QNetworkReply *reply = m_accessManager->post(request, QByteArray()); connect(reply, SIGNAL(finished()), this, SLOT(onRequestAccessToken())); } QString FanfouKit::stringEncrypt(const QString &content, QString key) { if (content.isEmpty() || key.isEmpty()) return content; key = QString::fromUtf8(QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Md5)); QString request; for (int i = 0; i < content.count(); ++i) { request.append(QChar(content.at(i).unicode() ^ key.at(i % key.size()).unicode())); } return request; } QString FanfouKit::stringUncrypt(const QString &content, QString key) { return stringEncrypt(content, key); } void FanfouKit::onRequestAccessToken() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); if (!reply) return; const QByteArray &data = reply->readAll(); /// network error if (reply->error() != QNetworkReply::NoError) { /// login failed if (data.contains("<error>")) { QString error = QString::fromUtf8(data); QRegExp regExp("<error>(.+)</error>", Qt::CaseInsensitive, QRegExp::RegExp2); if (regExp.indexIn(error) >= 0) { emit requestAccessTokenError(regExp.cap(1)); } else { emit requestAccessTokenError(regExp.errorString() + "\n" + error); } } else { emit requestAccessTokenError(reply->errorString()); } return; } const QList<QByteArray> &data_list = data.split('&'); if (data_list.count() < 2) { emit requestAccessTokenError("Parse reply data error, data: " + QString::fromUtf8(data)); return; } const QList<QByteArray> &token_list = data_list.first().split('='); const QList<QByteArray> &secret_list = data_list.last().split('='); if (token_list.count() < 2 || secret_list.count() < 2) { emit requestAccessTokenError("Parse reply data error, data: " + QString::fromUtf8(data)); return; } if (token_list.first().contains("secret")) { setOAuthToken(secret_list.last()); setOAuthTokenSecret(token_list.last()); } else { setOAuthToken(token_list.last()); setOAuthTokenSecret(secret_list.last()); } emit requestAccessTokenFinished(); } void FanfouKit::onGetSplashLateshFinished() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); if (!reply) return; const QList<QByteArray> dataList = reply->readAll().split(','); if (dataList.count() < 2) return; const QString splashPath = SPLASH_PATH; QByteArray splashFileName = dataList.last().split('"').at(3); if (!splashFileName.isEmpty()) { if (!QFile::exists(splashPath + splashFileName)) { QNetworkRequest request; request.setUrl(QUrl(SPLASH_URL + splashFileName)); QNetworkReply *reply = m_accessManager->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onGetSplashImageFinished())); } } } void FanfouKit::onGetSplashImageFinished() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); if (!reply) return; const QString &splashPath = SPLASH_PATH; QFile file(splashPath + QFileInfo(reply->url().path()).fileName()); if (!QDir().mkpath(QFileInfo(file.fileName()).absolutePath())) return; if (file.open(QIODevice::WriteOnly)) { file.write(reply->readAll()); file.close(); } } void FanfouKit::ensureVibraRumble() { if (m_rumble) return; m_rumble = new QTM_NAMESPACE::QFeedbackHapticsEffect(this); foreach (QTM_NAMESPACE::QFeedbackActuator *actuator, QTM_NAMESPACE::QFeedbackActuator::actuators()) { if (actuator->name() == "Vibra") { m_rumble->setActuator(actuator); break; } } } void FanfouKit::updateSplash() { QNetworkRequest request; request.setUrl(QUrl(SPLASH_URL + QLatin1String("latest"))); QNetworkReply *reply = m_accessManager->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onGetSplashLateshFinished())); int today = QDate::currentDate().toString("yyyyMMdd").toInt(); QDir splashDir(SPLASH_PATH); //clear old splash foreach (const QString &fileName, splashDir.entryList(QStringList() << "*.jpg", QDir::Files, QDir::Name)) { if (fileName.size() != 12) continue; bool ok = false; int file_date = fileName.left(8).toInt(&ok); if (ok && file_date < today) { splashDir.remove(fileName); } } }
26.896552
138
0.67674
zccrs
380eccdba101fe67405e699d92383e990c266bd8
29,808
cc
C++
src/ui/scenic/lib/scheduling/default_frame_scheduler.cc
casey/fuchsia
2b965e9a1e8f2ea346db540f3611a5be16bb4d6b
[ "BSD-3-Clause" ]
null
null
null
src/ui/scenic/lib/scheduling/default_frame_scheduler.cc
casey/fuchsia
2b965e9a1e8f2ea346db540f3611a5be16bb4d6b
[ "BSD-3-Clause" ]
null
null
null
src/ui/scenic/lib/scheduling/default_frame_scheduler.cc
casey/fuchsia
2b965e9a1e8f2ea346db540f3611a5be16bb4d6b
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/ui/scenic/lib/scheduling/default_frame_scheduler.h" #include <lib/async/cpp/task.h> #include <lib/async/default.h> #include <lib/async/time.h> #include <zircon/syscalls.h> #include <functional> #include <trace/event.h> #include "src/lib/fxl/logging.h" #include "src/ui/scenic/lib/scheduling/frame_timings.h" namespace { template <class T> static void RemoveSessionIdFromMap(scheduling::SessionId session_id, std::map<scheduling::SchedulingIdPair, T>* map) { auto start = map->lower_bound({session_id, 0}); auto end = map->lower_bound({session_id + 1, 0}); map->erase(start, end); } } // namespace namespace scheduling { DefaultFrameScheduler::DefaultFrameScheduler(std::shared_ptr<const VsyncTiming> vsync_timing, std::unique_ptr<FramePredictor> predictor, inspect::Node inspect_node, std::unique_ptr<cobalt::CobaltLogger> cobalt_logger) : dispatcher_(async_get_default_dispatcher()), vsync_timing_(vsync_timing), frame_predictor_(std::move(predictor)), inspect_node_(std::move(inspect_node)), stats_(inspect_node_.CreateChild("Frame Stats"), std::move(cobalt_logger)), weak_factory_(this) { FXL_DCHECK(vsync_timing_); FXL_DCHECK(frame_predictor_); outstanding_frames_.reserve(kMaxOutstandingFrames); inspect_frame_number_ = inspect_node_.CreateUint("most_recent_frame_number", frame_number_); inspect_last_successful_update_start_time_ = inspect_node_.CreateUint("inspect_last_successful_update_start_time_", 0); inspect_last_successful_render_start_time_ = inspect_node_.CreateUint("inspect_last_successful_render_start_time_", 0); } DefaultFrameScheduler::~DefaultFrameScheduler() {} void DefaultFrameScheduler::SetFrameRenderer(fxl::WeakPtr<FrameRenderer> frame_renderer) { FXL_DCHECK(!frame_renderer_ && frame_renderer); frame_renderer_ = frame_renderer; } void DefaultFrameScheduler::AddSessionUpdater(fxl::WeakPtr<SessionUpdater> session_updater) { FXL_DCHECK(session_updater); new_session_updaters_.push_back(std::move(session_updater)); } void DefaultFrameScheduler::OnFrameRendered(const FrameTimings& timings) { TRACE_INSTANT("gfx", "DefaultFrameScheduler::OnFrameRendered", TRACE_SCOPE_PROCESS, "Timestamp", timings.GetTimestamps().render_done_time.get(), "frame_number", timings.frame_number()); release_fence_signaller_.SignalFencesUpToAndIncluding(timings.frame_number()); auto current_timestamps = timings.GetTimestamps(); if (current_timestamps.render_done_time == FrameTimings::kTimeDropped) { return; } zx::duration duration = current_timestamps.render_done_time - current_timestamps.render_start_time; FXL_DCHECK(duration.get() > 0); frame_predictor_->ReportRenderDuration(zx::duration(duration)); } void DefaultFrameScheduler::SetRenderContinuously(bool render_continuously) { render_continuously_ = render_continuously; if (render_continuously_) { RequestFrame(zx::time(0)); } } PresentId DefaultFrameScheduler::RegisterPresent( SessionId session_id, std::variant<OnPresentedCallback, Present2Info> present_information, std::vector<zx::event> release_fences, PresentId present_id) { present_id = present_id == 0 ? scheduling::GetNextPresentId() : present_id; SchedulingIdPair id_pair{session_id, present_id}; if (auto present1_callback = std::get_if<OnPresentedCallback>(&present_information)) { present1_callbacks_.emplace(id_pair, std::move(*present1_callback)); } else { auto present2_info = std::get_if<Present2Info>(&present_information); FXL_DCHECK(present2_info); present2_infos_.emplace(id_pair, std::move(*present2_info)); } FXL_DCHECK(release_fences_.find(id_pair) == release_fences_.end()); release_fences_.emplace(id_pair, std::move(release_fences)); return present_id; } std::pair<zx::time, zx::time> DefaultFrameScheduler::ComputePresentationAndWakeupTimesForTargetTime( const zx::time requested_presentation_time) const { const zx::time last_vsync_time = vsync_timing_->last_vsync_time(); const zx::duration vsync_interval = vsync_timing_->vsync_interval(); const zx::time now = zx::time(async_now(dispatcher_)); PredictedTimes times = frame_predictor_->GetPrediction({.now = now, .requested_presentation_time = requested_presentation_time, .last_vsync_time = last_vsync_time, .vsync_interval = vsync_interval}); return std::make_pair(times.presentation_time, times.latch_point_time); } void DefaultFrameScheduler::RequestFrame(zx::time requested_presentation_time) { FXL_DCHECK(HaveUpdatableSessions() || render_continuously_ || render_pending_); // Output requested presentation time in milliseconds. // Logging the first few frames to find common startup bugs. if (frame_number_ < 3) { FXL_VLOG(1) << "RequestFrame"; } auto next_times = ComputePresentationAndWakeupTimesForTargetTime(requested_presentation_time); auto new_target_presentation_time = next_times.first; auto new_wakeup_time = next_times.second; TRACE_DURATION("gfx", "DefaultFrameScheduler::RequestFrame", "requested presentation time", requested_presentation_time.get() / 1'000'000, "target_presentation_time", new_target_presentation_time.get() / 1'000'000); uint64_t trace_id = SESSION_TRACE_ID(request_to_render_count_, new_wakeup_time.get()); render_wakeup_map_.insert({new_wakeup_time, trace_id}); ++request_to_render_count_; TRACE_FLOW_BEGIN("gfx", "request_to_render", trace_id); // If there is no render waiting we should schedule a frame. Likewise, if newly predicted wake up // time is earlier than the current one then we need to reschedule the next wake-up. if (!frame_render_task_.is_pending() || new_wakeup_time < wakeup_time_) { frame_render_task_.Cancel(); wakeup_time_ = new_wakeup_time; next_target_presentation_time_ = new_target_presentation_time; frame_render_task_.PostForTime(dispatcher_, zx::time(wakeup_time_)); } } void DefaultFrameScheduler::HandleNextFrameRequest() { if (!pending_present_requests_.empty()) { auto min_it = std::min_element(pending_present_requests_.begin(), pending_present_requests_.end(), [](const auto& left, const auto& right) { const auto leftPresentationTime = left.second; const auto rightPresentationTime = right.second; return leftPresentationTime < rightPresentationTime; }); RequestFrame(zx::time(min_it->second)); } } void DefaultFrameScheduler::MaybeRenderFrame(async_dispatcher_t*, async::TaskBase*, zx_status_t) { FXL_DCHECK(frame_renderer_); const uint64_t frame_number = frame_number_; { // Trace event to track the delta between the targeted wakeup_time_ and the actual wakeup time. // It is used to detect delays (i.e. if this thread is blocked on the cpu). The intended // wakeup_time_ is used to track the canonical "start" of this frame at various points during // the frame's execution. const zx::duration wakeup_delta = zx::time(async_now(dispatcher_)) - wakeup_time_; TRACE_COUNTER("gfx", "Wakeup Time Delta", /* counter_id */ 0, "delta", wakeup_delta.get()); } const auto target_presentation_time = next_target_presentation_time_; TRACE_DURATION("gfx", "FrameScheduler::MaybeRenderFrame", "target_presentation_time", target_presentation_time.get() / 1'000'000); // Logging the first few frames to find common startup bugs. if (frame_number < 3) { FXL_VLOG(1) << "MaybeRenderFrame target_presentation_time=" << target_presentation_time.get() << " wakeup_time=" << wakeup_time_.get() << " frame_number=" << frame_number; } // Apply all updates const zx::time update_start_time = zx::time(async_now(dispatcher_)); // The second value, |wakeup_time_|, here is important for ensuring our flows stay connected. // If you change it please ensure the "request_to_render" flow stays connected. bool needs_render = ApplyUpdates(target_presentation_time, wakeup_time_, frame_number); if (needs_render) { inspect_last_successful_update_start_time_.Set(update_start_time.get()); } // TODO(SCN-1482) Revisit how we do this. const zx::time update_end_time = zx::time(async_now(dispatcher_)); frame_predictor_->ReportUpdateDuration(zx::duration(update_end_time - update_start_time)); if (!needs_render && !render_pending_ && !render_continuously_) { // Nothing to render. Continue with next request in the queue. HandleNextFrameRequest(); return; } // TODO(SCN-1337) Remove the render_pending_ check, and pipeline frames within a VSYNC interval. if (currently_rendering_) { render_pending_ = true; return; } FXL_DCHECK(outstanding_frames_.size() < kMaxOutstandingFrames); // Logging the first few frames to find common startup bugs. if (frame_number < 3) { FXL_LOG(INFO) << "Calling RenderFrame target_presentation_time=" << target_presentation_time.get() << " frame_number=" << frame_number; } TRACE_INSTANT("gfx", "Render start", TRACE_SCOPE_PROCESS, "Expected presentation time", target_presentation_time.get(), "frame_number", frame_number); const zx::time frame_render_start_time = zx::time(async_now(dispatcher_)); // Ratchet the Present callbacks to signal that all outstanding Present() calls until this point // are applied to the next Scenic frame. std::for_each(session_updaters_.begin(), session_updaters_.end(), [frame_number](fxl::WeakPtr<SessionUpdater> updater) { if (updater) { updater->PrepareFrame(frame_number); } }); // Create a FrameTimings instance for this frame to track the render and presentation times. auto timings_rendered_callback = [weak = weak_factory_.GetWeakPtr()](const FrameTimings& timings) { if (weak) { weak->OnFrameRendered(timings); } else { FXL_LOG(ERROR) << "Error, cannot record render time: FrameScheduler does not exist"; } }; ++frame_render_trace_id_; TRACE_FLOW_BEGIN("gfx", "render_to_presented", frame_render_trace_id_); auto timings_presented_callback = [weak = weak_factory_.GetWeakPtr(), trace_id = frame_render_trace_id_](const FrameTimings& timings) { TRACE_FLOW_END("gfx", "render_to_presented", trace_id); if (weak) { weak->OnFramePresented(timings); } else { FXL_LOG(ERROR) << "Error, cannot record presentation time: FrameScheduler does not exist"; } }; auto frame_timings = std::make_unique<FrameTimings>( frame_number, target_presentation_time, wakeup_time_, frame_render_start_time, std::move(timings_rendered_callback), std::move(timings_presented_callback)); // TODO(SCN-1482) Revisit how we do this. frame_timings->OnFrameUpdated(update_end_time); inspect_frame_number_.Set(frame_number); // Render the frame. auto render_frame_result = frame_renderer_->RenderFrame(frame_timings->GetWeakPtr(), target_presentation_time); currently_rendering_ = render_frame_result == kRenderSuccess; // See SCN-1505 for details of measuring render time. const zx::time frame_render_end_cpu_time = zx::time(async_now(dispatcher_)); frame_timings->OnFrameCpuRendered(frame_render_end_cpu_time); switch (render_frame_result) { case kRenderSuccess: currently_rendering_ = true; outstanding_frames_.push_back(std::move(frame_timings)); render_pending_ = false; inspect_last_successful_render_start_time_.Set(target_presentation_time.get()); break; case kRenderFailed: // TODO(SCN-1344): Handle failed rendering somehow. FXL_LOG(WARNING) << "RenderFrame failed. " << "There may not be any calls to OnFrameRendered or OnFramePresented, and " "no callbacks may be invoked."; break; case kNoContentToRender: // Immediately invoke presentation callbacks. FXL_DCHECK(!frame_timings->finalized()); outstanding_frames_.push_back(std::move(frame_timings)); outstanding_frames_.back()->OnFrameSkipped(); break; } ++frame_number_; // Schedule next frame if any unhandled presents are left. HandleNextFrameRequest(); } void DefaultFrameScheduler::ScheduleUpdateForSession(zx::time requested_presentation_time, SchedulingIdPair id_pair) { TRACE_DURATION("gfx", "DefaultFrameScheduler::ScheduleUpdateForSession", "requested_presentation_time", requested_presentation_time.get() / 1'000'000); // Logging the first few frames to find common startup bugs. if (frame_number_ < 3) { FXL_VLOG(1) << "ScheduleUpdateForSession session_id: " << id_pair.session_id << " requested_presentation_time: " << requested_presentation_time.get(); } pending_present_requests_.emplace(id_pair, requested_presentation_time); RequestFrame(requested_presentation_time); } void DefaultFrameScheduler::GetFuturePresentationInfos( zx::duration requested_prediction_span, FrameScheduler::GetFuturePresentationInfosCallback presentation_infos_callback) { std::vector<fuchsia::scenic::scheduling::PresentationInfo> infos; PredictionRequest request; request.now = zx::time(async_now(dispatcher_)); request.last_vsync_time = vsync_timing_->last_vsync_time(); // We assume this value is constant, at least for the near future. request.vsync_interval = vsync_timing_->vsync_interval(); constexpr static const uint64_t kMaxPredictionCount = 8; uint64_t count = 0; zx::time prediction_limit = request.now + requested_prediction_span; while (request.now <= prediction_limit && count < kMaxPredictionCount) { // We ask for a "0 time" in order to give us the next possible presentation time. It also fits // the Present() pattern most Scenic clients currently use. request.requested_presentation_time = zx::time(0); PredictedTimes times = frame_predictor_->GetPrediction(request); fuchsia::scenic::scheduling::PresentationInfo info = fuchsia::scenic::scheduling::PresentationInfo(); info.set_latch_point(times.latch_point_time.get()); info.set_presentation_time(times.presentation_time.get()); infos.push_back(std::move(info)); // The new now time is one tick after the returned latch point. This ensures uniqueness in the // results we give to the client since we know we cannot schedule a frame for a latch point in // the past. // // We also guarantee loop termination by the same token. Latch points are monotonically // increasing, which means so is |request.now| so it will eventually reach prediction_limit. request.now = times.latch_point_time + zx::duration(1); // last_vsync_time should be the greatest value less than request.now where a vsync // occurred. We can calculate this inductively by adding vsync_intervals to last_vsync_time. // Therefore what we add to last_vsync_time is the difference between now and // last_vsync_time, integer divided by vsync_interval, then multipled by vsync_interval. // // Because now' is the latch_point, and latch points are monotonically increasing, we guarantee // that |difference| and therefore last_vsync_time is also monotonically increasing. zx::duration difference = request.now - request.last_vsync_time; uint64_t num_intervals = difference / request.vsync_interval; request.last_vsync_time += request.vsync_interval * num_intervals; ++count; } ZX_DEBUG_ASSERT(infos.size() >= 1); presentation_infos_callback(std::move(infos)); } void DefaultFrameScheduler::OnFramePresented(const FrameTimings& timings) { const uint64_t frame_number = timings.frame_number(); if (frame_number_ < 3) { FXL_LOG(INFO) << "DefaultFrameScheduler::OnFramePresented" << " frame_number=" << frame_number; } FXL_DCHECK(!outstanding_frames_.empty()); // TODO(SCN-400): how should we handle this case? It is theoretically possible, but if it // happens then it means that the EventTimestamper is receiving signals out-of-order and is // therefore generating bogus data. FXL_DCHECK(outstanding_frames_[0].get() == &timings) << "out-of-order."; FXL_DCHECK(timings.finalized()); const FrameTimings::Timestamps timestamps = timings.GetTimestamps(); stats_.RecordFrame(timestamps, vsync_timing_->vsync_interval()); if (timings.FrameWasDropped()) { TRACE_INSTANT("gfx", "FrameDropped", TRACE_SCOPE_PROCESS, "frame_number", frame_number); } else if (timings.FrameWasSkipped()) { TRACE_INSTANT("gfx", "FrameDropped", TRACE_SCOPE_PROCESS, "frame_number", frame_number); auto presentation_info = fuchsia::images::PresentationInfo(); presentation_info.presentation_time = timestamps.actual_presentation_time.get(); presentation_info.presentation_interval = vsync_timing_->vsync_interval().get(); SignalPresentCallbacksUpTo(frame_number, presentation_info); } else { if (TRACE_CATEGORY_ENABLED("gfx")) { // Log trace data.. zx::duration target_vs_actual = timestamps.actual_presentation_time - timestamps.target_presentation_time; zx::time now = zx::time(async_now(dispatcher_)); zx::duration elapsed_since_presentation = now - timestamps.actual_presentation_time; FXL_DCHECK(elapsed_since_presentation.get() >= 0); TRACE_INSTANT("gfx", "FramePresented", TRACE_SCOPE_PROCESS, "frame_number", frame_number, "presentation time", timestamps.actual_presentation_time.get(), "target time missed by", target_vs_actual.get(), "elapsed time since presentation", elapsed_since_presentation.get()); } auto presentation_info = fuchsia::images::PresentationInfo(); presentation_info.presentation_time = timestamps.actual_presentation_time.get(); presentation_info.presentation_interval = vsync_timing_->vsync_interval().get(); SignalPresentCallbacksUpTo(frame_number, presentation_info); } // Pop the front Frame off the queue. for (size_t i = 1; i < outstanding_frames_.size(); ++i) { outstanding_frames_[i - 1] = std::move(outstanding_frames_[i]); } outstanding_frames_.resize(outstanding_frames_.size() - 1); currently_rendering_ = false; if (render_continuously_ || render_pending_) { RequestFrame(zx::time(0)); } } void DefaultFrameScheduler::RemoveSession(SessionId session_id) { update_failed_callback_map_.erase(session_id); present2_callback_map_.erase(session_id); RemoveSessionIdFromMap(session_id, &pending_present_requests_); RemoveSessionIdFromMap(session_id, &present1_callbacks_); RemoveSessionIdFromMap(session_id, &present2_infos_); RemoveSessionIdFromMap(session_id, &release_fences_); } std::unordered_map<SessionId, PresentId> DefaultFrameScheduler::CollectUpdatesForThisFrame( zx::time target_presentation_time) { std::unordered_map<SessionId, PresentId> updates; SessionId current_session = 0; bool hit_limit = false; auto it = pending_present_requests_.begin(); while (it != pending_present_requests_.end()) { auto& [id_pair, requested_presentation_time] = *it; if (current_session != id_pair.session_id) { current_session = id_pair.session_id; hit_limit = false; } if (!hit_limit && requested_presentation_time <= target_presentation_time) { // Return only the last relevant present id for each session. updates[current_session] = id_pair.present_id; it = pending_present_requests_.erase(it); } else { hit_limit = true; ++it; } } return updates; } void DefaultFrameScheduler::PrepareUpdates(const std::unordered_map<SessionId, PresentId>& updates, zx::time latched_time, uint64_t frame_number) { handled_updates_.push({.frame_number = frame_number, .updated_sessions = updates}); for (const auto [session_id, present_id] : updates) { SetLatchedTimeForPresent2Infos({session_id, present_id}, latched_time); MoveReleaseFencesToSignaller({session_id, present_id}, frame_number); } } SessionUpdater::UpdateResults DefaultFrameScheduler::ApplyUpdatesToEachUpdater( const std::unordered_map<SessionId, PresentId>& sessions_to_update, uint64_t frame_number) { std::move(new_session_updaters_.begin(), new_session_updaters_.end(), std::back_inserter(session_updaters_)); new_session_updaters_.clear(); // Clear any stale SessionUpdaters. session_updaters_.erase( std::remove_if(session_updaters_.begin(), session_updaters_.end(), std::logical_not()), session_updaters_.end()); // Apply updates to each SessionUpdater. SessionUpdater::UpdateResults update_results; std::for_each( session_updaters_.begin(), session_updaters_.end(), [&sessions_to_update, &update_results, frame_number](fxl::WeakPtr<SessionUpdater> updater) { // We still need to check for dead updaters since more could die inside UpdateSessions. if (!updater) { return; } auto session_results = updater->UpdateSessions(sessions_to_update, frame_number); // Aggregate results from each updater. // Note: Currently, only one SessionUpdater handles each SessionId. If this // changes, then a SessionId corresponding to a failed update should not be passed // to subsequent SessionUpdaters. update_results.sessions_with_failed_updates.insert( session_results.sessions_with_failed_updates.begin(), session_results.sessions_with_failed_updates.end()); session_results.sessions_with_failed_updates.clear(); }); return update_results; } void DefaultFrameScheduler::SetLatchedTimeForPresent2Infos(SchedulingIdPair id_pair, zx::time latched_time) { const auto begin_it = present2_infos_.lower_bound({id_pair.session_id, 0}); const auto end_it = present2_infos_.upper_bound(id_pair); std::for_each(begin_it, end_it, [latched_time](std::pair<const SchedulingIdPair, Present2Info>& present2_info) { // Update latched time for Present2Infos that haven't already been latched on // previous frames. if (!present2_info.second.HasLatchedTime()) present2_info.second.SetLatchedTime(latched_time); }); } void DefaultFrameScheduler::MoveReleaseFencesToSignaller(SchedulingIdPair id_pair, uint64_t frame_number) { const auto begin_it = release_fences_.lower_bound({id_pair.session_id, 0}); const auto end_it = release_fences_.lower_bound(id_pair); FXL_DCHECK(std::distance(begin_it, end_it) >= 0); std::for_each( begin_it, end_it, [this, frame_number](std::pair<const SchedulingIdPair, std::vector<zx::event>>& release_fences) { release_fence_signaller_.AddFences(std::move(release_fences.second), frame_number); }); release_fences_.erase(begin_it, end_it); } bool DefaultFrameScheduler::ApplyUpdates(zx::time target_presentation_time, zx::time latched_time, uint64_t frame_number) { FXL_DCHECK(latched_time <= target_presentation_time); // Logging the first few frames to find common startup bugs. if (frame_number < 3) { FXL_VLOG(1) << "ApplyScheduledSessionUpdates target_presentation_time=" << target_presentation_time.get() << " frame_number=" << frame_number; } // NOTE: this name is used by scenic_processing_helpers.go TRACE_DURATION("gfx", "ApplyScheduledSessionUpdates", "target_presentation_time", target_presentation_time.get() / 1'000'000, "frame_number", frame_number); auto it = render_wakeup_map_.begin(); while (it != render_wakeup_map_.end() && it->first <= latched_time) { TRACE_FLOW_END("gfx", "request_to_render", it->second); ++it; } render_wakeup_map_.erase(render_wakeup_map_.begin(), it); TRACE_FLOW_BEGIN("gfx", "scenic_frame", frame_number); const auto update_map = CollectUpdatesForThisFrame(target_presentation_time); const bool have_updates = !update_map.empty(); if (have_updates) { PrepareUpdates(update_map, latched_time, frame_number); const auto update_results = ApplyUpdatesToEachUpdater(update_map, frame_number); RemoveFailedSessions(update_results.sessions_with_failed_updates); } // If anything was updated, we need to render. return have_updates; } void DefaultFrameScheduler::RemoveFailedSessions( const std::unordered_set<SessionId>& sessions_with_failed_updates) { // Aggregate all failed session callbacks, and remove failed sessions from all present callback // maps. std::vector<OnSessionUpdateFailedCallback> failure_callbacks; for (auto failed_session_id : sessions_with_failed_updates) { auto it = update_failed_callback_map_.find(failed_session_id); FXL_DCHECK(it != update_failed_callback_map_.end()); failure_callbacks.emplace_back(std::move(it->second)); // Remove the callback from the global map so they are not called after this failure callback is // triggered. RemoveSession(failed_session_id); } // Process all update failed callbacks. for (auto& callback : failure_callbacks) { callback(); } } // Handle any Present1 and |fuchsia::images::ImagePipe::PresentImage| callbacks. void DefaultFrameScheduler::SignalPresent1CallbacksUpTo( SchedulingIdPair id_pair, fuchsia::images::PresentationInfo presentation_info) { auto begin_it = present1_callbacks_.lower_bound({id_pair.session_id, 0}); auto end_it = present1_callbacks_.upper_bound(id_pair); FXL_DCHECK(std::distance(begin_it, end_it) >= 0); if (begin_it != end_it) { std::for_each( begin_it, end_it, [presentation_info](std::pair<const SchedulingIdPair, OnPresentedCallback>& pair) { // TODO(SCN-1346): Make this unique per session via id(). TRACE_FLOW_BEGIN("gfx", "present_callback", presentation_info.presentation_time); auto& callback = pair.second; callback(presentation_info); }); present1_callbacks_.erase(begin_it, end_it); } } void DefaultFrameScheduler::SignalPresent2CallbackForInfosUpTo(SchedulingIdPair id_pair, zx::time presented_time) { // Coalesces all Present2 updates and calls the callback once. auto begin_it = present2_infos_.lower_bound({id_pair.session_id, 0}); auto end_it = present2_infos_.upper_bound(id_pair); FXL_DCHECK(std::distance(begin_it, end_it) >= 0); if (begin_it != end_it) { std::vector<Present2Info> present2_infos_for_session; std::for_each( begin_it, end_it, [&present2_infos_for_session](std::pair<const SchedulingIdPair, Present2Info>& pair) { present2_infos_for_session.emplace_back(std::move(pair.second)); }); present2_infos_.erase(begin_it, end_it); // TODO(SCN-1346): Make this unique per session via id(). TRACE_FLOW_BEGIN("gfx", "present_callback", presented_time.get()); fuchsia::scenic::scheduling::FramePresentedInfo frame_presented_info = Present2Info::CoalescePresent2Infos(std::move(present2_infos_for_session), presented_time); FXL_DCHECK(present2_callback_map_.find(id_pair.session_id) != present2_callback_map_.end()); // Invoke the Session's OnFramePresented event. present2_callback_map_[id_pair.session_id](std::move(frame_presented_info)); } } void DefaultFrameScheduler::SignalPresentCallbacksUpTo( uint64_t frame_number, fuchsia::images::PresentationInfo presentation_info) { // Get last present_id up to |frame_number| for each session. std::unordered_map<SessionId, PresentId> last_updates; while (!handled_updates_.empty() && handled_updates_.front().frame_number <= frame_number) { for (auto [session_id, present_id] : handled_updates_.front().updated_sessions) { last_updates[session_id] = present_id; } handled_updates_.pop(); } for (auto [session_id, present_id] : last_updates) { SignalPresent1CallbacksUpTo({session_id, present_id}, presentation_info); SignalPresent2CallbackForInfosUpTo({session_id, present_id}, zx::time(presentation_info.presentation_time)); } } void DefaultFrameScheduler::SetOnUpdateFailedCallbackForSession( SessionId session_id, FrameScheduler::OnSessionUpdateFailedCallback update_failed_callback) { FXL_DCHECK(update_failed_callback_map_.find(session_id) == update_failed_callback_map_.end()); update_failed_callback_map_[session_id] = std::move(update_failed_callback); } void DefaultFrameScheduler::SetOnFramePresentedCallbackForSession( SessionId session_id, OnFramePresentedCallback frame_presented_callback) { FXL_DCHECK(present2_callback_map_.find(session_id) == present2_callback_map_.end()); present2_callback_map_[session_id] = std::move(frame_presented_callback); } } // namespace scheduling
43.388646
100
0.722658
casey
3811123b088cedfb7686765d09479455f4481b99
300
hpp
C++
includes/monster/UnsightedMonster.hpp
AndrewLester/final-project-cyborgwizards
1b6abfb759e2dda0ea368a6798cae5b354c5bb75
[ "Unlicense" ]
null
null
null
includes/monster/UnsightedMonster.hpp
AndrewLester/final-project-cyborgwizards
1b6abfb759e2dda0ea368a6798cae5b354c5bb75
[ "Unlicense" ]
null
null
null
includes/monster/UnsightedMonster.hpp
AndrewLester/final-project-cyborgwizards
1b6abfb759e2dda0ea368a6798cae5b354c5bb75
[ "Unlicense" ]
null
null
null
#ifndef UNSIGHTED_MONSTER_HPP #define UNSIGHTED_MONSTER_HPP #include "Monster.hpp" class UnsightedMonster : public Monster { private: int prev_intensity_ = 0; public: UnsightedMonster(LevelPos pos); void Draw(ScreenPos top_left) override; void OnNotify(Event* event) override; }; #endif
18.75
41
0.773333
AndrewLester
38180331ac38a2f7aff94f68a5a61007e56a9b22
897
cpp
C++
Utils/FieldOfViewChecker.cpp
L0rd1k/VisualKIT
d4ffb399cb69fe926fb093846b94fd02ac0826f2
[ "MIT" ]
10
2020-03-03T14:29:41.000Z
2022-03-26T15:40:31.000Z
Utils/FieldOfViewChecker.cpp
L0rd1k/VisualKIT
d4ffb399cb69fe926fb093846b94fd02ac0826f2
[ "MIT" ]
null
null
null
Utils/FieldOfViewChecker.cpp
L0rd1k/VisualKIT
d4ffb399cb69fe926fb093846b94fd02ac0826f2
[ "MIT" ]
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: FieldOfViewChecker.cpp * Author: ilya * * Created on November 19, 2019, 12:49 PM */ #include "FieldOfViewChecker.h" FieldOfViewChecker::FieldOfViewChecker(Mat matrixIntrinsics) : _m(matrixIntrinsics) { } double FieldOfViewChecker::getFov(int resolution, FovAxis axis) { int axisId = (int) axis; double focal_distance = _m.at<double>(axisId, axisId); return 2 * atan(resolution / (2 * focal_distance)) * (180.0 / CV_PI); } double FieldOfViewChecker::getResolution(double fov, FovAxis axis) { int axisId = (int) axis; double fov_rad = fov * CV_PI / 180; return 2 * _m.at<double>(axisId, axisId) * tan(fov_rad / 2); } FieldOfViewChecker::~FieldOfViewChecker() { }
25.628571
79
0.702341
L0rd1k
381bac2c9c576f9a9fe5e4bff6a9e3210940bccb
6,624
cc
C++
ndash/src/manifest_fetcher.cc
google/ndash
1465e2fb851ee17fd235280bdbbbf256e5af8044
[ "Apache-2.0" ]
41
2017-04-19T19:38:10.000Z
2021-09-07T02:40:27.000Z
ndash/src/manifest_fetcher.cc
google/ndash
1465e2fb851ee17fd235280bdbbbf256e5af8044
[ "Apache-2.0" ]
8
2017-04-21T16:40:09.000Z
2019-12-09T19:48:40.000Z
ndash/src/manifest_fetcher.cc
google/ndash
1465e2fb851ee17fd235280bdbbbf256e5af8044
[ "Apache-2.0" ]
19
2017-04-24T14:43:18.000Z
2022-03-17T19:13:45.000Z
/* * Copyright 2017 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "manifest_fetcher.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "upstream/constants.h" #include "upstream/curl_data_source.h" #include "upstream/data_spec.h" namespace ndash { constexpr size_t kBufSize = 8192; ManifestLoadable::ManifestLoadable(const std::string& manifest_uri) : manifest_uri_(manifest_uri) { load_buffer_ = std::unique_ptr<char[]>(new char[kBufSize + 1]); } ManifestLoadable::~ManifestLoadable() {} void ManifestLoadable::CancelLoad() { // Nothing to do. } bool ManifestLoadable::IsLoadCanceled() const { return false; } bool ManifestLoadable::Load() { upstream::Uri uri(manifest_uri_); upstream::DataSpec manifest_spec(uri); upstream::CurlDataSource data_source("manifest"); if (data_source.Open(manifest_spec) != upstream::RESULT_IO_ERROR) { ssize_t num_read; do { num_read = data_source.Read(load_buffer_.get(), kBufSize - 1); if (num_read > 0) { load_buffer_[num_read] = '\0'; manifest_xml_.append(load_buffer_.get()); } } while (num_read != upstream::RESULT_END_OF_INPUT && num_read != upstream::RESULT_IO_ERROR); data_source.Close(); return true; } data_source.Close(); return false; } const std::string& ManifestLoadable::GetManifestUri() const { return manifest_uri_; } const std::string& ManifestLoadable::GetManifestXml() const { return manifest_xml_; } ManifestFetcher::ManifestFetcher(const std::string& manifest_uri, scoped_refptr<base::TaskRunner> task_runner, EventListenerInterface* event_listener) : loader_("manifest_loader"), manifest_uri_(manifest_uri), task_runner_(task_runner), event_listener_(event_listener), load_error_(NONE), load_error_count_(0) {} ManifestFetcher::~ManifestFetcher() {} void ManifestFetcher::UpdateManifestUri(const std::string& manifest_uri) { manifest_uri_ = manifest_uri; } const scoped_refptr<mpd::MediaPresentationDescription> ManifestFetcher::GetManifest() const { return manifest_; } base::TimeTicks ManifestFetcher::GetManifestLoadStartTimestamp() const { return manifest_load_start_timestamp_; } base::TimeTicks ManifestFetcher::GetManifestLoadCompleteTimestamp() const { return manifest_load_complete_timestamp_; } bool ManifestFetcher::RequestRefresh() { base::TimeTicks now = base::TimeTicks::Now(); if (load_error_ != NONE && now < load_error_timestamp_ + base::TimeDelta::FromMilliseconds( GetRetryDelayMillis(load_error_count_))) { // The previous load failed, and it's too soon to try again. return false; } if (!loader_.IsLoading()) { // TODO(rmrossi): Consider re-using the loadable rather than creating one // with each request. current_loadable_ = std::unique_ptr<ManifestLoadable>(new ManifestLoadable(manifest_uri_)); current_load_start_timestamp_ = now; loader_.StartLoading( current_loadable_.get(), base::Bind(&ManifestFetcher::LoadComplete, base::Unretained(this))); NotifyManifestRefreshStarted(); } return true; } // Called by the thread that called StartLoading() void ManifestFetcher::LoadComplete(upstream::LoadableInterface* loadable, upstream::LoaderOutcome outcome) { if (current_loadable_.get() != loadable) { // Stale event. Ignore. return; } switch (outcome) { case upstream::LOAD_COMPLETE: ProcessLoadCompleted(); break; case upstream::LOAD_ERROR: ProcessLoadError(); break; case upstream::LOAD_CANCELED: // Nothing to do; break; } current_loadable_.reset(); } void ManifestFetcher::Enable() { if (enabled_count_++ == 0) { load_error_ = NONE; load_error_count_ = 0; } } void ManifestFetcher::Disable() { DCHECK_GT(enabled_count_, 0); if (--enabled_count_ == 0) { loader_.CancelLoading(); } } void ManifestFetcher::ProcessLoadCompleted() { const std::string& xml = current_loadable_->GetManifestXml(); base::TimeTicks now = base::TimeTicks::Now(); manifest_ = parser_.Parse(current_loadable_->GetManifestUri(), base::StringPiece(xml)); if (manifest_.get() != nullptr) { manifest_load_start_timestamp_ = current_load_start_timestamp_; manifest_load_complete_timestamp_ = now; load_error_ = NONE; load_error_count_ = 0; NotifyManifestRefreshed(); } else { // Turn this into an error. load_error_count_++; load_error_timestamp_ = now; load_error_ = PARSING_ERROR; NotifyManifestError(load_error_); } } void ManifestFetcher::ProcessLoadError() { base::TimeTicks now = base::TimeTicks::Now(); load_error_count_++; load_error_timestamp_ = now; load_error_ = UNKNOWN_ERROR; NotifyManifestError(load_error_); } // We allow fast retry after the first error but implement increasing back-off // thereafter. uint64_t ManifestFetcher::GetRetryDelayMillis(int error_count) const { // TODO(rmrossi): These values should be configurable. return std::min((error_count - 1) * 1000, 5000); } void ManifestFetcher::NotifyManifestRefreshStarted() { if (event_listener_ != nullptr) { task_runner_->PostTask( FROM_HERE, base::Bind(&EventListenerInterface::OnManifestRefreshStarted, base::Unretained(event_listener_))); } } void ManifestFetcher::NotifyManifestRefreshed() { if (event_listener_ != nullptr) { task_runner_->PostTask( FROM_HERE, base::Bind(&EventListenerInterface::OnManifestRefreshed, base::Unretained(event_listener_))); } } void ManifestFetcher::NotifyManifestError(ManifestFetchError error) { if (event_listener_ != nullptr) { task_runner_->PostTask( FROM_HERE, base::Bind(&EventListenerInterface::OnManifestError, base::Unretained(event_listener_), error)); } } } // namespace ndash
29.309735
80
0.69535
google
381ca0a284819d7abe03040d408e100620b3650a
5,235
cpp
C++
bcos-tars-protocol/protocol/BlockImpl.cpp
chuwen95/FISCO-BCOS
e9cc29151c90dd1f4634f4d52ba773bb216700ac
[ "Apache-2.0" ]
1
2022-03-06T10:46:12.000Z
2022-03-06T10:46:12.000Z
bcos-tars-protocol/protocol/BlockImpl.cpp
chuwen95/FISCO-BCOS
e9cc29151c90dd1f4634f4d52ba773bb216700ac
[ "Apache-2.0" ]
null
null
null
bcos-tars-protocol/protocol/BlockImpl.cpp
chuwen95/FISCO-BCOS
e9cc29151c90dd1f4634f4d52ba773bb216700ac
[ "Apache-2.0" ]
null
null
null
/** * Copyright (C) 2021 FISCO BCOS. * SPDX-License-Identifier: Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @brief implementation for Block * @file BlockImpl.cpp * @author: ancelmo * @date 2021-04-20 */ #include "BlockImpl.h" using namespace bcostars; using namespace bcostars::protocol; void BlockImpl::decode(bcos::bytesConstRef _data, bool, bool) { tars::TarsInputStream<tars::BufferReader> input; input.setBuffer((const char*)_data.data(), _data.size()); m_inner->readFrom(input); } void BlockImpl::encode(bcos::bytes& _encodeData) const { tars::TarsOutputStream<bcostars::protocol::BufferWriterByteVector> output; m_inner->writeTo(output); output.getByteBuffer().swap(_encodeData); } bcos::protocol::BlockHeader::Ptr BlockImpl::blockHeader() { bcos::ReadGuard l(x_blockHeader); return std::make_shared<bcostars::protocol::BlockHeaderImpl>( m_transactionFactory->cryptoSuite(), [inner = this->m_inner]() mutable { return &inner->blockHeader; }); } bcos::protocol::BlockHeader::ConstPtr BlockImpl::blockHeaderConst() const { bcos::ReadGuard l(x_blockHeader); return std::make_shared<const bcostars::protocol::BlockHeaderImpl>( m_transactionFactory->cryptoSuite(), [inner = this->m_inner]() { return &inner->blockHeader; }); } bcos::protocol::Transaction::ConstPtr BlockImpl::transaction(size_t _index) const { return std::make_shared<const bcostars::protocol::TransactionImpl>( m_transactionFactory->cryptoSuite(), [inner = m_inner, _index]() { return &(inner->transactions[_index]); }); } bcos::protocol::TransactionReceipt::ConstPtr BlockImpl::receipt(size_t _index) const { return std::make_shared<const bcostars::protocol::TransactionReceiptImpl>( m_transactionFactory->cryptoSuite(), [inner = m_inner, _index]() { return &(inner->receipts[_index]); }); } void BlockImpl::setBlockHeader(bcos::protocol::BlockHeader::Ptr _blockHeader) { if (_blockHeader) { bcos::WriteGuard l(x_blockHeader); m_inner->blockHeader = std::dynamic_pointer_cast<bcostars::protocol::BlockHeaderImpl>(_blockHeader)->inner(); } } void BlockImpl::setReceipt(size_t _index, bcos::protocol::TransactionReceipt::Ptr _receipt) { if (_index >= m_inner->receipts.size()) { m_inner->receipts.resize(m_inner->transactions.size()); } auto innerReceipt = std::dynamic_pointer_cast<bcostars::protocol::TransactionReceiptImpl>(_receipt)->inner(); m_inner->receipts[_index] = innerReceipt; } void BlockImpl::appendReceipt(bcos::protocol::TransactionReceipt::Ptr _receipt) { m_inner->receipts.emplace_back( std::dynamic_pointer_cast<bcostars::protocol::TransactionReceiptImpl>(_receipt)->inner()); } void BlockImpl::setNonceList(bcos::protocol::NonceList const& _nonceList) { m_inner->nonceList.clear(); m_inner->nonceList.reserve(_nonceList.size()); for (auto const& it : _nonceList) { m_inner->nonceList.emplace_back(boost::lexical_cast<std::string>(it)); } m_nonceList.clear(); } void BlockImpl::setNonceList(bcos::protocol::NonceList&& _nonceList) { m_inner->nonceList.clear(); m_inner->nonceList.reserve(_nonceList.size()); for (auto const& it : _nonceList) { m_inner->nonceList.emplace_back(boost::lexical_cast<std::string>(it)); } m_nonceList.clear(); } bcos::protocol::NonceList const& BlockImpl::nonceList() const { if (m_nonceList.empty()) { m_nonceList.reserve(m_inner->nonceList.size()); for (auto const& it : m_inner->nonceList) { if (it.empty()) { m_nonceList.push_back(bcos::protocol::NonceType(0)); } else { m_nonceList.push_back(boost::lexical_cast<bcos::u256>(it)); } } } return m_nonceList; } bcos::protocol::TransactionMetaData::ConstPtr BlockImpl::transactionMetaData(size_t _index) const { if (_index >= transactionsMetaDataSize()) { return nullptr; } auto txMetaData = std::make_shared<bcostars::protocol::TransactionMetaDataImpl>( [inner = m_inner, _index]() { return &inner->transactionsMetaData[_index]; }); return txMetaData; } void BlockImpl::appendTransactionMetaData(bcos::protocol::TransactionMetaData::Ptr _txMetaData) { auto txMetaDataImpl = std::dynamic_pointer_cast<bcostars::protocol::TransactionMetaDataImpl>(_txMetaData); m_inner->transactionsMetaData.emplace_back(txMetaDataImpl->inner()); } size_t BlockImpl::transactionsMetaDataSize() const { return m_inner->transactionsMetaData.size(); }
31.160714
98
0.693983
chuwen95
381d5fe3dbccae9629fe81ae99ef0d73e19b7317
332
cpp
C++
Libraries/RobsJuceModules/rosic/analysis/rosic_EnvelopeFollower.cpp
RobinSchmidt/RS-MET-Preliminary
6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe
[ "FTL" ]
34
2017-04-19T18:26:02.000Z
2022-02-15T17:47:26.000Z
Libraries/RobsJuceModules/rosic/analysis/rosic_EnvelopeFollower.cpp
RobinSchmidt/RS-MET-Preliminary
6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe
[ "FTL" ]
307
2017-05-04T21:45:01.000Z
2022-02-03T00:59:01.000Z
Libraries/RobsJuceModules/rosic/analysis/rosic_EnvelopeFollower.cpp
RobinSchmidt/RS-MET-Preliminary
6c01cbaad7cce3daa3293c444dd9e4b74e5ebfbe
[ "FTL" ]
4
2017-09-05T17:04:31.000Z
2021-12-15T21:24:28.000Z
//#include "rosic_EnvelopeFollower.h" //using namespace rosic; // Construction/Destruction: EnvelopeFollower::EnvelopeFollower() { mode = 1; // mean absolute value } EnvelopeFollower::~EnvelopeFollower() { } // Setup: void EnvelopeFollower::setMode(int Mode) { if( Mode >= MEAN_ABS && Mode < NUM_MODES ) mode = Mode; }
15.090909
44
0.698795
RobinSchmidt
381ddf9c3ad82ec8cbeaa0b653ecb66cbb8d057a
1,261
cpp
C++
vsproj/PointLight.cpp
nguillemot/spooky
e8a3ccb7ee58b70b289b2643ce5b35350d4cc785
[ "MIT" ]
null
null
null
vsproj/PointLight.cpp
nguillemot/spooky
e8a3ccb7ee58b70b289b2643ce5b35350d4cc785
[ "MIT" ]
1
2016-09-12T18:27:38.000Z
2016-09-12T18:28:25.000Z
vsproj/PointLight.cpp
nguillemot/spooky
e8a3ccb7ee58b70b289b2643ce5b35350d4cc785
[ "MIT" ]
null
null
null
#include "PointLight.h" #include <iostream> PointLight::PointLight() { } PointLight::~PointLight() { } PointLight::PointLight(const PointLight& copy_from) { pLight.LightColor = copy_from.pLight.LightColor; pLight.LightPosition = copy_from.pLight.LightPosition; pLight.AmbientLightColor = copy_from.pLight.AmbientLightColor; pLight.LightIntensity = copy_from.pLight.LightIntensity; } DirectX::XMFLOAT4 PointLight::GetColor() { return pLight.LightColor; } DirectX::XMFLOAT4 PointLight::GetPosition() { return pLight.LightPosition; } DirectX::XMFLOAT4 PointLight::GetAmbientColor() { return pLight.AmbientLightColor; } float PointLight::GetIntensity() { return pLight.LightIntensity; } void PointLight::SetColor(float r, float g, float b, float a) { DirectX::XMFLOAT4 color(r, g, b, a); pLight.LightPosition = color; } void PointLight::SetPosition(float x, float y, float z) { DirectX::XMFLOAT4 position(x, y, z, 1.f); pLight.LightPosition = position; } void PointLight::SetAmbientColor(float r, float g, float b, float a) { DirectX::XMFLOAT4 color(r, g, b, a); pLight.AmbientLightColor = color; } void PointLight::SetIntensity(float i) { pLight.LightIntensity = i; } LightData* PointLight::data() { return (LightData*) &pLight; }
18.275362
68
0.746233
nguillemot
382057a12618436e33e8ed6b94c6c9eccb8f8652
6,392
cpp
C++
src/utils/keyframe_msg.cpp
mfkiwl/FLVIS
7472fef6fbc6cfc1e2c0de5dd1d0a7ae5462f689
[ "BSD-2-Clause" ]
113
2020-10-18T12:35:16.000Z
2022-03-29T06:08:49.000Z
src/utils/keyframe_msg.cpp
JazzyFeng/FLVIS-gpu
74dd8a136d1923592d2ca74d2408cc2c3bbb8c7b
[ "BSD-2-Clause" ]
9
2020-07-04T07:54:57.000Z
2022-02-17T06:37:33.000Z
src/utils/keyframe_msg.cpp
JazzyFeng/FLVIS-gpu
74dd8a136d1923592d2ca74d2408cc2c3bbb8c7b
[ "BSD-2-Clause" ]
29
2021-01-11T13:04:53.000Z
2022-03-29T06:08:50.000Z
#include "include/keyframe_msg.h" KeyFrameMsg::KeyFrameMsg() { } KeyFrameMsg::KeyFrameMsg(ros::NodeHandle &nh, string topic_name, int buffersize) { kf_pub = nh.advertise<flvis::KeyFrame>(topic_name,1); } void KeyFrameMsg::cmdLMResetPub(ros::Time stamp) { flvis::KeyFrame kf; kf.header.stamp = stamp; kf.frame_id = 0; kf.lm_count = 0; kf.command = KFMSG_CMD_RESET_LM; kf.img0 = sensor_msgs::Image(); kf.img1 = sensor_msgs::Image(); kf.lm_count = 0; kf.lm_id_data = std_msgs::Int64MultiArray(); kf.lm_2d_data.clear(); kf.lm_3d_data.clear(); kf.lm_descriptor_data = std_msgs::UInt8MultiArray(); kf.T_c_w = geometry_msgs::Transform(); kf_pub.publish(kf); } void KeyFrameMsg::pub(CameraFrame& frame, ros::Time stamp) { flvis::KeyFrame kf; kf.header.stamp = stamp; kf.frame_id = frame.frame_id; kf.command = KFMSG_CMD_NONE; cv_bridge::CvImage cvimg0(std_msgs::Header(), "mono8", frame.img0); cvimg0.toImageMsg(kf.img0); if(frame.d_camera.cam_type==DEPTH_D435) { cv_bridge::CvImage cv_d_img(std_msgs::Header(), "16UC1", frame.d_img); cv_d_img.toImageMsg(kf.img1); } if(frame.d_camera.cam_type==STEREO_UNRECT || frame.d_camera.cam_type==STEREO_RECT) { cv_bridge::CvImage cvimg1(std_msgs::Header(), "mono8", frame.img1); cvimg1.toImageMsg(kf.img1); } vector<int64_t> lm_id; vector<Vec2> lm_2d; vector<Vec3> lm_3d; frame.getKeyFrameInf(lm_id,lm_2d,lm_3d); kf.lm_count = static_cast<int32_t>(lm_id.size()); // for(size_t i=0; i<lm_id.size(); i++) // { // cout << lm_id.at(i) << " " << lm_2d.at(i).transpose() << " " << lm_3d.at(i).transpose() << endl; // } kf.lm_id_data.layout.dim.push_back(std_msgs::MultiArrayDimension()); kf.lm_id_data.layout.dim[0].label = "lm_id"; kf.lm_id_data.layout.dim[0].size = static_cast<uint32_t>(lm_id.size()); kf.lm_id_data.layout.dim[0].stride = static_cast<uint32_t>(lm_id.size()); kf.lm_id_data.data.clear(); kf.lm_id_data.data.insert(kf.lm_id_data.data.end(),lm_id.begin(),lm_id.end()); kf.lm_descriptor_data.layout.dim.push_back(std_msgs::MultiArrayDimension()); kf.lm_descriptor_data.layout.dim.push_back(std_msgs::MultiArrayDimension()); kf.lm_descriptor_data.layout.dim[0].label = "lm_descriptor"; kf.lm_descriptor_data.layout.dim[0].size = 0; kf.lm_descriptor_data.layout.dim[0].stride = 0; // kf.lm_descriptor_data.layout.dim[0].size = static_cast<uint32_t>(lm_id.size()); // kf.lm_descriptor_data.layout.dim[0].stride = static_cast<uint32_t>(32*lm_id.size()); kf.lm_descriptor_data.layout.dim[1].label = "32uint_descriptor"; kf.lm_descriptor_data.layout.dim[1].size = 0; kf.lm_descriptor_data.layout.dim[1].stride = 0; // kf.lm_descriptor_data.layout.dim[1].size = 1; // kf.lm_descriptor_data.layout.dim[1].stride = 32; // for(size_t i=0; i<lm_id.size(); i++) // { // //cout << "i:" << lm_descriptors.at(i).type() << " " << "size:" << lm_descriptors.at(i).size << endl; // //cout << "i " << lm_descriptors.at(i) << endl; // for(int j=0; j<32; j++) // { // kf.lm_descriptor_data.data.push_back(lm_descriptors.at(i).at<uint8_t>(0,j)); // //cout << unsigned(lm_descriptors.at(i).at<uint8_t>(0,j)) << " "; // } // } for(size_t i=0; i<lm_id.size(); i++) { Vec2 p2d=lm_2d.at(i); Vec3 p3d=lm_3d.at(i); geometry_msgs::Vector3 vp2d; geometry_msgs::Vector3 vp3d; vp2d.x = p2d[0]; vp2d.y = p2d[1]; kf.lm_2d_data.push_back(vp2d); vp3d.x = p3d[0]; vp3d.y = p3d[1]; vp3d.z = p3d[2]; kf.lm_3d_data.push_back(vp3d); } //cout << "SE3 T_c_w: " << frame.T_c_w << endl; Vec3 t=frame.T_c_w.translation(); Quaterniond uq= frame.T_c_w.unit_quaternion(); kf.T_c_w.translation.x=t[0]; kf.T_c_w.translation.y=t[1]; kf.T_c_w.translation.z=t[2]; kf.T_c_w.rotation.w=uq.w(); kf.T_c_w.rotation.x=uq.x(); kf.T_c_w.rotation.y=uq.y(); kf.T_c_w.rotation.z=uq.z(); kf.command = KFMSG_CMD_NONE; kf_pub.publish(kf); } void KeyFrameMsg::unpack(flvis::KeyFrameConstPtr kf_const_ptr, int64_t &frame_id, cv::Mat &img0, cv::Mat &img1, int &lm_count, vector<int64_t> &lm_id, vector<Vec2> &lm_2d, vector<Vec3> &lm_3d, vector<cv::Mat> &lm_descriptors, SE3 &T_c_w, ros::Time &T) { img0.release(); img1.release(); lm_id.clear(); lm_2d.clear(); lm_3d.clear(); lm_descriptors.clear(); frame_id = kf_const_ptr->frame_id; cv_bridge::CvImagePtr cvbridge_image = cv_bridge::toCvCopy(kf_const_ptr->img0, kf_const_ptr->img0.encoding); img0=cvbridge_image->image; cv_bridge::CvImagePtr cvbridge_d_image = cv_bridge::toCvCopy(kf_const_ptr->img1, kf_const_ptr->img1.encoding); img1 = cvbridge_d_image->image; lm_count = kf_const_ptr->lm_count; int count = kf_const_ptr->lm_count; for(auto i=0; i<count; i++) { // cv::Mat descriptor = cv::Mat(1,32,CV_8U); // for(auto j=0; j<32; j++) // { // descriptor.at<uint8_t>(0,j)=kf_const_ptr->lm_descriptor_data.data.at(i*32+j); // } // lm_descriptors.push_back(descriptor); //cout << lm_descriptors.at(i) << endl; lm_id.push_back(kf_const_ptr->lm_id_data.data[i]); Vec2 p2d(kf_const_ptr->lm_2d_data.at(i).x,kf_const_ptr->lm_2d_data.at(i).y); Vec3 p3d(kf_const_ptr->lm_3d_data.at(i).x,kf_const_ptr->lm_3d_data.at(i).y,kf_const_ptr->lm_3d_data.at(i).z); lm_2d.push_back(p2d); lm_3d.push_back(p3d); } Vec3 t; Quaterniond uq; t(0) = kf_const_ptr->T_c_w.translation.x; t(1) = kf_const_ptr->T_c_w.translation.y; t(2) = kf_const_ptr->T_c_w.translation.z; uq.w() = kf_const_ptr->T_c_w.rotation.w; uq.x() = kf_const_ptr->T_c_w.rotation.x; uq.y() = kf_const_ptr->T_c_w.rotation.y; uq.z() = kf_const_ptr->T_c_w.rotation.z; T_c_w = SE3(uq,t); T = kf_const_ptr->header.stamp; }
35.511111
117
0.60826
mfkiwl
3821d1764bdbf16b2a280a706cf2c97a1aeb51bb
2,116
cpp
C++
framework/areg/trace/private/LoggerBase.cpp
Ali-Nasrolahi/areg-sdk
4fbc2f2644220196004a31672a697a864755f0b6
[ "Apache-2.0" ]
70
2021-07-20T11:26:16.000Z
2022-03-27T11:17:43.000Z
framework/areg/trace/private/LoggerBase.cpp
Ali-Nasrolahi/areg-sdk
4fbc2f2644220196004a31672a697a864755f0b6
[ "Apache-2.0" ]
32
2021-07-31T05:20:44.000Z
2022-03-20T10:11:52.000Z
framework/areg/trace/private/LoggerBase.cpp
Ali-Nasrolahi/areg-sdk
4fbc2f2644220196004a31672a697a864755f0b6
[ "Apache-2.0" ]
40
2021-11-02T09:45:38.000Z
2022-03-27T11:17:46.000Z
/************************************************************************ * This file is part of the AREG SDK core engine. * AREG SDK is dual-licensed under Free open source (Apache version 2.0 * License) and Commercial (with various pricing models) licenses, depending * on the nature of the project (commercial, research, academic or free). * You should have received a copy of the AREG SDK license description in LICENSE.txt. * If not, please contact to info[at]aregtech.com * * \copyright (c) 2017-2021 Aregtech UG. All rights reserved. * \file areg/trace/private/LoggerBase.cpp * \ingroup AREG Asynchronous Event-Driven Communication Framework * \author Artak Avetyan * \brief Logger interface ************************************************************************/ #include "areg/trace/private/LoggerBase.hpp" #include "areg/trace/private/TraceManager.hpp" LoggerBase::LoggerBase( LogConfiguration & tracerConfig ) : mTracerConfiguration ( tracerConfig ) , mLayoutsMessage ( ) , mLayoutsScopeEnter ( ) , mLayoutsScopeExit ( ) { } bool LoggerBase::reopenLogger(void) { closeLogger(); return openLogger(); } bool LoggerBase::createLayouts(void) { bool result = false; const TraceProperty & propMessage = mTracerConfiguration.getLayoutMessage(); const TraceProperty & propEnter = mTracerConfiguration.getLayoutEnter(); const TraceProperty & propExit = mTracerConfiguration.getLayoutExit(); if (propMessage.isValid() ) { result |= mLayoutsMessage.createLayouts( static_cast<const char *>(propMessage.getValue( )) ); } if ( propEnter.isValid() ) { result |= mLayoutsScopeEnter.createLayouts( static_cast<const char *>(propEnter.getValue( )) ); } if ( propExit.isValid() ) { result |= mLayoutsScopeExit.createLayouts( static_cast<const char *>(propExit.getValue( )) ); } return result; } void LoggerBase::releaseLayouts(void) { mLayoutsMessage.deleteLayouts(); mLayoutsScopeEnter.deleteLayouts(); mLayoutsScopeExit.deleteLayouts(); }
33.587302
103
0.653592
Ali-Nasrolahi
3823cded0aca4feea941da2e1de65517ca6c1848
111,958
cpp
C++
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32746G-Discovery/Demonstrations/TouchGFX/Gui/generated/images/src/MainMenu/demo_button_04_pressed.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32746G-Discovery/Demonstrations/TouchGFX/Gui/generated/images/src/MainMenu/demo_button_04_pressed.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32746G-Discovery/Demonstrations/TouchGFX/Gui/generated/images/src/MainMenu/demo_button_04_pressed.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
// Generated by imageconverter. Please, do not edit! #include <touchgfx/hal/Config.hpp> LOCATION_EXTFLASH_PRAGMA KEEP extern const unsigned char _demo_button_04_pressed[] LOCATION_EXTFLASH_ATTRIBUTE = { // 134x55 RGB565 pixels. 0x00,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x00,0x00, 0x05,0x01,0x26,0x01,0x05,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01, 0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x26,0x01,0x05,0x01,0x25,0x01,0x26,0x01,0x05,0x01, 0x66,0x09,0x26,0x01,0x26,0x01,0xe9,0x19, 0x10,0x5c,0xb2,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74, 0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xd3,0x74,0xb2,0x74,0x10,0x5c,0x09,0x1a,0x26,0x01, 0x26,0x01,0x66,0x09, 0x46,0x09,0x26,0x01,0x09,0x1a,0x92,0x6c,0x10,0x54,0xce,0x4b,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43,0xae,0x43, 0xae,0x43,0xae,0x43,0xcf,0x4b,0x10,0x54,0x92,0x6c,0x09,0x1a,0x26,0x01,0x26,0x09, 0x26,0x01,0x46,0x01,0xf0,0x5b,0xcf,0x4b,0xce,0x43,0xaf,0x43,0xaf,0x43,0xce,0x43, 0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b, 0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43, 0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43, 0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b, 0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43, 0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43, 0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b, 0xaf,0x43,0xce,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xce,0x43,0xae,0x43,0xaf,0x43,0xcf,0x4b,0xf0,0x5b,0x46,0x01,0x26,0x01, 0x26,0x01,0x46,0x01, 0x10,0x54,0xae,0x43,0xae,0x43,0xcf,0x43,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b, 0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43, 0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43, 0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b, 0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43, 0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43, 0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b, 0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xce,0x43,0xae,0x43, 0xce,0x43,0x10,0x54,0x46,0x01,0x26,0x01, 0x46,0x01,0x46,0x01,0xcf,0x4b,0xaf,0x43,0xcf,0x4b,0xce,0x4b,0xaf,0x43,0xaf,0x4b,0xce,0x43,0xaf,0x43,0xcf,0x4b,0xce,0x43, 0xaf,0x43,0xcf,0x4b,0xae,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x4b,0xcf,0x43,0xaf,0x4b,0xce,0x43,0xaf,0x43,0xaf,0x4b,0xce,0x43,0xaf,0x4b, 0xcf,0x43,0xce,0x4b,0xaf,0x43,0xcf,0x43,0xae,0x4b,0xaf,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x4b,0xaf,0x43,0xaf,0x4b, 0xce,0x43,0xaf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x4b,0xaf,0x43,0xcf,0x43,0xae,0x4b,0xcf,0x43,0xaf,0x4b,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x43, 0xaf,0x4b,0xaf,0x43,0xce,0x4b,0xaf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x43,0xcf,0x4b,0xae,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x4b,0xcf,0x43,0xaf,0x43,0xce,0x4b,0xcf,0x43, 0xaf,0x4b,0xce,0x43,0xaf,0x4b,0xaf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xce,0x4b,0xaf,0x43,0xcf,0x4b,0xae,0x43,0xaf,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x4b,0xaf,0x43, 0xce,0x4b,0xcf,0x43,0xaf,0x43,0xce,0x4b,0xaf,0x43,0xaf,0x4b,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x4b,0xaf,0x43,0xcf,0x4b,0xae,0x43, 0xcf,0x43,0xaf,0x4b,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x4b,0xaf,0x43,0xaf,0x43,0xce,0x4b,0xaf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xae,0x43,0xaf,0x4b, 0xcf,0x43,0xae,0x43,0xaf,0x4b,0xcf,0x4b,0xaf,0x4b,0xaf,0x43,0xcf,0x43,0xcf,0x4b,0x46,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0xcf,0x43,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xce,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43, 0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43, 0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43, 0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43, 0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xce,0x4b,0xce,0x43,0xcf,0x43,0xce,0x43,0xce,0x4b,0xcf,0x4b,0xcf,0x43,0xae,0x43,0x26,0x01,0x47,0x01, 0x46,0x01,0x26,0x01,0xcf,0x43,0xcf,0x43,0xaf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xcf,0x43,0xaf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43, 0xcf,0x43,0xaf,0x4b,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xaf,0x4b,0xce,0x43,0xcf,0x43,0xaf,0x4b,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xaf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xcf,0x4b, 0xae,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x43,0xcf,0x4b,0xcf,0x43,0xaf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xae,0x4b, 0xcf,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xaf,0x43,0xce,0x4b,0xcf,0x43,0xaf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xaf,0x4b,0xcf,0x43,0xce,0x43,0xaf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xaf,0x43,0xcf,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x4b,0xcf,0x43, 0xcf,0x43,0xcf,0x4b,0xce,0x43,0xaf,0x43,0xcf,0x4b,0xcf,0x43,0xaf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xae,0x43,0xcf,0x43,0xcf,0x4b,0xaf,0x43, 0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xaf,0x43,0xce,0x4b,0xcf,0x43,0xaf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x43, 0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0x26,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x4b,0xce,0x43, 0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43, 0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b, 0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b, 0xce,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b, 0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43, 0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0x46,0x01,0x46,0x01, 0x47,0x01,0x46,0x01,0xcf,0x4b,0xcf,0x43, 0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43, 0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43, 0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43, 0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b, 0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b, 0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b, 0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b, 0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x4b, 0x26,0x01,0x47,0x01, 0x46,0x01,0x26,0x01,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43, 0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b, 0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43, 0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x43,0xcf,0x4b, 0xce,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43, 0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x4b, 0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b, 0xcf,0x43,0xcf,0x43,0xce,0x4b,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x4b,0xce,0x43,0xcf,0x43, 0xcf,0x43,0xce,0x43,0xcf,0x4b,0xcf,0x43,0xcf,0x43,0xcf,0x43,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xcf,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x43,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x43,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x43,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x43,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x43,0xcf,0x4b, 0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x43,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b, 0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x43, 0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x43,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b, 0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0x26,0x01,0x46,0x01, 0x47,0x01,0x46,0x01, 0xcf,0x4b,0xcf,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xcf,0x43,0xef,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x4b, 0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43, 0xef,0x4b,0xcf,0x4b,0xef,0x43,0xef,0x4b,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xef,0x43, 0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x4b,0xef,0x4b,0xcf,0x43,0xef,0x4b,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b, 0xcf,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xcf,0x43,0xef,0x4b,0xef,0x43,0xcf,0x43,0xef,0x4b,0xef,0x43,0xcf,0x43,0xef,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xef,0x43, 0xef,0x4b,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x4b,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43,0xcf,0x4b,0xef,0x43,0xef,0x43, 0xcf,0x4b,0xef,0x43,0xef,0x4b,0xcf,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x4b,0xef,0x43,0xef,0x4b, 0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x43,0xef,0x4b,0xcf,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xcf,0x43,0xef,0x4b, 0xef,0x4b,0xcf,0x43,0x46,0x01,0x46,0x01, 0x46,0x01,0x26,0x01,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0x26,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b, 0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b, 0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b, 0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b, 0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b, 0xcf,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b, 0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0xcf,0x4b,0xef,0x4b,0xef,0x4b,0x26,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b, 0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43, 0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b, 0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43, 0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x43,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0xef,0x4b, 0xef,0x4b,0xef,0x43,0xef,0x4b,0xef,0x43,0x46,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b, 0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x43,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b, 0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x43,0xef,0x4b, 0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x43,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b, 0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x43,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b, 0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xf0,0x4b,0xf0,0x4b,0xf0,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0x46,0x01,0x47,0x01, 0x47,0x01,0x46,0x01,0xef,0x4b,0xf0,0x4b, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x43,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xef,0x4b,0xf0,0x4b, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b, 0xf0,0x4b,0xf0,0x43,0xef,0x4b,0x18,0xae,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xf7,0x9e,0xef,0x18,0xae,0x51,0x5c,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b, 0xf0,0x4b,0x18,0xae,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0xae,0xf0,0x4b,0xef,0x4b,0x9a,0xc6,0xdf,0xf7,0xb2,0x6c, 0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0x5d,0xe7,0x5d,0xe7,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b, 0xef,0x4b,0x51,0x5c,0x59,0xbe,0x9e,0xef,0xff,0xff,0xff,0xff,0x9e,0xef,0x59,0xbe,0x51,0x5c,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b, 0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xf0,0x4b, 0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xef,0x4b,0xf0,0x4b,0xef,0x4b,0xf0,0x4b, 0x26,0x01,0x46,0x01, 0x46,0x01,0x26,0x01,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c, 0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c, 0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x9e,0xef,0xff,0xff,0x59,0xbe,0x59,0xbe,0x59,0xbe,0x9a,0xc6,0x9e,0xf7, 0xff,0xff,0x9e,0xef,0xf3,0x7c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x9e,0xef,0xff,0xff,0x59,0xbe,0x59,0xbe,0x59,0xbe,0x59,0xbe,0x59,0xbe,0x59,0xbe,0x59,0xbe, 0xf3,0x7c,0x10,0x4c,0x0f,0x4c,0x9e,0xef,0xff,0xff,0xdb,0xd6,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x18,0xae, 0xff,0xff,0xff,0xff,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0xf3,0x7c,0xdf,0xf7,0xff,0xff,0x5d,0xe7,0x59,0xbe,0x59,0xbe,0x5d,0xe7,0xff,0xff,0xdf,0xff,0xf3,0x7c, 0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c, 0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c, 0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x46,0x01,0x47,0x01, 0x47,0x01,0x46,0x01,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef, 0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x18,0xb6,0xff,0xff,0x9e,0xef,0x71,0x5c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0xff,0xff,0xf4,0x7c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0xdf,0xf7,0xdf,0xff,0x96,0x9d,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x96,0x9d,0xdf,0xff,0xdf,0xf7,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x26,0x01,0x46,0x01, 0x46,0x01,0x26,0x01, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x79,0xbe,0xff,0xff,0x18,0xb6, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x9e,0xf7, 0xff,0xff,0xff,0xff,0x5d,0xe7,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x59,0xbe,0xff,0xff,0xff,0xff,0xff,0xff,0x10,0x4c,0x10,0x4c, 0x0f,0x4c,0x18,0xae,0xff,0xff,0x79,0xbe,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x79,0xbe,0xff,0xff,0x18,0xae,0x10,0x4c,0x10,0x4c,0x0f,0x4c, 0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c, 0x10,0x4c,0x10,0x4c,0x26,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c, 0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c, 0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0x10,0x4c,0x0f,0x4c,0x0f,0x4c, 0x10,0x4c,0x0f,0x4c,0x10,0x4c,0xb2,0x6c,0xff,0xff,0x9e,0xf7,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c, 0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xef,0xff,0xff,0x9e,0xf7,0xff,0xff,0x96,0x95,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x51,0x5c, 0xdf,0xff,0xdf,0xff,0x5d,0xe7,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0xdb,0xd6,0xff,0xff,0x14,0x7d,0x10,0x4c,0x0f,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c, 0x14,0x7d,0xff,0xff,0xdb,0xd6,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c, 0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c, 0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x10,0x4c,0x0f,0x4c,0x10,0x4c,0x26,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xf7, 0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x55,0x8d,0xff,0xff,0x5d,0xe7, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x59,0xbe,0xff,0xff,0x38,0xae,0x9e,0xef,0xff,0xff,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0xff,0xff,0x9e,0xf7,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x46,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x30,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x30,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x30,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c, 0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x9e,0xef,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0xfb,0xd6,0xff,0xff,0xd7,0xa5,0x30,0x4c,0x10,0x4c,0x10,0x4c,0xd3,0x74,0xdf,0xff,0x9e,0xef,0x30,0x4c,0x9e,0xf7,0xff,0xff, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x9e,0xef,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0xff,0xff,0x9e,0xef,0x30,0x4c, 0x30,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c,0x10,0x4c, 0x10,0x4c,0x10,0x4c,0x30,0x4c,0x10,0x4c,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x10,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c, 0x10,0x4c,0x10,0x54,0x10,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x10,0x54,0x10,0x4c, 0x10,0x4c,0x30,0x54,0x10,0x4c,0x10,0x4c,0x10,0x54,0x30,0x4c,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x14,0x7d,0xff,0xff,0x9e,0xf7,0x30,0x4c,0x30,0x4c,0x10,0x4c, 0xfb,0xd6,0xff,0xff,0x38,0xb6,0x10,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x10,0x4c,0x10,0x54,0x10,0x4c,0x10,0x54,0x30,0x4c, 0x10,0x54,0x30,0x4c,0x30,0x4c,0xff,0xff,0x9e,0xf7,0x30,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x10,0x4c,0x30,0x4c,0x30,0x4c,0x26,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0x30,0x4c,0x30,0x54, 0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c, 0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x54, 0x30,0x54,0x30,0x4c,0x30,0x54,0x9e,0xef,0xff,0xff,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x4c,0x9e,0xef,0xff,0xff,0x30,0x54,0x30,0x4c, 0x30,0x54,0x9e,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xd3,0x74,0x30,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c, 0x30,0x4c,0xba,0xce,0xff,0xff,0x38,0xb6,0x30,0x54,0x14,0x7d,0xff,0xff,0x5d,0xe7,0x30,0x4c,0x30,0x54,0x9e,0xef,0xff,0xff,0x30,0x54,0x30,0x54,0x30,0x4c,0x9e,0xf7, 0xff,0xff,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0xff,0xff,0x9e,0xf7,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x54, 0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x54, 0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54,0x30,0x54,0x30,0x4c,0x30,0x54,0x30,0x54, 0x26,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c, 0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54, 0x30,0x4c,0x30,0x54,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x79,0xbe,0x79,0xbe,0x79,0xbe,0x79,0xbe,0x79,0xbe,0x79,0xbe,0x38,0xb6, 0x30,0x4c,0x30,0x54,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x54,0x72,0x64,0xdf,0xff,0x9e,0xef,0x72,0x64,0xfb,0xd6,0xff,0xff,0xb6,0x9d,0x30,0x4c,0x30,0x4c, 0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x54,0x9e,0xf7,0xff,0xff,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0xff,0xff, 0x9e,0xef,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54, 0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x30,0x54, 0x30,0x4c,0x30,0x4c,0x30,0x4c,0x30,0x54,0x30,0x4c,0x30,0x4c,0x26,0x01,0x47,0x01, 0x47,0x01,0x26,0x01,0x30,0x54,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54, 0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c, 0x30,0x54,0x31,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x9e,0xef, 0xff,0xff,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x31,0x54,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x31,0x54,0x31,0x54,0x30,0x4c,0x9e,0xef,0xff,0xff,0x31,0x54, 0x30,0x54,0x31,0x54,0x30,0x54,0x31,0x54,0x30,0x54,0x30,0x4c,0x31,0x54,0x30,0x54,0x30,0x4c,0x9e,0xf7,0xff,0xff,0x31,0x4c,0x30,0x54,0x30,0x4c,0x7a,0xbe,0xff,0xff, 0x3c,0xdf,0xff,0xff,0x5d,0xe7,0x31,0x54,0x31,0x54,0x30,0x54,0x9e,0xef,0xff,0xff,0x31,0x54,0x30,0x4c,0x31,0x4c,0x9e,0xf7,0xff,0xff,0x31,0x54,0x30,0x54,0x31,0x54, 0x31,0x54,0x30,0x54,0x31,0x4c,0x31,0x54,0x30,0x4c,0xff,0xff,0x9e,0xf7,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x54, 0x30,0x4c,0x31,0x54,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54, 0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0x30,0x4c,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01, 0x31,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x30,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x4c,0x31,0x4c,0x30,0x54, 0x31,0x4c,0x30,0x4c,0x31,0x54,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54, 0x30,0x4c,0x31,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54,0x9e,0xef,0xff,0xff,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x54,0x30,0x4c,0x31,0x4c,0x31,0x54,0x9e,0xef,0xff,0xff, 0x31,0x4c,0x31,0x54,0x31,0x54,0x9e,0xef,0xff,0xff,0x31,0x4c,0x31,0x4c,0x30,0x4c,0x31,0x54,0x31,0x4c,0x31,0x4c,0x31,0x54,0x31,0x4c,0x31,0x4c,0x31,0x54,0x9e,0xef, 0xff,0xff,0x31,0x54,0x31,0x4c,0x30,0x54,0x92,0x64,0xdf,0xff,0xff,0xff,0xff,0xff,0xb6,0x9d,0x31,0x4c,0x31,0x54,0x51,0x4c,0x9e,0xf7,0xff,0xff,0x31,0x54,0x31,0x54, 0x30,0x4c,0x9e,0xef,0xff,0xff,0x31,0x4c,0x30,0x4c,0x31,0x4c,0x31,0x4c,0x30,0x54,0x31,0x54,0x31,0x4c,0x30,0x54,0xff,0xff,0x9e,0xef,0x31,0x54,0x30,0x4c,0x31,0x4c, 0x30,0x54,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54,0x31,0x4c,0x31,0x4c,0x30,0x54,0x31,0x4c,0x31,0x4c,0x30,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54, 0x30,0x4c,0x31,0x54,0x31,0x4c,0x30,0x54,0x31,0x4c,0x31,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x31,0x4c,0x30,0x4c,0x31,0x54,0x30,0x4c,0x31,0x54,0x30,0x4c,0x31,0x4c, 0x31,0x54,0x31,0x54,0x46,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x51,0x54,0x50,0x54,0x50,0x4c,0x51,0x54,0x30,0x54,0x50,0x4c,0x51,0x54,0x30,0x54,0x50,0x4c,0x51,0x54, 0x30,0x4c,0x50,0x54,0x30,0x54,0x50,0x54,0x30,0x54,0x51,0x54,0x50,0x54,0x31,0x4c,0x50,0x54,0x31,0x4c,0x50,0x54,0x50,0x54,0x31,0x54,0x50,0x54,0x50,0x54,0x31,0x54, 0x50,0x54,0x50,0x54,0x31,0x54,0x50,0x4c,0x50,0x54,0x31,0x4c,0x50,0x54,0x50,0x54,0x51,0x54,0x50,0x54,0x50,0x54,0x9e,0xf7,0xff,0xff,0x51,0x54,0x50,0x4c,0x50,0x54, 0x51,0x54,0x50,0x54,0x50,0x54,0x51,0x54,0x9e,0xf7,0xdf,0xff,0x50,0x4c,0x50,0x54,0x50,0x54,0x9e,0xf7,0xff,0xff,0x50,0x54,0x50,0x54,0x51,0x54,0x50,0x4c,0x50,0x54, 0x50,0x54,0x50,0x54,0x50,0x54,0x51,0x54,0x50,0x54,0x9e,0xf7,0xff,0xff,0x50,0x54,0x51,0x4c,0x50,0x54,0x30,0x54,0x38,0xb6,0xff,0xff,0xfb,0xd6,0x51,0x54,0x50,0x54, 0x50,0x4c,0x51,0x54,0x9e,0xf7,0xff,0xff,0x50,0x4c,0x51,0x54,0x50,0x54,0x9e,0xf7,0xff,0xff,0x51,0x54,0x50,0x54,0x50,0x54,0x50,0x4c,0x50,0x54,0x50,0x54,0x51,0x4c, 0x50,0x54,0xff,0xff,0x9e,0xf7,0x51,0x54,0x50,0x54,0x50,0x4c,0x51,0x54,0x50,0x54,0x30,0x4c,0x50,0x54,0x51,0x54,0x30,0x54,0x50,0x54,0x50,0x54,0x31,0x54,0x50,0x54, 0x50,0x54,0x31,0x54,0x50,0x54,0x30,0x54,0x51,0x54,0x50,0x54,0x30,0x4c,0x50,0x54,0x31,0x54,0x50,0x54,0x30,0x54,0x50,0x54,0x31,0x54,0x50,0x54,0x30,0x54,0x51,0x54, 0x30,0x54,0x50,0x4c,0x51,0x54,0x30,0x54,0x50,0x54,0x50,0x54,0x31,0x4c,0x50,0x54,0x46,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x4c, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x54,0x50,0x54,0x51,0x4c,0x51,0x54, 0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x4c,0x31,0x4c,0x51,0x54, 0x51,0x4c,0x9e,0xf7,0xff,0xff,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x50,0x4c,0xd3,0x74,0xff,0xff,0x9e,0xef,0x51,0x54,0x51,0x4c,0x51,0x54,0x9e,0xef, 0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x50,0x4c,0x51,0x4c,0x9e,0xf7,0xff,0xff,0x51,0x4c,0x51,0x54,0x51,0x4c, 0x51,0x4c,0x51,0x54,0xb6,0x9d,0x92,0x64,0x51,0x4c,0x51,0x54,0x30,0x54,0x51,0x4c,0x9e,0xf7,0xff,0xff,0x51,0x4c,0x51,0x54,0x51,0x54,0xfb,0xd6,0xff,0xff,0x34,0x7d, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x34,0x7d,0xff,0xff,0xfb,0xd6,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c, 0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54, 0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x50,0x4c,0x51,0x54,0x26,0x01,0x46,0x01, 0x46,0x01,0x26,0x01,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x4c,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x50,0x54,0x51,0x54, 0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x79,0xbe, 0xff,0xff,0x39,0xb6,0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff, 0x51,0x54,0x51,0x54,0x51,0x4c,0x38,0xb6,0xff,0xff,0x7a,0xbe,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x79,0xbe,0xff,0xff,0x39,0xb6,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54, 0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54, 0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x54,0x26,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54, 0x51,0x4c,0x51,0x54,0x50,0x54,0x51,0x4c,0x51,0x54,0x50,0x54,0x51,0x4c,0x51,0x54,0x50,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x39,0xb6,0xff,0xff,0x9e,0xef,0xb2,0x64,0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xf7,0xff,0xff,0x51,0x54,0x51,0x4c,0x50,0x54, 0x51,0x4c,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x9e,0xf7,0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0xdf,0xff,0xdf,0xff,0xb6,0x9d,0x51,0x4c,0x51,0x4c,0x51,0x54, 0x51,0x4c,0xb6,0x9d,0xdf,0xff,0xdf,0xff,0x51,0x54,0x51,0x4c,0x51,0x54,0x50,0x4c,0x51,0x54,0x51,0x4c,0x50,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54, 0x51,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x4c,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x4c,0x46,0x01,0x46,0x01, 0x47,0x01,0x46,0x01,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x4c,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x79,0xbe,0x79,0xbe,0x7a,0xbe,0xba,0xc6,0x9e,0xf7,0xff,0xff,0x9e,0xf7,0x34,0x85,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x9e,0xef,0xff,0xff,0x79,0xbe,0x79,0xbe,0x7a,0xbe,0x79,0xbe,0x79,0xbe,0x7a,0xbe,0x79,0xbe,0x34,0x85,0x51,0x54,0x51,0x54,0x9e,0xef,0xff,0xff,0x51,0x54, 0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x9e,0xf7,0xff,0xff,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x34,0x7d,0xdf,0xff,0xff,0xff,0x5d,0xe7,0x79,0xbe,0x79,0xbe,0x5d,0xe7,0xff,0xff,0xdf,0xff,0x34,0x85,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x50,0x54,0x51,0x54,0x51,0x54,0x50,0x54, 0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54,0x51,0x54, 0x26,0x01,0x46,0x01, 0x46,0x01,0x26,0x01,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54, 0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x4c,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54, 0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x4c,0x71,0x54,0x71,0x54,0x58,0xb6,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0x9e,0xf7, 0x59,0xb6,0xb2,0x64,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x4c,0x71,0x54,0x58,0xb6,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xba,0xc6,0x51,0x54,0x71,0x54,0xba,0xc6,0x7d,0xe7,0x71,0x54,0x71,0x54,0x51,0x4c,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x4c,0x71,0x54,0x51,0x54,0x71,0x4c,0x71,0x54, 0xba,0xc6,0x7d,0xe7,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0xb2,0x64,0x9a,0xbe,0x9e,0xf7,0xff,0xff,0xff,0xff,0x9e,0xf7,0x9a,0xbe,0xb2,0x64,0x51,0x54, 0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x4c,0x51,0x54,0x51,0x54,0x71,0x54,0x51,0x54, 0x51,0x54,0x71,0x54,0x51,0x4c,0x51,0x54,0x71,0x54,0x51,0x4c,0x51,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x4c,0x51,0x54, 0x71,0x54,0x51,0x54,0x51,0x4c,0x71,0x54,0x51,0x54,0x71,0x54,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x26,0x01,0x47,0x01, 0x47,0x01,0x26,0x01, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54, 0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x51,0x54, 0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x51,0x54, 0x51,0x54,0x71,0x54,0x51,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x51,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x26,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54, 0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x26,0x01,0x47,0x01, 0x47,0x01,0x26,0x01,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54, 0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54, 0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54, 0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54, 0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x46,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54, 0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54, 0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x71,0x54, 0x72,0x54,0x71,0x54,0x72,0x54,0x71,0x54,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54, 0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54, 0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x92,0x54, 0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c, 0x92,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x92,0x54, 0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54, 0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x92,0x54,0x72,0x54,0x91,0x54, 0x92,0x54,0x72,0x54,0x92,0x54,0x91,0x54,0x72,0x54,0x92,0x54,0x91,0x54,0x72,0x54,0x92,0x54,0x91,0x54,0x72,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54, 0x72,0x54,0x91,0x54,0x92,0x54,0x72,0x54,0x91,0x54,0x92,0x54,0x72,0x54,0x91,0x54,0x92,0x54,0x72,0x54,0x46,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0x71,0x54,0x72,0x54, 0x91,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x91,0x54,0x72,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x91,0x54,0x72,0x54, 0x91,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x71,0x54, 0x92,0x54,0x71,0x5c,0x71,0x54,0x91,0x54,0x71,0x5c,0x72,0x54,0x71,0x5c,0x72,0x54,0x72,0x5c,0x71,0x54,0x92,0x54,0x72,0x5c,0x71,0x54,0x92,0x54,0x71,0x5c,0x92,0x54, 0x71,0x54,0x71,0x5c,0x92,0x54,0x71,0x54,0x72,0x5c,0x71,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x72,0x54,0x72,0x54,0x71,0x5c,0x71,0x54,0x72,0x54,0x72,0x54,0x91,0x5c, 0x71,0x54,0x72,0x54,0x71,0x5c,0x92,0x54,0x71,0x54,0x71,0x5c,0x92,0x54,0x71,0x54,0x72,0x5c,0x91,0x54,0x71,0x5c,0x72,0x54,0x91,0x54,0x72,0x5c,0x91,0x54,0x72,0x54, 0x91,0x5c,0x71,0x54,0x72,0x54,0x91,0x5c,0x72,0x54,0x71,0x5c,0x71,0x54,0x72,0x5c,0x91,0x54,0x72,0x54,0x71,0x5c,0x72,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x72,0x54, 0x91,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x71,0x54,0x92,0x5c,0x71,0x54, 0x92,0x54,0x71,0x54,0x71,0x54,0x72,0x54,0x91,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x92,0x54,0x71,0x54,0x91,0x54,0x72,0x5c,0x91,0x54,0x71,0x54,0x91,0x54,0x72,0x54, 0x26,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54, 0x91,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c, 0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x5c,0x91,0x54, 0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x54, 0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54, 0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54, 0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x5c,0x91,0x54,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c, 0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c, 0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x91,0x54,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54, 0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54, 0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x91,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x26,0x01,0x46,0x01, 0x47,0x01,0x26,0x01, 0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x91,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x91,0x5c,0x92,0x54, 0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54, 0x91,0x54,0x92,0x54,0x91,0x5c,0x91,0x54,0x92,0x54,0x91,0x5c,0x91,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x91,0x5c,0x92,0x54, 0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x91,0x54,0x91,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x5c, 0x91,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54, 0x92,0x5c,0x91,0x54,0x91,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54, 0x91,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x5c,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x5c,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x5c,0x92,0x54, 0x91,0x54,0x92,0x5c,0x92,0x54,0x91,0x54,0x92,0x54,0x91,0x5c,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x92,0x54,0x92,0x54,0x91,0x54,0x91,0x5c,0x92,0x54,0x91,0x54, 0x92,0x5c,0x92,0x54,0x26,0x01,0x47,0x01, 0x46,0x01,0x46,0x01,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c, 0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x54, 0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c, 0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x5c,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c, 0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0x46,0x01,0x46,0x01, 0x47,0x01,0x26,0x01,0x71,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54, 0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54, 0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c, 0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54, 0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54, 0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54, 0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54, 0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54, 0xb2,0x5c,0xb2,0x54,0xb2,0x54,0x71,0x54,0x46,0x01,0x46,0x01, 0x46,0x01,0x46,0x01,0xaf,0x43,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0xb2,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x54, 0x92,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c, 0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x54,0xb2,0x5c, 0x92,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x54, 0x92,0x54,0xb2,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c, 0xb2,0x54,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0x92,0x54, 0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0x92,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xae,0x43,0x26,0x01,0x47,0x01, 0x87,0x09,0x46,0x01,0xc8,0x11,0x71,0x54, 0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c, 0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c, 0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c, 0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c, 0xb2,0x5c,0x92,0x54,0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0xb2,0x5c,0x92,0x5c, 0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0xb2,0x5c, 0x92,0x5c,0xb2,0x54,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0x92,0x5c,0x92,0x5c,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c,0x92,0x54,0xb2,0x5c,0x92,0x5c, 0x92,0x54,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0x92,0x5c,0xb2,0x5c,0xb2,0x5c,0x92,0x54,0x92,0x5c,0x71,0x54,0xc8,0x11, 0x46,0x01,0x67,0x09, 0xac,0x32,0x46,0x01,0x05,0x01,0x87,0x11,0x8e,0x3b,0x71,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c, 0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c, 0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c, 0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54, 0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c, 0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54, 0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x5c, 0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c,0xb2,0x5c,0xb2,0x54,0xb2,0x54,0xb2,0x5c, 0xb2,0x54,0xb2,0x54,0x71,0x54,0x8e,0x3b,0xa7,0x11,0x06,0x01,0x46,0x01,0xab,0x32, 0xb7,0xad,0x88,0x09,0x26,0x01,0x05,0x01,0xe5,0x00,0xe5,0x00,0xe5,0x00,0xe4,0x00, 0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00, 0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe5,0x00, 0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00, 0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00, 0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00, 0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00, 0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00, 0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe4,0x00,0xe4,0x00,0xe5,0x00,0xe5,0x00,0xe5,0x00,0x05,0x01,0x26,0x01,0x88,0x09,0xb7,0xad, 0xff,0xff,0x39,0xbe, 0x8c,0x32,0x67,0x09,0x26,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01, 0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01, 0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00, 0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00, 0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01, 0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0xe5,0x00,0x05,0x01,0x05,0x01,0x05,0x01,0x05,0x01,0x26,0x01, 0x67,0x09,0x8b,0x32,0x39,0xbe,0xff,0xff, 0x00,0x00,0xff,0xff,0xbf,0xf7,0xfc,0xde,0xf8,0xb5,0x35,0x95,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0x15,0x8d,0xf5,0x94,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0x15,0x8d,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c,0xf5,0x8c, 0xf5,0x8c,0xf5,0x8c,0xf5,0x94,0xf5,0x8c,0x35,0x95,0xf8,0xb5,0xfc,0xde,0xbf,0xf7,0xff,0xff,0x00,0x00 }; LOCATION_EXTFLASH_PRAGMA KEEP extern const unsigned char _demo_button_04_pressed_alpha_channel[] LOCATION_EXTFLASH_ATTRIBUTE = { // 134x55 alpha pixels. 0x00,0x14,0x69,0x92,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a, 0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96, 0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96, 0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a, 0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96, 0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96, 0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a, 0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96,0x96,0x9a,0x96, 0x96,0x9a,0x92,0x69,0x14,0x00, 0x18,0x8e,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x8e,0x18, 0x69,0x96,0x92,0xa2, 0xdb,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xdb,0xa2,0x92, 0x96,0x69, 0x8e,0x92,0xa2,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xf7,0xa2,0x92,0x8e, 0x92,0x8e,0xdb,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0x8e,0x92, 0x8e,0x8e, 0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xfb,0x8e,0x8e, 0x8e,0x96,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x96,0x8e, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0x8a, 0x8a,0x9e,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xfb,0x9e,0x8a, 0x8a,0x9e,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x9e,0x8a, 0x86,0x9a,0xd3,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xcf, 0x9a,0x86, 0x75,0x96,0xba,0xdf,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xf7,0xe3,0xba,0x96,0x75, 0x41,0x8a,0xa2,0xc3,0xdb,0xe3,0xe3,0xe7, 0xe7,0xe7,0xe3,0xe7,0xe7,0xe3,0xe7,0xe7,0xe3,0xe7,0xe7,0xe3,0xe7,0xe3,0xe3,0xe7, 0xe3,0xe3,0xe7,0xe3,0xe3,0xe7,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3, 0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xdb,0xc3,0xa2,0x8a,0x41, 0x0c,0x51, 0x7d,0x9e,0xb6,0xc7,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb, 0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcf,0xcb, 0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb, 0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf, 0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb, 0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb, 0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf, 0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xcf,0xcb,0xcb,0xc7,0xb6, 0x9e,0x7d,0x51,0x0c, 0x00,0x0c,0x34,0x4d,0x61,0x69,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, 0x6d,0x6d,0x6d,0x6d,0x69,0x61,0x51,0x34,0x0c,0x00 };
108.486434
160
0.792779
ramkumarkoppu
3824965739957beae561460ccec5c7bab1d4fc87
6,429
cpp
C++
modules/animationqt/src/widgets/keyframesequencewidgetqt.cpp
BioDataAnalysis/inviwo
6ca6fdd28837229ec1fdfa38d7ab35f3f07dd75b
[ "BSD-2-Clause" ]
null
null
null
modules/animationqt/src/widgets/keyframesequencewidgetqt.cpp
BioDataAnalysis/inviwo
6ca6fdd28837229ec1fdfa38d7ab35f3f07dd75b
[ "BSD-2-Clause" ]
null
null
null
modules/animationqt/src/widgets/keyframesequencewidgetqt.cpp
BioDataAnalysis/inviwo
6ca6fdd28837229ec1fdfa38d7ab35f3f07dd75b
[ "BSD-2-Clause" ]
null
null
null
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2018-2020 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #include <modules/animationqt/widgets/keyframesequencewidgetqt.h> #include <modules/animation/datastructures/animationtime.h> #include <warn/push> #include <warn/ignore/all> #include <QGraphicsLineItem> #include <QGraphicsScene> #include <QGraphicsView> #include <QPainter> #include <QLinearGradient> #include <QApplication> #include <warn/pop> namespace inviwo { namespace animation { KeyframeSequenceWidgetQt::KeyframeSequenceWidgetQt(KeyframeSequence& keyframeSequence, QGraphicsItem* parent) : QGraphicsItem(parent), keyframeSequence_(keyframeSequence) { setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges | ItemSendsScenePositionChanges); keyframeSequence.addObserver(this); setX(mapFromScene(timeToScenePos(keyframeSequence_.getFirstTime()), 0).x()); for (size_t i = 0; i < keyframeSequence_.size(); ++i) { keyframes_[&keyframeSequence_[i]] = std::make_unique<KeyframeWidgetQt>(keyframeSequence_[i], this); } QGraphicsItem::prepareGeometryChange(); setSelected(keyframeSequence_.isSelected()); } KeyframeSequenceWidgetQt::~KeyframeSequenceWidgetQt() = default; void KeyframeSequenceWidgetQt::paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget) { IVW_UNUSED_PARAM(options); IVW_UNUSED_PARAM(widget); painter->setRenderHint(QPainter::Antialiasing, true); QPen pen = QPen(); pen.setWidthF(1); pen.setCosmetic(true); pen.setCapStyle(Qt::RoundCap); pen.setStyle(Qt::SolidLine); isSelected() ? pen.setColor(QColor(66, 66, 132)) : pen.setColor(QColor(66, 66, 66)); QLinearGradient Gradient(0, -trackHeight / 2 + trackHeightNudge, 0, trackHeight / 2 - trackHeightNudge); Gradient.setColorAt(0, isSelected() ? QColor(63, 184, 255) : QColor(192, 192, 192)); Gradient.setColorAt(1, isSelected() ? QColor(66, 66, 132) : QColor(66, 66, 66)); QBrush brush = QBrush(Gradient); painter->setPen(pen); painter->setBrush(brush); auto rect = boundingRect(); auto penWidth = pen.widthF(); rect.adjust(0.5 * (keyframeWidth + penWidth), 0.5 * penWidth + trackHeightNudge, -0.5 * (keyframeWidth - penWidth), -0.5 * penWidth - trackHeightNudge); const auto start = mapFromScene(timeToScenePos(keyframeSequence_.getFirstTime()), 0).x(); const auto stop = mapFromScene(timeToScenePos(keyframeSequence_.getLastTime()), 0).x(); QRectF draw{start, -0.5 * trackHeight + trackHeightNudge, stop - start, trackHeight - 2 * trackHeightNudge}; painter->drawRect(draw); } KeyframeSequence& KeyframeSequenceWidgetQt::getKeyframeSequence() { return keyframeSequence_; } const KeyframeSequence& KeyframeSequenceWidgetQt::getKeyframeSequence() const { return keyframeSequence_; } void KeyframeSequenceWidgetQt::onKeyframeAdded(Keyframe* key, KeyframeSequence*) { prepareGeometryChange(); keyframes_[key] = std::make_unique<KeyframeWidgetQt>(*key, this); } void KeyframeSequenceWidgetQt::onKeyframeRemoved(Keyframe* key, KeyframeSequence*) { prepareGeometryChange(); keyframes_.erase(key); } void KeyframeSequenceWidgetQt::onKeyframeSequenceMoved(KeyframeSequence*) { prepareGeometryChange(); } QRectF KeyframeSequenceWidgetQt::boundingRect() const { return childrenBoundingRect(); } KeyframeWidgetQt* KeyframeSequenceWidgetQt::getKeyframeQt(const Keyframe* keyframe) const { auto it = keyframes_.find(keyframe); if (it != keyframes_.end()) { return it->second.get(); } else { return nullptr; } } QVariant KeyframeSequenceWidgetQt::itemChange(GraphicsItemChange change, const QVariant& value) { if (change == ItemPositionChange) { // Dragging the keyframesequence to a new time is like snapping its left-most keyframe // - parent coordinates (== track coordinates in our case) auto xResult = value.toPointF().x(); if (scene() && !scene()->views().empty() && QApplication::mouseButtons() == Qt::LeftButton) { const qreal xFirstChild = childItems().empty() ? 0 : childItems().first()->x(); const qreal xLeftBorderOfSequence = xResult + xFirstChild; const qreal xSnappedInScene = getSnapTime(xLeftBorderOfSequence, scene()->views().first()->transform().m11()); xResult = std::max(xSnappedInScene, 0.0) - xFirstChild; } // Restrict vertical movement: y does not change return QPointF(xResult, y()); } else if (change == ItemSelectedChange) { keyframeSequence_.setSelected(value.toBool()); } return QGraphicsItem::itemChange(change, value); } } // namespace animation } // namespace inviwo
39.685185
97
0.690154
BioDataAnalysis
3826493a538c177b705b60750827079f197dd7f3
162
cpp
C++
Game/Client/WXCore/Core/WXObjectFactory.cpp
hackerlank/SourceCode
b702c9e0a9ca5d86933f3c827abb02a18ffc9a59
[ "MIT" ]
4
2021-07-31T13:56:01.000Z
2021-11-13T02:55:10.000Z
Game/Client/WXCore/Core/WXObjectFactory.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
null
null
null
Game/Client/WXCore/Core/WXObjectFactory.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
7
2021-08-31T14:34:23.000Z
2022-01-19T08:25:58.000Z
#include "WXObjectFactory.h" #include "WXObject.h" namespace WX { void ObjectFactory::destroyInstance(Object* object) { delete object; } }
12.461538
55
0.654321
hackerlank
38266974dbd08c54f5a98e37605ab216390edda9
614
cpp
C++
test/framework/test_logger.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
1,467
2016-10-25T12:27:19.000Z
2022-03-28T04:32:05.000Z
test/framework/test_logger.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
2,366
2016-10-25T10:07:57.000Z
2022-03-31T22:03:24.000Z
test/framework/test_logger.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
662
2016-10-26T04:41:22.000Z
2022-03-31T04:15:02.000Z
/** * Copyright Soramitsu Co., Ltd. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ #include "framework/test_logger.hpp" #include "logger/logger_manager.hpp" logger::LoggerManagerTreePtr getTestLoggerManager( const logger::LogLevel &log_level) { static logger::LoggerManagerTreePtr log_manager( std::make_shared<logger::LoggerManagerTree>( logger::LoggerConfig{log_level, logger::getDefaultLogPatterns()})); return log_manager->getChild("Test"); } logger::LoggerPtr getTestLogger(const std::string &tag) { return getTestLoggerManager()->getChild(tag)->getLogger(); }
29.238095
77
0.7443
akshatkarani
382823605523a30a8b080b24cbb5c405f79ecdbe
7,699
cpp
C++
hw4/ch11/file_operation.cpp
Xanonymous-GitHub/os-hw
ec8e8320341028eba6f6ca96e5771f65882ed6d3
[ "MIT" ]
null
null
null
hw4/ch11/file_operation.cpp
Xanonymous-GitHub/os-hw
ec8e8320341028eba6f6ca96e5771f65882ed6d3
[ "MIT" ]
null
null
null
hw4/ch11/file_operation.cpp
Xanonymous-GitHub/os-hw
ec8e8320341028eba6f6ca96e5771f65882ed6d3
[ "MIT" ]
null
null
null
#include "inode.h" int erase_inode_content(int cur_inode) { // flag to verify if deletion completed or not bool delete_completed = false; // iterate over direct pointers for (int i = 0; i < 10; i++) { if (inode_arr[cur_inode].pointer[i] == -1) { delete_completed = true; break; } else { free_data_block_vector.push_back(inode_arr[cur_inode].pointer[i]); inode_arr[cur_inode].pointer[i] = -1; } } int indirectptr; if (!delete_completed) { // reading content of block pointed by indirect pointer indirectptr = inode_arr[cur_inode].pointer[10]; char blockbuffer[BLOCK_SIZE]; int indirect_ptr_array[1024]; block_read(indirectptr, blockbuffer); memcpy(indirect_ptr_array, blockbuffer, sizeof(indirect_ptr_array)); for (int i = 0; i < 1024; i++) { if (indirect_ptr_array[i] == -1) { delete_completed = true; break; } else { free_data_block_vector.push_back(indirect_ptr_array[i]); } } inode_arr[cur_inode].pointer[10] = -1; free_data_block_vector.push_back(indirectptr); } int doubleindirectptr; if (!delete_completed) { doubleindirectptr = inode_arr[cur_inode].pointer[11]; char blockbuffer[BLOCK_SIZE]; int doubleindirect_ptr_array[1024]; block_read(doubleindirectptr, blockbuffer); memcpy(doubleindirect_ptr_array, blockbuffer, sizeof(doubleindirect_ptr_array)); for (int i = 0; i < 1024; i++) { if (doubleindirect_ptr_array[i] == -1) { delete_completed = true; break; } else { int singleindirectptr = doubleindirect_ptr_array[i]; char blockbuffer1[BLOCK_SIZE]; int indirect_ptr_array[1024]; block_read(singleindirectptr, blockbuffer1); memcpy(indirect_ptr_array, blockbuffer1, sizeof(indirect_ptr_array)); for (int i = 0; i < 1024; i++) { if (indirect_ptr_array[i] == -1) { delete_completed = true; break; } else { free_data_block_vector.push_back(indirect_ptr_array[i]); } } free_data_block_vector.push_back(singleindirectptr); } } free_data_block_vector.push_back(doubleindirectptr); } // Resetting inode structure with default values. for (int i = 0; i < 12; ++i) { inode_arr[cur_inode].pointer[i] = -1; } inode_arr[cur_inode].filesize = 0; return 0; } int create_file(char *name) { string filename = string(name); // check if file already exist in disk if (file_to_inode_map.find(filename) != file_to_inode_map.end()) { cout << string(RED) << "Create File Error : File already present !!!" << string(DEFAULT) << endl; return -1; } // check if inode are available if (free_inode_vector.size() == 0) { cout << string(RED) << "Create File Error : No more Inodes available" << string(DEFAULT) << endl; return -1; } // check if datablock are available if (free_data_block_vector.size() == 0) { cout << string(RED) << "Create File Error : No more DataBlock available" << string(DEFAULT) << endl; return -1; } // get next free inode and datablock number int next_avl_inode = free_inode_vector.back(); free_inode_vector.pop_back(); int next_avl_datablock = free_data_block_vector.back(); free_data_block_vector.pop_back(); // assigned one data block to this inode inode_arr[next_avl_inode].pointer[0] = next_avl_datablock; inode_arr[next_avl_inode].filesize = 0; file_to_inode_map[filename] = next_avl_inode; inode_to_file_map[next_avl_inode] = filename; file_inode_mapping_arr[next_avl_inode].inode_num = next_avl_inode; strcpy(file_inode_mapping_arr[next_avl_inode].file_name, name); cout << string(GREEN) << "File Successfully Created :) " << string(DEFAULT) << endl; return 1; } int delete_file(char *name) { string filename = string(name); // check if file exist or not if (file_to_inode_map.find(filename) == file_to_inode_map.end()) { cout << string(RED) << "Delete File Error : File doesn't exist !!!" << string(DEFAULT) << endl; return -1; } // getting inode of file int cur_inode = file_to_inode_map[filename]; for (int i = 0; i < NO_OF_FILE_DESCRIPTORS; i++) { if (file_descriptor_map.find(i) != file_descriptor_map.end() && file_descriptor_map[i].first == cur_inode) { cout << string(RED) << "Delete File Error : File is opened, Can not delete an opened file !!!" << string(DEFAULT) << endl; return -1; } } erase_inode_content(cur_inode); free_inode_vector.push_back(cur_inode); char emptyname[30] = ""; strcpy(file_inode_mapping_arr[cur_inode].file_name, emptyname); file_inode_mapping_arr[cur_inode].inode_num = -1; inode_to_file_map.erase(file_to_inode_map[filename]); file_to_inode_map.erase(filename); cout << string(GREEN) << "File Deleted successfully :) " << string(DEFAULT) << endl; return 0; } int open_file(char *name) { string filename = string(name); if (file_to_inode_map.find(filename) == file_to_inode_map.end()) { cout << string(RED) << "Open File Error : File not found !!!" << string(DEFAULT) << endl; return -1; } if (free_filedescriptor_vector.size() == 0) { cout << string(RED) << "Open File Error : File descriptor not available !!!" << string(DEFAULT) << endl; return -1; } /* asking for mode of file */ int file_mode = -1; do { cout << "0 : read mode\n1 : write mode\n2 : append mode\n"; cin >> file_mode; if (file_mode < 0 || file_mode > 2) { cout << string(RED) << "Please make valid choice" << string(DEFAULT) << endl; } } while (file_mode < 0 || file_mode > 2); int cur_inode = file_to_inode_map[filename]; /* checking if file is already open in write or append mode. */ if (file_mode == 1 || file_mode == 2) { for (int i = 0; i < NO_OF_FILE_DESCRIPTORS; i++) { if (file_descriptor_map.find(i) != file_descriptor_map.end() && file_descriptor_map[i].first == cur_inode && (file_descriptor_mode_map[i] == 1 || file_descriptor_mode_map[i] == 2)) { cout << string(RED) << "File is already in use with file descriptor : " << i << string(DEFAULT) << endl; return -1; } } } int fd = free_filedescriptor_vector.back(); free_filedescriptor_vector.pop_back(); file_descriptor_map[fd].first = cur_inode; file_descriptor_map[fd].second = 0; file_descriptor_mode_map[fd] = file_mode; openfile_count++; cout << string(GREEN) << "File " << filename << " opened with file descriptor : " << fd << string(DEFAULT) << endl; return fd; } int close_file(int fd) { if (file_descriptor_map.find(fd) == file_descriptor_map.end()) { cout << string(RED) << "close File Error : file is not opened yet !!!" << string(DEFAULT) << endl; return -1; } file_descriptor_map.erase(fd); file_descriptor_mode_map.erase(fd); openfile_count--; free_filedescriptor_vector.push_back(fd); cout << string(GREEN) << "File closed successfully :) " << string(DEFAULT) << endl; return 1; }
35.155251
134
0.606053
Xanonymous-GitHub
38284f4dab2e48a712004c651ca40d48d9dfb3f2
287
cpp
C++
pointers_again/pointer_1.cpp
sahilduhan/Learn-C-plus-plus
80dba2ee08b36985deb297293a0318da5d6ace94
[ "RSA-MD" ]
null
null
null
pointers_again/pointer_1.cpp
sahilduhan/Learn-C-plus-plus
80dba2ee08b36985deb297293a0318da5d6ace94
[ "RSA-MD" ]
null
null
null
pointers_again/pointer_1.cpp
sahilduhan/Learn-C-plus-plus
80dba2ee08b36985deb297293a0318da5d6ace94
[ "RSA-MD" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int main() { int a = 100; int *p = &a; // p is a pointer to an integer which points towards the adress of a cout << " the adress of a is " << p << endl; cout << " the adress of the next is " << p + 1 << endl; return 0; }
26.090909
85
0.571429
sahilduhan
382e50d2b8f50e1d48f979c31b8c155252aa26ca
129
cxx
C++
Modules/ThirdParty/VNL/src/vxl/core/vnl/xio/tests/test_driver.cxx
arobert01/ITK
230d319fdeaa3877273fab5d409dd6c11f0a6874
[ "Apache-2.0" ]
945
2015-01-09T00:43:52.000Z
2022-03-30T08:23:02.000Z
Modules/ThirdParty/VNL/src/vxl/core/vnl/xio/tests/test_driver.cxx
arobert01/ITK
230d319fdeaa3877273fab5d409dd6c11f0a6874
[ "Apache-2.0" ]
2,354
2015-02-04T21:54:21.000Z
2022-03-31T20:58:21.000Z
Modules/ThirdParty/VNL/src/vxl/core/vnl/xio/tests/test_driver.cxx
arobert01/ITK
230d319fdeaa3877273fab5d409dd6c11f0a6874
[ "Apache-2.0" ]
566
2015-01-04T14:26:57.000Z
2022-03-18T20:33:18.000Z
#include "testlib/testlib_register.h" DECLARE(test_vnl_xio); void register_tests() { REGISTER(test_vnl_xio); } DEFINE_MAIN;
10.75
37
0.767442
arobert01
383234b936ca1442c0be2bfcff02cba5ae3d58bd
3,277
cc
C++
old-software/kpixSw/sidApi/online/KpixHistogram.cc
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
null
null
null
old-software/kpixSw/sidApi/online/KpixHistogram.cc
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
3
2021-04-06T08:33:01.000Z
2021-04-30T16:16:33.000Z
old-software/kpixSw/sidApi/online/KpixHistogram.cc
slaclab/kpix
abf5b87f9a5d25e4810fc5be523bdcc76c5cba91
[ "BSD-3-Clause-LBNL" ]
1
2020-12-12T22:58:44.000Z
2020-12-12T22:58:44.000Z
//----------------------------------------------------------------------------- // File : KpixHistogram.h // Author : Ryan Herbst <rherbst@slac.stanford.edu> // Created : 10/15/2008 // Project : SID Electronics API //----------------------------------------------------------------------------- // Description : // Class to track histograms generated in KPIX runs. //----------------------------------------------------------------------------- // Copyright (c) 2009 by SLAC. All rights reserved. // Proprietary and confidential to SLAC. //----------------------------------------------------------------------------- // Modification history : // 10/15/2008: created // 03/03/2009: changed container values to unsigned int // 06/22/2009: Added namespaces. // 06/23/2009: Removed namespaces. //----------------------------------------------------------------------------- #include <string> #include <stdlib.h> #include "KpixHistogram.h" using namespace std; // Constructor KpixHistogram::KpixHistogram () { data = NULL; entries = 0; min = 0; max = 0; } // DeConstructor KpixHistogram::~KpixHistogram ( ) { if ( data != NULL ) free(data); } // Add an entry void KpixHistogram::fill(unsigned int value) { unsigned int *newData; unsigned int newEntries; unsigned int x,diff; // First entry is added if ( data == NULL ) { data = (unsigned int *) malloc(sizeof(unsigned int)); if ( data == NULL ) throw(string("KpixHistogram::fill -> Malloc Error")); data[0] = 1; entries = 1; min = value; max = value; } else { // Entry is lower than the min value if ( value < min ) { diff = min-value; newEntries = entries + diff; newData = (unsigned int *) malloc(newEntries * sizeof(unsigned int)); if ( newData == NULL ) throw(string("KpixHistogram::fill -> Malloc Error")); for (x=0; x < diff; x++) newData[x] = 0; for (x=0; x < entries; x++) newData[x+diff] = data[x]; free(data); data = newData; entries = newEntries; min = value; } // Entry is larger than the max value else if ( value > max ) { diff = value-max; newEntries = entries + diff; newData = (unsigned int *) malloc(newEntries * sizeof(unsigned int)); if ( newData == NULL ) throw(string("KpixHistogram::fill -> Malloc Error")); for (x=0; x < entries; x++) newData[x] = data[x]; for (x=0; x < diff; x++) newData[x+entries] = 0; free(data); data = newData; entries = newEntries; max = value; } // Add new entry data[value-min]++; } } // Get Number Of Entries unsigned int KpixHistogram::binCount() { return(entries); } // Get Min Value unsigned int KpixHistogram::minValue() { return(min); } // Get Max Value unsigned int KpixHistogram::maxValue() { return(max); } // Get Bin Value unsigned int KpixHistogram::value(unsigned int bin) { if ( bin < entries ) return(min+bin); else return(0); } // Get Bin Count unsigned int KpixHistogram::count(unsigned int bin) { if ( bin < entries ) return(data[bin]); else return(0); }
28.745614
85
0.5148
slaclab
3833640b3de34ac049d4def56c2a4e4f1e450837
2,533
cpp
C++
clang-tools-extra/clang-tidy/bugprone/BadSignalToKillThreadCheck.cpp
rarutyun/llvm
76fa6b3bcade074bdedef740001c4528e1aa08a8
[ "Apache-2.0" ]
305
2019-09-14T17:16:05.000Z
2022-03-31T15:05:20.000Z
clang-tools-extra/clang-tidy/bugprone/BadSignalToKillThreadCheck.cpp
rarutyun/llvm
76fa6b3bcade074bdedef740001c4528e1aa08a8
[ "Apache-2.0" ]
410
2019-06-06T20:52:32.000Z
2022-01-18T14:21:48.000Z
clang-tools-extra/clang-tidy/bugprone/BadSignalToKillThreadCheck.cpp
rarutyun/llvm
76fa6b3bcade074bdedef740001c4528e1aa08a8
[ "Apache-2.0" ]
50
2019-05-10T21:12:24.000Z
2022-01-21T06:39:47.000Z
//===--- BadSignalToKillThreadCheck.cpp - clang-tidy ---------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "BadSignalToKillThreadCheck.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Lex/Preprocessor.h" using namespace clang::ast_matchers; namespace clang { namespace tidy { namespace bugprone { void BadSignalToKillThreadCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( callExpr(allOf(callee(functionDecl(hasName("::pthread_kill"))), argumentCountIs(2)), hasArgument(1, integerLiteral().bind("integer-literal"))) .bind("thread-kill"), this); } static Preprocessor *PP; void BadSignalToKillThreadCheck::check(const MatchFinder::MatchResult &Result) { const auto IsSigterm = [](const auto &KeyValue) -> bool { return KeyValue.first->getName() == "SIGTERM" && KeyValue.first->hasMacroDefinition(); }; const auto TryExpandAsInteger = [](Preprocessor::macro_iterator It) -> Optional<unsigned> { if (It == PP->macro_end()) return llvm::None; const MacroInfo *MI = PP->getMacroInfo(It->first); const Token &T = MI->tokens().back(); if (!T.isLiteral() || !T.getLiteralData()) return llvm::None; StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength()); llvm::APInt IntValue; constexpr unsigned AutoSenseRadix = 0; if (ValueStr.getAsInteger(AutoSenseRadix, IntValue)) return llvm::None; return IntValue.getZExtValue(); }; const auto SigtermMacro = llvm::find_if(PP->macros(), IsSigterm); if (!SigtermValue && !(SigtermValue = TryExpandAsInteger(SigtermMacro))) return; const auto *MatchedExpr = Result.Nodes.getNodeAs<Expr>("thread-kill"); const auto *MatchedIntLiteral = Result.Nodes.getNodeAs<IntegerLiteral>("integer-literal"); if (MatchedIntLiteral->getValue() == *SigtermValue) { diag(MatchedExpr->getBeginLoc(), "thread should not be terminated by raising the 'SIGTERM' signal"); } } void BadSignalToKillThreadCheck::registerPPCallbacks( const SourceManager &SM, Preprocessor *pp, Preprocessor *ModuleExpanderPP) { PP = pp; } } // namespace bugprone } // namespace tidy } // namespace clang
33.773333
80
0.667588
rarutyun
383509b931755ac2dc15276fc93191f18e9308bd
28,288
cpp
C++
extRCap.cpp
ilesser/OpenRCX
2d55c222b50de659f9792ffd3dfce2cda7a1e276
[ "BSD-3-Clause" ]
null
null
null
extRCap.cpp
ilesser/OpenRCX
2d55c222b50de659f9792ffd3dfce2cda7a1e276
[ "BSD-3-Clause" ]
null
null
null
extRCap.cpp
ilesser/OpenRCX
2d55c222b50de659f9792ffd3dfce2cda7a1e276
[ "BSD-3-Clause" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // BSD 3-Clause License // // Copyright (c) 2019, Nefelus Inc // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //#include "wire.h" #include <wire.h> #include "extRCap.h" #ifdef _WIN32 #include "direct.h" #endif #include <vector> #include <map> #include "darr.h" //#include "logger.h" #include <logger.h> BEGIN_NAMESPACE_ADS static int read_total_cap_file(const char *file,double *ctotV,double *rtotV,int nmax, dbBlock *block) { #ifndef BILL_WAY Ath__parser parser; parser.openFile((char*) file); notice(0, "Reading ref_file %s ... ... \n", file); while (parser.parseNextLine()>0) { parser.printWords(stdout); uint netid= 0; if (parser.isDigit(0,0)) netid= parser.getInt(0); else { char *netName= parser.get(0); if (block!=NULL) { dbNet *net= block->findNet(netName); if (net==NULL) warning(0, "Cannot find net %s in db\n", netName); } } double rtot= 0.0; if (parser.getWordCnt()>2) rtot= parser.getDouble(2); double ctot= parser.getDouble(1); ctotV[netid] = ctot; rtotV[netid] = rtot; } #else FILE *fp = fopen(file,"r"); if (!fp) { warning(0, "cannot open %s\n",file); return 0; } char line[256]; int netid; double ctot,rtot; while (fgets(line,256,fp)) { if (3 == sscanf(line,"%d %lf %lf",&netid,&ctot,&rtot)) { if (netid < 0 || netid >= nmax) { warning(0, "net id %d out of range in %s\n",netid,file); fclose(fp); return 0; } ctotV[netid] = ctot; rtotV[netid] = rtot; } } fclose(fp); #endif return 1; } typedef struct { int netid; double ctot; double cref; double cdif; double rtot; double rref; double rdif; } ext_rctot; static int ext_rctot_cmp_c(const void *a,const void *b) { ext_rctot *x = (ext_rctot*)a; ext_rctot *y = (ext_rctot*)b; if (x->cdif < y->cdif) return 1; if (x->cdif > y->cdif) return -1; return 0; } void extMain::initIncrementalSpef(const char *origp, const char *newp, const char *reader, const char *excludeC, bool noBackSlash) { if (_origSpefFilePrefix) free(_origSpefFilePrefix); _origSpefFilePrefix = NULL; if (origp) _origSpefFilePrefix = strdup ((char*)origp); if (_newSpefFilePrefix) free(_newSpefFilePrefix); _newSpefFilePrefix = NULL; if (newp) _newSpefFilePrefix = strdup ((char*)newp); if (_excludeCells) free(_excludeCells); _excludeCells = NULL; if (excludeC) _excludeCells = strdup ((char*)excludeC); if (!_origSpefFilePrefix && !_newSpefFilePrefix) _bufSpefCnt = 0; else _bufSpefCnt = 1; _incrNoBackSlash = noBackSlash; _incrSpefPrimtime = false; _incrSpefPsta = false; if ( reader ) { if (strcmp(reader, "prime_time") == 0) _incrSpefPrimtime = true; else if (strcmp(reader, "psta") == 0) _incrSpefPsta = true; else warning (0, "unknown reader %s\n", reader); } else { _incrSpefPrimtime = false; _incrSpefPsta = false; } } #ifndef DEFAULT_BILL_WAY void extMain::reportTotalCap(const char *file,bool icap,bool ires,double ccmult,const char *ref,const char *rd_file) { FILE *fp = stdout; if (file!=NULL) fp = fopen(file,"w"); else return; if (ref==NULL) { dbSet<dbNet> nets = _block->getNets(); dbSet<dbNet>::iterator nitr; for (nitr = nets.begin(); nitr != nets.end(); ++nitr) { dbNet *net = *nitr; float totCap = net->getTotalCapacitance(0, true); float ccCap = net->getTotalCouplingCap(0); fprintf(fp, "%13.6f %13.6f %s\n", totCap, ccCap, net->getConstName()); } } else { Ath__parser parser; parser.openFile((char*) ref); notice(0, "Reading ref_file %s ...\n", ref); while (parser.parseNextLine()>0) { //parser.printWords(stdout); dbNet *net= NULL; uint netid= 0; if (parser.isDigit(0,0)) netid= parser.getInt(0); else { char *netName= parser.get(0); if (_block!=NULL) { net= _block->findNet(netName); if (net==NULL) { warning(0, "Cannot find net %s in db\n", netName); continue; } } } if (net==NULL) continue; if (parser.getWordCnt()<2) continue; float totCap = net->getTotalCapacitance(0, true); float ccCap = net->getTotalCouplingCap(0); double ref_tot = parser.getDouble(1); double tot_diff = 100.0*(ref_tot-totCap)/ref_tot; if (parser.getWordCnt()<3) { fprintf(fp, "%5.1f %13.6f %13.6f %s\n",tot_diff,totCap, ref_tot, net->getConstName()); continue; } double ref_cc = parser.getDouble(2); double cc_diff = 100.0*(ref_cc-ccCap)/ref_cc; fprintf(fp, "%5.1f %5.1f %13.6f %13.6f %13.6f %13.6f %s\n", tot_diff, cc_diff, totCap, ref_tot, ccCap, ref_cc, net->getConstName()); } } if (file!=NULL) fclose(fp); } #else void extMain::reportTotalCap(const char *file,bool icap,bool ires,double ccmult,const char *ref,const char *rd_file) { bool cap = icap; bool res = ires; if (!res && !cap) res = cap = true; if (ccmult != 1.0) notice(0, "ccmult %g\n",ccmult); int j,nn = 2+_block->getNets().size(); double *ctotV = (double*)malloc(nn*sizeof(double)); double *rtotV = (double*)malloc(nn*sizeof(double)); for (j=0;j<nn;j++) ctotV[j] = rtotV[j] = 0.0; dbSet<dbNet> nets = _block->getNets(); dbSet<dbNet>::iterator nitr; dbNet *net; dbCapNode *node; if (rd_file && rd_file[0]) { if (!read_total_cap_file(rd_file,ctotV,rtotV,nn,_block)) { warning(0, "cannot read %s\n",rd_file); return; } } else for (nitr = nets.begin(); nitr != nets.end(); ++nitr) { net = *nitr; dbSet<dbCapNode> nodeSet= net->getCapNodes(); dbSet<dbCapNode>::iterator c_itr; bool has_foreign = false; double ctot = 0.0; for( c_itr = nodeSet.begin(); c_itr != nodeSet.end(); ++c_itr ) { node = *c_itr; if (node->isForeign()) has_foreign = true; ctot += node->getCapacitance(0); } double rtot = 0.0; dbSet<dbRSeg> rSet= net->getRSegs(); dbSet<dbRSeg>::iterator r_itr; for( r_itr = rSet.begin(); r_itr != rSet.end(); ++r_itr ) { dbRSeg* r = *r_itr; rtot += r->getResistance(0); if (!has_foreign) ctot += r->getCapacitance(0); } double cctot = net->getTotalCouplingCap(0); ctot += ccmult*cctot; ctot *= 1e-3; rtotV[net->getId()] = rtot; ctotV[net->getId()] = ctot; } double *crefV = NULL; double *rrefV = NULL; if (ref && ref[0]) { crefV = (double*)malloc(nn*sizeof(double)); rrefV = (double*)malloc(nn*sizeof(double)); for (j=0;j<nn;j++) crefV[j] = rrefV[j] = 0.0; if (!read_total_cap_file(ref,crefV,rrefV,nn, _block)) { warning(0, "cannot read %s\n",ref); free(crefV); crefV = NULL; free(rrefV); rrefV = NULL; } } FILE *fp = NULL; if (file && file[0]) fp = fopen(file,"w"); if (fp && !crefV) { for (j=0;j<nn;j++) if (ctotV[j]>0.0 || rtotV[j]>0.0) { if (cap && res) fprintf(fp,"%d %g %.2f\n",j,ctotV[j],rtotV[j]); else if (cap) fprintf(fp,"%d %g\n",j,ctotV[j]); else fprintf(fp,"%d %.2f\n",j,rtotV[j]); } } else if (crefV) { double max_abs_c = 0.0; double max_abs_r = 0.0; double abs_cthresh = 0.001; // pf double abs_cthresh2 = 0.0005; // pf double abs_rthresh = 1.0; // ohms double rel_cfloor = 0.010; // 10 ff double rel_cfloor2 = 0.001; // 1 ff double max_rel_c = 0.0; double max_rel_c2 = 0.0; uint max_rel_c_id = 0; uint max_rel_c_id2 = 0; double rel_cthresh = 0.02; // 2 percent int rel_cn = 0; // number over rel_cthresh int rel_cn2 = 0; ext_rctot *rctotV = (ext_rctot*)malloc(nn*sizeof(ext_rctot)); int rctotN = 0; ext_rctot *rctot; double cdif,rdif,cdif_avg = 0.0,rdif_avg = 0.0; double crel,cden; int ncdif = 0, nrdif = 0, ncdif2 = 0; int crel_cnt = 0, crel_cnt2 = 0; for (j=0;j<nn;j++) { if (ctotV[j]==0.0 && rtotV[j]==0.0 && crefV[j]==0.0 && rrefV[j]==0.0) continue; cdif = ctotV[j]-crefV[j]; rdif = rtotV[j]-rrefV[j]; cdif_avg += cdif; rdif_avg += rdif; if (cdif >= abs_cthresh || cdif <= -abs_cthresh) ncdif++; if (cdif >= abs_cthresh2 || cdif <= -abs_cthresh2) ncdif2++; if (rdif >= abs_rthresh || rdif <= -abs_rthresh) nrdif++; rctot = rctotV + rctotN++; rctot->netid = j; rctot->ctot = ctotV[j]; rctot->cref = crefV[j]; rctot->cdif = cdif; rctot->rtot = rtotV[j]; rctot->rref = rrefV[j]; rctot->rdif = rdif; if (cdif < 0.0) cdif = -cdif; if (cdif > max_abs_c) { max_abs_c = cdif; } if (rdif < 0.0) rdif = -rdif; if (rdif > max_abs_r) { max_abs_r = rdif; } cden = (crefV[j] >= ctotV[j] ? crefV[j] : ctotV[j]); if (cden >= rel_cfloor) { crel_cnt++; crel = cdif/cden; if (crel > max_rel_c) { max_rel_c = crel; max_rel_c_id = j; } if (crel >= rel_cthresh) { rel_cn++; } } if (cden >= rel_cfloor2) { crel_cnt2++; crel = cdif/cden; if (crel > max_rel_c2) { max_rel_c2 = crel; max_rel_c_id2 = j; } if (crel >= rel_cthresh) { rel_cn2++; } } } notice(0, "comparing all %d signal nets\n",rctotN); notice(0, " worst abs ctot diff = %.4f pf\n",max_abs_c); notice(0, " worst abs rtot diff = %.2f ohms\n",max_abs_r); notice(0, "\n"); notice(0, "comparing nets with c>=%.4f, %d nets\n",rel_cfloor,crel_cnt); notice(0, " worst percent ctot diff = %.1f %% for c>=%.4f\n",100.0*max_rel_c,rel_cfloor); if (max_rel_c_id) { j = max_rel_c_id; net = dbNet::getNet(_block,j); notice(0, " net %d %s\n",net->getId(),net->getName().c_str()); notice(0, " ctot %.4f cref %.4f rtot %.2f rref %.2f\n", ctotV[j],crefV[j],rtotV[j],rrefV[j]); } notice(0, " %d nets have ctot diff >= %.1f %% for c>=%.4f\n",rel_cn,100.0*rel_cthresh,rel_cfloor); notice(0, "\n"); notice(0, "comparing nets with c>=%.4f, %d nets\n",rel_cfloor2,crel_cnt2); notice(0, " worst percent ctot diff = %.1f %% for c>=%.4f\n",100.0*max_rel_c2,rel_cfloor2); if (max_rel_c_id2) { j = max_rel_c_id2; net = dbNet::getNet( _block,j); notice(0, " net %d %s\n",net->getId(),net->getName().c_str()); notice(0, " ctot %.4f cref %.4f rtot %.2f rref %.2f\n", ctotV[j],crefV[j],rtotV[j],rrefV[j]); } notice(0, " %d nets have ctot diff >= %.1f %% for c>=%.4f\n",rel_cn2,100.0*rel_cthresh,rel_cfloor2); notice(0, "\n"); if (rctotN > 0) { cdif_avg /= rctotN; rdif_avg /= rctotN; qsort(rctotV,rctotN,sizeof(ext_rctot),ext_rctot_cmp_c); rctot = rctotV; if (rctot->cdif > 0.0) { notice(0, "max ctot diff vs ref = %.4f pf\n",rctot->cdif); net = dbNet::getNet(_block,rctot->netid); notice(0, "net %d %s\n",net->getId(),net->getName().c_str()); notice(0, "ctot %.4f cref %.4f rtot %.2f rref %.2f\n", rctot->ctot,rctot->cref,rctot->rtot,rctot->rref); } rctot = rctotV+rctotN-1; if (rctot->cdif < 0.0) { notice(0, "min ctot diff vs ref = %.4f pf\n",rctot->cdif); net = dbNet::getNet(_block,rctot->netid); notice(0, "net %d %s\n",net->getId(),net->getName().c_str()); notice(0, "ctot %.4f cref %.4f rtot %.2f rref %.2f\n", rctot->ctot,rctot->cref,rctot->rtot,rctot->rref); } notice(0, "avg ctot diff vs ref = %.4f pf\n",cdif_avg); notice(0, "avg rtot diff vs ref = %.2f ohms\n",rdif_avg); notice(0, "%d nets have absolute ctot diff >= %.4f\n",ncdif,abs_cthresh); notice(0, "%d nets have absolute ctot diff >= %.4f\n",ncdif2,abs_cthresh2); notice(0, "%d nets have absolute rtot diff >= %.2f\n",nrdif,abs_rthresh); if (fp && ncdif+nrdif) { fprintf(fp,"# netid cdif ctot cref rdif rtot rref\n"); for (j=0;j<rctotN;j++) { rctot = rctotV+j; if (rctot->cdif<abs_cthresh2 && rctot->cdif> -abs_cthresh2 && rctot->rdif<abs_rthresh && rctot->rdif> -abs_rthresh ) continue; fprintf(fp,"%6d %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f\n", rctot->netid,rctot->cdif,rctot->ctot,rctot->cref, rctot->rdif,rctot->rtot,rctot->rref); } } } free(rctotV); } free(ctotV); free(rtotV); if (crefV) free(crefV); if (rrefV) free(rrefV); if (fp) fclose(fp); } #endif ///////////////////////////////////////////////////// typedef struct { int netid0; int netid1; double cctot; double ccref; double ccdif; } ext_cctot; static bool read_total_cc_file(const char *file,Darr<ext_cctot> &V) { FILE *fp = fopen(file,"r"); if (!fp) { notice(0, "cannot open %s\n",file); return false; } char line[256]; ext_cctot x; x.ccref = x.ccdif = 0.0; while (fgets(line,256,fp)) { if (3 == sscanf(line,"%d %d %lf",&x.netid0,&x.netid1,&x.cctot)) { V.insert(x); } } fclose(fp); return true; } static int ext_cctot_cmp(const void *a,const void *b) { ext_cctot *x = (ext_cctot*)a; ext_cctot *y = (ext_cctot*)b; if (x->ccdif < y->ccdif) return 1; if (x->ccdif > y->ccdif) return -1; return 0; } static bool read_ref_cc_file(const char *file,int netn,Darr<ext_cctot> &V) { FILE *fp = fopen(file,"r"); if (!fp) { notice(0, "cannot open %s\n",file); return false; } int *indV = (int*)malloc((2+netn)*sizeof(int)); int nn = V.n(); char line[256]; ext_cctot x; int j; int netid0 = 0; for (j=0;j<nn;j++) { x = V.get(j); if (netid0 < x.netid0) { while (++netid0 < x.netid0) { indV[netid0] = j; } indV[netid0] = j; } } indV[netid0+1] = j; int netid1; double ccref; while (fgets(line,256,fp)) { if (3 == sscanf(line,"%d %d %lf",&netid0,&netid1,&ccref)) { int j0 = indV[netid0]; int j1 = indV[netid0+1]; if (j0>=j1) continue; for (j=j0;j<j1;j++) { x = V.get(j); if (x.netid1 == netid1) { x.ccref = ccref; V.set(j,x); break; } } if (j<j1) continue; // not found x.netid0 = netid0; x.netid1 = netid1; x.cctot = 0.0; x.ccref = ccref; x.ccdif = -ccref; V.insert(x); } } free(indV); return true; } void extMain::reportTotalCc(const char *file,const char *ref,const char *rd_file) { notice(0, "\n"); Darr<ext_cctot> V; dbSet<dbNet> nets = _block->getNets(); dbSet<dbNet>::iterator nitr; dbNet *net0,*net1; std::vector<dbNet*> netV; std::vector<double> ccV; // dbSet<dbCCSeg> ccSet; std::vector<dbCCSeg *>::iterator cc_itr; dbCCSeg *cc; int j,nn,netN; ext_cctot x; x.ccref = 0.0; x.ccdif = 0.0; if (rd_file) { if (!read_total_cc_file(rd_file,V) || V.n()<1) { notice(0, "cannot read %s\n",rd_file); return; } } else for (nitr = nets.begin(); nitr != nets.end(); ++nitr) { net0 = *nitr; netN = 0; netV.clear(); ccV.clear(); std::vector<dbCCSeg *> ccSet1; net0->getSrcCCSegs(ccSet1); for (cc_itr = ccSet1.begin(); cc_itr != ccSet1.end(); ++cc_itr ) { cc = *cc_itr; net1 = cc->getTargetNet(); if (net1->getId() > net0->getId()) continue; for (j=0;j<netN;j++) if (net1 == netV[j]) break; if (j==netN) { netV.push_back(net1); ccV.push_back(0.0); netN++; } ccV[j] += cc->getCapacitance(0); } std::vector<dbCCSeg *> ccSet2; net0->getTgtCCSegs(ccSet2); for (cc_itr = ccSet2.begin(); cc_itr != ccSet2.end(); ++cc_itr ) { cc = *cc_itr; net1 = cc->getSourceNet(); if (net1->getId() > net0->getId()) continue; for (j=0;j<netN;j++) if (net1 == netV[j]) break; if (j==netN) { netV.push_back(net1); ccV.push_back(0.0); netN++; } ccV[j] += cc->getCapacitance(0); } for (j=0;j<netN;j++) { x.netid0 = net0->getId(); x.netid1 = netV[j]->getId(); x.cctot = 1e-3*ccV[j]; V.insert(x); } } if (ref) { if (!read_ref_cc_file(ref,nets.size(),V)) { notice(0, "cannot read %s\n",ref); return; } } nn = V.n(); FILE *fp = NULL; if (file) fp = fopen(file,"w"); if (fp && !ref) { for (j=0;j<nn;j++) { x = V.get(j); fprintf(fp,"%d %d %g\n",x.netid0,x.netid1,x.cctot); } } else if (ref) { double max_abs_cc = 0.0; double abs_ccthresh = 5e-4; // pf, so 0.5 ff double abs_ccthresh2 = 1e-4; // 0.1 ff int nccdif = 0; int nccdif2 = 0; for (j=0;j<nn;j++) { x = V.get(j); x.ccdif = x.cctot - x.ccref; V.set(j,x); double difabs = (x.ccdif<0 ? -x.ccdif : x.ccdif); if (difabs >= abs_ccthresh) nccdif++; if (difabs >= abs_ccthresh2) nccdif2++; if (difabs > max_abs_cc) { max_abs_cc = difabs; } } notice(0, "worst abs cctot(net0,net1) diff = %g pf\n",max_abs_cc); notice(0, "%d net pairs have absolute cctot diff > %g pf\n",nccdif,abs_ccthresh); notice(0, "%d net pairs have absolute cctot diff > %g pf\n",nccdif2,abs_ccthresh2); V.dsort(ext_cctot_cmp); dbNet *net0, *net1; x = V.get(0); if (x.ccdif > 0.0) { notice(0, "max cctot diff vs ref = %g pf\n",x.ccdif); net0 = dbNet::getNet(_block,x.netid0); net1 = dbNet::getNet(_block,x.netid1); notice(0, "net0 %d %s\n",net0->getId(),net0->getConstName()); notice(0, "net1 %d %s\n",net1->getId(),net1->getConstName()); notice(0, "cctot %g ccref %g ccdif %g\n",x.cctot,x.ccref,x.ccdif); } x = V.get(nn-1); if (x.ccdif < 0.0) { notice(0, "min cctot diff vs ref = %g pf\n",x.ccdif); net0 = dbNet::getNet(_block,x.netid0); net1 = dbNet::getNet(_block,x.netid1); notice(0, "net0 %d %s\n",net0->getId(),net0->getConstName()); notice(0, "net1 %d %s\n",net1->getId(),net1->getConstName()); notice(0, "cctot %g ccref %g ccdif %g\n",x.cctot,x.ccref,x.ccdif); } if (fp) { fprintf(fp,"# netid0 netid1 cctot ccref ccdif\n"); for (j=0;j<nn;j++) { x = V.get(j); if (x.ccdif < abs_ccthresh && x.ccdif > -abs_ccthresh) continue; fprintf(fp,"%6d %6d %8g %8g %8g\n",x.netid0,x.netid1,x.cctot,x.ccref,x.ccdif); } } } if (fp) fclose(fp); } ///////////////////////////////////////////////////// void extMain::extDump(char *file, bool openTreeFile, bool closeTreeFile, bool ccCapGeom, bool ccNetGeom, bool trackCnt, bool signal, bool power, uint layer) { Ath__searchBox bb; ZPtr<ISdb> targetSdb; if (closeTreeFile) { if (_ptFile) fclose (_ptFile); _ptFile = NULL; _block->setPtFile(NULL); return; } else if (ccCapGeom) targetSdb = _extCcapSDB; else if (ccNetGeom || trackCnt) targetSdb = _extNetSDB; else if (!openTreeFile && !trackCnt) return; if (!file || !file[0]) { notice(0, "please input dump file name\n"); return; } FILE *fp = fopen(file,"w"); if (!fp) { notice(0, "can not open file %s\n", file); return; } if (openTreeFile) { _ptFile = fp; _block->setPtFile(fp); return; } if (trackCnt) { targetSdb->dumpTrackCounts(fp); fclose(fp); return; } bool dumpSignalWire = true; bool dumpPowerWire = true; if (signal && !power) dumpPowerWire = false; if (!signal && power) dumpSignalWire = false; bool *etable = (bool*) malloc(100*sizeof(bool)); bool init = layer==0 ? false : true; for (uint idx=0; idx<100; idx++) etable[idx] = init; etable[layer] = false; targetSdb->resetMaxArea(); dbBox *tbox = _block->getBBox(); targetSdb->searchWireIds(tbox->xMin(), tbox->yMin(), tbox->xMax(), tbox->yMax(), false, etable); targetSdb->startIterator(); uint wid, wflags; while ((wid=targetSdb->getNextWireId())) { if (ccNetGeom) { wflags = targetSdb->getSearchPtr()->getWirePtr(wid)->getFlags(); if ((wflags == 1 && !dumpPowerWire) || (wflags == 2 && !dumpSignalWire)) continue; } targetSdb->getSearchPtr()->getCoords(&bb,wid); fprintf(fp,"m%d %d %d %d %d\n", bb.getLevel(), bb.loXY(0), bb.loXY(1), bb.hiXY(0), bb.hiXY(1)); } if (fp) fclose(fp); } void extMain::extCount( bool signalWireSeg, bool powerWireSeg) { if (!signalWireSeg && !powerWireSeg) signalWireSeg = powerWireSeg = true; uint signalViaCnt = 0; uint signalWireCnt = 0; uint powerViaCnt = 0; uint powerWireCnt = 0; dbSet<dbNet> bnets = _block->getNets(); dbSet<dbNet>::iterator net_itr; dbNet *net; for( net_itr = bnets.begin(); net_itr != bnets.end(); ++net_itr ) { net = *net_itr; dbSigType type= net->getSigType(); if ((type==dbSigType::POWER)||(type==dbSigType::GROUND)) net->getPowerWireCount (powerWireCnt, powerViaCnt); else net->getSignalWireCount (signalWireCnt, signalViaCnt); } if (signalWireSeg) notice (0," %d signal seg (%d wire, %d via)\n", signalWireCnt+signalViaCnt, signalWireCnt, signalViaCnt); if (powerWireSeg) notice (0, " %d power seg (%d wire, %d via)\n", powerWireCnt+powerViaCnt, powerWireCnt, powerViaCnt); } /* class extNetStats { double _tcap[2]; double _ccap[2]; double _cc2tcap[2]; double _cc[2]; uint _len[2]; uint _layerCnt[2]; uint _wCnt[2]; uint _vCnt[2]; uint _resCnt[2]; uint _ccCnt[2]; uint _gndCnt[2]; uint _id; bool _layerFilter[20]; adsRect _bbox; }; */ bool extMain::outOfBounds_i(int limit[2], int v) { if ((v<limit[0]) || (v>limit[1])) return true; else return false; } bool extMain::outOfBounds_d(double limit[2], double v) { if ((v<limit[0]) || (v>limit[1])) return true; else return false; } bool extMain::printNetRC(char *buff, dbNet *net, extNetStats *st) { double tCap= net->getTotalCapacitance(0, true); if (tCap<=0.0) return false; if (outOfBounds_d(st->_tcap, tCap)) return false; double ccCap= net->getTotalCouplingCap(); if (outOfBounds_d(st->_ccap, ccCap)) return false; double cc2tcap= 0.0; if (ccCap>0.0) { cc2tcap= ccCap/tCap; if (outOfBounds_d(st->_cc2tcap, cc2tcap)) return false; } else return false; double res= net->getTotalResistance(); if (outOfBounds_d(st->_res, res)) return false; // fprintf(fp, "C %8.3 CC %8.3f CCr %3.1f R %8.2f maxCC= %8.4f ", // tCap, ccCap, cc2tcap, res, maxCC); sprintf(buff, "C %.3f CC %.3f CCr %2.1f R %.1f ", tCap, ccCap, cc2tcap, res); return true; } bool extMain::printNetDB(char *buff, dbNet *net, extNetStats *st) { uint termCnt= net->getTermCount(); if (outOfBounds_i(st->_termCnt, termCnt)) return false; uint btermCnt= net->getBTermCount(); if (outOfBounds_i(st->_btermCnt, btermCnt)) return false; uint wireCnt= 0; uint viaCnt= 0; uint len= 0; uint layerCnt=0; uint layerTable[12]; for (uint jj= 0; jj<12; jj++) layerTable[jj]= 0; net->getNetStats(wireCnt, viaCnt, len, layerCnt, layerTable); uint ii= 1; for (; ii<12; ii++) { if (layerTable[ii]==0) continue; layerCnt ++; if (!st->_layerFilter[ii]) return false; } if (outOfBounds_i(st->_vCnt, viaCnt)) return false; if (outOfBounds_i(st->_wCnt, wireCnt)) return false; if (outOfBounds_i(st->_len, len)) return false; if (outOfBounds_i(st->_layerCnt, layerCnt)) return false; char buf1[256]; sprintf(buf1, "%s", "\0"); ii= 1; for (; ii<12; ii++) { if (layerTable[ii]>0) { sprintf(buf1, "%s%d", buf1, ii); break; } } ii++; for (; ii<12; ii++) { if (layerTable[ii]==0) continue; sprintf(buf1, "%s.%d", buf1, ii); } sprintf(buff, "V %d Wc %d L %d %dM%s T %d B %d", viaCnt, wireCnt, len/1000, layerCnt, buf1, termCnt, btermCnt); return true; } uint extMain::printNetStats(FILE *fp, dbBlock *block, extNetStats *bounds, bool skipRC, bool skipDb, bool skipPower, std::list<int> *list_of_nets) { adsRect bbox(bounds->_ll[0], bounds->_ll[1], bounds->_ur[0], bounds->_ur[1]); char buff1[256]; char buff2[256]; uint cnt= 0; dbSet<dbNet> bnets = block->getNets(); dbSet<dbNet>::iterator net_itr; for( net_itr = bnets.begin(); net_itr != bnets.end(); ++net_itr ) { dbNet* net = *net_itr; // uint viaCnt = 0; // uint wireCnt = 0; dbSigType type= net->getSigType(); if ((type==dbSigType::POWER)||(type==dbSigType::GROUND)) { if (skipPower) continue; //net->getPowerWireCount (powerWireCnt, powerViaCnt); continue; } if (!net->isEnclosed(&bbox)) continue; if (!skipRC) { if (!printNetRC(buff1, net, bounds)) continue; } if (!skipDb) { if (!printNetDB(buff2, net, bounds)) continue; } fprintf(fp, "%s %s ", buff1, buff2); net->printNetName(fp, true, true); list_of_nets->push_back(net->getId()); cnt ++; } return cnt; } void extNetStats::reset() { _tcap[0]= 0.0; _tcap[1]= 1.0*INT_MAX; _ccap[0]= 0.0; _ccap[1]= 1.0*INT_MAX; _cc2tcap[0]= 0.0; _cc2tcap[1]= 1.0*INT_MAX; _cc[0]= 0.0; _cc[1]= 1.0*INT_MAX; _res[0]= 0.0; _res[1]= 1.0*INT_MAX; _len[0]= 0; _len[1]= INT_MAX; _layerCnt[0]= 0; _layerCnt[1]= INT_MAX; _wCnt[0]= 0; _wCnt[1]= INT_MAX; _vCnt[0]= 0; _vCnt[1]= INT_MAX; _resCnt[0]= 0; _resCnt[1]= INT_MAX; _ccCnt[0]= 0; _ccCnt[1]= INT_MAX; _gndCnt[0]= 0; _gndCnt[1]= INT_MAX; _termCnt[0]= 0; _termCnt[1]= INT_MAX; _btermCnt[0]= 0; _btermCnt[1]= INT_MAX; _id= 0; _ll[0]= INT_MIN; _ll[1]= INT_MIN; _ur[0]= INT_MAX; _ur[1]= INT_MAX; for (uint ii=0; ii<20; ii++) _layerFilter[ii]= true; } void extNetStats::update_double_limits(int n, double v1, double v2, double *val, double units) { if (n==0) { val[0]= v1*units; val[1]= v2*units; } else if (n==1) val[0]= v1*units; else if (n==2) val[1]= v2*units; } void extNetStats::update_double(Ath__parser *parser, const char* word, double *val, double units) { double v1, v2; int n= parser->get2Double(word, ":", v1, v2); if (n>=0) update_double_limits(n, v1, v2, val, units); } void extNetStats::update_int_limits(int n, int v1, int v2, int *val, uint units) { if (n==0) { val[0]= v1*units; val[1]= v2*units; } else if (n==1) val[0]= v1*units; else if (n==2) val[1]= v2*units; } void extNetStats::update_int(Ath__parser *parser, const char* word, int *val, uint units) { int v1, v2; int n= parser->get2Int(word, ":", v1, v2); if (n>=0) update_int_limits(n, v1, v2, val, units); } void extNetStats::update_bbox(Ath__parser *parser, const char* bbox) { int n= parser->mkWords(bbox, " "); if (n<=3) { warning(0, "invalid bbox <%s>\n",bbox); warning(0, "assuming entire block\n"); return; } _ll[0]= parser->getInt(0); _ll[1]= parser->getInt(1); _ur[0]= parser->getInt(2); _ur[1]= parser->getInt(3); } END_NAMESPACE_ADS
27.544304
156
0.592725
ilesser
383af8b80b765fd9ce022005c7bf83bd2e15e3e4
4,295
cpp
C++
source/MultiLibrary/Media/SoundSource.cpp
danielga/multilibrary
3d1177dd3affa875e06015f5e3e42dda525f3336
[ "BSD-3-Clause" ]
2
2018-06-22T12:43:57.000Z
2019-05-31T21:56:27.000Z
source/MultiLibrary/Media/SoundSource.cpp
danielga/multilibrary
3d1177dd3affa875e06015f5e3e42dda525f3336
[ "BSD-3-Clause" ]
1
2017-09-09T01:21:31.000Z
2017-11-12T17:52:56.000Z
source/MultiLibrary/Media/SoundSource.cpp
danielga/multilibrary
3d1177dd3affa875e06015f5e3e42dda525f3336
[ "BSD-3-Clause" ]
1
2022-03-30T18:57:41.000Z
2022-03-30T18:57:41.000Z
/************************************************************************* * MultiLibrary - https://danielga.github.io/multilibrary/ * A C++ library that covers multiple low level systems. *------------------------------------------------------------------------ * Copyright (c) 2014-2022, Daniel Almeida * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *************************************************************************/ #include <MultiLibrary/Media/SoundSource.hpp> #include <MultiLibrary/Media/OpenAL.hpp> namespace MultiLibrary { SoundSource::SoundSource( ) { alCheck( alGenSources( 1, &audio_source ) ); alCheck( alSourcei( audio_source, AL_BUFFER, 0 ) ); } SoundSource::~SoundSource( ) { alCheck( alSourcei( audio_source, AL_BUFFER, 0 ) ); alCheck( alDeleteSources( 1, &audio_source ) ); } void SoundSource::SetPitch( float pitch ) { alCheck( alSourcef( audio_source, AL_PITCH, pitch ) ); } float SoundSource::GetPitch( ) const { ALfloat pitch; alCheck( alGetSourcef( audio_source, AL_PITCH, &pitch ) ); return pitch; } void SoundSource::SetGain( float gain ) { alCheck( alSourcef( audio_source, AL_GAIN, gain ) ); } float SoundSource::GetGain( ) const { ALfloat gain; alCheck( alGetSourcef( audio_source, AL_GAIN, &gain ) ); return gain; } void SoundSource::SetPosition( const Vector3f &pos ) { alCheck( alSourcefv( audio_source, AL_POSITION, reinterpret_cast<const ALfloat *>( &pos ) ) ); } Vector3f SoundSource::GetPosition( ) { Vector3f pos; alCheck( alGetSourcefv( audio_source, AL_POSITION, reinterpret_cast<ALfloat *>( &pos ) ) ); return pos; } void SoundSource::SetRelativeToListener( bool relative ) { alCheck( alSourcei( audio_source, AL_SOURCE_RELATIVE, relative ) ); } bool SoundSource::IsRelativeToListener( ) const { ALint relative; alCheck( alGetSourcei( audio_source, AL_SOURCE_RELATIVE, &relative ) ); return relative != 0; } void SoundSource::SetMinDistance( float distance ) { alCheck( alSourcef( audio_source, AL_REFERENCE_DISTANCE, distance ) ); } float SoundSource::GetMinDistance( ) const { ALfloat distance; alCheck( alGetSourcef( audio_source, AL_REFERENCE_DISTANCE, &distance ) ); return distance; } void SoundSource::SetAttenuation( float attenuation ) { alCheck( alSourcef( audio_source, AL_ROLLOFF_FACTOR, attenuation ) ); } float SoundSource::GetAttenuation( ) const { ALfloat attenuation; alCheck( alGetSourcef( audio_source, AL_ROLLOFF_FACTOR, &attenuation ) ); return attenuation; } SoundStatus SoundSource::GetStatus( ) const { ALint status; alCheck( alGetSourcei( audio_source, AL_SOURCE_STATE, &status ) ); switch( status ) { case AL_INITIAL: case AL_STOPPED: return Stopped; case AL_PAUSED: return Paused; case AL_PLAYING: return Playing; } return Stopped; } } // namespace MultiLibrary
29.02027
95
0.71362
danielga
383c2ad1cae19ddb3858e1d099787efd60f93368
325
tpp
C++
rb_tree/includes/btree_apply_infix.tpp
paulahemsi/ft_containers
c7d6c878c25bf4faeb60f86f977639c8a7006776
[ "MIT" ]
1
2022-03-02T15:14:16.000Z
2022-03-02T15:14:16.000Z
rb_tree/includes/btree_apply_infix.tpp
paulahemsi/ft_containers
c7d6c878c25bf4faeb60f86f977639c8a7006776
[ "MIT" ]
73
2021-12-11T18:54:53.000Z
2022-03-28T01:32:52.000Z
rb_tree/includes/btree_apply_infix.tpp
paulahemsi/ft_containers
c7d6c878c25bf4faeb60f86f977639c8a7006776
[ "MIT" ]
null
null
null
#ifndef BTREE_APPLY_INFIX_TPP #define BTREE_APPLY_INFIX_TPP #include "btree.tpp" template <class T> void btree_apply_infix(ft::btree<T> *root, void (*applyf)(const T*)) { if (!root || is_nil(root)) return; btree_apply_infix(root->left, applyf); applyf(root->item); btree_apply_infix(root->right, applyf); } #endif
17.105263
68
0.726154
paulahemsi
383deb430ac201f2ebda757eb5bb45240fae5de0
308
cpp
C++
CC++/WTL/WTL/Samples/GuidGen/stdatl.cpp
Peterinor/Coding
3ac4908b3c6ae5df96390332e5452da934d12c3b
[ "MIT" ]
null
null
null
CC++/WTL/WTL/Samples/GuidGen/stdatl.cpp
Peterinor/Coding
3ac4908b3c6ae5df96390332e5452da934d12c3b
[ "MIT" ]
null
null
null
CC++/WTL/WTL/Samples/GuidGen/stdatl.cpp
Peterinor/Coding
3ac4908b3c6ae5df96390332e5452da934d12c3b
[ "MIT" ]
null
null
null
// stdatl.cpp : source file that includes just the standard includes // GuidGen.pch will be the pre-compiled header // stdatl.obj will contain the pre-compiled type information #include "stdatl.h" #if (_ATL_VER < 0x0700) && !defined(_WIN32_WCE) #include <atlimpl.cpp> #endif //(_ATL_VER < 0x0700)
30.8
69
0.720779
Peterinor
3840c0b8543ce8833bc13189f64afd2ab3f0a90d
23,729
cpp
C++
sdl1/cannonball/src/main/hwvideo/hwroad.cpp
pdpdds/sdldualsystem
d74ea84cbea705fef62868ba8c693bf7d2555636
[ "BSD-2-Clause" ]
null
null
null
sdl1/cannonball/src/main/hwvideo/hwroad.cpp
pdpdds/sdldualsystem
d74ea84cbea705fef62868ba8c693bf7d2555636
[ "BSD-2-Clause" ]
null
null
null
sdl1/cannonball/src/main/hwvideo/hwroad.cpp
pdpdds/sdldualsystem
d74ea84cbea705fef62868ba8c693bf7d2555636
[ "BSD-2-Clause" ]
null
null
null
#include <cstring> // memcpy #include "hwvideo/hwroad.hpp" #include "globals.hpp" #include "frontend/config.hpp" /*************************************************************************** Video Emulation: OutRun Road Rendering Hardware. Based on MAME source code. Copyright Aaron Giles. All rights reserved. ***************************************************************************/ /******************************************************************************************* * * Out Run/X-Board-style road chip * * Road control register: * Bits Usage * -------- -----d-- (X-board only) Direct scanline mode (1) or indirect mode (0) * -------- ------pp Road enable/priorities: * 0 = road 0 only visible * 1 = both roads visible, road 0 has priority * 2 = both roads visible, road 1 has priority * 3 = road 1 only visible * * Road RAM: * Offset Bits Usage * 000-1FF ----s--- -------- Road 0: Solid fill (1) or ROM fill * -------- -ccccccc Road 0: Solid color (if solid fill) * -------i iiiiiiii Road 0: Index for other tables (if in indirect mode) * -------r rrrrrrr- Road 0: Road ROM line select * 200-3FF ----s--- -------- Road 1: Solid fill (1) or ROM fill * -------- -ccccccc Road 1: Solid color (if solid fill) * -------i iiiiiiii Road 1: Index for other tables (if in indirect mode) * -------r rrrrrrr- Road 1: Road ROM line select * 400-7FF ----hhhh hhhhhhhh Road 0: horizontal scroll * 800-BFF ----hhhh hhhhhhhh Road 1: horizontal scroll * C00-FFF ----bbbb -------- Background color index * -------- s------- Road 1: stripe color index * -------- -a------ Road 1: pixel value 2 color index * -------- --b----- Road 1: pixel value 1 color index * -------- ---c---- Road 1: pixel value 0 color index * -------- ----s--- Road 0: stripe color index * -------- -----a-- Road 0: pixel value 2 color index * -------- ------b- Road 0: pixel value 1 color index * -------- -------c Road 0: pixel value 0 color index * * Logic: * First, the scanline is used to index into the tables at 000-1FF/200-3FF * - if solid fill, the background is filled with the specified color index * - otherwise, the remaining tables are used * * If indirect mode is selected, the index is taken from the low 9 bits of the * table value from 000-1FF/200-3FF * If direct scanline mode is selected, the index is set equal to the scanline * for road 0, or the scanline + 256 for road 1 * * The horizontal scroll value is looked up using the index in the tables at * 400-7FF/800-BFF * * The color information is looked up using the index in the table at C00-FFF. Note * that the same table is used for both roads. * * * Out Run road priorities are controlled by a PAL that maps as indicated below. * This was used to generate the priority_map. It is assumed that X-board is the * same, though this logic is locked inside a Sega custom. * * RRC0 = CENTA & (RDA == 3) & !RRC2 * | CENTB & (RDB == 3) & RRC2 * | (RDA == 1) & !RRC2 * | (RDB == 1) & RRC2 * * RRC1 = CENTA & (RDA == 3) & !RRC2 * | CENTB & (RDB == 3) & RRC2 * | (RDA == 2) & !RRC2 * | (RDB == 2) & RRC2 * * RRC2 = !/HSYNC & IIQ * | (CTRL == 3) * | !CENTA & (RDA == 3) & !CENTB & (RDB == 3) & (CTRL == 2) * | CENTB & (RDB == 3) & (CTRL == 2) * | !CENTA & (RDA == 3) & !M2 & (CTRL == 2) * | !CENTA & (RDA == 3) & !M3 & (CTRL == 2) * | !M0 & (RDB == 0) & (CTRL == 2) * | !M1 & (RDB == 0) & (CTRL == 2) * | !CENTA & (RDA == 3) & CENTB & (RDB == 3) & (CTRL == 1) * | !M0 & CENTB & (RDB == 3) & (CTRL == 1) * | !M1 & CENTB & (RDB == 3) & (CTRL == 1) * | !CENTA & M0 & (RDB == 0) & (CTRL == 1) * | !CENTA & M1 & (RDB == 0) & (CTRL == 1) * | !CENTA & (RDA == 3) & (RDB == 1) & (CTRL == 1) * | !CENTA & (RDA == 3) & (RDB == 2) & (CTRL == 1) * * RRC3 = VA11 & VB11 * | VA11 & (CTRL == 0) * | (CTRL == 3) & VB11 * * RRC4 = !CENTA & (RDA == 3) & !CENTB & (RDB == 3) * | VA11 & VB11 * | VA11 & (CTRL == 0) * | (CTRL == 3) & VB11 * | !CENTB & (RDB == 3) & (CTRL == 3) * | !CENTA & (RDA == 3) & (CTRL == 0) * *******************************************************************************************/ HWRoad hwroad; HWRoad::HWRoad() { } HWRoad::~HWRoad() { } // Convert road to a more useable format void HWRoad::init(const uint8_t* src_road, const bool hires) { road_control = 0; color_offset1 = 0x400; color_offset2 = 0x420; color_offset3 = 0x780; x_offset = 0; if (src_road) decode_road(src_road); if (hires) { render_background = &HWRoad::render_background_hires; render_foreground = &HWRoad::render_foreground_hires; } else { render_background = &HWRoad::render_background_lores; render_foreground = &HWRoad::render_foreground_lores; } } /* There are TWO (identical) roads we need to decode. Each of these roads is represented using a 512x256 map. See: http://www.extentofthejam.com/pseudo/ 512 x 256 x 2bpp map 0x8000 bytes of data. 2 Bits Per Pixel. Per Road: Bit 0 of each pixel is stored at offset 0x0000 - 0x3FFF Bit 1 of each pixel is stored at offset 0x4000 - 0x7FFF This means: 80 bytes per X Row [2 x 0x40 Bytes from the two separate locations] Decoded Format: 0 = Road Colour 1 = Road Inner Stripe 2 = Road Outer Stripe 3 = Road Exterior 7 = Central Stripe */ void HWRoad::decode_road(const uint8_t* src_road) { for (int y = 0; y < 256 * 2; y++) { const int src = ((y & 0xff) * 0x40 + (y >> 8) * 0x8000) % rom_size; // tempGfx const int dst = y * 512; // System16Roads // loop over columns for (int x = 0; x < 512; x++) { roads[dst + x] = (((src_road[src + (x / 8)] >> (~x & 7)) & 1) << 0) | (((src_road[src + (x / 8 + 0x4000)] >> (~x & 7)) & 1) << 1); // pre-mark road data in the "stripe" area with a high bit if (x >= 256 - 8 && x < 256 && roads[dst + x] == 3) roads[dst + x] |= 4; } } // set up a dummy road in the last entry for (int i = 0; i < 512; i++) { roads[256 * 2 * 512 + i] = 3; } } // Writes go to RAM, but we read from the RAM Buffer. void HWRoad::write16(uint32_t adr, const uint16_t data) { ram[(adr >> 1) & 0x7FF] = data; } void HWRoad::write16(uint32_t* adr, const uint16_t data) { uint32_t a = *adr; ram[(a >> 1) & 0x7FF] = data; *adr += 2; } void HWRoad::write32(uint32_t* adr, const uint32_t data) { uint32_t a = *adr; ram[(a >> 1) & 0x7FF] = data >> 16; ram[((a >> 1) + 1) & 0x7FF] = data & 0xFFFF; *adr += 4; } uint16_t HWRoad::read_road_control() { uint32_t *src = (uint32_t *)ram; uint32_t *dst = (uint32_t *)ramBuff; // swap the halves of the road RAM for (uint16_t i = 0; i < ROAD_RAM_SIZE/4; i++) { uint32_t temp = *src; *src++ = *dst; *dst++ = temp; } return 0xffff; } void HWRoad::write_road_control(const uint8_t road_control) { this->road_control = road_control; } // ------------------------------------------------------------------------------------------------ // Road Rendering: Lores Version // ------------------------------------------------------------------------------------------------ // Background: Look for solid fill scanlines void HWRoad::render_background_lores(uint16_t* pixels) { int x, y; uint16_t* roadram = ramBuff; for (y = 0; y < S16_HEIGHT; y++) { int data0 = roadram[0x000 + y]; int data1 = roadram[0x100 + y]; int color = -1; // based on the info->control, we can figure out which sky to draw switch (road_control & 3) { case 0: if (data0 & 0x800) color = data0 & 0x7f; break; case 1: if (data0 & 0x800) color = data0 & 0x7f; else if (data1 & 0x800) color = data1 & 0x7f; break; case 2: if (data1 & 0x800) color = data1 & 0x7f; else if (data0 & 0x800) color = data0 & 0x7f; break; case 3: if (data1 & 0x800) color = data1 & 0x7f; break; } // fill the scanline with color if (color != -1) { uint16_t* pPixel = pixels + (y * config.s16_width); color |= color_offset3; for (x = 0; x < config.s16_width; x++) *(pPixel)++ = color; } } } // Foreground: Render From ROM void HWRoad::render_foreground_lores(uint16_t* pixels) { int x, y; uint16_t* roadram = ramBuff; for (y = 0; y < S16_HEIGHT; y++) { uint16_t color_table[32]; static const uint8_t priority_map[2][8] = { { 0x80,0x81,0x81,0x87,0,0,0,0x00 }, { 0x81,0x81,0x81,0x8f,0,0,0,0x80 } }; const uint32_t data0 = roadram[0x000 + y]; const uint32_t data1 = roadram[0x100 + y]; // if both roads are low priority, skip if (((data0 & 0x800) != 0) && ((data1 & 0x800) != 0)) continue; uint16_t* pPixel = pixels + (y * config.s16_width); int32_t hpos0, hpos1, color0, color1; int32_t control = road_control & 3; uint8_t *src0, *src1; int32_t bgcolor; // 8 bits // get road 0 data src0 = ((data0 & 0x800) != 0) ? roads + 256 * 2 * 512 : (roads + (0x000 + ((data0 >> 1) & 0xff)) * 512); hpos0 = roadram[0x200 + (((road_control & 4) != 0) ? y : (data0 & 0x1ff))] & 0xfff; color0 = roadram[0x600 + (((road_control & 4) != 0) ? y : (data0 & 0x1ff))]; // get road 1 data src1 = ((data1 & 0x800) != 0) ? roads + 256 * 2 * 512 : (roads + (0x100 + ((data1 >> 1) & 0xff)) * 512); hpos1 = roadram[0x400 + (((road_control & 4) != 0) ? (0x100 + y) : (data1 & 0x1ff))] & 0xfff; color1 = roadram[0x600 + (((road_control & 4) != 0) ? (0x100 + y) : (data1 & 0x1ff))]; // determine the 5 colors for road 0 color_table[0x00] = color_offset1 ^ 0x00 ^ ((color0 >> 0) & 1); color_table[0x01] = color_offset1 ^ 0x02 ^ ((color0 >> 1) & 1); color_table[0x02] = color_offset1 ^ 0x04 ^ ((color0 >> 2) & 1); bgcolor = (color0 >> 8) & 0xf; color_table[0x03] = ((data0 & 0x200) != 0) ? color_table[0x00] : (color_offset2 ^ 0x00 ^ bgcolor); color_table[0x07] = color_offset1 ^ 0x06 ^ ((color0 >> 3) & 1); // determine the 5 colors for road 1 color_table[0x10] = color_offset1 ^ 0x08 ^ ((color1 >> 4) & 1); color_table[0x11] = color_offset1 ^ 0x0a ^ ((color1 >> 5) & 1); color_table[0x12] = color_offset1 ^ 0x0c ^ ((color1 >> 6) & 1); bgcolor = (color1 >> 8) & 0xf; color_table[0x13] = ((data1 & 0x200) != 0) ? color_table[0x10] : (color_offset2 ^ 0x10 ^ bgcolor); color_table[0x17] = color_offset1 ^ 0x0e ^ ((color1 >> 7) & 1); // Shift road dependent on whether we are in widescreen mode or not uint16_t s16_x = 0x5f8 + config.s16_x_off; // draw the road switch (control) { case 0: if (data0 & 0x800) continue; hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; pPixel[x] = color_table[0x00 + pix0]; hpos0 = (hpos0 + 1) & 0xfff; } break; case 1: hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; if (((priority_map[0][pix0] >> pix1) & 1) != 0) pPixel[x] = color_table[0x10 + pix1]; else pPixel[x] = color_table[0x00 + pix0]; hpos0 = (hpos0 + 1) & 0xfff; hpos1 = (hpos1 + 1) & 0xfff; } break; case 2: hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; if (((priority_map[1][pix0] >> pix1) & 1) != 0) pPixel[x] = color_table[0x10 + pix1]; else pPixel[x] = color_table[0x00 + pix0]; hpos0 = (hpos0 + 1) & 0xfff; hpos1 = (hpos1 + 1) & 0xfff; } break; case 3: if (data1 & 0x800) continue; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; pPixel[x] = color_table[0x10 + pix1]; hpos1 = (hpos1 + 1) & 0xfff; } break; } // end switch } // end for } // ------------------------------------------------------------------------------------------------ // High Resolution (Double Resolution) Road Rendering // ------------------------------------------------------------------------------------------------ void HWRoad::render_background_hires(uint16_t* pixels) { int x, y; uint16_t* roadram = ramBuff; for (y = 0; y < config.s16_height; y += 2) { int data0 = roadram[0x000 + (y >> 1)]; int data1 = roadram[0x100 + (y >> 1)]; int color = -1; // based on the info->control, we can figure out which sky to draw switch (road_control & 3) { case 0: if (data0 & 0x800) color = data0 & 0x7f; break; case 1: if (data0 & 0x800) color = data0 & 0x7f; else if (data1 & 0x800) color = data1 & 0x7f; break; case 2: if (data1 & 0x800) color = data1 & 0x7f; else if (data0 & 0x800) color = data0 & 0x7f; break; case 3: if (data1 & 0x800) color = data1 & 0x7f; break; } // fill the scanline with color if (color != -1) { uint16_t* pPixel = pixels + (y * config.s16_width); color |= color_offset3; for (x = 0; x < config.s16_width; x++) *(pPixel)++ = color; } // Hi-Res Mode: Copy extra line of background memcpy(pixels + ((y+1) * config.s16_width), pixels + (y * config.s16_width), sizeof(uint16_t) * config.s16_width); } } // ------------------------------------------------------------------------------------------------ // Render Road Foreground - High Resolution Version // Interpolates previous scanline with next. // ------------------------------------------------------------------------------------------------ void HWRoad::render_foreground_hires(uint16_t* pixels) { int x, y, yy; uint16_t* roadram = ramBuff; uint16_t color_table[32]; int32_t color0, color1; int32_t bgcolor; // 8 bits for (y = 0; y < config.s16_height; y++) { yy = y >> 1; static const uint8_t priority_map[2][8] = { { 0x80,0x81,0x81,0x87,0,0,0,0x00 }, { 0x81,0x81,0x81,0x8f,0,0,0,0x80 } }; uint32_t data0 = roadram[0x000 + yy]; uint32_t data1 = roadram[0x100 + yy]; // if both roads are low priority, skip if (((data0 & 0x800) != 0) && ((data1 & 0x800) != 0)) { y++; continue; } uint8_t *src0 = NULL, *src1 = NULL; // get road 0 data int32_t hpos0 = roadram[0x200 + (((road_control & 4) != 0) ? yy : (data0 & 0x1ff))] & 0xfff; // get road 1 data int32_t hpos1 = roadram[0x400 + (((road_control & 4) != 0) ? (0x100 + yy) : (data1 & 0x1ff))] & 0xfff; // ---------------------------------------------------------------------------------------- // Interpolate Scanlines when in hi-resolution mode. // ---------------------------------------------------------------------------------------- if (y & 1 && yy < S16_HEIGHT - 1) { uint32_t data0_next = roadram[0x000 + yy + 1]; uint32_t data1_next = roadram[0x100 + yy + 1]; int32_t hpos0_next = roadram[0x200 + (((road_control & 4) != 0) ? yy + 1 : (data0_next & 0x1ff))] & 0xfff; int32_t hpos1_next = roadram[0x400 + (((road_control & 4) != 0) ? yy + 1 : (data1_next & 0x1ff))] & 0xfff; // Interpolate road 1 position if (((data0 & 0x800) == 0) && (data0_next & 0x800) == 0) { data0 = (data0 >> 1) & 0xFF; data0_next = (data0_next >> 1) & 0xFF; int32_t diff = (data0 + ((data0_next - data0) >> 1)) & 0xFF; src0 = (roads + (0x000 + diff) * 512); hpos0 = (hpos0 + ((hpos0_next - hpos0) >> 1)) & 0xFFF; } // Interpolate road 2 source position if (((data1 & 0x800) == 0) && (data1_next & 0x800) == 0) { data1 = (data1 >> 1) & 0xFF; data1_next = (data1_next >> 1) & 0xFF; int32_t diff = (data1 + ((data1_next - data1) >> 1)) & 0xFF; src1 = (roads + (0x100 + diff) * 512); hpos1 = (hpos1 + ((hpos1_next - hpos1) >> 1)) & 0xFFF; } } // ---------------------------------------------------------------------------------------- // Recalculate for non-interpolated scanlines // ---------------------------------------------------------------------------------------- else { color0 = roadram[0x600 + (((road_control & 4) != 0) ? yy : (data0 & 0x1ff))]; color1 = roadram[0x600 + (((road_control & 4) != 0) ? (0x100 + yy) : (data1 & 0x1ff))]; // determine the 5 colors for road 0 color_table[0x00] = color_offset1 ^ 0x00 ^ ((color0 >> 0) & 1); color_table[0x01] = color_offset1 ^ 0x02 ^ ((color0 >> 1) & 1); color_table[0x02] = color_offset1 ^ 0x04 ^ ((color0 >> 2) & 1); bgcolor = (color0 >> 8) & 0xf; color_table[0x03] = ((data0 & 0x200) != 0) ? color_table[0x00] : (color_offset2 ^ 0x00 ^ bgcolor); color_table[0x07] = color_offset1 ^ 0x06 ^ ((color0 >> 3) & 1); // determine the 5 colors for road 1 color_table[0x10] = color_offset1 ^ 0x08 ^ ((color1 >> 4) & 1); color_table[0x11] = color_offset1 ^ 0x0a ^ ((color1 >> 5) & 1); color_table[0x12] = color_offset1 ^ 0x0c ^ ((color1 >> 6) & 1); bgcolor = (color1 >> 8) & 0xf; color_table[0x13] = ((data1 & 0x200) != 0) ? color_table[0x10] : (color_offset2 ^ 0x10 ^ bgcolor); color_table[0x17] = color_offset1 ^ 0x0e ^ ((color1 >> 7) & 1); } if (src0 == NULL) src0 = ((data0 & 0x800) != 0) ? roads + 256 * 2 * 512 : (roads + (0x000 + ((data0 >> 1) & 0xff)) * 512); if (src1 == NULL) src1 = ((data1 & 0x800) != 0) ? roads + 256 * 2 * 512 : (roads + (0x100 + ((data1 >> 1) & 0xff)) * 512); // Shift road dependent on whether we are in widescreen mode or not uint16_t s16_x = 0x5f8 + config.s16_x_off; uint16_t* const pPixel = pixels + (y * config.s16_width); // draw the road switch (road_control & 3) { case 0: if (data0 & 0x800) continue; hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; pPixel[x] = color_table[0x00 + pix0]; if (x & 1) hpos0 = (hpos0 + 1) & 0xfff; } break; case 1: hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; if (((priority_map[0][pix0] >> pix1) & 1) != 0) pPixel[x] = color_table[0x10 + pix1]; else pPixel[x] = color_table[0x00 + pix0]; if (x & 1) { hpos0 = (hpos0 + 1) & 0xfff; hpos1 = (hpos1 + 1) & 0xfff; } } break; case 2: hpos0 = (hpos0 - (s16_x + x_offset)) & 0xfff; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix0 = (hpos0 < 0x200) ? src0[hpos0] : 3; int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; if (((priority_map[1][pix0] >> pix1) & 1) != 0) pPixel[x] = color_table[0x10 + pix1]; else pPixel[x] = color_table[0x00 + pix0]; if (x & 1) { hpos0 = (hpos0 + 1) & 0xfff; hpos1 = (hpos1 + 1) & 0xfff; } } break; case 3: if (data1 & 0x800) continue; hpos1 = (hpos1 - (s16_x + x_offset)) & 0xfff; for (x = 0; x < config.s16_width; x++) { int pix1 = (hpos1 < 0x200) ? src1[hpos1] : 3; pPixel[x] = color_table[0x10 + pix1]; if (x & 1) hpos1 = (hpos1 + 1) & 0xfff; } break; } // end switch } // end for }
36.618827
142
0.435838
pdpdds
384207afeda1ef3452bc021f83b7af56bc0e2454
657
cpp
C++
COS2614/Assignments/Assignment 1/Question_1/main.cpp
ziyaadfredericks/university
0c9612921b417e6b428a34a84d3012bd07281dd0
[ "MIT" ]
null
null
null
COS2614/Assignments/Assignment 1/Question_1/main.cpp
ziyaadfredericks/university
0c9612921b417e6b428a34a84d3012bd07281dd0
[ "MIT" ]
null
null
null
COS2614/Assignments/Assignment 1/Question_1/main.cpp
ziyaadfredericks/university
0c9612921b417e6b428a34a84d3012bd07281dd0
[ "MIT" ]
null
null
null
#include <QApplication> #include <QInputDialog> #include <QMessageBox> #include <QString> float convertToCelsius(float temperatureC) { return ((9 * temperatureC) / 5) + 32; } int main(int argc, char* argv[]) { QApplication app(argc, argv); bool buttonClicked = false; float temperatureC = QInputDialog::getDouble(0, "Temperature Converter", "Enter the temperature in °C:", 0, -2147483647, 2147483647, 2, &buttonClicked); QString temperatureF = QString("The temperature is %0°F.").arg(convertToCelsius(temperatureC)); if (buttonClicked) { QMessageBox::information(0, "Temperature Converter", temperatureF); } return 0; }
27.375
156
0.707763
ziyaadfredericks
3844e3bc31a4c4ab80936712d0ac7514c9cb3571
88,151
cc
C++
media/engine/webrtcvideoengine2.cc
UWNetworksLab/webrtc-mod
5b910438baf4f7c7883996a2323d8ed809fd10e1
[ "DOC", "BSD-3-Clause" ]
1
2017-02-20T04:24:44.000Z
2017-02-20T04:24:44.000Z
media/engine/webrtcvideoengine2.cc
UWNetworksLab/webrtc-mod
5b910438baf4f7c7883996a2323d8ed809fd10e1
[ "DOC", "BSD-3-Clause" ]
null
null
null
media/engine/webrtcvideoengine2.cc
UWNetworksLab/webrtc-mod
5b910438baf4f7c7883996a2323d8ed809fd10e1
[ "DOC", "BSD-3-Clause" ]
1
2016-10-17T18:34:08.000Z
2016-10-17T18:34:08.000Z
/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/media/engine/webrtcvideoengine2.h" #include <algorithm> #include <set> #include <string> #include "webrtc/base/buffer.h" #include "webrtc/base/logging.h" #include "webrtc/base/stringutils.h" #include "webrtc/base/timeutils.h" #include "webrtc/base/trace_event.h" #include "webrtc/call.h" #include "webrtc/media/base/videocapturer.h" #include "webrtc/media/base/videorenderer.h" #include "webrtc/media/engine/constants.h" #include "webrtc/media/engine/simulcast.h" #include "webrtc/media/engine/webrtcmediaengine.h" #include "webrtc/media/engine/webrtcvideoencoderfactory.h" #include "webrtc/media/engine/webrtcvideoframe.h" #include "webrtc/media/engine/webrtcvoiceengine.h" #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" #include "webrtc/system_wrappers/include/field_trial.h" #include "webrtc/video_decoder.h" #include "webrtc/video_encoder.h" namespace cricket { namespace { // Wrap cricket::WebRtcVideoEncoderFactory as a webrtc::VideoEncoderFactory. class EncoderFactoryAdapter : public webrtc::VideoEncoderFactory { public: // EncoderFactoryAdapter doesn't take ownership of |factory|, which is owned // by e.g. PeerConnectionFactory. explicit EncoderFactoryAdapter(cricket::WebRtcVideoEncoderFactory* factory) : factory_(factory) {} virtual ~EncoderFactoryAdapter() {} // Implement webrtc::VideoEncoderFactory. webrtc::VideoEncoder* Create() override { return factory_->CreateVideoEncoder(webrtc::kVideoCodecVP8); } void Destroy(webrtc::VideoEncoder* encoder) override { return factory_->DestroyVideoEncoder(encoder); } private: cricket::WebRtcVideoEncoderFactory* const factory_; }; webrtc::Call::Config::BitrateConfig GetBitrateConfigForCodec( const VideoCodec& codec) { webrtc::Call::Config::BitrateConfig config; int bitrate_kbps; if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) && bitrate_kbps > 0) { config.min_bitrate_bps = bitrate_kbps * 1000; } else { config.min_bitrate_bps = 0; } if (codec.GetParam(kCodecParamStartBitrate, &bitrate_kbps) && bitrate_kbps > 0) { config.start_bitrate_bps = bitrate_kbps * 1000; } else { // Do not reconfigure start bitrate unless it's specified and positive. config.start_bitrate_bps = -1; } if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && bitrate_kbps > 0) { config.max_bitrate_bps = bitrate_kbps * 1000; } else { config.max_bitrate_bps = -1; } return config; } // An encoder factory that wraps Create requests for simulcastable codec types // with a webrtc::SimulcastEncoderAdapter. Non simulcastable codec type // requests are just passed through to the contained encoder factory. class WebRtcSimulcastEncoderFactory : public cricket::WebRtcVideoEncoderFactory { public: // WebRtcSimulcastEncoderFactory doesn't take ownership of |factory|, which is // owned by e.g. PeerConnectionFactory. explicit WebRtcSimulcastEncoderFactory( cricket::WebRtcVideoEncoderFactory* factory) : factory_(factory) {} static bool UseSimulcastEncoderFactory( const std::vector<VideoCodec>& codecs) { // If any codec is VP8, use the simulcast factory. If asked to create a // non-VP8 codec, we'll just return a contained factory encoder directly. for (const auto& codec : codecs) { if (codec.type == webrtc::kVideoCodecVP8) { return true; } } return false; } webrtc::VideoEncoder* CreateVideoEncoder( webrtc::VideoCodecType type) override { RTC_DCHECK(factory_ != NULL); // If it's a codec type we can simulcast, create a wrapped encoder. if (type == webrtc::kVideoCodecVP8) { return new webrtc::SimulcastEncoderAdapter( new EncoderFactoryAdapter(factory_)); } webrtc::VideoEncoder* encoder = factory_->CreateVideoEncoder(type); if (encoder) { non_simulcast_encoders_.push_back(encoder); } return encoder; } const std::vector<VideoCodec>& codecs() const override { return factory_->codecs(); } bool EncoderTypeHasInternalSource( webrtc::VideoCodecType type) const override { return factory_->EncoderTypeHasInternalSource(type); } void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override { // Check first to see if the encoder wasn't wrapped in a // SimulcastEncoderAdapter. In that case, ask the factory to destroy it. if (std::remove(non_simulcast_encoders_.begin(), non_simulcast_encoders_.end(), encoder) != non_simulcast_encoders_.end()) { factory_->DestroyVideoEncoder(encoder); return; } // Otherwise, SimulcastEncoderAdapter can be deleted directly, and will call // DestroyVideoEncoder on the factory for individual encoder instances. delete encoder; } private: cricket::WebRtcVideoEncoderFactory* factory_; // A list of encoders that were created without being wrapped in a // SimulcastEncoderAdapter. std::vector<webrtc::VideoEncoder*> non_simulcast_encoders_; }; bool CodecIsInternallySupported(const std::string& codec_name) { if (CodecNamesEq(codec_name, kVp8CodecName)) { return true; } if (CodecNamesEq(codec_name, kVp9CodecName)) { return true; } if (CodecNamesEq(codec_name, kH264CodecName)) { return webrtc::H264Encoder::IsSupported() && webrtc::H264Decoder::IsSupported(); } return false; } void AddDefaultFeedbackParams(VideoCodec* codec) { codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); codec->AddFeedbackParam( FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); } static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, const char* name) { VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate, 0); AddDefaultFeedbackParams(&codec); return codec; } static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { std::stringstream out; out << '{'; for (size_t i = 0; i < codecs.size(); ++i) { out << codecs[i].ToString(); if (i != codecs.size() - 1) { out << ", "; } } out << '}'; return out.str(); } static bool ValidateCodecFormats(const std::vector<VideoCodec>& codecs) { bool has_video = false; for (size_t i = 0; i < codecs.size(); ++i) { if (!codecs[i].ValidateCodecFormat()) { return false; } if (codecs[i].GetCodecType() == VideoCodec::CODEC_VIDEO) { has_video = true; } } if (!has_video) { LOG(LS_ERROR) << "Setting codecs without a video codec is invalid: " << CodecVectorToString(codecs); return false; } return true; } static bool ValidateStreamParams(const StreamParams& sp) { if (sp.ssrcs.empty()) { LOG(LS_ERROR) << "No SSRCs in stream parameters: " << sp.ToString(); return false; } std::vector<uint32_t> primary_ssrcs; sp.GetPrimarySsrcs(&primary_ssrcs); std::vector<uint32_t> rtx_ssrcs; sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs); for (uint32_t rtx_ssrc : rtx_ssrcs) { bool rtx_ssrc_present = false; for (uint32_t sp_ssrc : sp.ssrcs) { if (sp_ssrc == rtx_ssrc) { rtx_ssrc_present = true; break; } } if (!rtx_ssrc_present) { LOG(LS_ERROR) << "RTX SSRC '" << rtx_ssrc << "' missing from StreamParams ssrcs: " << sp.ToString(); return false; } } if (!rtx_ssrcs.empty() && primary_ssrcs.size() != rtx_ssrcs.size()) { LOG(LS_ERROR) << "RTX SSRCs exist, but don't cover all SSRCs (unsupported): " << sp.ToString(); return false; } return true; } inline bool ContainsHeaderExtension( const std::vector<webrtc::RtpExtension>& extensions, const std::string& name) { for (const auto& kv : extensions) { if (kv.name == name) { return true; } } return false; } // Merges two fec configs and logs an error if a conflict arises // such that merging in different order would trigger a different output. static void MergeFecConfig(const webrtc::FecConfig& other, webrtc::FecConfig* output) { if (other.ulpfec_payload_type != -1) { if (output->ulpfec_payload_type != -1 && output->ulpfec_payload_type != other.ulpfec_payload_type) { LOG(LS_WARNING) << "Conflict merging ulpfec_payload_type configs: " << output->ulpfec_payload_type << " and " << other.ulpfec_payload_type; } output->ulpfec_payload_type = other.ulpfec_payload_type; } if (other.red_payload_type != -1) { if (output->red_payload_type != -1 && output->red_payload_type != other.red_payload_type) { LOG(LS_WARNING) << "Conflict merging red_payload_type configs: " << output->red_payload_type << " and " << other.red_payload_type; } output->red_payload_type = other.red_payload_type; } if (other.red_rtx_payload_type != -1) { if (output->red_rtx_payload_type != -1 && output->red_rtx_payload_type != other.red_rtx_payload_type) { LOG(LS_WARNING) << "Conflict merging red_rtx_payload_type configs: " << output->red_rtx_payload_type << " and " << other.red_rtx_payload_type; } output->red_rtx_payload_type = other.red_rtx_payload_type; } } // Returns true if the given codec is disallowed from doing simulcast. bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) { return CodecNamesEq(codec_name, kH264CodecName) || CodecNamesEq(codec_name, kVp9CodecName); } // The selected thresholds for QVGA and VGA corresponded to a QP around 10. // The change in QP declined above the selected bitrates. static int GetMaxDefaultVideoBitrateKbps(int width, int height) { if (width * height <= 320 * 240) { return 600; } else if (width * height <= 640 * 480) { return 1700; } else if (width * height <= 960 * 540) { return 2000; } else { return 2500; } } } // namespace // Constants defined in webrtc/media/engine/constants.h // TODO(pbos): Move these to a separate constants.cc file. const int kMinVideoBitrate = 30; const int kStartVideoBitrate = 300; const int kVideoMtu = 1200; const int kVideoRtpBufferSize = 65536; // This constant is really an on/off, lower-level configurable NACK history // duration hasn't been implemented. static const int kNackHistoryMs = 1000; static const int kDefaultQpMax = 56; static const int kDefaultRtcpReceiverReportSsrc = 1; std::vector<VideoCodec> DefaultVideoCodecList() { std::vector<VideoCodec> codecs; codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, kVp8CodecName)); codecs.push_back( VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); if (CodecIsInternallySupported(kVp9CodecName)) { codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, kVp9CodecName)); codecs.push_back( VideoCodec::CreateRtxCodec(kDefaultRtxVp9PlType, kDefaultVp9PlType)); } if (CodecIsInternallySupported(kH264CodecName)) { codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultH264PlType, kH264CodecName)); codecs.push_back( VideoCodec::CreateRtxCodec(kDefaultRtxH264PlType, kDefaultH264PlType)); } codecs.push_back(VideoCodec(kDefaultRedPlType, kRedCodecName)); codecs.push_back( VideoCodec::CreateRtxCodec(kDefaultRtxRedPlType, kDefaultRedPlType)); codecs.push_back(VideoCodec(kDefaultUlpfecType, kUlpfecCodecName)); return codecs; } std::vector<webrtc::VideoStream> WebRtcVideoChannel2::WebRtcVideoSendStream::CreateSimulcastVideoStreams( const VideoCodec& codec, const VideoOptions& options, int max_bitrate_bps, size_t num_streams) { int max_qp = kDefaultQpMax; codec.GetParam(kCodecParamMaxQuantization, &max_qp); return GetSimulcastConfig( num_streams, codec.width, codec.height, max_bitrate_bps, max_qp, codec.framerate != 0 ? codec.framerate : kDefaultVideoMaxFramerate); } std::vector<webrtc::VideoStream> WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoStreams( const VideoCodec& codec, const VideoOptions& options, int max_bitrate_bps, size_t num_streams) { int codec_max_bitrate_kbps; if (codec.GetParam(kCodecParamMaxBitrate, &codec_max_bitrate_kbps)) { max_bitrate_bps = codec_max_bitrate_kbps * 1000; } if (num_streams != 1) { return CreateSimulcastVideoStreams(codec, options, max_bitrate_bps, num_streams); } // For unset max bitrates set default bitrate for non-simulcast. if (max_bitrate_bps <= 0) { max_bitrate_bps = GetMaxDefaultVideoBitrateKbps(codec.width, codec.height) * 1000; } webrtc::VideoStream stream; stream.width = codec.width; stream.height = codec.height; stream.max_framerate = codec.framerate != 0 ? codec.framerate : kDefaultVideoMaxFramerate; stream.min_bitrate_bps = kMinVideoBitrate * 1000; stream.target_bitrate_bps = stream.max_bitrate_bps = max_bitrate_bps; int max_qp = kDefaultQpMax; codec.GetParam(kCodecParamMaxQuantization, &max_qp); stream.max_qp = max_qp; std::vector<webrtc::VideoStream> streams; streams.push_back(stream); return streams; } void* WebRtcVideoChannel2::WebRtcVideoSendStream::ConfigureVideoEncoderSettings( const VideoCodec& codec, const VideoOptions& options, bool is_screencast) { // No automatic resizing when using simulcast or screencast. bool automatic_resize = !is_screencast && parameters_.config.rtp.ssrcs.size() == 1; bool frame_dropping = !is_screencast; bool denoising; bool codec_default_denoising = false; if (is_screencast) { denoising = false; } else { // Use codec default if video_noise_reduction is unset. codec_default_denoising = !options.video_noise_reduction; denoising = options.video_noise_reduction.value_or(false); } if (CodecNamesEq(codec.name, kH264CodecName)) { encoder_settings_.h264 = webrtc::VideoEncoder::GetDefaultH264Settings(); encoder_settings_.h264.frameDroppingOn = frame_dropping; return &encoder_settings_.h264; } if (CodecNamesEq(codec.name, kVp8CodecName)) { encoder_settings_.vp8 = webrtc::VideoEncoder::GetDefaultVp8Settings(); encoder_settings_.vp8.automaticResizeOn = automatic_resize; // VP8 denoising is enabled by default. encoder_settings_.vp8.denoisingOn = codec_default_denoising ? true : denoising; encoder_settings_.vp8.frameDroppingOn = frame_dropping; return &encoder_settings_.vp8; } if (CodecNamesEq(codec.name, kVp9CodecName)) { encoder_settings_.vp9 = webrtc::VideoEncoder::GetDefaultVp9Settings(); // VP9 denoising is disabled by default. encoder_settings_.vp9.denoisingOn = codec_default_denoising ? false : denoising; encoder_settings_.vp9.frameDroppingOn = frame_dropping; return &encoder_settings_.vp9; } return NULL; } DefaultUnsignalledSsrcHandler::DefaultUnsignalledSsrcHandler() : default_recv_ssrc_(0), default_sink_(NULL) {} UnsignalledSsrcHandler::Action DefaultUnsignalledSsrcHandler::OnUnsignalledSsrc( WebRtcVideoChannel2* channel, uint32_t ssrc) { if (default_recv_ssrc_ != 0) { // Already one default stream. LOG(LS_WARNING) << "Unknown SSRC, but default receive stream already set."; return kDropPacket; } StreamParams sp; sp.ssrcs.push_back(ssrc); LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; if (!channel->AddRecvStream(sp, true)) { LOG(LS_WARNING) << "Could not create default receive stream."; } channel->SetSink(ssrc, default_sink_); default_recv_ssrc_ = ssrc; return kDeliverPacket; } rtc::VideoSinkInterface<VideoFrame>* DefaultUnsignalledSsrcHandler::GetDefaultSink() const { return default_sink_; } void DefaultUnsignalledSsrcHandler::SetDefaultSink( VideoMediaChannel* channel, rtc::VideoSinkInterface<VideoFrame>* sink) { default_sink_ = sink; if (default_recv_ssrc_ != 0) { channel->SetSink(default_recv_ssrc_, default_sink_); } } WebRtcVideoEngine2::WebRtcVideoEngine2() : initialized_(false), external_decoder_factory_(NULL), external_encoder_factory_(NULL) { LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()"; video_codecs_ = GetSupportedCodecs(); } WebRtcVideoEngine2::~WebRtcVideoEngine2() { LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2"; } void WebRtcVideoEngine2::Init() { LOG(LS_INFO) << "WebRtcVideoEngine2::Init"; initialized_ = true; } WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( webrtc::Call* call, const MediaConfig& config, const VideoOptions& options) { RTC_DCHECK(initialized_); LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); return new WebRtcVideoChannel2(call, config, options, video_codecs_, external_encoder_factory_, external_decoder_factory_); } const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { return video_codecs_; } RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const { RtpCapabilities capabilities; capabilities.header_extensions.push_back( RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, kRtpTimestampOffsetHeaderExtensionDefaultId)); capabilities.header_extensions.push_back( RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension, kRtpAbsoluteSenderTimeHeaderExtensionDefaultId)); capabilities.header_extensions.push_back( RtpHeaderExtension(kRtpVideoRotationHeaderExtension, kRtpVideoRotationHeaderExtensionDefaultId)); if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe") == "Enabled") { capabilities.header_extensions.push_back(RtpHeaderExtension( kRtpTransportSequenceNumberHeaderExtension, kRtpTransportSequenceNumberHeaderExtensionDefaultId)); } return capabilities; } void WebRtcVideoEngine2::SetExternalDecoderFactory( WebRtcVideoDecoderFactory* decoder_factory) { RTC_DCHECK(!initialized_); external_decoder_factory_ = decoder_factory; } void WebRtcVideoEngine2::SetExternalEncoderFactory( WebRtcVideoEncoderFactory* encoder_factory) { RTC_DCHECK(!initialized_); if (external_encoder_factory_ == encoder_factory) return; // No matter what happens we shouldn't hold on to a stale // WebRtcSimulcastEncoderFactory. simulcast_encoder_factory_.reset(); if (encoder_factory && WebRtcSimulcastEncoderFactory::UseSimulcastEncoderFactory( encoder_factory->codecs())) { simulcast_encoder_factory_.reset( new WebRtcSimulcastEncoderFactory(encoder_factory)); encoder_factory = simulcast_encoder_factory_.get(); } external_encoder_factory_ = encoder_factory; video_codecs_ = GetSupportedCodecs(); } std::vector<VideoCodec> WebRtcVideoEngine2::GetSupportedCodecs() const { std::vector<VideoCodec> supported_codecs = DefaultVideoCodecList(); if (external_encoder_factory_ == NULL) { return supported_codecs; } const std::vector<WebRtcVideoEncoderFactory::VideoCodec>& codecs = external_encoder_factory_->codecs(); for (size_t i = 0; i < codecs.size(); ++i) { // Don't add internally-supported codecs twice. if (CodecIsInternallySupported(codecs[i].name)) { continue; } // External video encoders are given payloads 120-127. This also means that // we only support up to 8 external payload types. const int kExternalVideoPayloadTypeBase = 120; size_t payload_type = kExternalVideoPayloadTypeBase + i; RTC_DCHECK(payload_type < 128); VideoCodec codec(static_cast<int>(payload_type), codecs[i].name, codecs[i].max_width, codecs[i].max_height, codecs[i].max_fps, 0); AddDefaultFeedbackParams(&codec); supported_codecs.push_back(codec); } return supported_codecs; } WebRtcVideoChannel2::WebRtcVideoChannel2( webrtc::Call* call, const MediaConfig& config, const VideoOptions& options, const std::vector<VideoCodec>& recv_codecs, WebRtcVideoEncoderFactory* external_encoder_factory, WebRtcVideoDecoderFactory* external_decoder_factory) : VideoMediaChannel(config), call_(call), unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), signal_cpu_adaptation_(config.enable_cpu_overuse_detection), disable_prerenderer_smoothing_(config.disable_prerenderer_smoothing), external_encoder_factory_(external_encoder_factory), external_decoder_factory_(external_decoder_factory) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); send_params_.options = options; rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; sending_ = false; default_send_ssrc_ = 0; RTC_DCHECK(ValidateCodecFormats(recv_codecs)); recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); } WebRtcVideoChannel2::~WebRtcVideoChannel2() { for (auto& kv : send_streams_) delete kv.second; for (auto& kv : receive_streams_) delete kv.second; } bool WebRtcVideoChannel2::CodecIsExternallySupported( const std::string& name) const { if (external_encoder_factory_ == NULL) { return false; } const std::vector<WebRtcVideoEncoderFactory::VideoCodec> external_codecs = external_encoder_factory_->codecs(); for (size_t c = 0; c < external_codecs.size(); ++c) { if (CodecNamesEq(name, external_codecs[c].name)) { return true; } } return false; } std::vector<WebRtcVideoChannel2::VideoCodecSettings> WebRtcVideoChannel2::FilterSupportedCodecs( const std::vector<WebRtcVideoChannel2::VideoCodecSettings>& mapped_codecs) const { std::vector<VideoCodecSettings> supported_codecs; for (size_t i = 0; i < mapped_codecs.size(); ++i) { const VideoCodecSettings& codec = mapped_codecs[i]; if (CodecIsInternallySupported(codec.codec.name) || CodecIsExternallySupported(codec.codec.name)) { supported_codecs.push_back(codec); } } return supported_codecs; } bool WebRtcVideoChannel2::ReceiveCodecsHaveChanged( std::vector<VideoCodecSettings> before, std::vector<VideoCodecSettings> after) { if (before.size() != after.size()) { return true; } // The receive codec order doesn't matter, so we sort the codecs before // comparing. This is necessary because currently the // only way to change the send codec is to munge SDP, which causes // the receive codec list to change order, which causes the streams // to be recreates which causes a "blink" of black video. In order // to support munging the SDP in this way without recreating receive // streams, we ignore the order of the received codecs so that // changing the order doesn't cause this "blink". auto comparison = [](const VideoCodecSettings& codec1, const VideoCodecSettings& codec2) { return codec1.codec.id > codec2.codec.id; }; std::sort(before.begin(), before.end(), comparison); std::sort(after.begin(), after.end(), comparison); for (size_t i = 0; i < before.size(); ++i) { // For the same reason that we sort the codecs, we also ignore the // preference. We don't want a preference change on the receive // side to cause recreation of the stream. before[i].codec.preference = 0; after[i].codec.preference = 0; if (before[i] != after[i]) { return true; } } return false; } bool WebRtcVideoChannel2::GetChangedSendParameters( const VideoSendParameters& params, ChangedSendParameters* changed_params) const { if (!ValidateCodecFormats(params.codecs) || !ValidateRtpExtensions(params.extensions)) { return false; } // Handle send codec. const std::vector<VideoCodecSettings> supported_codecs = FilterSupportedCodecs(MapCodecs(params.codecs)); if (supported_codecs.empty()) { LOG(LS_ERROR) << "No video codecs supported."; return false; } if (!send_codec_ || supported_codecs.front() != *send_codec_) { changed_params->codec = rtc::Optional<VideoCodecSettings>(supported_codecs.front()); } // Handle RTP header extensions. std::vector<webrtc::RtpExtension> filtered_extensions = FilterRtpExtensions( params.extensions, webrtc::RtpExtension::IsSupportedForVideo, true); if (send_rtp_extensions_ != filtered_extensions) { changed_params->rtp_header_extensions = rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions); } // Handle max bitrate. if (params.max_bandwidth_bps != bitrate_config_.max_bitrate_bps && params.max_bandwidth_bps >= 0) { // 0 uncaps max bitrate (-1). changed_params->max_bandwidth_bps = rtc::Optional<int>( params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps); } // Handle conference mode. if (params.conference_mode != send_params_.conference_mode) { changed_params->conference_mode = rtc::Optional<bool>(params.conference_mode); } // Handle options. // TODO(pbos): Require VideoSendParameters to contain a full set of options // and check if params.options != options_ instead of applying a delta. VideoOptions new_options = send_params_.options; new_options.SetAll(params.options); if (!(new_options == send_params_.options)) { changed_params->options = rtc::Optional<VideoOptions>(new_options); } // Handle RTCP mode. if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize : webrtc::RtcpMode::kCompound); } return true; } rtc::DiffServCodePoint WebRtcVideoChannel2::PreferredDscp() const { return rtc::DSCP_AF41; } bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); ChangedSendParameters changed_params; if (!GetChangedSendParameters(params, &changed_params)) { return false; } bool bitrate_config_changed = false; if (changed_params.codec) { const VideoCodecSettings& codec_settings = *changed_params.codec; send_codec_ = rtc::Optional<VideoCodecSettings>(codec_settings); LOG(LS_INFO) << "Using codec: " << codec_settings.codec.ToString(); // TODO(holmer): Changing the codec parameters shouldn't necessarily mean // that we change the min/max of bandwidth estimation. Reevaluate this. bitrate_config_ = GetBitrateConfigForCodec(codec_settings.codec); bitrate_config_changed = true; } if (changed_params.rtp_header_extensions) { send_rtp_extensions_ = *changed_params.rtp_header_extensions; } if (changed_params.max_bandwidth_bps) { // TODO(pbos): Figure out whether b=AS means max bitrate for this // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), in // which case this should not set a Call::BitrateConfig but rather // reconfigure all senders. int max_bitrate_bps = *changed_params.max_bandwidth_bps; bitrate_config_.start_bitrate_bps = -1; bitrate_config_.max_bitrate_bps = max_bitrate_bps; if (max_bitrate_bps > 0 && bitrate_config_.min_bitrate_bps > max_bitrate_bps) { bitrate_config_.min_bitrate_bps = max_bitrate_bps; } bitrate_config_changed = true; } if (bitrate_config_changed) { call_->SetBitrateConfig(bitrate_config_); } if (changed_params.options) send_params_.options.SetAll(*changed_params.options); { rtc::CritScope stream_lock(&stream_crit_); for (auto& kv : send_streams_) { kv.second->SetSendParameters(changed_params); } if (changed_params.codec) { // Update receive feedback parameters from new codec. LOG(LS_INFO) << "SetFeedbackOptions on all the receive streams because the send " "codec has changed."; for (auto& kv : receive_streams_) { RTC_DCHECK(kv.second != nullptr); kv.second->SetFeedbackParameters(HasNack(send_codec_->codec), HasRemb(send_codec_->codec), HasTransportCc(send_codec_->codec)); } } } send_params_ = params; return true; } bool WebRtcVideoChannel2::GetChangedRecvParameters( const VideoRecvParameters& params, ChangedRecvParameters* changed_params) const { if (!ValidateCodecFormats(params.codecs) || !ValidateRtpExtensions(params.extensions)) { return false; } // Handle receive codecs. const std::vector<VideoCodecSettings> mapped_codecs = MapCodecs(params.codecs); if (mapped_codecs.empty()) { LOG(LS_ERROR) << "SetRecvParameters called without any video codecs."; return false; } std::vector<VideoCodecSettings> supported_codecs = FilterSupportedCodecs(mapped_codecs); if (mapped_codecs.size() != supported_codecs.size()) { LOG(LS_ERROR) << "SetRecvParameters called with unsupported video codecs."; return false; } if (ReceiveCodecsHaveChanged(recv_codecs_, supported_codecs)) { changed_params->codec_settings = rtc::Optional<std::vector<VideoCodecSettings>>(supported_codecs); } // Handle RTP header extensions. std::vector<webrtc::RtpExtension> filtered_extensions = FilterRtpExtensions( params.extensions, webrtc::RtpExtension::IsSupportedForVideo, false); if (filtered_extensions != recv_rtp_extensions_) { changed_params->rtp_header_extensions = rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions); } // Handle RTCP mode. if (params.rtcp.reduced_size != recv_params_.rtcp.reduced_size) { changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize : webrtc::RtcpMode::kCompound); } return true; } bool WebRtcVideoChannel2::SetRecvParameters(const VideoRecvParameters& params) { TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRecvParameters"); LOG(LS_INFO) << "SetRecvParameters: " << params.ToString(); ChangedRecvParameters changed_params; if (!GetChangedRecvParameters(params, &changed_params)) { return false; } if (changed_params.rtp_header_extensions) { recv_rtp_extensions_ = *changed_params.rtp_header_extensions; } if (changed_params.codec_settings) { LOG(LS_INFO) << "Changing recv codecs from " << CodecSettingsVectorToString(recv_codecs_) << " to " << CodecSettingsVectorToString(*changed_params.codec_settings); recv_codecs_ = *changed_params.codec_settings; } { rtc::CritScope stream_lock(&stream_crit_); for (auto& kv : receive_streams_) { kv.second->SetRecvParameters(changed_params); } } recv_params_ = params; return true; } std::string WebRtcVideoChannel2::CodecSettingsVectorToString( const std::vector<VideoCodecSettings>& codecs) { std::stringstream out; out << '{'; for (size_t i = 0; i < codecs.size(); ++i) { out << codecs[i].codec.ToString(); if (i != codecs.size() - 1) { out << ", "; } } out << '}'; return out.str(); } bool WebRtcVideoChannel2::GetSendCodec(VideoCodec* codec) { if (!send_codec_) { LOG(LS_VERBOSE) << "GetSendCodec: No send codec set."; return false; } *codec = send_codec_->codec; return true; } bool WebRtcVideoChannel2::SetSend(bool send) { LOG(LS_VERBOSE) << "SetSend: " << (send ? "true" : "false"); if (send && !send_codec_) { LOG(LS_ERROR) << "SetSend(true) called before setting codec."; return false; } if (send) { StartAllSendStreams(); } else { StopAllSendStreams(); } sending_ = send; return true; } bool WebRtcVideoChannel2::SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options) { TRACE_EVENT0("webrtc", "SetVideoSend"); LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable << "options: " << (options ? options->ToString() : "nullptr") << ")."; // TODO(solenberg): The state change should be fully rolled back if any one of // these calls fail. if (!MuteStream(ssrc, !enable)) { return false; } if (enable && options) { SetOptions(ssrc, *options); } return true; } bool WebRtcVideoChannel2::ValidateSendSsrcAvailability( const StreamParams& sp) const { for (uint32_t ssrc : sp.ssrcs) { if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) { LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists."; return false; } } return true; } bool WebRtcVideoChannel2::ValidateReceiveSsrcAvailability( const StreamParams& sp) const { for (uint32_t ssrc : sp.ssrcs) { if (receive_ssrcs_.find(ssrc) != receive_ssrcs_.end()) { LOG(LS_ERROR) << "Receive stream with SSRC '" << ssrc << "' already exists."; return false; } } return true; } bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) { LOG(LS_INFO) << "AddSendStream: " << sp.ToString(); if (!ValidateStreamParams(sp)) return false; rtc::CritScope stream_lock(&stream_crit_); if (!ValidateSendSsrcAvailability(sp)) return false; for (uint32_t used_ssrc : sp.ssrcs) send_ssrcs_.insert(used_ssrc); webrtc::VideoSendStream::Config config(this); config.overuse_callback = this; WebRtcVideoSendStream* stream = new WebRtcVideoSendStream(call_, sp, config, external_encoder_factory_, bitrate_config_.max_bitrate_bps, send_codec_, send_rtp_extensions_, send_params_); uint32_t ssrc = sp.first_ssrc(); RTC_DCHECK(ssrc != 0); send_streams_[ssrc] = stream; if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { rtcp_receiver_report_ssrc_ = ssrc; LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " "a send stream."; for (auto& kv : receive_streams_) kv.second->SetLocalSsrc(ssrc); } if (default_send_ssrc_ == 0) { default_send_ssrc_ = ssrc; } if (sending_) { stream->Start(); } return true; } bool WebRtcVideoChannel2::RemoveSendStream(uint32_t ssrc) { LOG(LS_INFO) << "RemoveSendStream: " << ssrc; if (ssrc == 0) { if (default_send_ssrc_ == 0) { LOG(LS_ERROR) << "No default send stream active."; return false; } LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; ssrc = default_send_ssrc_; } WebRtcVideoSendStream* removed_stream; { rtc::CritScope stream_lock(&stream_crit_); std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = send_streams_.find(ssrc); if (it == send_streams_.end()) { return false; } for (uint32_t old_ssrc : it->second->GetSsrcs()) send_ssrcs_.erase(old_ssrc); removed_stream = it->second; send_streams_.erase(it); // Switch receiver report SSRCs, the one in use is no longer valid. if (rtcp_receiver_report_ssrc_ == ssrc) { rtcp_receiver_report_ssrc_ = send_streams_.empty() ? kDefaultRtcpReceiverReportSsrc : send_streams_.begin()->first; LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because the " "previous local SSRC was removed."; for (auto& kv : receive_streams_) { kv.second->SetLocalSsrc(rtcp_receiver_report_ssrc_); } } } delete removed_stream; if (ssrc == default_send_ssrc_) { default_send_ssrc_ = 0; } return true; } void WebRtcVideoChannel2::DeleteReceiveStream( WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { for (uint32_t old_ssrc : stream->GetSsrcs()) receive_ssrcs_.erase(old_ssrc); delete stream; } bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) { return AddRecvStream(sp, false); } bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp, bool default_stream) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); LOG(LS_INFO) << "AddRecvStream" << (default_stream ? " (default stream)" : "") << ": " << sp.ToString(); if (!ValidateStreamParams(sp)) return false; uint32_t ssrc = sp.first_ssrc(); RTC_DCHECK(ssrc != 0); // TODO(pbos): Is this ever valid? rtc::CritScope stream_lock(&stream_crit_); // Remove running stream if this was a default stream. const auto& prev_stream = receive_streams_.find(ssrc); if (prev_stream != receive_streams_.end()) { if (default_stream || !prev_stream->second->IsDefaultStream()) { LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc << "' already exists."; return false; } DeleteReceiveStream(prev_stream->second); receive_streams_.erase(prev_stream); } if (!ValidateReceiveSsrcAvailability(sp)) return false; for (uint32_t used_ssrc : sp.ssrcs) receive_ssrcs_.insert(used_ssrc); webrtc::VideoReceiveStream::Config config(this); ConfigureReceiverRtp(&config, sp); // Set up A/V sync group based on sync label. config.sync_group = sp.sync_label; config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false; config.rtp.transport_cc = send_codec_ ? HasTransportCc(send_codec_->codec) : false; receive_streams_[ssrc] = new WebRtcVideoReceiveStream( call_, sp, config, external_decoder_factory_, default_stream, recv_codecs_, disable_prerenderer_smoothing_); return true; } void WebRtcVideoChannel2::ConfigureReceiverRtp( webrtc::VideoReceiveStream::Config* config, const StreamParams& sp) const { uint32_t ssrc = sp.first_ssrc(); config->rtp.remote_ssrc = ssrc; config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; config->rtp.extensions = recv_rtp_extensions_; config->rtp.rtcp_mode = recv_params_.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize : webrtc::RtcpMode::kCompound; // TODO(pbos): This protection is against setting the same local ssrc as // remote which is not permitted by the lower-level API. RTCP requires a // corresponding sender SSRC. Figure out what to do when we don't have // (receive-only) or know a good local SSRC. if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; } else { config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; } } for (size_t i = 0; i < recv_codecs_.size(); ++i) { MergeFecConfig(recv_codecs_[i].fec, &config->rtp.fec); } for (size_t i = 0; i < recv_codecs_.size(); ++i) { uint32_t rtx_ssrc; if (recv_codecs_[i].rtx_payload_type != -1 && sp.GetFidSsrc(ssrc, &rtx_ssrc)) { webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = config->rtp.rtx[recv_codecs_[i].codec.id]; rtx.ssrc = rtx_ssrc; rtx.payload_type = recv_codecs_[i].rtx_payload_type; } } } bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) { LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; if (ssrc == 0) { LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; return false; } rtc::CritScope stream_lock(&stream_crit_); std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator stream = receive_streams_.find(ssrc); if (stream == receive_streams_.end()) { LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; return false; } DeleteReceiveStream(stream->second); receive_streams_.erase(stream); return true; } bool WebRtcVideoChannel2::SetSink(uint32_t ssrc, rtc::VideoSinkInterface<VideoFrame>* sink) { LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " " << (sink ? "(ptr)" : "NULL"); if (ssrc == 0) { default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink); return true; } rtc::CritScope stream_lock(&stream_crit_); std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = receive_streams_.find(ssrc); if (it == receive_streams_.end()) { return false; } it->second->SetSink(sink); return true; } bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { info->Clear(); FillSenderStats(info); FillReceiverStats(info); webrtc::Call::Stats stats = call_->GetStats(); FillBandwidthEstimationStats(stats, info); if (stats.rtt_ms != -1) { for (size_t i = 0; i < info->senders.size(); ++i) { info->senders[i].rtt_ms = stats.rtt_ms; } } return true; } void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) { rtc::CritScope stream_lock(&stream_crit_); for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = send_streams_.begin(); it != send_streams_.end(); ++it) { video_media_info->senders.push_back(it->second->GetVideoSenderInfo()); } } void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) { rtc::CritScope stream_lock(&stream_crit_); for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = receive_streams_.begin(); it != receive_streams_.end(); ++it) { video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo()); } } void WebRtcVideoChannel2::FillBandwidthEstimationStats( const webrtc::Call::Stats& stats, VideoMediaInfo* video_media_info) { BandwidthEstimationInfo bwe_info; bwe_info.available_send_bandwidth = stats.send_bandwidth_bps; bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps; bwe_info.bucket_delay = stats.pacer_delay_ms; // Get send stream bitrate stats. rtc::CritScope stream_lock(&stream_crit_); for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = send_streams_.begin(); stream != send_streams_.end(); ++stream) { stream->second->FillBandwidthEstimationInfo(&bwe_info); } video_media_info->bw_estimations.push_back(bwe_info); } bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " << (capturer != NULL ? "(capturer)" : "NULL"); RTC_DCHECK(ssrc != 0); { rtc::CritScope stream_lock(&stream_crit_); const auto& kv = send_streams_.find(ssrc); if (kv == send_streams_.end()) { LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; return false; } if (!kv->second->SetCapturer(capturer)) { return false; } } { rtc::CritScope lock(&capturer_crit_); capturers_[ssrc] = capturer; } return true; } void WebRtcVideoChannel2::OnPacketReceived( rtc::Buffer* packet, const rtc::PacketTime& packet_time) { const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, packet_time.not_before); const webrtc::PacketReceiver::DeliveryStatus delivery_result = call_->Receiver()->DeliverPacket( webrtc::MediaType::VIDEO, reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), webrtc_packet_time); switch (delivery_result) { case webrtc::PacketReceiver::DELIVERY_OK: return; case webrtc::PacketReceiver::DELIVERY_PACKET_ERROR: return; case webrtc::PacketReceiver::DELIVERY_UNKNOWN_SSRC: break; } uint32_t ssrc = 0; if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { return; } int payload_type = 0; if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) { return; } // See if this payload_type is registered as one that usually gets its own // SSRC (RTX) or at least is safe to drop either way (ULPFEC). If it is, and // it wasn't handled above by DeliverPacket, that means we don't know what // stream it associates with, and we shouldn't ever create an implicit channel // for these. for (auto& codec : recv_codecs_) { if (payload_type == codec.rtx_payload_type || payload_type == codec.fec.red_rtx_payload_type || payload_type == codec.fec.ulpfec_payload_type) { return; } } switch (unsignalled_ssrc_handler_->OnUnsignalledSsrc(this, ssrc)) { case UnsignalledSsrcHandler::kDropPacket: return; case UnsignalledSsrcHandler::kDeliverPacket: break; } if (call_->Receiver()->DeliverPacket( webrtc::MediaType::VIDEO, reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) { LOG(LS_WARNING) << "Failed to deliver RTP packet on re-delivery."; return; } } void WebRtcVideoChannel2::OnRtcpReceived( rtc::Buffer* packet, const rtc::PacketTime& packet_time) { const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, packet_time.not_before); // TODO(pbos): Check webrtc::PacketReceiver::DELIVERY_OK once we deliver // for both audio and video on the same path. Since BundleFilter doesn't // filter RTCP anymore incoming RTCP packets could've been going to audio (so // logging failures spam the log). call_->Receiver()->DeliverPacket( webrtc::MediaType::VIDEO, reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), webrtc_packet_time); } void WebRtcVideoChannel2::OnReadyToSend(bool ready) { LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); } bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) { LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " << (mute ? "mute" : "unmute"); RTC_DCHECK(ssrc != 0); rtc::CritScope stream_lock(&stream_crit_); const auto& kv = send_streams_.find(ssrc); if (kv == send_streams_.end()) { LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; return false; } kv->second->MuteStream(mute); return true; } // TODO(pbos): Remove SetOptions in favor of SetSendParameters. void WebRtcVideoChannel2::SetOptions(uint32_t ssrc, const VideoOptions& options) { LOG(LS_INFO) << "SetOptions: ssrc " << ssrc << ": " << options.ToString(); rtc::CritScope stream_lock(&stream_crit_); const auto& kv = send_streams_.find(ssrc); if (kv == send_streams_.end()) { return; } kv->second->SetOptions(options); } void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { MediaChannel::SetInterface(iface); // Set the RTP recv/send buffer to a bigger size MediaChannel::SetOption(NetworkInterface::ST_RTP, rtc::Socket::OPT_RCVBUF, kVideoRtpBufferSize); // Speculative change to increase the outbound socket buffer size. // In b/15152257, we are seeing a significant number of packets discarded // due to lack of socket buffer space, although it's not yet clear what the // ideal value should be. MediaChannel::SetOption(NetworkInterface::ST_RTP, rtc::Socket::OPT_SNDBUF, kVideoRtpBufferSize); } void WebRtcVideoChannel2::OnLoadUpdate(Load load) { // OnLoadUpdate can not take any locks that are held while creating streams // etc. Doing so establishes lock-order inversions between the webrtc process // thread on stream creation and locks such as stream_crit_ while calling out. rtc::CritScope stream_lock(&capturer_crit_); if (!signal_cpu_adaptation_) return; // Do not adapt resolution for screen content as this will likely result in // blurry and unreadable text. for (auto& kv : capturers_) { if (kv.second != nullptr && !kv.second->IsScreencast() && kv.second->video_adapter() != nullptr) { kv.second->video_adapter()->OnCpuResolutionRequest( load == kOveruse ? CoordinatedVideoAdapter::DOWNGRADE : CoordinatedVideoAdapter::UPGRADE); } } } bool WebRtcVideoChannel2::SendRtp(const uint8_t* data, size_t len, const webrtc::PacketOptions& options) { rtc::Buffer packet(data, len, kMaxRtpPacketLen); rtc::PacketOptions rtc_options; rtc_options.packet_id = options.packet_id; return MediaChannel::SendPacket(&packet, rtc_options); } bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { rtc::Buffer packet(data, len, kMaxRtpPacketLen); return MediaChannel::SendRtcp(&packet, rtc::PacketOptions()); } void WebRtcVideoChannel2::StartAllSendStreams() { rtc::CritScope stream_lock(&stream_crit_); for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = send_streams_.begin(); it != send_streams_.end(); ++it) { it->second->Start(); } } void WebRtcVideoChannel2::StopAllSendStreams() { rtc::CritScope stream_lock(&stream_crit_); for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = send_streams_.begin(); it != send_streams_.end(); ++it) { it->second->Stop(); } } WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: VideoSendStreamParameters( const webrtc::VideoSendStream::Config& config, const VideoOptions& options, int max_bitrate_bps, const rtc::Optional<VideoCodecSettings>& codec_settings) : config(config), options(options), max_bitrate_bps(max_bitrate_bps), codec_settings(codec_settings) {} WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder::AllocatedEncoder( webrtc::VideoEncoder* encoder, webrtc::VideoCodecType type, bool external) : encoder(encoder), external_encoder(nullptr), type(type), external(external) { if (external) { external_encoder = encoder; this->encoder = new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); } } WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( webrtc::Call* call, const StreamParams& sp, const webrtc::VideoSendStream::Config& config, WebRtcVideoEncoderFactory* external_encoder_factory, int max_bitrate_bps, const rtc::Optional<VideoCodecSettings>& codec_settings, const std::vector<webrtc::RtpExtension>& rtp_extensions, // TODO(deadbeef): Don't duplicate information between send_params, // rtp_extensions, options, etc. const VideoSendParameters& send_params) : ssrcs_(sp.ssrcs), ssrc_groups_(sp.ssrc_groups), call_(call), external_encoder_factory_(external_encoder_factory), stream_(NULL), parameters_(config, send_params.options, max_bitrate_bps, codec_settings), pending_encoder_reconfiguration_(false), allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), capturer_(NULL), sending_(false), muted_(false), old_adapt_changes_(0), first_frame_timestamp_ms_(0), last_frame_timestamp_ms_(0) { parameters_.config.rtp.max_packet_size = kVideoMtu; parameters_.conference_mode = send_params.conference_mode; sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs); sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, &parameters_.config.rtp.rtx.ssrcs); parameters_.config.rtp.c_name = sp.cname; parameters_.config.rtp.extensions = rtp_extensions; parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize : webrtc::RtcpMode::kCompound; if (codec_settings) { SetCodecAndOptions(*codec_settings, parameters_.options); } } WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { DisconnectCapturer(); if (stream_ != NULL) { call_->DestroyVideoSendStream(stream_); } DestroyVideoEncoder(&allocated_encoder_); } static void CreateBlackFrame(webrtc::VideoFrame* video_frame, int width, int height, webrtc::VideoRotation rotation) { video_frame->CreateEmptyFrame(width, height, width, (width + 1) / 2, (width + 1) / 2); memset(video_frame->buffer(webrtc::kYPlane), 16, video_frame->allocated_size(webrtc::kYPlane)); memset(video_frame->buffer(webrtc::kUPlane), 128, video_frame->allocated_size(webrtc::kUPlane)); memset(video_frame->buffer(webrtc::kVPlane), 128, video_frame->allocated_size(webrtc::kVPlane)); video_frame->set_rotation(rotation); } void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( const VideoFrame& frame) { TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0, frame.GetVideoRotation()); rtc::CritScope cs(&lock_); if (stream_ == NULL) { // Frame input before send codecs are configured, dropping frame. return; } // Not sending, abort early to prevent expensive reconfigurations while // setting up codecs etc. if (!sending_) return; if (muted_) { // Create a black frame to transmit instead. CreateBlackFrame(&video_frame, static_cast<int>(frame.GetWidth()), static_cast<int>(frame.GetHeight()), video_frame.rotation()); } int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec; // frame->GetTimeStamp() is essentially a delta, align to webrtc time if (first_frame_timestamp_ms_ == 0) { first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms; } last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms; video_frame.set_render_time_ms(last_frame_timestamp_ms_); // Reconfigure codec if necessary. SetDimensions(video_frame.width(), video_frame.height(), capturer_->IsScreencast()); last_rotation_ = video_frame.rotation(); stream_->Input()->IncomingCapturedFrame(video_frame); } bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer( VideoCapturer* capturer) { TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetCapturer"); if (!DisconnectCapturer() && capturer == NULL) { return false; } { rtc::CritScope cs(&lock_); // Reset timestamps to realign new incoming frames to a webrtc timestamp. A // new capturer may have a different timestamp delta than the previous one. first_frame_timestamp_ms_ = 0; if (capturer == NULL) { if (stream_ != NULL) { LOG(LS_VERBOSE) << "Disabling capturer, sending black frame."; webrtc::VideoFrame black_frame; CreateBlackFrame(&black_frame, last_dimensions_.width, last_dimensions_.height, last_rotation_); // Force this black frame not to be dropped due to timestamp order // check. As IncomingCapturedFrame will drop the frame if this frame's // timestamp is less than or equal to last frame's timestamp, it is // necessary to give this black frame a larger timestamp than the // previous one. last_frame_timestamp_ms_ += 1; black_frame.set_render_time_ms(last_frame_timestamp_ms_); stream_->Input()->IncomingCapturedFrame(black_frame); } capturer_ = NULL; return true; } capturer_ = capturer; capturer_->AddOrUpdateSink(this, sink_wants_); } return true; } void WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) { rtc::CritScope cs(&lock_); muted_ = mute; } bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { cricket::VideoCapturer* capturer; { rtc::CritScope cs(&lock_); if (capturer_ == NULL) return false; if (capturer_->video_adapter() != nullptr) old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); capturer = capturer_; capturer_ = NULL; } capturer->RemoveSink(this); return true; } const std::vector<uint32_t>& WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { return ssrcs_; } void WebRtcVideoChannel2::WebRtcVideoSendStream::SetOptions( const VideoOptions& options) { rtc::CritScope cs(&lock_); VideoOptions old_options = parameters_.options; parameters_.options.SetAll(options); // No need to do anything if the options aren't changing. if (parameters_.options == old_options) { return; } if (parameters_.codec_settings) { LOG(LS_INFO) << "SetCodecAndOptions because of SetOptions; options=" << options.ToString(); SetCodecAndOptions(*parameters_.codec_settings, options); } else { parameters_.options = options; } } webrtc::VideoCodecType CodecTypeFromName(const std::string& name) { if (CodecNamesEq(name, kVp8CodecName)) { return webrtc::kVideoCodecVP8; } else if (CodecNamesEq(name, kVp9CodecName)) { return webrtc::kVideoCodecVP9; } else if (CodecNamesEq(name, kH264CodecName)) { return webrtc::kVideoCodecH264; } return webrtc::kVideoCodecUnknown; } WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoder( const VideoCodec& codec) { webrtc::VideoCodecType type = CodecTypeFromName(codec.name); // Do not re-create encoders of the same type. if (type == allocated_encoder_.type && allocated_encoder_.encoder != NULL) { return allocated_encoder_; } if (external_encoder_factory_ != NULL) { webrtc::VideoEncoder* encoder = external_encoder_factory_->CreateVideoEncoder(type); if (encoder != NULL) { return AllocatedEncoder(encoder, type, true); } } if (type == webrtc::kVideoCodecVP8) { return AllocatedEncoder( webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kVp8), type, false); } else if (type == webrtc::kVideoCodecVP9) { return AllocatedEncoder( webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kVp9), type, false); } else if (type == webrtc::kVideoCodecH264) { return AllocatedEncoder( webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kH264), type, false); } // This shouldn't happen, we should not be trying to create something we don't // support. RTC_DCHECK(false); return AllocatedEncoder(NULL, webrtc::kVideoCodecUnknown, false); } void WebRtcVideoChannel2::WebRtcVideoSendStream::DestroyVideoEncoder( AllocatedEncoder* encoder) { if (encoder->external) { external_encoder_factory_->DestroyVideoEncoder(encoder->external_encoder); } delete encoder->encoder; } void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodecAndOptions( const VideoCodecSettings& codec_settings, const VideoOptions& options) { parameters_.encoder_config = CreateVideoEncoderConfig(last_dimensions_, codec_settings.codec); RTC_DCHECK(!parameters_.encoder_config.streams.empty()); AllocatedEncoder new_encoder = CreateVideoEncoder(codec_settings.codec); parameters_.config.encoder_settings.encoder = new_encoder.encoder; parameters_.config.encoder_settings.full_overuse_time = new_encoder.external; parameters_.config.encoder_settings.payload_name = codec_settings.codec.name; parameters_.config.encoder_settings.payload_type = codec_settings.codec.id; if (new_encoder.external) { webrtc::VideoCodecType type = CodecTypeFromName(codec_settings.codec.name); parameters_.config.encoder_settings.internal_source = external_encoder_factory_->EncoderTypeHasInternalSource(type); } parameters_.config.rtp.fec = codec_settings.fec; // Set RTX payload type if RTX is enabled. if (!parameters_.config.rtp.rtx.ssrcs.empty()) { if (codec_settings.rtx_payload_type == -1) { LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX " "payload type. Ignoring."; parameters_.config.rtp.rtx.ssrcs.clear(); } else { parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type; } } parameters_.config.rtp.nack.rtp_history_ms = HasNack(codec_settings.codec) ? kNackHistoryMs : 0; parameters_.config.suspend_below_min_bitrate = options.suspend_below_min_bitrate.value_or(false); parameters_.codec_settings = rtc::Optional<WebRtcVideoChannel2::VideoCodecSettings>(codec_settings); parameters_.options = options; LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetCodecAndOptions; options=" << options.ToString(); RecreateWebRtcStream(); if (allocated_encoder_.encoder != new_encoder.encoder) { DestroyVideoEncoder(&allocated_encoder_); allocated_encoder_ = new_encoder; } } void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSendParameters( const ChangedSendParameters& params) { rtc::CritScope cs(&lock_); // |recreate_stream| means construction-time parameters have changed and the // sending stream needs to be reset with the new config. bool recreate_stream = false; if (params.rtcp_mode) { parameters_.config.rtp.rtcp_mode = *params.rtcp_mode; recreate_stream = true; } if (params.rtp_header_extensions) { parameters_.config.rtp.extensions = *params.rtp_header_extensions; sink_wants_.rotation_applied = !ContainsHeaderExtension( *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension); if (capturer_) { capturer_->AddOrUpdateSink(this, sink_wants_); } recreate_stream = true; } if (params.max_bandwidth_bps) { // Max bitrate has changed, reconfigure encoder settings on the next frame // or stream recreation. parameters_.max_bitrate_bps = *params.max_bandwidth_bps; pending_encoder_reconfiguration_ = true; } if (params.conference_mode) { parameters_.conference_mode = *params.conference_mode; } // Set codecs and options. if (params.codec) { SetCodecAndOptions(*params.codec, params.options ? *params.options : parameters_.options); return; } else if (params.options) { // Reconfigure if codecs are already set. if (parameters_.codec_settings) { SetCodecAndOptions(*parameters_.codec_settings, *params.options); return; } else { parameters_.options = *params.options; } } else if (params.conference_mode && parameters_.codec_settings) { SetCodecAndOptions(*parameters_.codec_settings, parameters_.options); return; } if (recreate_stream) { LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetSendParameters"; RecreateWebRtcStream(); } } webrtc::VideoEncoderConfig WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig( const Dimensions& dimensions, const VideoCodec& codec) const { webrtc::VideoEncoderConfig encoder_config; if (dimensions.is_screencast) { encoder_config.min_transmit_bitrate_bps = 1000 * parameters_.options.screencast_min_bitrate_kbps.value_or(0); encoder_config.content_type = webrtc::VideoEncoderConfig::ContentType::kScreen; } else { encoder_config.min_transmit_bitrate_bps = 0; encoder_config.content_type = webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo; } // Restrict dimensions according to codec max. int width = dimensions.width; int height = dimensions.height; if (!dimensions.is_screencast) { if (codec.width < width) width = codec.width; if (codec.height < height) height = codec.height; } VideoCodec clamped_codec = codec; clamped_codec.width = width; clamped_codec.height = height; // By default, the stream count for the codec configuration should match the // number of negotiated ssrcs. But if the codec is blacklisted for simulcast // or a screencast, only configure a single stream. size_t stream_count = parameters_.config.rtp.ssrcs.size(); if (IsCodecBlacklistedForSimulcast(codec.name) || dimensions.is_screencast) { stream_count = 1; } encoder_config.streams = CreateVideoStreams(clamped_codec, parameters_.options, parameters_.max_bitrate_bps, stream_count); // Conference mode screencast uses 2 temporal layers split at 100kbit. if (parameters_.conference_mode && dimensions.is_screencast && encoder_config.streams.size() == 1) { ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault(); // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked // on the VideoCodec struct as target and max bitrates, respectively. // See eg. webrtc::VP8EncoderImpl::SetRates(). encoder_config.streams[0].target_bitrate_bps = config.tl0_bitrate_kbps * 1000; encoder_config.streams[0].max_bitrate_bps = config.tl1_bitrate_kbps * 1000; encoder_config.streams[0].temporal_layer_thresholds_bps.clear(); encoder_config.streams[0].temporal_layer_thresholds_bps.push_back( config.tl0_bitrate_kbps * 1000); } return encoder_config; } void WebRtcVideoChannel2::WebRtcVideoSendStream::SetDimensions( int width, int height, bool is_screencast) { if (last_dimensions_.width == width && last_dimensions_.height == height && last_dimensions_.is_screencast == is_screencast && !pending_encoder_reconfiguration_) { // Configured using the same parameters, do not reconfigure. return; } LOG(LS_INFO) << "SetDimensions: " << width << "x" << height << (is_screencast ? " (screencast)" : " (not screencast)"); last_dimensions_.width = width; last_dimensions_.height = height; last_dimensions_.is_screencast = is_screencast; RTC_DCHECK(!parameters_.encoder_config.streams.empty()); RTC_CHECK(parameters_.codec_settings); VideoCodecSettings codec_settings = *parameters_.codec_settings; webrtc::VideoEncoderConfig encoder_config = CreateVideoEncoderConfig(last_dimensions_, codec_settings.codec); encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings( codec_settings.codec, parameters_.options, is_screencast); bool stream_reconfigured = stream_->ReconfigureVideoEncoder(encoder_config); encoder_config.encoder_specific_settings = NULL; pending_encoder_reconfiguration_ = false; if (!stream_reconfigured) { LOG(LS_WARNING) << "Failed to reconfigure video encoder for dimensions: " << width << "x" << height; return; } parameters_.encoder_config = encoder_config; } void WebRtcVideoChannel2::WebRtcVideoSendStream::Start() { rtc::CritScope cs(&lock_); RTC_DCHECK(stream_ != NULL); stream_->Start(); sending_ = true; } void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() { rtc::CritScope cs(&lock_); if (stream_ != NULL) { stream_->Stop(); } sending_ = false; } VideoSenderInfo WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { VideoSenderInfo info; webrtc::VideoSendStream::Stats stats; { rtc::CritScope cs(&lock_); for (uint32_t ssrc : parameters_.config.rtp.ssrcs) info.add_ssrc(ssrc); if (parameters_.codec_settings) info.codec_name = parameters_.codec_settings->codec.name; for (size_t i = 0; i < parameters_.encoder_config.streams.size(); ++i) { if (i == parameters_.encoder_config.streams.size() - 1) { info.preferred_bitrate += parameters_.encoder_config.streams[i].max_bitrate_bps; } else { info.preferred_bitrate += parameters_.encoder_config.streams[i].target_bitrate_bps; } } if (stream_ == NULL) return info; stats = stream_->GetStats(); info.adapt_changes = old_adapt_changes_; info.adapt_reason = CoordinatedVideoAdapter::ADAPTREASON_NONE; if (capturer_ != NULL) { if (!capturer_->IsMuted()) { VideoFormat last_captured_frame_format; capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, &info.capturer_frame_time, &last_captured_frame_format); info.input_frame_width = last_captured_frame_format.width; info.input_frame_height = last_captured_frame_format.height; } if (capturer_->video_adapter() != nullptr) { info.adapt_changes += capturer_->video_adapter()->adaptation_changes(); info.adapt_reason = capturer_->video_adapter()->adapt_reason(); } } } // Get bandwidth limitation info from stream_->GetStats(). // Input resolution (output from video_adapter) can be further scaled down or // higher video layer(s) can be dropped due to bitrate constraints. // Note, adapt_changes only include changes from the video_adapter. if (stats.bw_limited_resolution) info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; info.encoder_implementation_name = stats.encoder_implementation_name; info.ssrc_groups = ssrc_groups_; info.framerate_input = stats.input_frame_rate; info.framerate_sent = stats.encode_frame_rate; info.avg_encode_ms = stats.avg_encode_time_ms; info.encode_usage_percent = stats.encode_usage_percent; info.nominal_bitrate = stats.media_bitrate_bps; info.send_frame_width = 0; info.send_frame_height = 0; for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = stats.substreams.begin(); it != stats.substreams.end(); ++it) { // TODO(pbos): Wire up additional stats, such as padding bytes. webrtc::VideoSendStream::StreamStats stream_stats = it->second; info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes + stream_stats.rtp_stats.transmitted.header_bytes + stream_stats.rtp_stats.transmitted.padding_bytes; info.packets_sent += stream_stats.rtp_stats.transmitted.packets; info.packets_lost += stream_stats.rtcp_stats.cumulative_lost; if (stream_stats.width > info.send_frame_width) info.send_frame_width = stream_stats.width; if (stream_stats.height > info.send_frame_height) info.send_frame_height = stream_stats.height; info.firs_rcvd += stream_stats.rtcp_packet_type_counts.fir_packets; info.nacks_rcvd += stream_stats.rtcp_packet_type_counts.nack_packets; info.plis_rcvd += stream_stats.rtcp_packet_type_counts.pli_packets; } if (!stats.substreams.empty()) { // TODO(pbos): Report fraction lost per SSRC. webrtc::VideoSendStream::StreamStats first_stream_stats = stats.substreams.begin()->second; info.fraction_lost = static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) / (1 << 8); } return info; } void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBandwidthEstimationInfo( BandwidthEstimationInfo* bwe_info) { rtc::CritScope cs(&lock_); if (stream_ == NULL) { return; } webrtc::VideoSendStream::Stats stats = stream_->GetStats(); for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = stats.substreams.begin(); it != stats.substreams.end(); ++it) { bwe_info->transmit_bitrate += it->second.total_bitrate_bps; bwe_info->retransmit_bitrate += it->second.retransmit_bitrate_bps; } bwe_info->target_enc_bitrate += stats.target_media_bitrate_bps; bwe_info->actual_enc_bitrate += stats.media_bitrate_bps; } void WebRtcVideoChannel2::WebRtcVideoSendStream::RecreateWebRtcStream() { if (stream_ != NULL) { call_->DestroyVideoSendStream(stream_); } RTC_CHECK(parameters_.codec_settings); parameters_.encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings( parameters_.codec_settings->codec, parameters_.options, parameters_.encoder_config.content_type == webrtc::VideoEncoderConfig::ContentType::kScreen); webrtc::VideoSendStream::Config config = parameters_.config; if (!config.rtp.rtx.ssrcs.empty() && config.rtp.rtx.payload_type == -1) { LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX " "payload type the set codec. Ignoring RTX."; config.rtp.rtx.ssrcs.clear(); } stream_ = call_->CreateVideoSendStream(config, parameters_.encoder_config); parameters_.encoder_config.encoder_specific_settings = NULL; pending_encoder_reconfiguration_ = false; if (sending_) { stream_->Start(); } } WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( webrtc::Call* call, const StreamParams& sp, const webrtc::VideoReceiveStream::Config& config, WebRtcVideoDecoderFactory* external_decoder_factory, bool default_stream, const std::vector<VideoCodecSettings>& recv_codecs, bool disable_prerenderer_smoothing) : call_(call), ssrcs_(sp.ssrcs), ssrc_groups_(sp.ssrc_groups), stream_(NULL), default_stream_(default_stream), config_(config), external_decoder_factory_(external_decoder_factory), disable_prerenderer_smoothing_(disable_prerenderer_smoothing), sink_(NULL), last_width_(-1), last_height_(-1), first_frame_timestamp_(-1), estimated_remote_start_ntp_time_ms_(0) { config_.renderer = this; std::vector<AllocatedDecoder> old_decoders; ConfigureCodecs(recv_codecs, &old_decoders); RecreateWebRtcStream(); RTC_DCHECK(old_decoders.empty()); } WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder:: AllocatedDecoder(webrtc::VideoDecoder* decoder, webrtc::VideoCodecType type, bool external) : decoder(decoder), external_decoder(nullptr), type(type), external(external) { if (external) { external_decoder = decoder; this->decoder = new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); } } WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { call_->DestroyVideoReceiveStream(stream_); ClearDecoders(&allocated_decoders_); } const std::vector<uint32_t>& WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { return ssrcs_; } WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( std::vector<AllocatedDecoder>* old_decoders, const VideoCodec& codec) { webrtc::VideoCodecType type = CodecTypeFromName(codec.name); for (size_t i = 0; i < old_decoders->size(); ++i) { if ((*old_decoders)[i].type == type) { AllocatedDecoder decoder = (*old_decoders)[i]; (*old_decoders)[i] = old_decoders->back(); old_decoders->pop_back(); return decoder; } } if (external_decoder_factory_ != NULL) { webrtc::VideoDecoder* decoder = external_decoder_factory_->CreateVideoDecoder(type); if (decoder != NULL) { return AllocatedDecoder(decoder, type, true); } } if (type == webrtc::kVideoCodecVP8) { return AllocatedDecoder( webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); } if (type == webrtc::kVideoCodecVP9) { return AllocatedDecoder( webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp9), type, false); } if (type == webrtc::kVideoCodecH264) { return AllocatedDecoder( webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kH264), type, false); } return AllocatedDecoder( webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kUnsupportedCodec), webrtc::kVideoCodecUnknown, false); } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs( const std::vector<VideoCodecSettings>& recv_codecs, std::vector<AllocatedDecoder>* old_decoders) { *old_decoders = allocated_decoders_; allocated_decoders_.clear(); config_.decoders.clear(); for (size_t i = 0; i < recv_codecs.size(); ++i) { AllocatedDecoder allocated_decoder = CreateOrReuseVideoDecoder(old_decoders, recv_codecs[i].codec); allocated_decoders_.push_back(allocated_decoder); webrtc::VideoReceiveStream::Decoder decoder; decoder.decoder = allocated_decoder.decoder; decoder.payload_type = recv_codecs[i].codec.id; decoder.payload_name = recv_codecs[i].codec.name; config_.decoders.push_back(decoder); } // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. config_.rtp.fec = recv_codecs.front().fec; config_.rtp.nack.rtp_history_ms = HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0; } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetLocalSsrc( uint32_t local_ssrc) { // TODO(pbos): Consider turning this sanity check into a RTC_DCHECK. You // should not be able to create a sender with the same SSRC as a receiver, but // right now this can't be done due to unittests depending on receiving what // they are sending from the same MediaChannel. if (local_ssrc == config_.rtp.remote_ssrc) { LOG(LS_INFO) << "Ignoring call to SetLocalSsrc because parameters are " "unchanged; local_ssrc=" << local_ssrc; return; } config_.rtp.local_ssrc = local_ssrc; LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetLocalSsrc; local_ssrc=" << local_ssrc; RecreateWebRtcStream(); } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetFeedbackParameters( bool nack_enabled, bool remb_enabled, bool transport_cc_enabled) { int nack_history_ms = nack_enabled ? kNackHistoryMs : 0; if (config_.rtp.nack.rtp_history_ms == nack_history_ms && config_.rtp.remb == remb_enabled && config_.rtp.transport_cc == transport_cc_enabled) { LOG(LS_INFO) << "Ignoring call to SetFeedbackParameters because parameters are " "unchanged; nack=" << nack_enabled << ", remb=" << remb_enabled << ", transport_cc=" << transport_cc_enabled; return; } config_.rtp.remb = remb_enabled; config_.rtp.nack.rtp_history_ms = nack_history_ms; config_.rtp.transport_cc = transport_cc_enabled; LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetFeedbackParameters; nack=" << nack_enabled << ", remb=" << remb_enabled << ", transport_cc=" << transport_cc_enabled; RecreateWebRtcStream(); } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRecvParameters( const ChangedRecvParameters& params) { bool needs_recreation = false; std::vector<AllocatedDecoder> old_decoders; if (params.codec_settings) { ConfigureCodecs(*params.codec_settings, &old_decoders); needs_recreation = true; } if (params.rtp_header_extensions) { config_.rtp.extensions = *params.rtp_header_extensions; needs_recreation = true; } if (params.rtcp_mode) { config_.rtp.rtcp_mode = *params.rtcp_mode; needs_recreation = true; } if (needs_recreation) { LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetRecvParameters"; RecreateWebRtcStream(); ClearDecoders(&old_decoders); } } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RecreateWebRtcStream() { if (stream_ != NULL) { call_->DestroyVideoReceiveStream(stream_); } stream_ = call_->CreateVideoReceiveStream(config_); stream_->Start(); } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ClearDecoders( std::vector<AllocatedDecoder>* allocated_decoders) { for (size_t i = 0; i < allocated_decoders->size(); ++i) { if ((*allocated_decoders)[i].external) { external_decoder_factory_->DestroyVideoDecoder( (*allocated_decoders)[i].external_decoder); } delete (*allocated_decoders)[i].decoder; } allocated_decoders->clear(); } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RenderFrame( const webrtc::VideoFrame& frame, int time_to_render_ms) { rtc::CritScope crit(&sink_lock_); if (first_frame_timestamp_ < 0) first_frame_timestamp_ = frame.timestamp(); int64_t rtp_time_elapsed_since_first_frame = (timestamp_wraparound_handler_.Unwrap(frame.timestamp()) - first_frame_timestamp_); int64_t elapsed_time_ms = rtp_time_elapsed_since_first_frame / (cricket::kVideoCodecClockrate / 1000); if (frame.ntp_time_ms() > 0) estimated_remote_start_ntp_time_ms_ = frame.ntp_time_ms() - elapsed_time_ms; if (sink_ == NULL) { LOG(LS_WARNING) << "VideoReceiveStream not connected to a VideoSink."; return; } last_width_ = frame.width(); last_height_ = frame.height(); const WebRtcVideoFrame render_frame( frame.video_frame_buffer(), frame.render_time_ms() * rtc::kNumNanosecsPerMillisec, frame.rotation()); sink_->OnFrame(render_frame); } bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsTextureSupported() const { return true; } bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::SmoothsRenderedFrames() const { return disable_prerenderer_smoothing_; } bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { return default_stream_; } void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink( rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { rtc::CritScope crit(&sink_lock_); sink_ = sink; } std::string WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType( int payload_type) { for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) { if (decoder.payload_type == payload_type) { return decoder.payload_name; } } return ""; } VideoReceiverInfo WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo() { VideoReceiverInfo info; info.ssrc_groups = ssrc_groups_; info.add_ssrc(config_.rtp.remote_ssrc); webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); info.decoder_implementation_name = stats.decoder_implementation_name; info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + stats.rtp_stats.transmitted.header_bytes + stats.rtp_stats.transmitted.padding_bytes; info.packets_rcvd = stats.rtp_stats.transmitted.packets; info.packets_lost = stats.rtcp_stats.cumulative_lost; info.fraction_lost = static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); info.framerate_rcvd = stats.network_frame_rate; info.framerate_decoded = stats.decode_frame_rate; info.framerate_output = stats.render_frame_rate; { rtc::CritScope frame_cs(&sink_lock_); info.frame_width = last_width_; info.frame_height = last_height_; info.capture_start_ntp_time_ms = estimated_remote_start_ntp_time_ms_; } info.decode_ms = stats.decode_ms; info.max_decode_ms = stats.max_decode_ms; info.current_delay_ms = stats.current_delay_ms; info.target_delay_ms = stats.target_delay_ms; info.jitter_buffer_ms = stats.jitter_buffer_ms; info.min_playout_delay_ms = stats.min_playout_delay_ms; info.render_delay_ms = stats.render_delay_ms; info.codec_name = GetCodecNameFromPayloadType(stats.current_payload_type); info.firs_sent = stats.rtcp_packet_type_counts.fir_packets; info.plis_sent = stats.rtcp_packet_type_counts.pli_packets; info.nacks_sent = stats.rtcp_packet_type_counts.nack_packets; return info; } WebRtcVideoChannel2::VideoCodecSettings::VideoCodecSettings() : rtx_payload_type(-1) {} bool WebRtcVideoChannel2::VideoCodecSettings::operator==( const WebRtcVideoChannel2::VideoCodecSettings& other) const { return codec == other.codec && fec.ulpfec_payload_type == other.fec.ulpfec_payload_type && fec.red_payload_type == other.fec.red_payload_type && fec.red_rtx_payload_type == other.fec.red_rtx_payload_type && rtx_payload_type == other.rtx_payload_type; } bool WebRtcVideoChannel2::VideoCodecSettings::operator!=( const WebRtcVideoChannel2::VideoCodecSettings& other) const { return !(*this == other); } std::vector<WebRtcVideoChannel2::VideoCodecSettings> WebRtcVideoChannel2::MapCodecs(const std::vector<VideoCodec>& codecs) { RTC_DCHECK(!codecs.empty()); std::vector<VideoCodecSettings> video_codecs; std::map<int, bool> payload_used; std::map<int, VideoCodec::CodecType> payload_codec_type; // |rtx_mapping| maps video payload type to rtx payload type. std::map<int, int> rtx_mapping; webrtc::FecConfig fec_settings; for (size_t i = 0; i < codecs.size(); ++i) { const VideoCodec& in_codec = codecs[i]; int payload_type = in_codec.id; if (payload_used[payload_type]) { LOG(LS_ERROR) << "Payload type already registered: " << in_codec.ToString(); return std::vector<VideoCodecSettings>(); } payload_used[payload_type] = true; payload_codec_type[payload_type] = in_codec.GetCodecType(); switch (in_codec.GetCodecType()) { case VideoCodec::CODEC_RED: { // RED payload type, should not have duplicates. RTC_DCHECK(fec_settings.red_payload_type == -1); fec_settings.red_payload_type = in_codec.id; continue; } case VideoCodec::CODEC_ULPFEC: { // ULPFEC payload type, should not have duplicates. RTC_DCHECK(fec_settings.ulpfec_payload_type == -1); fec_settings.ulpfec_payload_type = in_codec.id; continue; } case VideoCodec::CODEC_RTX: { int associated_payload_type; if (!in_codec.GetParam(kCodecParamAssociatedPayloadType, &associated_payload_type) || !IsValidRtpPayloadType(associated_payload_type)) { LOG(LS_ERROR) << "RTX codec with invalid or no associated payload type: " << in_codec.ToString(); return std::vector<VideoCodecSettings>(); } rtx_mapping[associated_payload_type] = in_codec.id; continue; } case VideoCodec::CODEC_VIDEO: break; } video_codecs.push_back(VideoCodecSettings()); video_codecs.back().codec = in_codec; } // One of these codecs should have been a video codec. Only having FEC // parameters into this code is a logic error. RTC_DCHECK(!video_codecs.empty()); for (std::map<int, int>::const_iterator it = rtx_mapping.begin(); it != rtx_mapping.end(); ++it) { if (!payload_used[it->first]) { LOG(LS_ERROR) << "RTX mapped to payload not in codec list."; return std::vector<VideoCodecSettings>(); } if (payload_codec_type[it->first] != VideoCodec::CODEC_VIDEO && payload_codec_type[it->first] != VideoCodec::CODEC_RED) { LOG(LS_ERROR) << "RTX not mapped to regular video codec or RED codec."; return std::vector<VideoCodecSettings>(); } if (it->first == fec_settings.red_payload_type) { fec_settings.red_rtx_payload_type = it->second; } } for (size_t i = 0; i < video_codecs.size(); ++i) { video_codecs[i].fec = fec_settings; if (rtx_mapping[video_codecs[i].codec.id] != 0 && rtx_mapping[video_codecs[i].codec.id] != fec_settings.red_payload_type) { video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; } } return video_codecs; } } // namespace cricket
34.952815
80
0.702805
UWNetworksLab
38455ccbd33cea36f2acc4d1768a2df1e9696def
17,502
cpp
C++
src/network_stores/src/jsub_callbacks.cpp
yulicrunchy/JALoP
a474b464d4916fe559cf1df97c855232e5ec24ab
[ "Apache-2.0" ]
null
null
null
src/network_stores/src/jsub_callbacks.cpp
yulicrunchy/JALoP
a474b464d4916fe559cf1df97c855232e5ec24ab
[ "Apache-2.0" ]
null
null
null
src/network_stores/src/jsub_callbacks.cpp
yulicrunchy/JALoP
a474b464d4916fe559cf1df97c855232e5ec24ab
[ "Apache-2.0" ]
null
null
null
/** * @file jsub_callbacks.cpp This file contains handlers for the * Network Library subscriber callbacks. * * @section LICENSE * * Source code in 3rd-party is licensed and owned by their respective * copyright holders. * * All other source code is copyright Tresys Technology and licensed as below. * * Copyright (c) 2012-2013 Tresys Technology LLC, Columbia, Maryland, USA * * This software was developed by Tresys Technology LLC * with U.S. Government sponsorship. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <inttypes.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include "jsub_callbacks.hpp" #include "jsub_db_layer.hpp" #include "jal_alloc.h" #include "jal_asprintf_internal.h" #include "jal_base64_internal.h" #define DEBUG_LOG(args...) \ do { \ time_t rawtime; \ time(&rawtime); \ char timestr[26]; \ strftime(timestr, 26, "%Y-%m-%dT%H:%M:%S", gmtime(&rawtime)); \ fprintf(stdout, "(jal_subscribe) %s[%d](%s) ", __FUNCTION__, __LINE__, timestr); \ fprintf(stdout, ##args); \ fprintf(stdout, "\n"); \ } while(0) #define JSUB_INITIAL_NONCE "0" volatile bool jsub_is_conn_closed = false; volatile int jsub_debug = 0; static struct jaln_subscriber_callbacks *sub_cbs = NULL; static struct jaln_connection_callbacks *cb = NULL; // Journal buffers static uint8_t *journal_sys_meta_buf = NULL; static uint32_t journal_sys_meta_size = 0; static uint8_t *journal_app_meta_buf = NULL; static uint32_t journal_app_meta_size = 0; static uint64_t journal_payload_size = 0; // Audit buffers static uint8_t *audit_sys_meta_buf = NULL; static uint32_t audit_sys_meta_size = 0; static uint8_t *audit_app_meta_buf = NULL; static uint32_t audit_app_meta_size = 0; // Log buffers static uint8_t *log_sys_meta_buf = NULL; static uint32_t log_sys_meta_size = 0; static uint8_t *log_app_meta_buf = NULL; static uint32_t log_app_meta_size = 0; // Journal path and fd static char *db_payload_path = NULL; static int db_payload_fd = -1; enum jaln_connect_error jsub_connect_request_handler( const struct jaln_connect_request *req, int *selected_encoding, int *selected_digest, __attribute__((unused)) void *user_data) { // Nothing to do here if (jsub_debug) { DEBUG_LOG("CONNECT_REQUEST_HANDLER"); DEBUG_LOG("req: %p, enc:%p, dgst:%p", req, selected_encoding, selected_digest); } return JALN_CE_ACCEPT; } void jsub_on_channel_close( const struct jaln_channel_info *channel_info, __attribute__((unused)) void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_CHANNEL_CLOSED"); DEBUG_LOG("channel_info: %p", channel_info); } } void jsub_on_connection_close( const struct jaln_connection *jal_conn, __attribute__((unused)) void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_CONNECTION_CLOSED"); DEBUG_LOG("conn_info: %p", jal_conn); } jsub_is_conn_closed = true; } void jsub_connect_ack( const struct jaln_connect_ack *ack, __attribute__((unused)) void *user_data) { // Nothing to do here if (jsub_debug) { DEBUG_LOG("CONNECT_ACK"); DEBUG_LOG("hostname: %s", ack->hostname); DEBUG_LOG("addr: %s", ack->addr); DEBUG_LOG("version: %d", ack->jaln_version); if (ack->jaln_agent) { DEBUG_LOG("agent: %s", ack->jaln_agent); } DEBUG_LOG("role: %s", ack->mode == JALN_ROLE_SUBSCRIBER ? "subscriber" : "publisher"); } } void jsub_connect_nack( const struct jaln_connect_nack *nack, __attribute__((unused)) void *user_data) { if (jsub_debug) { DEBUG_LOG("CONNECT_NACK"); DEBUG_LOG("ack: %p", nack); } jsub_is_conn_closed = true; } int jsub_get_subscribe_request( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, enum jaln_record_type type, char **nonce, uint64_t *offset) { int ret = 0; enum jaldb_rec_type rec_type; if (jsub_debug) { DEBUG_LOG("GET_SUBSCRIBE_REQUEST"); DEBUG_LOG("host_name: %s", ch_info->hostname); } switch (type) { case JALN_RTYPE_JOURNAL: rec_type = JALDB_RTYPE_JOURNAL; break; case JALN_RTYPE_AUDIT: rec_type = JALDB_RTYPE_AUDIT; break; case JALN_RTYPE_LOG: rec_type = JALDB_RTYPE_LOG; break; default: rec_type = JALDB_RTYPE_UNKNOWN; break; } std::string nonce_out; if (type == JALN_RTYPE_JOURNAL) { // Retrieve offset if it exists char *full_payload_path = NULL; ret = jsub_get_journal_resume(jsub_db_ctx, ch_info->hostname, nonce, &db_payload_path, *offset); if (0 != ret) { // Default *offset = 0; db_payload_path = NULL; } else { jal_asprintf(&full_payload_path, "%s/%s", jsub_db_ctx->journal_root, db_payload_path); nonce_out = *nonce; db_payload_fd = open(full_payload_path, O_RDWR | O_APPEND); if (0 > db_payload_fd) { DEBUG_LOG("Failed to open journal payload for resume: %s", strerror(errno)); } DEBUG_LOG("Opened payload resume file: %d\n", db_payload_fd); free(full_payload_path); } if ((0 != ret) && jsub_debug) { DEBUG_LOG("failed to retrieve a journal resume for host: %s", ch_info->hostname); } if ((0 == ret) && jsub_debug) { DEBUG_LOG("retrieved a journal resume for host: %s", ch_info->hostname); } ret = 0; } if (jsub_debug) { DEBUG_LOG("record_type: %d nonce: %s", type, nonce_out.c_str()); } return ret; } int jsub_on_record_info( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, enum jaln_record_type type, const struct jaln_record_info *record_info, const struct jaln_mime_header *headers, const uint8_t *system_metadata_buffer, const uint32_t system_metadata_size, const uint8_t *application_metadata_buffer, const uint32_t application_metadata_size, void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_RECORD INFO"); DEBUG_LOG("ch info:%p type:%d rec_info: %p headers: %p smb: %p sms:%d amb:%p ams:%d ud:%p\n", ch_info, type, record_info, headers, system_metadata_buffer, system_metadata_size, application_metadata_buffer, application_metadata_size, user_data); } switch (type) { case JALN_RTYPE_JOURNAL: journal_sys_meta_size = system_metadata_size; journal_sys_meta_buf = (uint8_t *) jal_memdup((char *)system_metadata_buffer, system_metadata_size); journal_app_meta_size = application_metadata_size; journal_app_meta_buf = (uint8_t *) jal_memdup((char *)application_metadata_buffer, application_metadata_size); break; case JALN_RTYPE_AUDIT: audit_sys_meta_size = system_metadata_size; audit_sys_meta_buf = (uint8_t *) jal_memdup((char *)system_metadata_buffer, system_metadata_size); audit_app_meta_size = application_metadata_size; audit_app_meta_buf = (uint8_t *) jal_memdup((char *)application_metadata_buffer, application_metadata_size); break; case JALN_RTYPE_LOG: log_sys_meta_size = system_metadata_size; log_sys_meta_buf = (uint8_t *) jal_memdup((char *)system_metadata_buffer, system_metadata_size); log_app_meta_size = application_metadata_size; log_app_meta_buf = (uint8_t *) jal_memdup((char *)application_metadata_buffer, application_metadata_size); break; default: break; } return JAL_OK; } int jsub_on_audit( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, const char *nonce, const uint8_t *buffer, const uint32_t cnt, void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_AUDIT"); DEBUG_LOG("ch info:%p nonce:%s buf: %p cnt:%d ud:%p\n", ch_info, nonce, buffer, cnt, user_data); } // Insert audit into temp container return jsub_insert_audit(jsub_db_ctx, ch_info->hostname, audit_sys_meta_buf, audit_sys_meta_size, audit_app_meta_buf, audit_app_meta_size, (uint8_t *)buffer, cnt, (char *)nonce, jsub_debug); } int jsub_on_log( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, const char *nonce, const uint8_t *buffer, const uint32_t cnt, void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_LOG"); DEBUG_LOG("ch info:%p nonce:%s buf: %p cnt:%d ud:%p\n", ch_info, nonce, buffer, cnt, user_data); } // Insert log into temp container return jsub_insert_log(jsub_db_ctx, ch_info->hostname, log_sys_meta_buf, log_sys_meta_size, log_app_meta_buf, log_app_meta_size, (uint8_t *)buffer, cnt, (char *)nonce, jsub_debug); } int jsub_on_journal( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, const char *nonce, const uint8_t *buffer, const uint32_t cnt, __attribute__((unused)) const uint64_t offset, const int more, void *user_data) { if (jsub_debug) { DEBUG_LOG("ON_JOURNAL"); DEBUG_LOG("more: %d", more); DEBUG_LOG("ch info:%p nonce:%s buf: %p cnt:%d ud:%p\n", ch_info, nonce, buffer, cnt, user_data); } // Write data to disk until there is no more data to write. // Then write the system/application metadata to DB. if (0 == more) { // No more data if (buffer) { int ret = jsub_write_journal( jsub_db_ctx, &db_payload_path, &db_payload_fd, (uint8_t *)buffer, cnt, 0, ch_info->hostname, nonce, jsub_debug); if (0 != ret) { return ret; } } else { jsub_clear_journal_resume(jsub_db_ctx, ch_info->hostname); } int ret = jsub_insert_journal_metadata( jsub_db_ctx, ch_info->hostname, journal_sys_meta_buf, journal_sys_meta_size, journal_app_meta_buf, journal_app_meta_size, db_payload_path, journal_payload_size, (char *)nonce, jsub_debug); journal_payload_size = 0; return ret; } else { // There will be more data, append what we've // received to file on disk. journal_payload_size += cnt; return jsub_write_journal( jsub_db_ctx, &db_payload_path, &db_payload_fd, (uint8_t *)buffer, cnt, journal_payload_size, ch_info->hostname, nonce, jsub_debug); } return JAL_OK; } int jsub_notify_digest( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, enum jaln_record_type type, char *nonce, const uint8_t *digest, const uint32_t len, const void *user_data) { if (jsub_debug) { DEBUG_LOG("NOTIFY_DIGEST"); DEBUG_LOG("ch info:%p type:%d nonce:%s dgst:%p, len:%d, ud:%p\n", ch_info, type, nonce, digest, len, user_data); char *b64 = jal_base64_enc(digest, len); DEBUG_LOG("dgst: %s\n", b64); free(b64); } return JAL_OK; } int jsub_on_digest_response( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, enum jaln_record_type type, const char *nonce, const enum jaln_digest_status status, const void *user_data) { const char *status_str; switch (status) { case JALN_DIGEST_STATUS_CONFIRMED: status_str = "Confirmed"; break; case JALN_DIGEST_STATUS_INVALID: status_str = "Invalid"; break; case JALN_DIGEST_STATUS_UNKNOWN: status_str = "Unknown"; break; default: status_str = "illegal"; return -1; } if (jsub_debug) { DEBUG_LOG("ON_DIGEST_RESPONSE"); DEBUG_LOG("ch info:%p type:%d nonce:%s status: %s, ds:%d, ud:%p\n", ch_info, type, nonce, status_str, status, user_data); } // If the status was CONFIRMED, we should mark it as such. // In any other case, we just return, and it will be removed at the next startup. if (status != JALN_DIGEST_STATUS_CONFIRMED) { return JAL_OK; } enum jaldb_status db_err; int ret = -1; enum jaldb_rec_type jaldb_type = JALDB_RTYPE_UNKNOWN; std::string nonce_out = ""; std::string source = ch_info->hostname; std::string nonce_str = nonce; std::string rec_type = ""; bool willXfer = false; char *rec_nonce = NULL; switch (type) { case JALN_RTYPE_JOURNAL: // xfer journal willXfer = true; ret = JAL_OK; rec_type = "JOURNAL"; jaldb_type = JALDB_RTYPE_JOURNAL; break; case JALN_RTYPE_AUDIT: // xfer audit willXfer = true; ret = JAL_OK; rec_type = "AUDIT"; jaldb_type = JALDB_RTYPE_AUDIT; break; case JALN_RTYPE_LOG: // xfer log willXfer = true; ret = JAL_OK; rec_type = "LOG"; jaldb_type = JALDB_RTYPE_LOG; break; default: // Nothing ret = JAL_OK; rec_type = "UNKNOWN RECORD TYPE"; break; } if (willXfer) { db_err = jaldb_mark_confirmed(jsub_db_ctx, jaldb_type, nonce_str.c_str(), &rec_nonce); if(JALDB_OK != db_err) { DEBUG_LOG("Failed to confirm record! %s nonce: %s error: %d\n", rec_type.c_str(), nonce_str.c_str(), db_err); ret = -1; } } free(rec_nonce); return ret; } void jsub_message_complete( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, enum jaln_record_type type, void *user_data) { int rc = 0; if (jsub_debug) { DEBUG_LOG("MESSAGE_COMPLETE"); DEBUG_LOG("ch info:%p type:%d ud:%p\n", ch_info, type, user_data); } switch (type) { case JALN_RTYPE_JOURNAL: // Perform some cleanup? if (-1 != db_payload_fd) { rc = fsync(db_payload_fd); if ((-1 == rc) && jsub_debug) { DEBUG_LOG("payload file sync failed for %s\n", ch_info->hostname); } rc = close(db_payload_fd); if ((-1 == rc) && jsub_debug) { DEBUG_LOG("payload file close failed for %s\n", ch_info->hostname); } db_payload_fd = -1; } free(journal_sys_meta_buf); free(journal_app_meta_buf); free(db_payload_path); journal_sys_meta_buf = NULL; journal_app_meta_buf = NULL; journal_sys_meta_size = 0; journal_app_meta_size = 0; db_payload_path = NULL; break; case JALN_RTYPE_AUDIT: free(audit_sys_meta_buf); free(audit_app_meta_buf); audit_sys_meta_buf = NULL; audit_app_meta_buf = NULL; audit_sys_meta_size = 0; audit_app_meta_size = 0; break; case JALN_RTYPE_LOG: free(log_sys_meta_buf); free(log_app_meta_buf); log_sys_meta_buf = NULL; log_app_meta_buf = NULL; log_sys_meta_size = 0; log_app_meta_size = 0; break; default: break; } } enum jal_status jsub_get_bytes( const uint64_t offset, uint8_t *const buffer, uint64_t *size, __attribute__((unused))void *feeder_data) { if (-1 == db_payload_fd){ if (jsub_debug) { DEBUG_LOG("get_bytes: bad file descriptor!\n"); } return JAL_E_BAD_FD; } int rc = lseek64(db_payload_fd, offset, SEEK_SET); if (-1 == rc ) { if (jsub_debug) { DEBUG_LOG("get_bytes: seek failed!\n"); } return JAL_E_FILE_IO; } ssize_t bytes_read = read(db_payload_fd, buffer, *size); *size = bytes_read; if (-1 == bytes_read) { if (jsub_debug) { DEBUG_LOG("get_bytes: read failed!\n"); } return JAL_E_FILE_IO; } return JAL_OK; } int jsub_acquire_journal_feeder( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, const char *nonce, struct jaln_payload_feeder *feeder, void *user_data) { if (jsub_debug) { DEBUG_LOG("ACQUIRE_JOURNAL_FEEDER"); DEBUG_LOG("ch_info: %p, nonce:%s, feeder:%p\n", ch_info, nonce, feeder); } feeder->feeder_data = user_data; feeder->get_bytes = jsub_get_bytes; return JAL_OK; } void jsub_release_journal_feeder( __attribute__((unused)) jaln_session *session, const struct jaln_channel_info *ch_info, const char *nonce, struct jaln_payload_feeder *feeder, __attribute__((unused)) void *user_data) { if (jsub_debug) { DEBUG_LOG("RELEASE_JOURNAL_FEEDER"); DEBUG_LOG("ch_info: %p, nonce:%s, feeder:%p\n", ch_info, nonce, feeder); } // Unclear what to do here } enum jal_status jsub_init_subscriber_callbacks(jaln_context *context) { sub_cbs = jaln_subscriber_callbacks_create(); sub_cbs->get_subscribe_request = jsub_get_subscribe_request; sub_cbs->on_record_info = jsub_on_record_info; sub_cbs->on_audit = jsub_on_audit; sub_cbs->on_log = jsub_on_log; sub_cbs->on_journal = jsub_on_journal; sub_cbs->notify_digest = jsub_notify_digest; sub_cbs->on_digest_response = jsub_on_digest_response; sub_cbs->message_complete = jsub_message_complete; sub_cbs->acquire_journal_feeder = jsub_acquire_journal_feeder; sub_cbs->release_journal_feeder = jsub_release_journal_feeder; enum jal_status ret = jaln_register_subscriber_callbacks(context, sub_cbs); jaln_subscriber_callbacks_destroy(&sub_cbs); return ret; } enum jal_status jsub_init_connection_callbacks(jaln_context *context) { cb = jaln_connection_callbacks_create(); cb->connect_request_handler = jsub_connect_request_handler; cb->on_channel_close = jsub_on_channel_close; cb->on_connection_close = jsub_on_connection_close; cb->connect_ack = jsub_connect_ack; cb->connect_nack = jsub_connect_nack; return jaln_register_connection_callbacks(context, cb); } enum jal_status jsub_callbacks_init(jaln_context *context) { enum jal_status ret; ret = jsub_init_connection_callbacks(context); if (JAL_OK != ret) { if (jsub_debug) { DEBUG_LOG("connection_callback_init_failed\n"); } return ret; } ret = jsub_init_subscriber_callbacks(context); if (JAL_OK != ret) { if (jsub_debug) { DEBUG_LOG("subscriber_callback_init_failed\n"); } return ret; } return ret; }
26.884793
112
0.721003
yulicrunchy
3845895e575a59b58c530274848359c48cb6d098
1,856
cpp
C++
app/src/main/cpp/GameApplication.cpp
KoreanGinseng/2d_shooting_game_for_android
be21b4f4bbf8326c834f2148f6ab6337fd2c0518
[ "MIT" ]
null
null
null
app/src/main/cpp/GameApplication.cpp
KoreanGinseng/2d_shooting_game_for_android
be21b4f4bbf8326c834f2148f6ab6337fd2c0518
[ "MIT" ]
null
null
null
app/src/main/cpp/GameApplication.cpp
KoreanGinseng/2d_shooting_game_for_android
be21b4f4bbf8326c834f2148f6ab6337fd2c0518
[ "MIT" ]
null
null
null
/******************************************************************************/ /*! @file GameApplication.cpp @brief ゲームアプリケーションクラス実装ファイル *******************************************************************************/ #include "GameApplication.h" using namespace Shooting2D; /******************************************************************************/ /*! アプリケーションの初期化 @return 成功 k_Success, 失敗 それ以外 *******************************************************************************/ MyS32 CGameApplication::Initialize() { m_SceneManager = std::make_shared<CSceneManager>(); m_SceneManager->Regist<CTitleScene>("Title"); m_SceneManager->Regist<CGameScene>("Game"); m_SceneManager->Regist<CClearScene>("Clear"); m_SceneManager->Regist<COverScene>("Over"); m_SceneManager->Change("Title"); SceneChangerService::SetService(m_SceneManager); return k_Success; } /******************************************************************************/ /*! アプリケーションの更新 @return 成功 k_Success, 失敗 それ以外 *******************************************************************************/ MyS32 CGameApplication::Update() { return m_SceneManager->Update(); } /******************************************************************************/ /*! アプリケーションの描画 @return 成功 k_Success, 失敗 それ以外 *******************************************************************************/ MyS32 CGameApplication::Draw() { return m_SceneManager->Draw(); } /******************************************************************************/ /*! アプリケーションの解放 @return 成功 k_Success, 失敗 それ以外 *******************************************************************************/ MyS32 CGameApplication::Release() { m_SceneManager->Release(); SceneChangerService::Release(); return k_Success; }
33.745455
80
0.386853
KoreanGinseng
384716cf972c58eedfa9659e8799bf3146931521
2,633
cpp
C++
Gems/Atom/RPI/Code/Source/RPI.Public/Image/AttachmentImagePool.cpp
cypherdotXd/o3de
bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676
[ "Apache-2.0", "MIT" ]
11
2021-07-08T09:58:26.000Z
2022-03-17T17:59:26.000Z
Gems/Atom/RPI/Code/Source/RPI.Public/Image/AttachmentImagePool.cpp
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
29
2021-07-06T19:33:52.000Z
2022-03-22T10:27:49.000Z
Gems/Atom/RPI/Code/Source/RPI.Public/Image/AttachmentImagePool.cpp
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
4
2021-07-06T19:24:43.000Z
2022-03-31T12:42:27.000Z
/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include <Atom/RPI.Public/Image/AttachmentImagePool.h> #include <Atom/RPI.Reflect/ResourcePoolAsset.h> #include <Atom/RHI/Factory.h> #include <Atom/RHI/ImagePool.h> #include <Atom/RHI.Reflect/ImagePoolDescriptor.h> #include <AtomCore/Instance/InstanceDatabase.h> namespace AZ { namespace RPI { Data::Instance<AttachmentImagePool> AttachmentImagePool::FindOrCreate(const Data::Asset<ResourcePoolAsset>& resourcePoolAsset) { return Data::InstanceDatabase<AttachmentImagePool>::Instance().FindOrCreate( Data::InstanceId::CreateFromAssetId(resourcePoolAsset.GetId()), resourcePoolAsset); } Data::Instance<AttachmentImagePool> AttachmentImagePool::CreateInternal(RHI::Device& device, ResourcePoolAsset& poolAsset) { Data::Instance<AttachmentImagePool> imagePool = aznew AttachmentImagePool(); RHI::ResultCode resultCode = imagePool->Init(device, poolAsset); if (resultCode == RHI::ResultCode::Success) { return imagePool; } return nullptr; } RHI::ResultCode AttachmentImagePool::Init(RHI::Device& device, ResourcePoolAsset& poolAsset) { RHI::Ptr<RHI::ImagePool> imagePool = RHI::Factory::Get().CreateImagePool(); if (!imagePool) { AZ_Error("RPI::ImagePool", false, "Failed to create RHI::ImagePool"); return RHI::ResultCode::Fail; } RHI::ImagePoolDescriptor *desc = azrtti_cast<RHI::ImagePoolDescriptor*>(poolAsset.GetPoolDescriptor().get()); if (!desc) { AZ_Error("RPI::ImagePool", false, "The resource pool asset does not contain an image pool descriptor."); return RHI::ResultCode::Fail; } RHI::ResultCode resultCode = imagePool->Init(device, *desc); if (resultCode == RHI::ResultCode::Success) { m_pool = imagePool; m_pool->SetName(AZ::Name{ poolAsset.GetPoolName() }); } return resultCode; } const RHI::ImagePool* AttachmentImagePool::GetRHIPool() const { return m_pool.get(); } RHI::ImagePool* AttachmentImagePool::GetRHIPool() { return m_pool.get(); } } }
32.9125
134
0.609191
cypherdotXd
38471ec692cf3fb79f8f69e8bb522db856b9adc0
6,787
cpp
C++
third_party/opencore-audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
asveikau/audio
4b8978d5a7855a0ee62cd15b1dd76d35fb6c8290
[ "0BSD" ]
null
null
null
third_party/opencore-audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
asveikau/audio
4b8978d5a7855a0ee62cd15b1dd76d35fb6c8290
[ "0BSD" ]
null
null
null
third_party/opencore-audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
asveikau/audio
4b8978d5a7855a0ee62cd15b1dd76d35fb6c8290
[ "0BSD" ]
null
null
null
/* ------------------------------------------------------------------ * Copyright (C) 2008 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * See the License for the specific language governing permissions * and limitations under the License. * ------------------------------------------------------------------- */ /**************************************************************************************** Portions of this file are derived from the following 3GPP standard: 3GPP TS 26.073 ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec Available from http://www.3gpp.org (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) Permission to distribute, modify and use this file under the standard license terms listed above has been obtained from the copyright holder. ****************************************************************************************/ /* Filename: /audio/gsm_amr/c/src/ph_disp_tab.c Date: 01/16/2002 ------------------------------------------------------------------------------ REVISION HISTORY Description: Added #ifdef __cplusplus and removed "extern" from table definition. Description: Put "extern" back. Description: ------------------------------------------------------------------------------ MODULE DESCRIPTION This file contains the table of impulse responses of the phase dispersion filters. All impulse responses are in Q15 ------------------------------------------------------------------------------ */ /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ #include "typedef.h" /*--------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /*---------------------------------------------------------------------------- ; MACROS ; [Define module specific macros here] ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; DEFINES ; [Include all pre-processor statements here. Include conditional ; compile variables also.] ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; LOCAL FUNCTION DEFINITIONS ; [List function prototypes here] ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; LOCAL VARIABLE DEFINITIONS ; [Variable declaration - defined here and used outside this module] ----------------------------------------------------------------------------*/ extern const Word16 ph_imp_low_MR795[40] = { 26777, 801, 2505, -683, -1382, 582, 604, -1274, 3511, -5894, 4534, -499, -1940, 3011, -5058, 5614, -1990, -1061, -1459, 4442, -700, -5335, 4609, 452, -589, -3352, 2953, 1267, -1212, -2590, 1731, 3670, -4475, -975, 4391, -2537, 949, -1363, -979, 5734 }; extern const Word16 ph_imp_mid_MR795[40] = { 30274, 3831, -4036, 2972, -1048, -1002, 2477, -3043, 2815, -2231, 1753, -1611, 1714, -1775, 1543, -1008, 429, -169, 472, -1264, 2176, -2706, 2523, -1621, 344, 826, -1529, 1724, -1657, 1701, -2063, 2644, -3060, 2897, -1978, 557, 780, -1369, 842, 655 }; extern const Word16 ph_imp_low[40] = { 14690, 11518, 1268, -2761, -5671, 7514, -35, -2807, -3040, 4823, 2952, -8424, 3785, 1455, 2179, -8637, 8051, -2103, -1454, 777, 1108, -2385, 2254, -363, -674, -2103, 6046, -5681, 1072, 3123, -5058, 5312, -2329, -3728, 6924, -3889, 675, -1775, 29, 10145 }; extern const Word16 ph_imp_mid[40] = { 30274, 3831, -4036, 2972, -1048, -1002, 2477, -3043, 2815, -2231, 1753, -1611, 1714, -1775, 1543, -1008, 429, -169, 472, -1264, 2176, -2706, 2523, -1621, 344, 826, -1529, 1724, -1657, 1701, -2063, 2644, -3060, 2897, -1978, 557, 780, -1369, 842, 655 }; /*--------------------------------------------------------------------------*/ #ifdef __cplusplus } #endif /* ------------------------------------------------------------------------------ FUNCTION NAME: ------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs: None Outputs: None Returns: None Global Variables Used: None Local Variables Needed: None ------------------------------------------------------------------------------ FUNCTION DESCRIPTION None ------------------------------------------------------------------------------ REQUIREMENTS None ------------------------------------------------------------------------------ REFERENCES [1] ph_disp.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001 ------------------------------------------------------------------------------ PSEUDO-CODE ------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable used to represent cycle count for each subroutine called) where: (cycle count variable) = cycle count for [subroutine name] ------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function] ------------------------------------------------------------------------------ */ /*---------------------------------------------------------------------------- ; FUNCTION CODE ----------------------------------------------------------------------------*/
35.165803
89
0.398556
asveikau
3848339fd71227afed4ea80e324561f03b125856
1,781
cpp
C++
QubGL/src/Rendering/Mesh.cpp
festivaledu/QubGL
2ab1def8a654868fa010f3384ef8937b257cc111
[ "MIT" ]
null
null
null
QubGL/src/Rendering/Mesh.cpp
festivaledu/QubGL
2ab1def8a654868fa010f3384ef8937b257cc111
[ "MIT" ]
null
null
null
QubGL/src/Rendering/Mesh.cpp
festivaledu/QubGL
2ab1def8a654868fa010f3384ef8937b257cc111
[ "MIT" ]
null
null
null
// // Mesh.cpp // QubGL // // Copyright © 2020 Team FESTIVAL. All rights reserved. // #include "Mesh.hpp" #include <iostream> #include "ElementBufferObject.hpp" #include "Material.hpp" #include "Vertex.hpp" #include "VertexArrayObject.hpp" #include "VertexBufferObject.hpp" Mesh::Mesh(std::vector<Vertex>& vertices, std::vector<unsigned int>& indices) :m_ebo(nullptr), m_vao(nullptr), m_vbo(nullptr) { if (!m_isLoaded) { Load(&vertices, &indices); } } void Mesh::Bind() const { m_vao->Bind(); m_vbo->Bind(); m_ebo->Bind(); } void Mesh::Draw() const { Bind(); glDrawElements(GL_TRIANGLES, m_ebo->GetIndicesCount(), GL_UNSIGNED_INT, (void*)0); Unbind(); } Material Mesh::GetMaterial() const { return m_material; } std::string Mesh::GetName() const { return m_name; } void Mesh::Load(std::vector<Vertex>* vertices, std::vector<unsigned int>* indices) { m_vao = new VertexArrayObject(); m_vbo = new VertexBufferObject(); m_ebo = new ElementBufferObject(); m_vao->Bind(); m_vbo->Bind(); m_vbo->BufferData(GL_ARRAY_BUFFER, vertices->size() * sizeof(Vertex), &vertices->front(), GL_STATIC_DRAW); m_vao->SetupAttribPointers(); m_vbo->Unbind(); m_ebo->Bind(); m_ebo->BufferData(GL_ELEMENT_ARRAY_BUFFER, indices->size() * sizeof(unsigned int), &indices->front(), GL_STATIC_DRAW); m_ebo->Unbind(); m_vao->Unbind(); m_isLoaded = true; } void Mesh::SetMaterial(Material material) { m_material = material; } void Mesh::SetName(std::string name) { m_name = name; } void Mesh::Unbind() const { m_vao->Unbind(); m_vbo->Unbind(); m_ebo->Unbind(); } void Mesh::Unload() { delete m_vao; delete m_vbo; delete m_ebo; m_isLoaded = false; }
20.011236
122
0.651319
festivaledu
38499074995745c03f3829d2214b884e45fb9cd2
96
cpp
C++
src/node.cpp
fMalinka/sem1R
fab02834ec73b9b85550a7013741902da1010e72
[ "MIT" ]
null
null
null
src/node.cpp
fMalinka/sem1R
fab02834ec73b9b85550a7013741902da1010e72
[ "MIT" ]
null
null
null
src/node.cpp
fMalinka/sem1R
fab02834ec73b9b85550a7013741902da1010e72
[ "MIT" ]
null
null
null
#include "node.h" Node::Node() { //std::vector<edge> *relationship; } Node::~Node() { }
7.384615
38
0.552083
fMalinka
38499397174f03255678ddd633cbd016d85d840b
8,434
cpp
C++
src/gerbil/KmerDistributor.cpp
danflomin/gerbil
699826e07c81a5bcb045d23ebc33371b124115ca
[ "MIT" ]
37
2017-01-04T12:31:47.000Z
2022-03-11T08:47:32.000Z
src/gerbil/KmerDistributor.cpp
danflomin/gerbil
699826e07c81a5bcb045d23ebc33371b124115ca
[ "MIT" ]
18
2016-05-06T07:58:48.000Z
2022-02-17T04:11:17.000Z
src/gerbil/KmerDistributor.cpp
danflomin/gerbil
699826e07c81a5bcb045d23ebc33371b124115ca
[ "MIT" ]
13
2016-05-16T12:52:50.000Z
2022-03-02T19:26:50.000Z
/* * KmerDistributer.cpp * * Created on: Jan 22, 2016 * Author: rechner */ #include "../../include/gerbil/KmerDistributer.h" #include "../../include/gerbil/config.h" #include <stdio.h> #include <cmath> #include <cstring> #include <climits> #include <map> #include <algorithm> #include <sstream> namespace gerbil { KmerDistributer::KmerDistributer(const uint32_t numCPUHasherThreads, const uint32_t numGPUHasherThreads, const uint32_t maxNumFiles) : numThreadsCPU(numCPUHasherThreads), numThreadsGPU(numGPUHasherThreads), _kmerNumber(0), _ukmerNumber(0), _ukmerRatio(0.0), _totalCapacity(0) { const uint32_t numThreads = numCPUHasherThreads + numGPUHasherThreads; prefixSum = new double[numThreads + 1]; tmp = new double[numThreads]; capacity = new uint64_t[numThreads]; throughput = new double[numThreads]; memset(throughput, 0, numThreads * sizeof(double)); // fill throughput array with initial zeros // init all capacities with infinity for (int i = 0; i < numThreads; i++) capacity[i] = ULONG_MAX; // initialize file specific variables ratio.resize(maxNumFiles); buckets.resize(maxNumFiles); lock.resize(maxNumFiles); for (int i = 0; i < maxNumFiles; i++) { ratio[i] = new double[numThreads]; buckets[i] = new uint32_t[BUCKETSIZE]; lock[i] = 1; // set lock status of each file to locked memset(ratio[i], 0, numThreads * sizeof(double)); } } KmerDistributer::~KmerDistributer() { delete[] prefixSum; delete[] tmp; delete[] capacity; delete[] throughput; for (int i = 0; i < buckets.size(); i++) { delete[] buckets[i]; delete[] ratio[i]; } } void KmerDistributer::updateThroughput(const bool gpu, const uint32_t tId, const double t) { if (gpu) { //printf("gpu hasher %u: update throughput to %f kmers/ms\n", tId, t); throughput[numThreadsCPU + tId] = t; } else { //printf("cpu hasher %u: update throughput to %f kmers/ms\n", tId, t); throughput[tId] = t; } } void KmerDistributer::updateCapacity(const bool gpu, const uint32_t tId, const uint64_t cap) { if (gpu) { //printf("gpu hasher %u: update capacity to %u kmer\n", tId, cap); capacity[numThreadsCPU + tId] = cap; } else { //printf("cpu hasher %u: update capacity to %u kmer\n", tId, cap); //capacity[tId] = cap; } _totalCapacity += cap; //std::cout << "cap: " << cap << " " << _totalCapacity << std::endl; //printf("updateCapacity: cap= %lu _totalCapacity= %lu\n", cap, _totalCapacity.load()); } /*void KmerDistributer::updateUKmerRatio(const bool gpu, const uint32_t tId, const uint binkmernumber, const uint binukmernumber) { if(!tId && !gpu) { _ukmerNumber += binukmernumber; _kmerNumber += binkmernumber; _ukmerRatio = _kmerNumber ? ((double)_ukmerNumber) / _kmerNumber : 1; } }*/ double KmerDistributer::getSplitRatio(const bool gpu, const uint32_t tId, const uint_tfn curTempFileId) const { //return 1; // wait until updates are complete //while (lock[curTempFileId]) // usleep(10); return gpu ? ratio[curTempFileId][numThreadsCPU + tId] : ratio[curTempFileId][tId]; } void KmerDistributer::updateFileInformation(const uint32_t curFileId, const uint32_t curRun, const uint32_t maxRunsPerFile, const uint64_t kmersInFile) { //printf(">>>>>>>>>>>>>updateFileInformation!\n"); // try to lock data structure //if (CAS(&lock[curFileId], 1, 2) != 1) // return; const double eps = 1e-6; const uint32_t numThreads = numThreadsCPU + numThreadsGPU; // compute sum of all throughput double sum = 0; for (int i = 0; i < numThreads; i++) { //printf("thread %u has throughput %f\n", i, throughput[i]); sum += throughput[i]; // break if any thread has not yet provieded throughput information if (fabs(throughput[i]) < eps) { sum = 0; break; } } /** * Update the ratio of kmers from latest throughput and capacity */ // if some thread has not provided throughput information if (fabs(sum) < eps) { // distribute kmers equally over all threads for (int i = 0; i < numThreads; i++) { ratio[curFileId][i] = 1.0f / numThreads; //printf("thread %u becomes ratio of %f\n", i, ratio[curFileId][i]); } } // if all threads have provided throughput information else { // define the new ratio of kmers for each hasher thread for (int i = 0; i < numThreads; i++) { /* Version 1: Each Ratio is defined as average between throughput ratio and uniform distribution */ //cpuRatio[i] = 0.5 * cpu_throughput[i] / sum + 0.5 / (numCPUHasherThreads + numGPUHasherThreads); /* Version 2: Each Ratio is defined as average between troughput ratio and old ratio */ ratio[curFileId][i] = 0.5 * ratio[lastFileId][i] + 0.5 * throughput[i] / sum; /* Version 3: Each Ratio is defined as pure throughput ratio */ //ratio[curFileId][i] = throughput[lastFileId][i] / sum; //printf("thread %u becomes ratio of %f\n", i, ratio[curFileId][i]); } } // Check whether any capacity constraint will be violated. int numPositiveCapacity = 0; for (int i = 0; i < numThreads; i++) { double maxRatio = (double) capacity[i] / (double) kmersInFile; tmp[i] = maxRatio - ratio[curFileId][i]; if (tmp[i] > 0) numPositiveCapacity++; //printf("thread %u has diff of %f\n", i, tmp[i]); } for (int i = 0; i < numThreads; i++) { // while ratio constraint of thread i is violated and there are threads that could compensate int rnd = 0; while (rnd < 100 && tmp[i] < -eps && numPositiveCapacity > 0) { rnd++; //printf("while (tmp[i] < 0 && numPositiveCapacity > 0)\n"); // try to redistribute an amount of kmers to other hasher threads /*printf( "capacity of thread %u is violated! redistribute a relative amount of %f kmers!\n", i, -tmp[i]);*/ // try to redistribute uniformly to all threads with positive capacity double y = -tmp[i] / (double) numPositiveCapacity; for (int k = 0; tmp[i] < -eps && k < numThreads; k++) { // if thread k has still open capacity if (tmp[k] > eps) { double x = std::min(y, tmp[k]); ratio[curFileId][i] -= x;// ratio of thread i becomes smaller by x ratio[curFileId][k] += x;// ratio of thread k becomes larger by x tmp[i] += x; tmp[k] -= x; //printf("give %f to thread %u\n", x, k); if (tmp[k] <= eps) numPositiveCapacity--; } } } // if difference is still smaller than zero: exception! if (numPositiveCapacity <= 0 && tmp[i] < -eps) throw std::runtime_error( "gerbil::exception: system has not enough memory for this number of files. Try to increase the number of temporary files.\n"); } /** * Update prefix sums */ int j = 0; double x = 0; for (int i = 0; i < numThreads; i++) { prefixSum[j] = x; x += ratio[curFileId][i]; j++; // printf("thread %u becomes final ratio of %f\n", i, ratio[curFileId][i]); } prefixSum[numThreads] = 1.0; /** * Update Bucket table for the current file. */ uint32_t* bucket = buckets[curFileId]; for(size_t i = 0; i < BUCKETSIZE; ++i) bucket[i] = NULL_BUCKET_VALUE; uint tempBucketSize = BUCKETSIZE / maxRunsPerFile; uint offset = curRun * tempBucketSize; if(curRun + 1 == maxRunsPerFile) tempBucketSize = BUCKETSIZE - offset; uint32_t threadId = 0; int i = 0; // for each hasher thread while (threadId < numThreads) { // for each bucket entry with corresponds to current hasher thread //std::cout << "tempBucketSize: " << tempBucketSize << " " << (int)(prefixSum[bucketId + 1] * tempBucketSize) << std::endl; while (offset + i < BUCKETSIZE && i < prefixSum[threadId + 1] * tempBucketSize) { bucket[offset + i] = threadId; i++; } threadId++; } #if false std::stringstream s; s << (int) curFileId << " " << (int) curRun << " ["; for(size_t i = 0; i < BUCKETSIZE; ++i) { if(bucket[i] == NULL_BUCKET_VALUE) s << "N"; else s << (int) bucket[i]; s << ", "; } s << "]\n"; std::cout << s.str() << std::flush; #endif // unlock current file //lock[curFileId] = 0; lastFileId = curFileId; } } /* namespace gerbil */
30.669091
132
0.623429
danflomin
384d6369e11578437894de056daf3ff41eb928b1
9,189
hpp
C++
tpls/pressio/include/pressio/utils/logger/spdlog/details/registry.hpp
fnrizzi/pressio-demoapps
6ff10bbcf4d526610580940753c9620725bff1ba
[ "BSD-3-Clause" ]
29
2019-11-11T13:17:57.000Z
2022-03-16T01:31:31.000Z
tpls/pressio/include/pressio/utils/logger/spdlog/details/registry.hpp
fnrizzi/pressio-demoapps
6ff10bbcf4d526610580940753c9620725bff1ba
[ "BSD-3-Clause" ]
303
2019-09-30T10:15:41.000Z
2022-03-30T08:24:04.000Z
tpls/pressio/include/pressio/utils/logger/spdlog/details/registry.hpp
fnrizzi/pressio-demoapps
6ff10bbcf4d526610580940753c9620725bff1ba
[ "BSD-3-Clause" ]
4
2020-07-07T03:32:36.000Z
2022-03-10T05:21:42.000Z
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef UTILS_LOGGER_SPDLOG_DETAILS_REGISTRY_HPP_ #define UTILS_LOGGER_SPDLOG_DETAILS_REGISTRY_HPP_ // Loggers registry of unique name->logger pointer // An attempt to create a logger with an already existing name will result with spdlog_ex exception. // If user requests a non existing logger, nullptr will be returned // This class is thread safe #include <unordered_map> #include <mutex> //#include "../common.hpp" //#include "../logger.hpp" #include "./periodic_worker.hpp" // #include <chrono> // #include <functional> // #include <memory> // #include <string> namespace spdlog { //class logger; namespace details { class thread_pool; class periodic_worker; class registry { public: using log_levels = std::unordered_map<std::string, level::level_enum>; registry(const registry &) = delete; registry &operator=(const registry &) = delete; public: void register_logger(std::shared_ptr<logger> new_logger) { std::lock_guard<std::mutex> lock(logger_map_mutex_); register_logger_(std::move(new_logger)); } void initialize_logger(std::shared_ptr<logger> new_logger) { std::lock_guard<std::mutex> lock(logger_map_mutex_); new_logger->set_formatter(formatter_->clone()); if (err_handler_) { new_logger->set_error_handler(err_handler_); } // set new level according to previously configured level or default level auto it = log_levels_.find(new_logger->name()); auto new_level = it != log_levels_.end() ? it->second : global_log_level_; new_logger->set_level(new_level); new_logger->flush_on(flush_level_); if (backtrace_n_messages_ > 0) { new_logger->enable_backtrace(backtrace_n_messages_); } if (automatic_registration_) { register_logger_(std::move(new_logger)); } } std::shared_ptr<logger> get(const std::string &logger_name) { std::lock_guard<std::mutex> lock(logger_map_mutex_); auto found = loggers_.find(logger_name); return found == loggers_.end() ? nullptr : found->second; } std::shared_ptr<logger> default_logger() { std::lock_guard<std::mutex> lock(logger_map_mutex_); return default_logger_; } // Return raw ptr to the default logger. // To be used directly by the spdlog default api (e.g. spdlog::info) // This make the default API faster, but cannot be used concurrently with set_default_logger(). // e.g do not call set_default_logger() from one thread while calling spdlog::info() from another. logger *get_default_raw() { return default_logger_.get(); } // set default logger. // default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map. void set_default_logger(std::shared_ptr<logger> new_default_logger) { std::lock_guard<std::mutex> lock(logger_map_mutex_); // remove previous default logger from the map if (default_logger_ != nullptr) { loggers_.erase(default_logger_->name()); } if (new_default_logger != nullptr) { loggers_[new_default_logger->name()] = new_default_logger; } default_logger_ = std::move(new_default_logger); } void set_tp(std::shared_ptr<thread_pool> tp) { std::lock_guard<std::recursive_mutex> lock(tp_mutex_); tp_ = std::move(tp); } std::shared_ptr<thread_pool> get_tp() { std::lock_guard<std::recursive_mutex> lock(tp_mutex_); return tp_; } // Set global formatter. Each sink in each logger will get a clone of this object void set_formatter(std::unique_ptr<formatter> formatter) { std::lock_guard<std::mutex> lock(logger_map_mutex_); formatter_ = std::move(formatter); for (auto &l : loggers_) { l.second->set_formatter(formatter_->clone()); } } void enable_backtrace(size_t n_messages) { std::lock_guard<std::mutex> lock(logger_map_mutex_); backtrace_n_messages_ = n_messages; for (auto &l : loggers_) { l.second->enable_backtrace(n_messages); } } void disable_backtrace() { std::lock_guard<std::mutex> lock(logger_map_mutex_); backtrace_n_messages_ = 0; for (auto &l : loggers_) { l.second->disable_backtrace(); } } void set_level(level::level_enum log_level) { std::lock_guard<std::mutex> lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->set_level(log_level); } global_log_level_ = log_level; } void flush_on(level::level_enum log_level) { std::lock_guard<std::mutex> lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->flush_on(log_level); } flush_level_ = log_level; } void flush_every(std::chrono::seconds interval) { std::lock_guard<std::mutex> lock(flusher_mutex_); auto clbk = [this]() { this->flush_all(); }; periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval); } void set_error_handler(void (*handler)(const std::string &msg)) { std::lock_guard<std::mutex> lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->set_error_handler(handler); } err_handler_ = handler; } void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun) { std::lock_guard<std::mutex> lock(logger_map_mutex_); for (auto &l : loggers_) { fun(l.second); } } void flush_all() { std::lock_guard<std::mutex> lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->flush(); } } void drop(const std::string &logger_name) { std::lock_guard<std::mutex> lock(logger_map_mutex_); loggers_.erase(logger_name); if (default_logger_ && default_logger_->name() == logger_name) { default_logger_.reset(); } } void drop_all() { std::lock_guard<std::mutex> lock(logger_map_mutex_); loggers_.clear(); default_logger_.reset(); } // clean all resources and threads started by the registry void shutdown() { { std::lock_guard<std::mutex> lock(flusher_mutex_); periodic_flusher_.reset(); } drop_all(); { std::lock_guard<std::recursive_mutex> lock(tp_mutex_); tp_.reset(); } } std::recursive_mutex & tp_mutex() { return tp_mutex_; } void set_automatic_registration(bool automatic_registration) { std::lock_guard<std::mutex> lock(logger_map_mutex_); automatic_registration_ = automatic_registration; } void set_levels(log_levels levels, level::level_enum *global_level) { std::lock_guard<std::mutex> lock(logger_map_mutex_); log_levels_ = std::move(levels); auto global_level_requested = global_level != nullptr; global_log_level_ = global_level_requested ? *global_level : global_log_level_; for (auto &logger : loggers_) { auto logger_entry = log_levels_.find(logger.first); if (logger_entry != log_levels_.end()) { logger.second->set_level(logger_entry->second); } else if (global_level_requested) { logger.second->set_level(*global_level); } } } static registry &instance() { static registry s_instance; return s_instance; } private: registry() : formatter_(new pattern_formatter("%+")) { #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER // create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows). #ifdef _WIN32 auto color_sink = std::make_shared<sinks::wincolor_stdout_sink_mt>(); #else auto color_sink = std::make_shared<sinks::ansicolor_stdout_sink_mt>(); #endif const char *default_logger_name = ""; default_logger_ = std::make_shared<spdlog::logger>(default_logger_name, std::move(color_sink)); loggers_[default_logger_name] = default_logger_; #endif // SPDLOG_DISABLE_DEFAULT_LOGGER } ~registry() = default; void throw_if_exists_(const std::string &logger_name) { if (loggers_.find(logger_name) != loggers_.end()) { throw_spdlog_ex("logger with name '" + logger_name + "' already exists"); } } void register_logger_(std::shared_ptr<logger> new_logger) { auto logger_name = new_logger->name(); throw_if_exists_(logger_name); loggers_[logger_name] = std::move(new_logger); } //bool set_level_from_cfg_(logger *logger); private: std::mutex logger_map_mutex_, flusher_mutex_; std::recursive_mutex tp_mutex_; std::unordered_map<std::string, std::shared_ptr<logger>> loggers_; log_levels log_levels_; std::unique_ptr<formatter> formatter_; spdlog::level::level_enum global_log_level_ = level::info; level::level_enum flush_level_ = level::off; void (*err_handler_)(const std::string &msg); std::shared_ptr<thread_pool> tp_; std::unique_ptr<periodic_worker> periodic_flusher_; std::shared_ptr<logger> default_logger_; bool automatic_registration_ = true; size_t backtrace_n_messages_ = 0; }; } // namespace details } // namespace spdlog // #ifdef SPDLOG_HEADER_ONLY // #include "registry-inl.hpp" // #endif #endif // UTILS_LOGGER_SPDLOG_DETAILS_REGISTRY_HPP_
26.868421
100
0.688541
fnrizzi
384ea49223a428bcef5d10b66d931c3d10ace61d
2,798
cpp
C++
src/bar_widget.cpp
cbeck88/HexWarfare
94a70b1889afc2fbd990892ed66be874ac70d1b4
[ "Apache-2.0" ]
null
null
null
src/bar_widget.cpp
cbeck88/HexWarfare
94a70b1889afc2fbd990892ed66be874ac70d1b4
[ "Apache-2.0" ]
null
null
null
src/bar_widget.cpp
cbeck88/HexWarfare
94a70b1889afc2fbd990892ed66be874ac70d1b4
[ "Apache-2.0" ]
null
null
null
/* Copyright 2014 Kristina Simpson <sweet.kristas@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "bar_widget.hpp" #include "gui_elements.hpp" #include "wm.hpp" namespace gui { bar::bar(const rectf& pos, Justify justify, BarOrientation orientation) : widget(pos, justify), orientation_(orientation) { } bar::bar(BarOrientation orientation, Justify justify) : widget(point(), justify), orientation_(orientation) { } void bar::handle_init() { if(orientation_ == BarOrientation::HORIZONTAL) { endcap_lt_ = section::get("barBlue_horizontalLeft"); endcap_rb_ = section::get("barBlue_horizontalRight"); bar_middle_ = section::get("barBlue_horizontalMid"); } else { endcap_lt_ = section::get("barBlue_verticalTop"); endcap_rb_ = section::get("barBlue_verticalBottom"); bar_middle_ = section::get("barBlue_verticalMid"); } } void bar::handle_draw(const rect& r, float rotation, float scale) const { const point p = r.top_left(); auto& wm = graphics::window_manager::get_main_window(); bar_middle_.blit_ex((mid_r_+p)* scale, rotation, (mid_r_+p).mid() * scale, graphics::FlipFlags::NONE); endcap_lt_.blit_ex((lt_r_+p) * scale, rotation, (mid_r_+p).mid() * scale, graphics::FlipFlags::NONE); endcap_rb_.blit_ex((rb_r_+p) * scale, rotation, (mid_r_+p).mid() * scale, graphics::FlipFlags::NONE); } void bar::recalc_dimensions() { int lt_x, lt_y; int rb_x, rb_y; int lt_w, lt_h; int rb_w, rb_h; if(orientation_ == BarOrientation::HORIZONTAL) { lt_x = physical_area().x(); lt_y = physical_area().y(); lt_w = endcap_lt_.width(); lt_h = physical_area().h(); rb_x = physical_area().x2() - endcap_rb_.width(); rb_y = physical_area().y(); rb_w = endcap_rb_.width(); rb_h = physical_area().h(); mid_r_.set(lt_x+lt_w-1, lt_y, rb_x-lt_x+lt_w-1, lt_h); } else { lt_x = physical_area().x(); lt_y = physical_area().y(); lt_w = physical_area().w(); lt_h = endcap_lt_.height(); rb_x = physical_area().x(); rb_y = physical_area().y2() - endcap_rb_.height(); rb_w = physical_area().h(); rb_h = endcap_rb_.height(); mid_r_.set(lt_x, lt_y+lt_h-1, lt_w, rb_y-lt_y+lt_h-1); } lt_r_.set(lt_x, lt_y, lt_w, lt_h); rb_r_.set(rb_x, rb_y, rb_w, rb_h); } }
30.086022
104
0.686562
cbeck88
384ed0f44997e7818e229d719c76a8722cd2a7c6
3,781
cc
C++
mwrap/example/fem/src/elastic2d.cc
ejyoo921/FMM3D
6aeb4031340c1aeca0754f0fd2b7ef8e754a449e
[ "Apache-2.0" ]
31
2015-07-10T08:25:10.000Z
2021-10-15T12:39:49.000Z
mwrap/example/fem/src/elastic2d.cc
ejyoo921/FMM3D
6aeb4031340c1aeca0754f0fd2b7ef8e754a449e
[ "Apache-2.0" ]
6
2020-07-06T02:24:03.000Z
2020-08-10T15:06:35.000Z
mwrap/example/fem/src/elastic2d.cc
ejyoo921/FMM3D
6aeb4031340c1aeca0754f0fd2b7ef8e754a449e
[ "Apache-2.0" ]
17
2017-03-28T02:50:22.000Z
2022-03-11T14:12:16.000Z
/* * elastic2d.cc * Element type for 2D elasticity (4 node quad only). * * Copyright (c) 2007 David Bindel * See the file COPYING for copying permissions */ #include "etype.h" #include "mesh.h" #include "elastic2d.h" #include "quad2d.h" #include "gauss2by2.h" #include <string.h> #define ME Elastic2D ME::ME(double E, double nu, const char* type) { if (strcmp(type, "plane stress") == 0) plane_stress(E, nu); else plane_strain(E, nu); } void ME::plane_strain(double E, double nu) { /* <generator matexpr> input E, nu; output D(3,3); D = E/(1+nu)/(1-2*nu) * [ 1-nu, nu, 0; nu, 1-nu, 0; 0, 0, (1-2*nu)/2 ]; */ } void ME::plane_stress(double E, double nu) { /* <generator matexpr> input E, nu; output D(3,3); D = E/(1-nu*nu) * [ 1, nu, 0; nu, 1, 0; 0, 0, (1-nu)/2 ]; */ } void ME::assign_ids(Mesh* mesh, int eltid) { for (int i = 0; i < 4; ++i) { int ni = mesh->ix(i,eltid); mesh->id(0,ni) = 1; mesh->id(1,ni) = 1; } } void ME::assemble_f(Mesh* mesh, int eltid) { Quad2d quad; Gauss4 xi(quad); get_quad(quad, mesh, eltid); vector<double> K(4*4); for (xi.start(); !xi.done(); ++xi) { double eps[3] = {0, 0, 0}; for (int j = 0; j < 4; ++j) { const double* u = mesh->u(mesh->ix(j,eltid)); double Nj_x = xi.dN(j,0); double Nj_y = xi.dN(j,1); /* <generator matexpr> // Contribute strain at quadrature point input Nj_x, Nj_y, D(3,3); inout eps(3); input u(2); Bj = [Nj_x, 0; 0, Nj_y; Nj_y, Nj_x]; eps += Bj*u; */ } for (int i = 0; i < 4; ++i) { double* f = mesh->f(mesh->ix(i,eltid)); double Ni_x = xi.dN(i,0); double Ni_y = xi.dN(i,1); double w = xi.wt(); /* <generator matexpr> // Contribute B_i'*D*B(u) * w input Ni_x, Ni_y, D(3,3), w; input eps(3); inout f(2); Bi = [Ni_x, 0; 0, Ni_y; Ni_y, Ni_x]; f += Bi'*D*eps*w; */ } } } void ME::assemble_K(Mesh* mesh, int eltid, MatrixAssembler* K_assembler) { Quad2d quad; Gauss4 xi(quad); get_quad(quad, mesh, eltid); vector<double> K(8*8); for (xi.start(); !xi.done(); ++xi) { double w = xi.wt(); for (int j = 0; j < 4; ++j) { double Nj_x = xi.dN(j,0); double Nj_y = xi.dN(j,1); for (int i = 0; i < 4; ++i) { double Ni_x = xi.dN(i,0); double Ni_y = xi.dN(i,1); double* Knodal = &(K[16*j +2*i+ 0]); /* <generator matexpr> // B-matrix based displacement formulation // Isotropic plane strain constitutive tensor input D(3,3), w; input Ni_x, Ni_y, Nj_x, Nj_y; inout Knodal[8](2,2); Bi = [Ni_x, 0; 0, Ni_y; Ni_y, Ni_x]; Bj = [Nj_x, 0; 0, Nj_y; Nj_y, Nj_x]; Knodal += Bi'*D*Bj * w; */ } } } K_assembler->add_entry(id, id, &(K[0]), 8, 8); } void ME::get_quad(FEShapes& quad, Mesh* mesh, int eltid) { for (int i = 0; i < 4; ++i) { int n = mesh->ix(i,eltid); quad.set_node(i, mesh->x(n)); id[2*i+0] = mesh->id(0,n); id[2*i+1] = mesh->id(1,n); } }
21.729885
61
0.427665
ejyoo921
384f638fdca397c8059b2b35004ba99e4e4d61ea
15,355
cpp
C++
OpenTESArena/src/Media/TextureUtils.cpp
TotalCaesar659/OpenTESArena
e72eda7a5e03869309b5ed7375f432d0ad826ff3
[ "MIT" ]
null
null
null
OpenTESArena/src/Media/TextureUtils.cpp
TotalCaesar659/OpenTESArena
e72eda7a5e03869309b5ed7375f432d0ad826ff3
[ "MIT" ]
null
null
null
OpenTESArena/src/Media/TextureUtils.cpp
TotalCaesar659/OpenTESArena
e72eda7a5e03869309b5ed7375f432d0ad826ff3
[ "MIT" ]
null
null
null
#include <algorithm> #include "TextureUtils.h" #include "../Assets/ArenaTextureName.h" #include "../Math/Rect.h" #include "../Media/TextureManager.h" #include "../Rendering/Renderer.h" #include "../UI/ArenaFontName.h" #include "../UI/FontLibrary.h" #include "../UI/Surface.h" #include "../UI/TextAlignment.h" #include "../UI/TextBox.h" #include "../UI/TextRenderUtils.h" Surface TextureUtils::makeSurfaceFrom8Bit(int width, int height, const uint8_t *pixels, const Palette &palette) { Surface surface = Surface::createWithFormat(width, height, Renderer::DEFAULT_BPP, Renderer::DEFAULT_PIXELFORMAT); uint32_t *dstPixels = static_cast<uint32_t*>(surface.getPixels()); const int pixelCount = width * height; for (int i = 0; i < pixelCount; i++) { const uint8_t srcPixel = pixels[i]; const Color dstColor = palette[srcPixel]; dstPixels[i] = dstColor.toARGB(); } return surface; } Texture TextureUtils::makeTextureFrom8Bit(int width, int height, const uint8_t *pixels, const Palette &palette, Renderer &renderer) { Texture texture = renderer.createTexture(Renderer::DEFAULT_PIXELFORMAT, SDL_TEXTUREACCESS_STREAMING, width, height); if (texture.get() == nullptr) { DebugLogError("Couldn't create texture (dims: " + std::to_string(width) + "x" + std::to_string(height) + ")."); return texture; } uint32_t *dstPixels; int pitch; if (SDL_LockTexture(texture.get(), nullptr, reinterpret_cast<void**>(&dstPixels), &pitch) != 0) { DebugLogError("Couldn't lock SDL texture (dims: " + std::to_string(width) + "x" + std::to_string(height) + ")."); return texture; } const int pixelCount = width * height; for (int i = 0; i < pixelCount; i++) { const uint8_t srcPixel = pixels[i]; const Color dstColor = palette[srcPixel]; dstPixels[i] = dstColor.toARGB(); } SDL_UnlockTexture(texture.get()); // Set alpha transparency on. if (SDL_SetTextureBlendMode(texture.get(), SDL_BLENDMODE_BLEND) != 0) { DebugLogError("Couldn't set SDL texture alpha blending."); } return texture; } Surface TextureUtils::generate(TextureUtils::PatternType type, int width, int height, TextureManager &textureManager, Renderer &renderer) { // Initialize the scratch surface to transparent. Surface surface = Surface::createWithFormat(width, height, Renderer::DEFAULT_BPP, Renderer::DEFAULT_PIXELFORMAT); const uint32_t clearColor = surface.mapRGBA(0, 0, 0, 0); surface.fill(clearColor); if (type == TextureUtils::PatternType::Parchment) { // Minimum dimensions of parchment pop-up. DebugAssert(width >= 40); DebugAssert(height >= 40); // Get the nine parchment tiles. const std::string &tilesPaletteFilename = ArenaTextureName::CharacterCreation; const std::optional<PaletteID> tilesPaletteID = textureManager.tryGetPaletteID(tilesPaletteFilename.c_str()); if (!tilesPaletteID.has_value()) { DebugCrash("Couldn't get tile palette ID for \"" + tilesPaletteFilename + "\"."); } const std::string &tilesFilename = ArenaTextureName::Parchment; const std::optional<TextureBuilderIdGroup> tilesTextureBuilderIDs = textureManager.tryGetTextureBuilderIDs(tilesFilename.c_str()); if (!tilesTextureBuilderIDs.has_value()) { DebugCrash("Couldn't get tiles texture builder IDs for \"" + tilesFilename + "\"."); } // Lambda for making a temp SDL surface wrapper for writing to the final texture. This is a // temp compatibility layer for keeping from changing the SDL blit code below, since making a // new surface from a texture builder is wasteful. auto makeSurface = [&textureManager, tilesPaletteID](TextureBuilderID textureBuilderID) { const TextureBuilder &textureBuilder = textureManager.getTextureBuilderHandle(textureBuilderID); Surface surface = Surface::createWithFormat(textureBuilder.getWidth(), textureBuilder.getHeight(), Renderer::DEFAULT_BPP, Renderer::DEFAULT_PIXELFORMAT); // Parchment tiles should all be 8-bit for now. DebugAssert(textureBuilder.getType() == TextureBuilder::Type::Paletted); const TextureBuilder::PalettedTexture &srcTexture = textureBuilder.getPaletted(); const Buffer2D<uint8_t> &srcTexels = srcTexture.texels; uint32_t *dstPixels = static_cast<uint32_t*>(surface.getPixels()); const Palette &palette = textureManager.getPaletteHandle(*tilesPaletteID); std::transform(srcTexels.get(), srcTexels.end(), dstPixels, [&palette](const uint8_t srcTexel) { return palette[srcTexel].toARGB(); }); return surface; }; // Four corner tiles. const TextureBuilderID topLeftTextureBuilderID = tilesTextureBuilderIDs->getID(0); const TextureBuilderID topRightTextureBuilderID = tilesTextureBuilderIDs->getID(2); const TextureBuilderID bottomLeftTextureBuilderID = tilesTextureBuilderIDs->getID(6); const TextureBuilderID bottomRightTextureBuilderID = tilesTextureBuilderIDs->getID(8); const Surface topLeft = makeSurface(topLeftTextureBuilderID); const Surface topRight = makeSurface(topRightTextureBuilderID); const Surface bottomLeft = makeSurface(bottomLeftTextureBuilderID); const Surface bottomRight = makeSurface(bottomRightTextureBuilderID); // Four side tiles. const TextureBuilderID topTextureBuilderID = tilesTextureBuilderIDs->getID(1); const TextureBuilderID leftTextureBuilderID = tilesTextureBuilderIDs->getID(3); const TextureBuilderID rightTextureBuilderID = tilesTextureBuilderIDs->getID(5); const TextureBuilderID bottomTextureBuilderID = tilesTextureBuilderIDs->getID(7); const Surface top = makeSurface(topTextureBuilderID); const Surface left = makeSurface(leftTextureBuilderID); const Surface right = makeSurface(rightTextureBuilderID); const Surface bottom = makeSurface(bottomTextureBuilderID); // One body tile. const TextureBuilderID bodyTextureBuilderID = tilesTextureBuilderIDs->getID(4); const Surface body = makeSurface(bodyTextureBuilderID); // Draw body tiles. for (int y = topLeft.getHeight(); y < (surface.getHeight() - topRight.getHeight()); y += body.getHeight()) { for (int x = topLeft.getWidth(); x < (surface.getWidth() - topRight.getWidth()); x += body.getWidth()) { const Rect rect(x, y, body.getWidth(), body.getHeight()); body.blit(surface, rect); } } // Draw edge tiles. for (int y = topLeft.getHeight(); y < (surface.getHeight() - bottomLeft.getHeight()); y += left.getHeight()) { const Rect leftRect(0, y, left.getWidth(), left.getHeight()); const Rect rightRect(surface.getWidth() - right.getWidth(), y, right.getWidth(), right.getHeight()); // Remove any traces of body tiles underneath. surface.fillRect(leftRect, clearColor); surface.fillRect(rightRect, clearColor); left.blit(surface, leftRect); right.blit(surface, rightRect); } for (int x = topLeft.getWidth(); x < (surface.getWidth() - topRight.getWidth()); x += top.getWidth()) { const Rect topRect(x, 0, top.getWidth(), top.getHeight()); const Rect bottomRect(x, surface.getHeight() - bottom.getHeight(), bottom.getWidth(), bottom.getHeight()); // Remove any traces of other tiles underneath. surface.fillRect(topRect, clearColor); surface.fillRect(bottomRect, clearColor); top.blit(surface, topRect); bottom.blit(surface, bottomRect); } // Draw corner tiles. const Rect topLeftRect(0, 0, topLeft.getWidth(), topLeft.getHeight()); const Rect topRightRect(surface.getWidth() - topRight.getWidth(), 0, topRight.getWidth(), topRight.getHeight()); const Rect bottomLeftRect(0, surface.getHeight() - bottomLeft.getHeight(), bottomLeft.getWidth(), bottomLeft.getHeight()); const Rect bottomRightRect(surface.getWidth() - bottomRight.getWidth(), surface.getHeight() - bottomRight.getHeight(), bottomRight.getWidth(), bottomRight.getHeight()); // Remove any traces of other tiles underneath. surface.fillRect(topLeftRect, clearColor); surface.fillRect(topRightRect, clearColor); surface.fillRect(bottomLeftRect, clearColor); surface.fillRect(bottomRightRect, clearColor); topLeft.blit(surface, topLeftRect); topRight.blit(surface, topRightRect); bottomLeft.blit(surface, bottomLeftRect); bottomRight.blit(surface, bottomRightRect); } else if (type == TextureUtils::PatternType::Dark) { // Minimum dimensions of dark pop-up. DebugAssert(width >= 4); DebugAssert(height >= 4); // Get all the colors used with the dark pop-up. const uint32_t fillColor = surface.mapRGBA(28, 24, 36, 255); const uint32_t topColor = surface.mapRGBA(36, 36, 48, 255); const uint32_t bottomColor = surface.mapRGBA(12, 12, 24, 255); const uint32_t rightColor = surface.mapRGBA(56, 69, 77, 255); const uint32_t leftColor = bottomColor; const uint32_t topRightColor = surface.mapRGBA(69, 85, 89, 255); const uint32_t bottomRightColor = surface.mapRGBA(36, 36, 48, 255); // Fill with dark-bluish color. surface.fill(fillColor); // Color edges. uint32_t *pixels = static_cast<uint32_t*>(surface.get()->pixels); for (int x = 0; x < surface.getWidth(); x++) { pixels[x] = topColor; pixels[x + surface.getWidth()] = topColor; pixels[x + ((surface.getHeight() - 2) * surface.getWidth())] = bottomColor; pixels[x + ((surface.getHeight() - 1) * surface.getWidth())] = bottomColor; } for (int y = 0; y < surface.getHeight(); y++) { pixels[y * surface.getWidth()] = leftColor; pixels[1 + (y * surface.getWidth())] = leftColor; pixels[(surface.getWidth() - 2) + (y * surface.getWidth())] = rightColor; pixels[(surface.getWidth() - 1) + (y * surface.getWidth())] = rightColor; } // Color corners. pixels[1] = topColor; pixels[surface.getWidth() - 2] = topColor; pixels[surface.getWidth() - 1] = topRightColor; pixels[(surface.getWidth() - 2) + surface.getWidth()] = topRightColor; pixels[(surface.getWidth() - 2) + ((surface.getHeight() - 2) * surface.getWidth())] = bottomRightColor; pixels[(surface.getWidth() - 2) + ((surface.getHeight() - 1) * surface.getWidth())] = bottomColor; pixels[(surface.getWidth() - 1) + ((surface.getHeight() - 1) * surface.getWidth())] = bottomRightColor; } else if (type == TextureUtils::PatternType::Custom1) { // Minimum dimensions of light-gray pattern. DebugAssert(width >= 3); DebugAssert(height >= 3); const uint32_t fillColor = surface.mapRGBA(85, 85, 97, 255); const uint32_t lightBorder = surface.mapRGBA(125, 125, 145, 255); const uint32_t darkBorder = surface.mapRGBA(40, 40, 48, 255); // Fill with light gray color. surface.fill(fillColor); // Color edges. uint32_t *pixels = static_cast<uint32_t*>(surface.get()->pixels); for (int x = 0; x < surface.getWidth(); x++) { pixels[x] = lightBorder; pixels[x + ((surface.getHeight() - 1) * surface.getWidth())] = darkBorder; } for (int y = 0; y < surface.getHeight(); y++) { pixels[y * surface.getWidth()] = darkBorder; pixels[(surface.getWidth() - 1) + (y * surface.getWidth())] = lightBorder; } // Color corners. pixels[0] = fillColor; pixels[(surface.getWidth() - 1) + ((surface.getHeight() - 1) * surface.getWidth())] = fillColor; } else { DebugCrash("Unrecognized pattern type."); } return surface; } Surface TextureUtils::createTooltip(const std::string &text, const FontLibrary &fontLibrary) { const char *fontName = ArenaFontName::D; int fontDefIndex; if (!fontLibrary.tryGetDefinitionIndex(fontName, &fontDefIndex)) { DebugCrash("Couldn't get font definition for \"" + std::string(fontName) + "\"."); } const FontDefinition &fontDef = fontLibrary.getDefinition(fontDefIndex); constexpr int lineSpacing = 1; TextRenderUtils::TextureGenInfo textureGenInfo = TextRenderUtils::makeTextureGenInfo(text, fontDef, std::nullopt, lineSpacing); constexpr int padding = 4; Surface surface = Surface::createWithFormat(textureGenInfo.width + padding, textureGenInfo.height + padding, Renderer::DEFAULT_BPP, Renderer::DEFAULT_PIXELFORMAT); const Color backColor(32, 32, 32, 192); surface.fill(backColor.r, backColor.g, backColor.b, backColor.a); // Offset the text from the top left corner a bit so it isn't against the side of the tooltip // (for aesthetic purposes). const int dstX = padding / 2; const int dstY = padding / 2; const Color textColor(255, 255, 255, 255); BufferView2D<uint32_t> surfacePixelsView( static_cast<uint32_t*>(surface.getPixels()), surface.getWidth(), surface.getHeight()); std::vector<std::string_view> textLines = TextRenderUtils::getTextLines(text); constexpr TextAlignment alignment = TextAlignment::TopLeft; TextRenderUtils::drawTextLines(BufferView<const std::string_view>(textLines.data(), static_cast<int>(textLines.size())), fontDef, dstX, dstY, textColor, alignment, lineSpacing, nullptr, nullptr, surfacePixelsView); return surface; } Buffer<TextureAssetReference> TextureUtils::makeTextureAssetRefs(const std::string &filename, TextureManager &textureManager) { const std::optional<TextureFileMetadataID> metadataID = textureManager.tryGetMetadataID(filename.c_str()); if (!metadataID.has_value()) { DebugLogError("Couldn't get texture file metadata for \"" + filename + "\"."); return Buffer<TextureAssetReference>(); } const TextureFileMetadata &textureFileMetadata = textureManager.getMetadataHandle(*metadataID); const int textureCount = textureFileMetadata.getTextureCount(); Buffer<TextureAssetReference> textureAssetRefs(textureCount); for (int i = 0; i < textureCount; i++) { TextureAssetReference textureAssetRef(std::string(textureFileMetadata.getFilename()), i); textureAssetRefs.set(i, std::move(textureAssetRef)); } return textureAssetRefs; } bool TextureUtils::tryAllocUiTexture(const TextureAssetReference &textureAssetRef, const TextureAssetReference &paletteTextureAssetRef, TextureManager &textureManager, Renderer &renderer, UiTextureID *outID) { const std::optional<PaletteID> paletteID = textureManager.tryGetPaletteID(paletteTextureAssetRef); if (!paletteID.has_value()) { DebugLogError("Couldn't get palette ID for \"" + paletteTextureAssetRef.filename + "\"."); return false; } const std::optional<TextureBuilderID> textureBuilderID = textureManager.tryGetTextureBuilderID(textureAssetRef); if (!textureBuilderID.has_value()) { DebugLogError("Couldn't get texture builder ID for \"" + textureAssetRef.filename + "\"."); return false; } if (!renderer.tryCreateUiTexture(*textureBuilderID, *paletteID, textureManager, outID)) { DebugLogError("Couldn't create UI texture for \"" + textureAssetRef.filename + "\"."); return false; } return true; } bool TextureUtils::tryAllocUiTextureFromSurface(const Surface &surface, TextureManager &textureManager, Renderer &renderer, UiTextureID *outID) { const int width = surface.getWidth(); const int height = surface.getHeight(); UiTextureID textureID; if (!renderer.tryCreateUiTexture(width, height, &textureID)) { DebugLogError("Couldn't create UI texture from surface."); return false; } const int texelCount = width * height; const uint32_t *srcTexels = static_cast<const uint32_t*>(surface.getPixels()); uint32_t *dstTexels = renderer.lockUiTexture(textureID); if (dstTexels == nullptr) { DebugLogError("Couldn't lock UI texels for writing from surface."); return false; } std::copy(srcTexels, srcTexels + texelCount, dstTexels); renderer.unlockUiTexture(textureID); *outID = textureID; return true; }
37.820197
121
0.730511
TotalCaesar659
384f87eeba92a32cf92994a6cf06d0e3af80af45
2,760
cpp
C++
unit-test/common/test_topicregistry.cpp
google/detectorgraph
d6c923f8e495a21137312b236e35c36a55d3a755
[ "Apache-2.0" ]
43
2018-05-17T07:13:18.000Z
2022-02-02T01:54:06.000Z
unit-test/common/test_topicregistry.cpp
google/detectorgraph
d6c923f8e495a21137312b236e35c36a55d3a755
[ "Apache-2.0" ]
4
2018-09-20T04:14:11.000Z
2018-09-21T08:05:33.000Z
unit-test/common/test_topicregistry.cpp
google/detectorgraph
d6c923f8e495a21137312b236e35c36a55d3a755
[ "Apache-2.0" ]
12
2018-05-17T09:03:31.000Z
2020-10-13T16:38:15.000Z
// Copyright 2018 Nest Labs, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "test_topicregistry.h" #include "topicregistry.hpp" #include "nltest.h" #define SUITE_DECLARATION(name, test_ptr) { #name, test_ptr, setup_##name, teardown_##name } using namespace DetectorGraph; static int setup_topicregistry(void *inContext) { return 0; } static int teardown_topicregistry(void *inContext) { return 0; } namespace { struct TopicStateA : public TopicState {}; struct TopicStateB : public TopicState {}; } static void Test_ResolveUnregistered(nlTestSuite *inSuite, void *inContext) { TopicRegistry registry; Topic<TopicStateA>* resolvedPtr; Topic<TopicStateB> other; resolvedPtr = registry.Resolve<TopicStateA>(); NL_TEST_ASSERT(inSuite, resolvedPtr == NULL); registry.Register(&other); resolvedPtr = registry.Resolve<TopicStateA>(); NL_TEST_ASSERT(inSuite, resolvedPtr == NULL); } static void Test_ResolveRegistered(nlTestSuite *inSuite, void *inContext) { TopicRegistry registry; Topic<TopicStateA> topicA; Topic<TopicStateB> topicB; registry.Register(&topicA); registry.Register(&topicB); Topic<TopicStateA>* topicAPtr = registry.Resolve<TopicStateA>(); NL_TEST_ASSERT(inSuite, topicAPtr == &topicA); Topic<TopicStateB>* topicBPtr = registry.Resolve<TopicStateB>(); NL_TEST_ASSERT(inSuite, topicBPtr == &topicB); } static void Test_CleanupWithScope(nlTestSuite *inSuite, void *inContext) { { TopicRegistry registry; Topic<TopicStateA> topicA; registry.Register(&topicA); } { TopicRegistry registry; Topic<TopicStateA>* topicAPtr = registry.Resolve<TopicStateA>(); NL_TEST_ASSERT(inSuite, topicAPtr == NULL); } } static const nlTest sTests[] = { NL_TEST_DEF("Test_ResolveUnregistered", Test_ResolveUnregistered), NL_TEST_DEF("Test_ResolveRegistered", Test_ResolveRegistered), NL_TEST_DEF("Test_CleanupWithScope", Test_CleanupWithScope), NL_TEST_SENTINEL() }; extern "C" int topicregistry_testsuite(void) { nlTestSuite theSuite = SUITE_DECLARATION(topicregistry, &sTests[0]); nlTestRunner(&theSuite, NULL); return nlTestRunnerStats(&theSuite); }
28.163265
92
0.727536
google
ee2c53c0d076a24737f2fadf8282c91e61f5c46e
1,188
cpp
C++
dataset/test/modification/1486_all/32/transformation_1.cpp
Karina5005/Plagiarism
ce11f72ba21a754ca84a27e5f26a31a19d6cb6fb
[ "MIT" ]
3
2022-02-15T00:29:39.000Z
2022-03-15T08:36:44.000Z
dataset/test/modification/1486_all/32/transformation_1.cpp
Kira5005-code/Plagiarism
ce11f72ba21a754ca84a27e5f26a31a19d6cb6fb
[ "MIT" ]
null
null
null
dataset/test/modification/1486_all/32/transformation_1.cpp
Kira5005-code/Plagiarism
ce11f72ba21a754ca84a27e5f26a31a19d6cb6fb
[ "MIT" ]
null
null
null
#include <iomanip> #include <iostream> #include<bits/stdc++.h> using namespace std; int main(); int main() { int j; cin >> j; if (5 > 3) cout << "new code";for ( ; j--; ) /* 'for' inside */ { int t; cin >> t; int hf_q[t + 1]; int wye_en = 0; long long d = 0; { int lqq = 1; if (5 > 3) cout << "new code";for ( ; lqq <= t; ) /* 'for' inside */ { cin >> hf_q[lqq]; lqq++; }} { int yp_chu = 1; if (5 > 3) cout << "new code";for ( ; yp_chu <= t; ) /* 'for' inside */ { long long b = ((yp_chu * (yp_chu - 1)) / 2); d += hf_q[yp_chu]; /* 'if' begin */ if (d < b) /* 'if' inside */ { wye_en = 1; break; } yp_chu++; }} /* 'if' begin */ if (!(wye_en)) /* 'if' inside */ cout << "YES\n"; else cout << "NO\n"; } }
22.415094
65
0.300505
Karina5005
ee322252a1fa099722bffa033a79ab27106e4ffd
1,339
cpp
C++
kactl/stress-tests/geometry/CircleLine.cpp
prince776/CodeBook
874fc7f94011ad1d25a55bcd91fecd2a11eb5a9b
[ "CC0-1.0" ]
17
2021-01-25T12:07:17.000Z
2022-02-26T17:20:31.000Z
kactl/stress-tests/geometry/CircleLine.cpp
NavneelSinghal/CodeBook
ff60ace9107dd19ef8ba81e175003f567d2a9070
[ "CC0-1.0" ]
null
null
null
kactl/stress-tests/geometry/CircleLine.cpp
NavneelSinghal/CodeBook
ff60ace9107dd19ef8ba81e175003f567d2a9070
[ "CC0-1.0" ]
4
2021-02-28T11:13:44.000Z
2021-11-20T12:56:20.000Z
#include "../utilities/template.h" #include "../utilities/randGeo.h" #include "../../content/geometry/lineDistance.h" #include "../../content/geometry/CircleLine.h" typedef Point<double> P; int main() { { auto res = circleLine(P(0, 0), 1, P(-1, -1), P(1, 1)); assert(res.size() == 2); assert((res[1]-P(sqrt(2)/2, sqrt(2)/2)).dist() < 1e-8); } { auto res = circleLine(P(0, 0), 1, P(-5, 1), P(5, 1)); assert(res.size() == 1); assert((res[0]-P(0,1)).dist() < 1e-8); } { auto res = circleLine(P(4, 4), 1, P(0, 0), P(5, 0)); assert(res.size() == 0); } rep(it,0,100000) { P a = randIntPt(5); P b = randIntPt(5); P c = randIntPt(5); if (a == b) { // Not a well defined line continue; } double r = sqrt(rand() % 49); vector<P> points = circleLine(c, r, a, b); // Soundness assert(sz(points) <= 2); for (P p : points) { // Point is on circle assert(abs((p - c).dist() - r) < 1e-6); // Point is on line assert(lineDist(a, b, p) < 1e-6); } // Best-effort completeness check: // in some easy cases we must have points in the intersection. if ((a - c).dist() < r - 1e-6 || (b - c).dist() < r - 1e-6 || ((a + b) / 2 - c).dist() < r - 1e-6) { assert(!points.empty()); } } cout<<"Tests passed!"<<endl; }
26.254902
102
0.512323
prince776
ee32398844a1abce62e35c50d982dd1b6748e08f
12,954
cpp
C++
android/android_23/frameworks/base/media/libstagefright/codecs/aacdec/calc_auto_corr.cpp
yakuizhao/intel-vaapi-driver
b2bb0383352694941826543a171b557efac2219b
[ "MIT" ]
null
null
null
android/android_23/frameworks/base/media/libstagefright/codecs/aacdec/calc_auto_corr.cpp
yakuizhao/intel-vaapi-driver
b2bb0383352694941826543a171b557efac2219b
[ "MIT" ]
null
null
null
android/android_23/frameworks/base/media/libstagefright/codecs/aacdec/calc_auto_corr.cpp
yakuizhao/intel-vaapi-driver
b2bb0383352694941826543a171b557efac2219b
[ "MIT" ]
null
null
null
/* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * See the License for the specific language governing permissions * and limitations under the License. * ------------------------------------------------------------------- */ /* Filename: calc_auto_corr.c ------------------------------------------------------------------------------ REVISION HISTORY Who: Date: MM/DD/YYYY Description: ------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS ------------------------------------------------------------------------------ FUNCTION DESCRIPTION ------------------------------------------------------------------------------ REQUIREMENTS ------------------------------------------------------------------------------ REFERENCES SC 29 Software Copyright Licencing Disclaimer: This software module was originally developed by Coding Technologies and edited by - in the course of development of the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards for reference purposes and its performance may not have been optimized. This software module is an implementation of one or more tools as specified by the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards. ISO/IEC gives users free license to this software module or modifications thereof for use in products claiming conformance to audiovisual and image-coding related ITU Recommendations and/or ISO/IEC International Standards. ISO/IEC gives users the same free license to this software module or modifications thereof for research purposes and further ISO/IEC standardisation. Those intending to use this software module in products are advised that its use may infringe existing patents. ISO/IEC have no liability for use of this software module or modifications thereof. Copyright is not released for products that do not conform to audiovisual and image-coding related ITU Recommendations and/or ISO/IEC International Standards. The original developer retains full right to modify and use the code for its own purpose, assign or donate the code to a third party and to inhibit third parties from using the code for products that do not conform to audiovisual and image-coding related ITU Recommendations and/or ISO/IEC International Standards. This copyright notice must be included in all copies or derivative works. Copyright (c) ISO/IEC 2002. ------------------------------------------------------------------------------ PSEUDO-CODE ------------------------------------------------------------------------------ */ /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ #ifdef AAC_PLUS #include "calc_auto_corr.h" #include "aac_mem_funcs.h" /*---------------------------------------------------------------------------- ; MACROS ; Define module specific macros here ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; DEFINES ; Include all pre-processor statements here. Include conditional ; compile variables also. ----------------------------------------------------------------------------*/ #include "fxp_mul32.h" #include "pv_normalize.h" #define N 2 /*---------------------------------------------------------------------------- ; LOCAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; LOCAL STORE/BUFFER/POINTER DEFINITIONS ; Variable declaration - defined here and used outside this module ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; EXTERNAL FUNCTION REFERENCES ; Declare functions defined elsewhere and referenced in this module ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES ; Declare variables used in this module but defined elsewhere ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; FUNCTION CODE ----------------------------------------------------------------------------*/ void calc_auto_corr_LC(struct ACORR_COEFS *ac, Int32 realBuf[][32], Int32 bd, Int32 len) { Int32 j; Int32 temp1; Int32 temp3; Int32 temp5; int64_t temp_r01r; int64_t temp_r02r; int64_t temp_r11r; int64_t temp_r12r; int64_t temp_r22r; int64_t max = 0; temp1 = (realBuf[ 0][bd]) >> N; temp3 = (realBuf[-1][bd]) >> N; temp5 = (realBuf[-2][bd]) >> N; temp_r11r = fxp_mac64_Q31(0, temp3, temp3); /* [j-1]*[j-1] */ temp_r12r = fxp_mac64_Q31(0, temp3, temp5); /* [j-1]*[j-2] */ temp_r22r = fxp_mac64_Q31(0, temp5, temp5); /* [j-2]*[j-2] */ temp_r01r = 0; temp_r02r = 0; for (j = 1; j < len; j++) { temp_r01r = fxp_mac64_Q31(temp_r01r, temp1, temp3); /* [j ]*[j-1] */ temp_r02r = fxp_mac64_Q31(temp_r02r, temp1, temp5); /* [j ]*[j-2] */ temp_r11r = fxp_mac64_Q31(temp_r11r, temp1, temp1); /* [j-1]*[j-1] */ temp5 = temp3; temp3 = temp1; temp1 = (realBuf[j][bd]) >> N; } temp_r22r += temp_r11r; temp_r12r += temp_r01r; /* [j-1]*[j-2] */ temp_r22r = fxp_mac64_Q31(temp_r22r, -temp3, temp3); temp_r01r = fxp_mac64_Q31(temp_r01r, temp1, temp3); temp_r02r = fxp_mac64_Q31(temp_r02r, temp1, temp5); max |= temp_r01r ^(temp_r01r >> 63); max |= temp_r02r ^(temp_r02r >> 63); max |= temp_r11r; max |= temp_r12r ^(temp_r12r >> 63); max |= temp_r22r; if (max) { temp1 = (UInt32)(max >> 32); if (temp1) { temp3 = 33 - pv_normalize(temp1); ac->r01r = (Int32)(temp_r01r >> temp3); ac->r02r = (Int32)(temp_r02r >> temp3); ac->r11r = (Int32)(temp_r11r >> temp3); ac->r12r = (Int32)(temp_r12r >> temp3); ac->r22r = (Int32)(temp_r22r >> temp3); } else { temp3 = pv_normalize(((UInt32)max) >> 1) - 2; if (temp3 > 0) { ac->r01r = (Int32)(temp_r01r << temp3); ac->r02r = (Int32)(temp_r02r << temp3); ac->r11r = (Int32)(temp_r11r << temp3); ac->r12r = (Int32)(temp_r12r << temp3); ac->r22r = (Int32)(temp_r22r << temp3); } else { temp3 = -temp3; ac->r01r = (Int32)(temp_r01r >> temp3); ac->r02r = (Int32)(temp_r02r >> temp3); ac->r11r = (Int32)(temp_r11r >> temp3); ac->r12r = (Int32)(temp_r12r >> temp3); ac->r22r = (Int32)(temp_r22r >> temp3); } } /* * ac->det = ac->r11r*ac->r22r - rel*(ac->r12r*ac->r12r); */ /* 1/(1 + 1e-6) == 1 - 1e-6 */ /* 2^-20 == 1e-6 */ ac->det = fxp_mul32_Q30(ac->r12r, ac->r12r); ac->det -= ac->det >> 20; ac->det = fxp_mul32_Q30(ac->r11r, ac->r22r) - ac->det; } else { pv_memset((void *)ac, 0, sizeof(struct ACORR_COEFS)); } } #ifdef HQ_SBR void calc_auto_corr(struct ACORR_COEFS *ac, Int32 realBuf[][32], Int32 imagBuf[][32], Int32 bd, Int32 len) { Int32 j; Int32 temp1; Int32 temp2; Int32 temp3; Int32 temp4; Int32 temp5; Int32 temp6; int64_t accu1 = 0; int64_t accu2 = 0; int64_t accu3 = 0; int64_t accu4 = 0; int64_t accu5 = 0; int64_t temp_r12r; int64_t temp_r12i; int64_t temp_r22r; int64_t max = 0; temp1 = realBuf[0 ][bd] >> N; temp2 = imagBuf[0 ][bd] >> N; temp3 = realBuf[0-1][bd] >> N; temp4 = imagBuf[0-1][bd] >> N; temp5 = realBuf[0-2][bd] >> N; temp6 = imagBuf[0-2][bd] >> N; temp_r22r = fxp_mac64_Q31(0, temp5, temp5); temp_r22r = fxp_mac64_Q31(temp_r22r, temp6, temp6); temp_r12r = fxp_mac64_Q31(0, temp3, temp5); temp_r12r = fxp_mac64_Q31(temp_r12r, temp4, temp6); temp_r12i = -fxp_mac64_Q31(0, temp3, temp6); temp_r12i = fxp_mac64_Q31(temp_r12i, temp4, temp5); for (j = 1; j < len; j++) { accu1 = fxp_mac64_Q31(accu1, temp3, temp3); accu1 = fxp_mac64_Q31(accu1, temp4, temp4); accu2 = fxp_mac64_Q31(accu2, temp1, temp3); accu2 = fxp_mac64_Q31(accu2, temp2, temp4); accu3 = fxp_mac64_Q31(accu3, temp2, temp3); accu3 = fxp_mac64_Q31(accu3, -temp1, temp4); accu4 = fxp_mac64_Q31(accu4, temp1, temp5); accu4 = fxp_mac64_Q31(accu4, temp2, temp6); accu5 = fxp_mac64_Q31(accu5, temp2, temp5); accu5 = fxp_mac64_Q31(accu5, -temp1, temp6); temp5 = temp3; temp6 = temp4; temp3 = temp1; temp4 = temp2; temp1 = realBuf[j][bd] >> N; temp2 = imagBuf[j][bd] >> N; } temp_r22r += accu1; temp_r12r += accu2; temp_r12i += accu3; accu1 = fxp_mac64_Q31(accu1, temp3, temp3); accu1 = fxp_mac64_Q31(accu1, temp4, temp4); accu2 = fxp_mac64_Q31(accu2, temp1, temp3); accu2 = fxp_mac64_Q31(accu2, temp2, temp4); accu3 = fxp_mac64_Q31(accu3, temp2, temp3); accu3 = fxp_mac64_Q31(accu3, -temp1, temp4); accu4 = fxp_mac64_Q31(accu4, temp1, temp5); accu4 = fxp_mac64_Q31(accu4, temp2, temp6); accu5 = fxp_mac64_Q31(accu5, temp2, temp5); accu5 = fxp_mac64_Q31(accu5, -temp1, temp6); max |= accu5 ^(accu5 >> 63); max |= accu4 ^(accu4 >> 63); max |= accu3 ^(accu3 >> 63); max |= accu2 ^(accu2 >> 63); max |= accu1; max |= temp_r12r ^(temp_r12r >> 63); max |= temp_r12i ^(temp_r12i >> 63); max |= temp_r22r; if (max) { temp1 = (UInt32)(max >> 32); if (temp1) { temp1 = 34 - pv_normalize(temp1); ac->r11r = (Int32)(accu1 >> temp1); ac->r01r = (Int32)(accu2 >> temp1); ac->r01i = (Int32)(accu3 >> temp1); ac->r02r = (Int32)(accu4 >> temp1); ac->r02i = (Int32)(accu5 >> temp1); ac->r12r = (Int32)(temp_r12r >> temp1); ac->r12i = (Int32)(temp_r12i >> temp1); ac->r22r = (Int32)(temp_r22r >> temp1); } else { temp1 = pv_normalize(((UInt32)max) >> 1) - 3; if (temp1 > 0) { ac->r11r = (Int32)(accu1 << temp1); ac->r01r = (Int32)(accu2 << temp1); ac->r01i = (Int32)(accu3 << temp1); ac->r02r = (Int32)(accu4 << temp1); ac->r02i = (Int32)(accu5 << temp1); ac->r12r = (Int32)(temp_r12r << temp1); ac->r12i = (Int32)(temp_r12i << temp1); ac->r22r = (Int32)(temp_r22r << temp1); } else { temp1 = -temp1; ac->r11r = (Int32)(accu1 >> temp1); ac->r01r = (Int32)(accu2 >> temp1); ac->r01i = (Int32)(accu3 >> temp1); ac->r02r = (Int32)(accu4 >> temp1); ac->r02i = (Int32)(accu5 >> temp1); ac->r12r = (Int32)(temp_r12r >> temp1); ac->r12i = (Int32)(temp_r12i >> temp1); ac->r22r = (Int32)(temp_r22r >> temp1); } } /* * ac->det = ac->r11r*ac->r22r - rel*(ac->r12r*ac->r12r); */ /* 1/(1 + 1e-6) == 1 - 1e-6 */ /* 2^-20 == 1e-6 */ ac->det = fxp_mul32_Q29(ac->r12i, ac->r12i); ac->det = fxp_mac32_Q29(ac->r12r, ac->r12r, ac->det); ac->det -= ac->det >> 20; ac->det = -fxp_msu32_Q29(ac->r11r, ac->r22r, ac->det); } else { pv_memset((void *)ac, 0, sizeof(struct ACORR_COEFS)); } } #endif #endif
31.064748
81
0.483171
yakuizhao
ee3633d6f4961e602ca50ad8472a8ef09ef685fe
6,981
cpp
C++
Shell_simulation_node/src/shell_simulation_node.cpp
shashankkmciv18/Averera
6c59d8e812bfbff3d7470e2ad6e6f12cf5d95109
[ "MIT" ]
null
null
null
Shell_simulation_node/src/shell_simulation_node.cpp
shashankkmciv18/Averera
6c59d8e812bfbff3d7470e2ad6e6f12cf5d95109
[ "MIT" ]
null
null
null
Shell_simulation_node/src/shell_simulation_node.cpp
shashankkmciv18/Averera
6c59d8e812bfbff3d7470e2ad6e6f12cf5d95109
[ "MIT" ]
null
null
null
#include <ros/ros.h> #include<std_msgs/Float64.h> #include<nav_msgs/Odometry.h> #include<math.h> #include<tf/transform_datatypes.h> #include<shell_simulation/Car_Command.h> #include<vector> using namespace std; // Structure for coordinates struct coordinates { float x,y; }; // Class for goal/target points struct points{ float x, y; int direction; }; // Store all target points in a vector vector < points > list_of_target(12); void set_targets(float x, float y, float dir, int count) { list_of_target[count].x = x; list_of_target[count].y = y; list_of_target[count].direction = dir; } // Global variables coordinates position, destination; double roll, pitch, yaw; int axis, run = 0, point_count = 0; // X+ = 1, X- = -1, Y+ = 2, Y- = -2 float speed, speed_x, speed_y; const float pi = 3.14159; // Get next coordinates void get_destination() { point_count++; if(point_count == 12) { while(ros::ok()) { } } destination.x = list_of_target[point_count].x; destination.y = list_of_target[point_count].y; axis = list_of_target[point_count].direction; } // Odom topic callback void get_position(const nav_msgs::Odometry& msg) { position.x = msg.pose.pose.position.x; position.y = msg.pose.pose.position.y; speed_x = msg.twist.twist.linear.x; speed_y = msg.twist.twist.linear.y; speed = sqrt(speed_x*speed_x + speed_y*speed_y); tf::Quaternion quat_form(msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w); tf::Matrix3x3 quat_matrix(quat_form); quat_matrix.getRPY(roll, pitch, yaw); // Convert yaw so that it is measured from X axis (rather than Y which is default) if(yaw < (pi/2)) yaw = (pi/2) - yaw; else yaw = (5*pi/2) - yaw; } int main( int argc, char **argv) { // Set goal points set_targets(-212,0,-1, 0); set_targets(-212,-128,-2, 1); set_targets(44,-128,1, 2); set_targets(44,-256,-2, 3); set_targets(-212,-256,-1, 4); set_targets(-212,-48,2, 5); set_targets(-84,-48,1, 6); set_targets(-84,0,2, 7); set_targets(44,0,1, 8); set_targets(44,-256,-2, 9); set_targets(-84,-256,-1, 10); set_targets(-84,-180,2, 11); // Set values for first point destination.x = list_of_target[0].x, destination.y = list_of_target[0].y, axis = list_of_target[0].direction; // Initialize node ros::init (argc, argv, "shell_simulation_node"); ros::NodeHandle nh; // Create subscriber and Publisher objects for communication with each different topic // ros::Subscriber sub_motion = nh.subscribe("motion", 100, &get_destination); ros::Subscriber sub_odom = nh.subscribe("odom", 100, &get_position); ros::Publisher pub = nh.advertise<shell_simulation::Car_Command>("airsim_node/PhysXCar/car_cmd_body_frame", 100); // Initialize variables float distance; coordinates del; float cross_track_error, heading_error; int heading_sense, cross_track_sense, flag, flag2; shell_simulation::Car_Command vel; float prop_heading = 0.55, prop_cros_track = 0.45, speed_calib, heading_calib, cross_track_calib; float target_speed = 15; ros::Duration(2).sleep(); // ros::Rate rate(0.02); // Start loop to keep the node running while(ros::ok()) { // Check and execute callbacks from any of the subscribed topics ros::spinOnce(); // Record the coordinates followed by vehicle // ROS_INFO_STREAM_THROTTLE(2, "x: " << position.x << " y: " << position.y); // Set default values vel.handbrake = false; vel.brake = 0; vel.steering = 0; vel.throttle = 0; // Calculating distance from destination del.x = destination.x - position.x; del.y = destination.y - position.y; // Calculating cross_track and heading errors , direction/signs considered if (abs(axis) == 1) { // If X axis distance = abs(del.x); flag = (yaw > pi)*(axis == 1); cross_track_error = (destination.y - position.y)*(axis); heading_error = pi*(2*flag + (-axis+1)/2) - yaw; } else { // If Y axis distance = abs(del.y); cross_track_error = (position.x - destination.x)*(axis/2); flag = (yaw > 3*pi/2)*(axis == 2); flag2 = (yaw < pi/2)*(axis == -2); heading_error = (pi/2)*(-0.5*axis + 2) - ((flag == 0) - (flag > 0))*yaw + 2*pi*(flag - flag2); } // Calculate the angular sense of errors about Z axis heading_sense = (heading_error > 0) - (heading_error < 0); cross_track_sense = (cross_track_error > 0) - (cross_track_error < 0); // Calculation of linear velocity component if(distance > 14) { heading_calib = (-2.925)*abs(heading_error)*abs(heading_error) + (-0.0875)*abs(heading_error) + 1; cross_track_calib = -abs(cross_track_error)*(0.3) + 1; vel.throttle = 0.6*heading_calib*cross_track_calib; if(vel.throttle < 0.3) vel.throttle = 0.35; } else { vel.throttle = 0; vel.steering = 0; vel.brake = 0.3; // Brake until speed is reduced to 0.7 while(speed > 5.25) { ros::spinOnce(); pub.publish(vel); } vel.brake = 0; pub.publish(vel); get_destination(); continue; } // Calculation of angular velocity component if(abs(heading_error) > (pi/8.5)) { target_speed = 10; if(abs(cross_track_error) > 10) { vel.steering = 0; vel.throttle = 0.3; } else { vel.steering = 0.85*heading_sense*(abs(cross_track_error)*(-0.08) + 1); // vel.throttle = 0.8*(target_speed - speed)*(target_speed > speed)/target_speed; vel.throttle = 0.52; } } else { vel.steering = prop_heading*(heading_error/2) + prop_cros_track*(cross_track_error/9.0); } if(abs(vel.steering > 1)) vel.steering = 0.9*heading_sense; // As positive steering means right -> negative angular, thus sign has to be interchanged vel.steering = -vel.steering; // Publish calculated velocity values pub.publish(vel); // rate.sleep(); } }
31.445946
118
0.559232
shashankkmciv18
ee368e8fb43d4e878de7bb297d57d1659d0b8753
446
cpp
C++
src/unity/ios/logging_ios.cpp
devlz303/gulden-official
c624d0383b081fe3ae5e79b4f228a8224e79818e
[ "MIT" ]
null
null
null
src/unity/ios/logging_ios.cpp
devlz303/gulden-official
c624d0383b081fe3ae5e79b4f228a8224e79818e
[ "MIT" ]
null
null
null
src/unity/ios/logging_ios.cpp
devlz303/gulden-official
c624d0383b081fe3ae5e79b4f228a8224e79818e
[ "MIT" ]
1
2020-09-10T09:22:14.000Z
2020-09-10T09:22:14.000Z
// Copyright (c) 2018 The Gulden developers // Authored by: Willem de Jonge (willem@isnapp.nl) // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <string> #include "../unity_impl.h" #include "gulden_unified_frontend.hpp" void OpenDebugLog() { } int LogPrintStr(const std::string &str) { signalHandler->logPrint(str); return str.size(); }
23.473684
70
0.733184
devlz303
ee395ea7eebb6a15c65fec1680e5d1f18476e107
1,039
hpp
C++
apps/opencs/model/world/cellcoordinates.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
apps/opencs/model/world/cellcoordinates.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
apps/opencs/model/world/cellcoordinates.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
#ifndef CSM_WOLRD_CELLCOORDINATES_H #define CSM_WOLRD_CELLCOORDINATES_H #include <iosfwd> #include <string> #include <QMetaType> namespace CSMWorld { class CellCoordinates { int mX; int mY; public: CellCoordinates(); CellCoordinates (int x, int y); int getX() const; int getY() const; CellCoordinates move (int x, int y) const; ///< Return a copy of *this, moved by the given offset. std::string getId (const std::string& worldspace) const; ///< Return the ID for the cell at these coordinates. }; bool operator== (const CellCoordinates& left, const CellCoordinates& right); bool operator!= (const CellCoordinates& left, const CellCoordinates& right); bool operator< (const CellCoordinates& left, const CellCoordinates& right); std::ostream& operator<< (std::ostream& stream, const CellCoordinates& coordiantes); } Q_DECLARE_METATYPE (CSMWorld::CellCoordinates) #endif
24.162791
88
0.643888
Bodillium
ee3c4f85c44539b00e1af0bebfad76e50232dc84
2,965
cc
C++
bin/asharing.cc
chyyuu/sv6
1dceb0f462fdcc676a4e0bd03579d682eee15b52
[ "MIT-0" ]
null
null
null
bin/asharing.cc
chyyuu/sv6
1dceb0f462fdcc676a4e0bd03579d682eee15b52
[ "MIT-0" ]
null
null
null
bin/asharing.cc
chyyuu/sv6
1dceb0f462fdcc676a4e0bd03579d682eee15b52
[ "MIT-0" ]
null
null
null
// Tests to drive abstract sharing analysis #include "types.h" #include "user.h" #include <fcntl.h> #include "mtrace.h" #include "pthread.h" #include "rnd.hh" #include <stdio.h> #include <string.h> #include <sys/mman.h> #include <atomic> #include <utility> static int cpu; std::atomic<int> barrier; enum { ncore = 8 }; void next() { if (setaffinity(cpu) < 0) { cpu = 0; if (setaffinity(cpu) < 0) die("sys_setaffinity(%d) failed", cpu); } cpu++; } void ready(void) { int slot = --barrier; if (slot == 1) { mtenable_type(mtrace_record_ascope, "xv6-asharing"); --barrier; } else { while (barrier) asm volatile("pause"); } } void* vmsharing(void* arg) { u64 i = (u64) arg; ready(); volatile char *p = (char*)(0x40000UL + i * 4096); if (mmap((void *) p, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) < 0) die("mmap failed"); if (munmap((void *) p, 4096) < 0) die("munmap failed"); return 0; } std::atomic<int> round; void* vm2sharing(void *arg) { u64 i = (u64) arg; char *base = (char*)0x1000; ready(); while (true) { while (round % ncore != i) asm volatile("pause"); if (round >= 50) { round++; return 0; } int op = rnd() % 2; int lo = rnd() % 10, hi = rnd() % 10; if (lo > hi) std::swap(lo, hi); if (lo == hi) continue; if (op == 0) { // Map void *res = mmap(base + lo * 4096, (hi-lo) * 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); if (res == MAP_FAILED) die("asharing: mmap failed"); // Fault for (int i = lo; i < hi; i++) base[i * 4096] = 42; } else { // Unmap int res = munmap(base + lo * 4096, (hi-lo) * 4096); if (res < 0) die("asharing: munmap failed"); } round++; } } void* fssharing(void* arg) { int i = (uintptr_t) arg; // Note that we keep these files open; otherwise all of these // operations will share the abstract FD object and we won't get any // results. char filename[32]; snprintf(filename, sizeof(filename), "f%d", i); open(filename, O_CREAT|O_RDWR, 0666); ready(); for (int j = 0; j < ncore; j++) { snprintf(filename, sizeof(filename), "f%d", j); open(filename, O_RDWR); } return 0; } int main(int ac, char **av) { void* (*op)(void*) = 0; if (ac == 2 && strcmp(av[1], "vm") == 0) op = vmsharing; else if (ac == 2 && strcmp(av[1], "vm2") == 0) op = vm2sharing; else if (ac == 2 && strcmp(av[1], "fs") == 0) op = fssharing; else die("usage: %s vm|fs", av[0]); if (op) { barrier = ncore + 1; for (u64 i = 0; i < ncore; i++) { next(); pthread_t tid; pthread_create(&tid, 0, op, (void*) i); } for (u64 i = 0; i < ncore; i++) wait(NULL); if (barrier) die("forgot to call ready()"); mtdisable("xv6-asharing"); } }
18.765823
99
0.543339
chyyuu
ee3ce33328af8ef0ec1385f264581ba0cbafd6e7
906
hpp
C++
shared/math/math_definitions.hpp
mathew235/csgo-internal
2d0744d65191de5801dd93c53ce7811c581e3a89
[ "MIT" ]
130
2019-05-26T09:19:08.000Z
2022-03-22T17:31:46.000Z
shared/math/math_definitions.hpp
mathew235/csgo-internal
2d0744d65191de5801dd93c53ce7811c581e3a89
[ "MIT" ]
13
2019-05-27T16:02:19.000Z
2021-12-31T20:01:47.000Z
shared/math/math_definitions.hpp
mathew235/csgo-internal
2d0744d65191de5801dd93c53ce7811c581e3a89
[ "MIT" ]
52
2019-05-26T09:19:27.000Z
2021-12-07T16:45:28.000Z
#pragma once #define PITCH 0 #define YAW 1 #define ROLL 2 namespace shared::math { /// <summary> /// Converts radians to degrees /// </summary> /// <param name="rad">Radians</param> /// <returns>Degrees</returns> inline float rad2deg( const float rad ) { return static_cast<float>( rad * ( 180.f / M_PI ) ); } /// <summary> /// Converts degrees to radians /// </summary> /// <param name="deg">Degrees</param> /// <returns>Radians</returns> inline float deg2rad( const float deg ) { return static_cast< float >( deg * ( M_PI / 180.f ) ); } /// <summary> /// Simple wrapper function to execute both sin and cos /// </summary> /// <param name="rad">The radian factor</param> /// <param name="sine">Sine</param> /// <param name="cosine">Cosine</param> inline void sincos( const float rad, float& sine, float& cosine ) { sine = std::sin( rad ); cosine = std::cos( rad ); } }
22.65
66
0.629139
mathew235
ee41c707061fd83bf5f2e1396561107e0fee5618
1,132
hpp
C++
src/plugins/intel_cpu/src/utils/shape_inference/shape_inference.hpp
ryanloney/openvino-1
4e0a740eb3ee31062ba0df88fcf438564f67edb7
[ "Apache-2.0" ]
1
2022-03-09T08:11:10.000Z
2022-03-09T08:11:10.000Z
src/plugins/intel_cpu/src/utils/shape_inference/shape_inference.hpp
ryanloney/openvino-1
4e0a740eb3ee31062ba0df88fcf438564f67edb7
[ "Apache-2.0" ]
18
2022-01-21T08:42:58.000Z
2022-03-28T13:21:31.000Z
src/plugins/intel_cpu/src/utils/shape_inference/shape_inference.hpp
ryanloney/openvino-1
4e0a740eb3ee31062ba0df88fcf438564f67edb7
[ "Apache-2.0" ]
1
2020-12-13T22:16:54.000Z
2020-12-13T22:16:54.000Z
// Copyright (C) 2018-2022 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include <ngraph/runtime/host_tensor.hpp> #include <openvino/core/core.hpp> #include <openvino/core/node.hpp> #include "static_shape.hpp" void shape_inference(ov::Node* op, const std::vector<ov::StaticShape>& input_shapes, std::vector<ov::StaticShape>& output_shapes, const std::map<size_t, std::shared_ptr<ngraph::runtime::HostTensor>>& constant_data = {}); class IShapeInfer { public: virtual std::vector<ov::StaticShape> infer( const std::vector<ov::StaticShape>& input_shapes, const std::map<size_t, std::shared_ptr<ngraph::runtime::HostTensor>>& constant_data) = 0; // infer may generate padding as by-product, these APIs is designed to retrieve them back virtual const ov::CoordinateDiff& get_pads_begin() = 0; virtual const ov::CoordinateDiff& get_pads_end() = 0; virtual const std::vector<int64_t>& get_input_ranks() = 0; }; std::shared_ptr<IShapeInfer> make_shape_inference(const std::shared_ptr<ngraph::Node>& op);
35.375
111
0.691696
ryanloney
ee4406425163a88c4b35214d4b13c7defdd285bc
3,898
cpp
C++
compiler/enco/frontend/tflite/src/Op/MaxPool2D.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
1
2020-05-22T13:51:03.000Z
2020-05-22T13:51:03.000Z
compiler/enco/frontend/tflite/src/Op/MaxPool2D.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
1
2020-09-23T23:12:23.000Z
2020-09-23T23:20:34.000Z
compiler/enco/frontend/tflite/src/Op/MaxPool2D.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
1
2021-07-22T11:02:43.000Z
2021-07-22T11:02:43.000Z
/* * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "MaxPool2D.h" #include "Convert.h" #include "IRBuilder.h" #include "GraphBuilder.h" #include "Padding.h" #include "Activation.h" #include <morph/tflite.h> #include <coco/IR/Module.h> #include <coco/IR/FeatureLayouts.h> #include <nncc/core/ADT/tensor/Shape.h> #include <schema_generated.h> #include <cassert> using namespace nncc::core::ADT; using namespace morph::tflite; namespace tflimport { bool MaxPool2DGraphBuilder::validate(const tflite::Operator *op) const { auto const options = op->builtin_options_as_Pool2DOptions(); if ((options->stride_h() == 0) || (options->stride_w() == 0)) { return false; } return true; } void MaxPool2DGraphBuilder::build(const tflite::Operator *op, GraphBuilderContext *context) const { assert(context != nullptr); // check if init(..) is called coco::Module *m = context->m(); coco::Block *blk = context->block(); TensorContext &tensor_context = context->tensor(); TensorBags &bags = context->bags(); IndexVector opinputs = as_index_vector(op->inputs()); IndexVector opoutputs = as_index_vector(op->outputs()); // these are fixed in tflite // input index 0 : input feature // output index 0 : output feature assert(opinputs.size() == 1); assert(opoutputs.size() == 1); int ifm_idx = opinputs.at(0); int ofm_idx = opoutputs.at(0); const tensor::Shape &ifm_shape = tensor_context.shape(ifm_idx); const tensor::Shape &ofm_shape = tensor_context.shape(ofm_idx); // Create an object for an input feature map coco::FeatureObject *ifm_obj = m->entity()->object()->create<coco::FeatureObject>(); coco::Bag *ifm_bag = bags.bag(ifm_idx); ifm_obj->bag(ifm_bag); ifm_obj->layout(coco::FeatureLayouts::BHWC::create(as_feature_shape(ifm_shape))); // Create an object for an output feature map coco::FeatureObject *ofm_obj = m->entity()->object()->create<coco::FeatureObject>(); coco::Bag *ofm_bag = bags.bag(ofm_idx); ofm_obj->bag(ofm_bag); ofm_obj->layout(coco::FeatureLayouts::BHWC::create(as_feature_shape(ofm_shape))); // Create a Load op coco::Op *coco_load = op_builder(m).load(ifm_obj).pop(); // Create a MaxPool2D coco::MaxPool2D *coco_maxpool2d = m->entity()->op()->create<coco::MaxPool2D>(); const tflite::Pool2DOptions *params = op->builtin_options_as_Pool2DOptions(); coco_maxpool2d->window()->height(params->filter_height()); coco_maxpool2d->window()->width(params->filter_width()); coco_maxpool2d->stride()->vertical(params->stride_h()); coco_maxpool2d->stride()->horizontal(params->stride_w()); coco::Padding2D padding = pool2D_padding(params, ifm_shape, params->filter_width(), params->filter_height()); coco_maxpool2d->pad()->top(padding.top()); coco_maxpool2d->pad()->bottom(padding.bottom()); coco_maxpool2d->pad()->left(padding.left()); coco_maxpool2d->pad()->right(padding.right()); // Link ops coco_maxpool2d->arg(coco_load); // Create an Eval instruction coco::Eval *ins = instr_builder(m).eval(ofm_obj, coco_maxpool2d); // Append the instruction to the block blk->instr()->append(ins); // TODO activation, e.g., relu assert(params->fused_activation_function() == tflite::ActivationFunctionType::ActivationFunctionType_NONE); } } // namespace tflimport
31.435484
97
0.713443
bogus-sudo
ee469103ef48db646f415e81cc23d9dad2982dd0
4,181
hpp
C++
openstudiocore/src/model/PlanarSurfaceGroup_Impl.hpp
jasondegraw/OpenStudio
2ab13f6e5e48940929041444e40ad9d36f80f552
[ "blessing" ]
1
2016-12-29T08:45:03.000Z
2016-12-29T08:45:03.000Z
openstudiocore/src/model/PlanarSurfaceGroup_Impl.hpp
jasondegraw/OpenStudio
2ab13f6e5e48940929041444e40ad9d36f80f552
[ "blessing" ]
null
null
null
openstudiocore/src/model/PlanarSurfaceGroup_Impl.hpp
jasondegraw/OpenStudio
2ab13f6e5e48940929041444e40ad9d36f80f552
[ "blessing" ]
null
null
null
/********************************************************************** * Copyright (c) 2008-2016, Alliance for Sustainable Energy. * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********************************************************************/ #ifndef MODEL_PLANARSURFACEGROUP_IMPL_HPP #define MODEL_PLANARSURFACEGROUP_IMPL_HPP #include "ParentObject_Impl.hpp" #include "../utilities/geometry/Transformation.hpp" namespace openstudio { class Point3d; class BoundingBox; namespace model { namespace detail { class MODEL_API PlanarSurfaceGroup_Impl : public ParentObject_Impl { Q_OBJECT; public: /** @name Constructors and Destructors */ //@{ // constructor PlanarSurfaceGroup_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); // construct from workspace PlanarSurfaceGroup_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); PlanarSurfaceGroup_Impl(const PlanarSurfaceGroup_Impl& other, Model_Impl* model,bool keepHandle); // virtual destructor virtual ~PlanarSurfaceGroup_Impl(){} virtual double directionofRelativeNorth() const = 0; virtual bool isDirectionofRelativeNorthDefaulted() const = 0; virtual double xOrigin() const = 0; virtual bool isXOriginDefaulted() const = 0; virtual double yOrigin() const = 0; virtual bool isYOriginDefaulted() const = 0; virtual double zOrigin() const = 0; virtual bool isZOriginDefaulted() const = 0; virtual void setDirectionofRelativeNorth(double directionofRelativeNorth, bool driverMethod = true) = 0; virtual void resetDirectionofRelativeNorth() = 0; virtual void setXOrigin(double xOrigin, bool driverMethod = true) = 0; virtual void resetXOrigin() = 0; virtual void setYOrigin(double yOrigin, bool driverMethod = true) = 0; virtual void resetYOrigin() = 0; virtual void setZOrigin(double zOrigin, bool driverMethod = true) = 0; virtual void resetZOrigin() = 0; /** Returns the transformation from local coordinates to parent coordinates. */ openstudio::Transformation transformation() const; /** Returns the transformation from local coordinates to site coordinates. */ openstudio::Transformation siteTransformation() const; /** Returns the transformation from local coordinates to building coordinates. */ virtual openstudio::Transformation buildingTransformation() const = 0; /** Sets the transformation from local coordinates to parent coordinates, * this method can be used to move the group. */ bool setTransformation(const openstudio::Transformation& transformation); /** Changes the transformation from local coordinates to parent coordinates, * this method alter geometry of children relative to the * group so that it stays in the same place with the new transformation. */ virtual bool changeTransformation(const openstudio::Transformation& transformation) = 0; /** Get the BoundingBox in local coordinates. */ virtual openstudio::BoundingBox boundingBox() const = 0; //@} private slots: void clearCachedVariables(); private: REGISTER_LOGGER("openstudio.model.PlanarSurfaceGroup"); mutable boost::optional<openstudio::Transformation> m_cachedTransformation; }; } // detail } // model } // openstudio #endif // MODEL_PLANARSURFACEGROUP_IMPL_HPP
33.448
108
0.70916
jasondegraw
ee483af3242a3c8a00820fe19068514018f7290c
2,841
cpp
C++
CO2003/1_Review/q3/main.cpp
Smithienious/hcmut-201
be16b77831aae83ff42e656a181881686c74e674
[ "MIT" ]
null
null
null
CO2003/1_Review/q3/main.cpp
Smithienious/hcmut-201
be16b77831aae83ff42e656a181881686c74e674
[ "MIT" ]
2
2020-10-12T09:57:12.000Z
2020-11-09T11:05:01.000Z
CO2003/1_Review/q3/main.cpp
Smithienious/hcmut-201
be16b77831aae83ff42e656a181881686c74e674
[ "MIT" ]
4
2020-10-12T10:30:56.000Z
2020-12-15T14:46:04.000Z
#include <bits/stdc++.h> using namespace std; class Point { private: double x, y; public: Point() { /* * STUDENT ANSWER * TODO: set zero x-y coordinate */ x = 0; y = 0; } Point(double x, double y) { /* * STUDENT ANSWER */ this->x = x; this->y = y; } void setX(double x) { /* * STUDENT ANSWER */ this->x = x; } void setY(double y) { /* * STUDENT ANSWER */ this->y = y; } double getX() const { /* * STUDENT ANSWER */ return this->x; } double getY() const { /* * STUDENT ANSWER */ return this->y; } double distanceToPoint(const Point &pointA) { /* * STUDENT ANSWER * TODO: calculate the distance from this point to point A in the coordinate plane */ double dis = pow((pointA.x - this->x), 2) + pow((pointA.y - this->y), 2); return sqrt(dis); } }; class Circle { private: Point center; double radius; public: Circle() { /* * STUDENT ANSWER * TODO: set zero center's x-y and radius */ center.setX(0); center.setY(0); radius = 0; } Circle(Point center, double radius) { /* * STUDENT ANSWER */ this->center.setX(center.getX()); this->center.setY(center.getY()); this->radius = radius; } bool containsPoint(const Point point) { /* * STUDENT ANSWER * TODO: check if a given point is entirely within the circle (does not count if the point lies on the circle). If contain, return true. */ return (pow(point.getX() - center.getX(), 2) + pow(point.getY() - center.getY(), 2)) < pow(radius, 2); } bool containsTriangle(const Point pointA, const Point pointB, const Point pointC) { /* * STUDENT ANSWER * TODO: check if a given triangle ABC (A, B, C are not on the same line) is entirely within the circle (does not count if any point of the triangle lies on the circle). If contain, return true. */ return ((pow(pointA.getX() - center.getX(), 2) + pow(pointA.getY() - center.getY(), 2)) < pow(radius, 2)) && ((pow(pointB.getX() - center.getX(), 2) + pow(pointB.getY() - center.getY(), 2)) < pow(radius, 2)) && ((pow(pointC.getX() - center.getX(), 2) + pow(pointC.getY() - center.getY(), 2)) < pow(radius, 2)); } }; int main() { Point pointO(0, 2); Point point1(1, 2); Circle A = Circle(pointO, 2); cout << A.containsPoint(point1); return 0; }
21.522727
179
0.491728
Smithienious
ee4857e01074268462a3f224d91c86464ba9ef87
4,378
cpp
C++
taco-oopsla2017/src/storage/array.cpp
peterahrens/FillEstimationIPDPS2017
857b6ee8866a2950aa5721d575d2d7d0797c4302
[ "BSD-3-Clause" ]
null
null
null
taco-oopsla2017/src/storage/array.cpp
peterahrens/FillEstimationIPDPS2017
857b6ee8866a2950aa5721d575d2d7d0797c4302
[ "BSD-3-Clause" ]
null
null
null
taco-oopsla2017/src/storage/array.cpp
peterahrens/FillEstimationIPDPS2017
857b6ee8866a2950aa5721d575d2d7d0797c4302
[ "BSD-3-Clause" ]
null
null
null
#include "taco/storage/array.h" #include <cstring> #include <iostream> #include "taco/type.h" #include "taco/error.h" #include "taco/util/uncopyable.h" #include "taco/util/strings.h" using namespace std; namespace taco { namespace storage { struct Array::Content : util::Uncopyable { Type type; void* data; size_t size; Policy policy = Array::UserOwns; ~Content() { switch (policy) { case UserOwns: // do nothing break; case Free: free(data); break; case Delete: switch (type.getKind()) { case Type::Bool: delete[] ((bool*)data); break; case Type::UInt: switch (type.getNumBits()) { case 8: delete[] ((uint8_t*)data); break; case 16: delete[] ((uint16_t*)data); break; case 32: delete[] ((uint32_t*)data); break; case 64: delete[] ((uint64_t*)data); break; } break; case Type::Int: switch (type.getNumBits()) { switch (type.getNumBits()) { case 8: delete[] ((int8_t*)data); break; case 16: delete[] ((int16_t*)data); break; case 32: delete[] ((int32_t*)data); break; case 64: delete[] ((int64_t*)data); break; } } break; case Type::Float: switch (type.getNumBits()) { case 32: delete[] ((float*)data); break; case 64: delete[] ((double*)data); break; } break; case Type::Undefined: taco_ierror; break; } break; } } }; Array::Array() : content(new Content) { } Array::Array(Type type, void* data, size_t size, Policy policy) : Array() { content->type = type; content->data = data; content->size = size; content->policy = policy; } const Type& Array::getType() const { return content->type; } size_t Array::getSize() const { return content->size; } const void* Array::getData() const { return content->data; } void* Array::getData() { return content->data; } void Array::zero() { memset(getData(), 0, getSize() * getType().getNumBytes()); } template<typename T> void printData(ostream& os, const Array& array) { const T* data = static_cast<const T*>(array.getData()); os << "["; if (array.getSize() > 0) { os << data[0]; } for (size_t i = 1; i < array.getSize(); i++) { os << ", " << data[i]; } os << "]"; } std::ostream& operator<<(std::ostream& os, const Array& array) { Type type = array.getType(); switch (type.getKind()) { case Type::Bool: printData<bool>(os, array); break; case Type::UInt: switch (type.getNumBits()) { case 8: printData<uint8_t>(os, array); break; case 16: printData<uint16_t>(os, array); break; case 32: printData<uint32_t>(os, array); break; case 64: printData<uint64_t>(os, array); break; } break; case Type::Int: switch (type.getNumBits()) { case 8: printData<int8_t>(os, array); break; case 16: printData<int16_t>(os, array); break; case 32: printData<int32_t>(os, array); break; case 64: printData<int64_t>(os, array); break; } break; case Type::Float: switch (type.getNumBits()) { case 32: printData<float>(os, array); break; case 64: printData<double>(os, array); break; } break; case Type::Undefined: os << "[]"; break; } return os; } std::ostream& operator<<(std::ostream& os, Array::Policy policy) { switch (policy) { case Array::UserOwns: os << "user"; break; case Array::Free: os << "free"; break; case Array::Delete: os << "delete"; break; } return os; } }}
21.673267
75
0.476473
peterahrens
ee4ad7e9f18ce75ef36f4d328d9b1a417a7dd9c9
1,605
cc
C++
spectator/dist_summary.cc
copperlight/spectator-cpp
993c98700a29cbcf067fb87fb88b37d5213530f0
[ "Apache-2.0" ]
31
2019-01-05T20:48:59.000Z
2021-11-15T10:32:33.000Z
spectator/dist_summary.cc
copperlight/spectator-cpp
993c98700a29cbcf067fb87fb88b37d5213530f0
[ "Apache-2.0" ]
58
2018-11-21T20:58:41.000Z
2021-04-14T18:08:45.000Z
spectator/dist_summary.cc
copperlight/spectator-cpp
993c98700a29cbcf067fb87fb88b37d5213530f0
[ "Apache-2.0" ]
15
2018-11-20T23:50:59.000Z
2021-08-03T04:21:32.000Z
#include "dist_summary.h" #include "atomicnumber.h" namespace spectator { DistributionSummary::DistributionSummary(IdPtr id) noexcept : id_(std::move(id)), count_(0), total_(0), totalSq_(0.0), max_(0) {} IdPtr DistributionSummary::MeterId() const noexcept { return id_; } std::vector<Measurement> DistributionSummary::Measure() const noexcept { std::vector<Measurement> results; auto cnt = count_.exchange(0, std::memory_order_relaxed); if (cnt == 0) { return results; } if (!count_id_) { total_id_ = id_->WithStat("totalAmount"); total_sq_id_ = id_->WithStat("totalOfSquares"); max_id_ = id_->WithStat("max"); count_id_ = id_->WithStat("count"); } auto total = total_.exchange(0.0, std::memory_order_relaxed); auto t_sq = totalSq_.exchange(0.0, std::memory_order_relaxed); auto mx = max_.exchange(0.0, std::memory_order_relaxed); results.reserve(4); results.push_back({count_id_, static_cast<double>(cnt)}); results.push_back({total_id_, total}); results.push_back({total_sq_id_, t_sq}); results.push_back({max_id_, mx}); return results; } void DistributionSummary::Record(double amount) noexcept { Update(); if (amount >= 0) { count_.fetch_add(1, std::memory_order_relaxed); add_double(&total_, amount); add_double(&totalSq_, amount * amount); update_max(&max_, amount); } } int64_t DistributionSummary::Count() const noexcept { return count_.load(std::memory_order_relaxed); } double DistributionSummary::TotalAmount() const noexcept { return total_.load(std::memory_order_relaxed); } } // namespace spectator
28.660714
73
0.712773
copperlight
ee4ce3c22d5112e132bd828b4273ae7bc8c83514
5,420
cpp
C++
matCUDA tests/src/UnitTest02.cpp
leomiquelutti/matCUDA
95bd7917289288b0137ce23a952d4ccfd43e0d1d
[ "MIT" ]
null
null
null
matCUDA tests/src/UnitTest02.cpp
leomiquelutti/matCUDA
95bd7917289288b0137ce23a952d4ccfd43e0d1d
[ "MIT" ]
null
null
null
matCUDA tests/src/UnitTest02.cpp
leomiquelutti/matCUDA
95bd7917289288b0137ce23a952d4ccfd43e0d1d
[ "MIT" ]
null
null
null
#include "unitTests.h" #define sizeSmall 4 #define sizeLarge 1024 void test_plus_equal_float_1() { // small vector Array<float> v1( sizeSmall ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) += -1.0; Array<float> v2( sizeSmall ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) += 1.0; Array<float> v4( sizeSmall ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_float_2() { // large vector Array<float> v1( sizeLarge ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) += -1.0; Array<float> v2( sizeLarge ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) += 1.0; Array<float> v4( sizeLarge ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_float_3() { Array<float> m1( sizeSmall, sizeSmall ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += -1.0; } Array<float> m2( sizeSmall, sizeSmall ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += 1.0; } Array<float> m4( sizeSmall, sizeSmall ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_float_4() { // matrix Array<float> m1( sizeLarge, sizeLarge ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += -1.0; } Array<float> m2( sizeLarge, sizeLarge ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += 1.0; } Array<float> m4( sizeLarge, sizeLarge ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_double_1() { // small vector Array<double> v1( sizeSmall ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) += -1.0; Array<double> v2( sizeSmall ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) += 1.0; Array<double> v4( sizeSmall ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_double_2() { // large vector Array<double> v1( sizeLarge ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) += -1.0; Array<double> v2( sizeLarge ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) += 1.0; Array<double> v4( sizeLarge ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_double_3() { Array<double> m1( sizeSmall, sizeSmall ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += -1.0; } Array<double> m2( sizeSmall, sizeSmall ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += 1.0; } Array<double> m4( sizeSmall, sizeSmall ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_double_4() { // matrix Array<double> m1( sizeLarge, sizeLarge ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += -1.0; } Array<double> m2( sizeLarge, sizeLarge ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += 1.0; } Array<double> m4( sizeLarge, sizeLarge ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_complex_1() { // small vector Array<Complex> v1( sizeSmall ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) += Complex(-1,-1); Array<Complex> v2( sizeSmall ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) += Complex(1,1); Array<Complex> v4( sizeSmall ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_complex_2() { // large vector Array<Complex> v1( sizeLarge ); for (int i = 0; i < v1.GetDescriptor().GetDim( 0 ); i++) v1(i) = Complex(-1,-1); Array<Complex> v2( sizeLarge ); for (int i = 0; i < v2.GetDescriptor().GetDim( 0 ); i++) v2(i) = Complex(1,1); Array<Complex> v4( sizeLarge ); v1 += v2; TEST_CALL( v1, v4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_complex_3() { Array<Complex> m1( sizeSmall, sizeSmall ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += Complex(-1,-1); } Array<Complex> m2( sizeSmall, sizeSmall ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += Complex(1,1); } Array<Complex> m4( sizeSmall, sizeSmall ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); } void test_plus_equal_complex_4() { // matrix Array<Complex> m1( sizeLarge, sizeLarge ); for (int i = 0; i < m1.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m1.GetDescriptor().GetDim( 1 ); j++) m1(i,j) += Complex(-1,-1); } Array<Complex> m2( sizeLarge, sizeLarge ); for (int i = 0; i < m2.GetDescriptor().GetDim( 0 ); i++) { for (int j = 0; j < m2.GetDescriptor().GetDim( 1 ); j++) m2(i,j) += Complex(1,1); } Array<Complex> m4( sizeLarge, sizeLarge ); m1 += m2; TEST_CALL( m1, m4, BOOST_CURRENT_FUNCTION ); }
22.396694
59
0.596679
leomiquelutti