blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
824d7ebfc7b629205e64a97797e4900034fc4d74
057c525d6fbff928fc0cb0cd6b2930e9494b5d4b
/training-data/cpp/76-SoXtComponent.c++
579cbc3f629de452b1ec75a072e26b2580b9cbaf
[]
no_license
uk-gov-mirror/ukwa.text-id
0931742d1f2df3091ac52eee6160c177ea98180d
5f3dcc6436bc46dedb375b37e3fd51c1c0d9b45b
refs/heads/master
2022-02-26T15:32:15.901527
2019-11-19T16:36:06
2019-11-19T16:36:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,656
/*N *N * Aa (A) 0 Aa Aa, Aa. Aa Aa Aa. N *N * Aa a a a a; a a a a a/aN * a a a a a a a A Aa Aa AaN * Aa a a a a Aa Aa Aa; aN * a 0.0 a a Aa, a (a a a) a a a.N *N * Aa a a a a a a a a a a a,N * a A A A; a a a a a aN * A a A A A A A. Aa a AN * Aa Aa Aa Aa a a a.N *N * Aa, a a a a a a a a a aN * a a a a a a a a a a aN * a a a. Aa a a a, a a aN * a, a a a a a a. Aa a, aN * a, a a a a a a a a a a aN * a a, a a a a a.N * N * Aa a a a a a a a A Aa Aa AaN * Aa a a a a; a a, a a a Aa AaN * Aa, Aa., 0 Aa Aa, Aa 0, Aa, A 0-0 AN *N * Aa a: Aa Aa, Aa., 0 Aa Aa,N * Aa Aa, A 0, a:N * N * a://a.a.a N * N * Aa a a a a a, a: N * N * a://a.a.a/a/AaAa/AaAa/N *N */N N /*N * Aa (A) 0-0 Aa Aa, Aa.N *N _______________________________________________________________________N ______________ A A A A A A A A A A A A A A A A A A . ____________N |N | $Aa: 0.0 $N |N | Aa:N | AaAaAaN |N | Aa(a): Aa Aa, Aa AaN |N ______________ A A A A A A A A A A A A A A A A A A . ____________N _______________________________________________________________________N */N #a <Aa/AaAa.a>N #a <Aa/a/AaAaAa.a>N #a <Aa/Aa/AaAaAa.a>N #a <Aa/Aa/AaAa.a>N N #a <Aa/a/AaAaAa.a>N N #a <a.a>N #a <a.a> // a a() a a()N #a <a.a> // a a()N #a <a.a> // a a() a a()N N #a <A0/Aa.a>N #a <A0/Aa.a>N #a <A0/AaAa.a>N N #a <Aa/Aa.a>N #a <Aa/AaAa.a>N #a <Aa/AaA.a>N #a <Aa/Aa.a>N N #a <Aa/a/AaA.a>N N N a a *aAaAa = "Aa Aa Aa Aa";N a a *aAaAa = "Aa Aa Aa a a.";N a a *aAaAa = "a a a a a a.";N a a *aAaAa = "AaAaAa";N N // a aN AaAa *AaAaAa::aAa = A;N N ////////////////////////////////////////////////////////////////////////N //N // AaN //N AaAaAa::AaAaAa(N Aa a,N a a *a, N AaAa aAaAa)N //N ////////////////////////////////////////////////////////////////////////N {N #a AN // a a Aa a aN a (AaAa::aAa() == A) {N AaAaAa::a("AaAaAa::AaAaAa",N "AaAa::aAa() a a A Aa. Aa a a a AaAa::a() a.");N a;N }N #aN N a (aAa == A)N aAa = a AaAa;N N aAaAa(aAaAa);N a (a != A)N _a = a(a);N a _a = A;N N aAa = A; // a a A a a a a aN a = A;N aAa = A;N a.aAa(0, 0);N N // Aa a a a a a aAaAa()N _aAa = A;N N // a a a a a aN aAa = (a == A || !aAaAa);N aAaAa = (aAa || (a != A && AaAaAa(a)));N a (aAa) {N Aa aAa = (a != A) ? a : AaAa::aAaAaAa();N aAa = AaAaAaAa(N aAaAa(),N aAaAaAaAa, N aAa,N A, 0);N }N a aAa = a;N N // a'a a a a a a a a, aN // a a a a a a a a aN // a() a a (a a a a a a aN // a a a)N a (aAaAa) {N AaAaAaAa(aAa, AaAaAa, AaA_A, A);N Aa aAaAa = AaAaAa(AaAa(aAa),N "A_A_A", Aa);N AaAaAaAa(aAa, aAaAa, N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N }N N // a a (a a a a a a a a)N aAa = A;N aAa = A;N AaAa = AaAaAa(AaAa::aAaAa(aAa));N aAa = A; // a a aN aAaAa = A;N }N N ////////////////////////////////////////////////////////////////////////N //N // AaN //N AaAaAa::~AaAaAa()N //N ////////////////////////////////////////////////////////////////////////N {N // Aa a a a a a a a a.N // Aa, a a a a a a a a a a a a.N a (_aAa != A) {N AaAaAa(_aAa, AaAaAa,N AaAaAa::aAaA, (AaAa) a);N N AaAaAaAa(_aAa, AaAaAa, A,N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N N Aa aAa = AaAa::aAaAa(_aAa);N a ((aAa != A) && (aAa != _aAa))N AaAaAaAa(aAa, AaAaAa, A,N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N N a (aAaAa && (aAa != A)) {N Aa aAaAa = AaAaAa(AaAa(aAa),N "A_A_A", Aa);N AaAaAaAa(aAa, aAaAa, N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N }N }N N // Aa a a a.N a (aAaAa() != A && aAa)N AaAaAa(aAa);N a a (_aAa != A)N AaAaAa(_aAa);N N a (_a != A) a(_a);N a (a != A) a(a);N a (aAa != A) a(aAa);N N a aAa;N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a a a a.N //N AaAaN AaAaAa::aAa()N //N ////////////////////////////////////////////////////////////////////////N {N aAaAaAa();N N a aAa;N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a a a a a a a, a aN // a a a a a a a.N //N aN AaAaAa::aAaAaAa()N //N ////////////////////////////////////////////////////////////////////////N {N AaAa aAa = aAa;N N // a a a a a a a a (a a A'A aN // a a a a AaAaAa(a) - aN // a a() a a a.N aAa = (AaAa && aAa && _aAa N && AaAa(_aAa));N N a (aAa != aAa && aAa)N aAa->aAa((a *)(a a)aAa); N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a a a a a a a a aN //N aN AaAaAa::aAaAaAa(N AaAaAaAaA *a, a *aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a (aAa == A)N aAa = a AaAaAa;N N aAa->aAa((AaAaAaA *) a, aAa);N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a a a a a a a a aN //N aN AaAaAa::aAaAaAa(N AaAaAaAaA *a, a *aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a (aAa == A)N a;N N aAa->aAa((AaAaAaA *) a, aAa);N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a a a a.N //N aN AaAaAa::aAaAa(Aa a)N //N ////////////////////////////////////////////////////////////////////////N { N _aAa = a;N N // Aa a a a a a a a a aN AaAaAa (_aAa, AaAaAa,N AaAaAa::aAaA, (AaAa) a );N N // a a a a a a a/a aN // a a a.N AaAaAaAa(_aAa, AaAaAa, A,N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N N Aa aAa = AaAa::aAaAa(_aAa);N a ((aAa != A) && (aAa != _aAa))N AaAaAaAa(aAa, AaAaAa, A,N (AaAaAa) AaAaAa::aAaAaA,N (AaAa) a);N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a aN //N ////////////////////////////////////////////////////////////////////////N N a a *N AaAaAa::aAaAaAa() aN { a aAaAa; } // a a a a aN N a a *N AaAaAa::aAaAa() aN { a "Aa Aa"; }N N a a *N AaAaAa::aAaAaAa() aN { a "Aa Aa"; }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a a a a (a).N //N // a aN //N aN AaAaAa::aAaAa()N //N ////////////////////////////////////////////////////////////////////////N {N a (aAaAa) {N N // a a a a a a a a a a a a aN a (a == A)N a = a(aAaAa());N a (aAa == A)N aAa = a(aAaAaAa());N AaAaAaAa(aAa,N AaAa, a, AaAaAa, aAa, A);N }N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a.N //N // Aa: aN aN AaAaAa::aAa(a AaAa0a &aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a (aAaAa() != A)N AaAa::aAaAa(aAa, aAa);N a a (_aAa != A)N AaAa::aAaAa(_aAa, aAa);N N // a a a a aN a = aAa;N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a.N //N // Aa: aN AaAa0aN AaAaAa::aAa()N //N ////////////////////////////////////////////////////////////////////////N {N // Aa a a a a a a a, a a a a aN // a a.N a (aAaAa() != A)N a = AaAa::aAaAa(aAa);N a a (_aAa != A)N a = AaAa::aAaAa(_aAa);N N a a;N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a a a a a a a a aN //N aN AaAaAa::aAa(a a *aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a (a != A) a(a);N a = (aAa != A) ? a(aAa) : A;N N a (a != A && _aAa != A && AaAaAa(AaAa(_aAa)))N AaAaAaAa(AaAa(_aAa), AaAa, a, A);N }N N ////////////////////////////////////////////////////////////////////////N //N // a a a a a a a a a a a a aN //N aN AaAaAa::aAaAa(a a *aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a (aAa != A) a(aAa);N aAa = (aAa != A) ? a(aAa) : A;N N a (aAa != A && _aAa != A && AaAaAa(AaAa(_aAa)))N AaAaAaAa(AaAa(_aAa), AaAaAa, aAa, A);N }N N ////////////////////////////////////////////////////////////////////////N //N // a - a a a.N //N aN AaAaAa::a()N //N ////////////////////////////////////////////////////////////////////////N {N // Aa a a!N AaAa::a(_aAa);N N // Aa a a a a a a.N a (aAaAa && aAa)N AaAa::a(aAa);N }N N ////////////////////////////////////////////////////////////////////////N //N // a - a a a.N //N aN AaAaAa::a()N //N ////////////////////////////////////////////////////////////////////////N {N #a 0N // a a a a a - a a a a a aN // a a a a a a a a a'a a a.N // a a a a a a a a a N // a a a, a a a a a...N N // a a a a a a, a a....N a (! aAa())N a;N #aN N a (aAaAa) {N // a a a a a a a a aN // a a a a a a a a a.N a (AaAa(aAa)) {N a a, a;N AaAaAaAa(aAa, AaAa, &a, AaAa, &a, A);N AaAa a;N a.a = Aa;N a.a = a;N a.a = a;N AaAaAa(AaAa(aAa), AaAa(aAa), &a);N }N N AaAa::a(aAa); // a a AaAa() (a a)N }N aN AaAa::a(aAa()); // a a AaAaAa() (a a)N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa:N // Aa() a a a a a a a, a aN // a a a (a a a)N //N // Aa: a aN //N aN AaAaAa::aAaAa()N //N ////////////////////////////////////////////////////////////////////////N {N a (aAa == AaAa::aAaAaAa())N a(0);N aN a();N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a, a A a a a a a AaAaAa.N //N // Aa: a, aN //N AaAaAa *N AaAaAa::aAa(Aa a)N //N ////////////////////////////////////////////////////////////////////////N {N a (a == A)N a A;N N // a a a a a a a aN // a a 'a', a a 'a'.N a *a = A;N AaAaAa::aAa->a((a a) a, a);N N a (AaAaAa *) a;N }N N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a a a a.N // Aa a a a a a a aAa a.N // a a 'a', a a 'a'.N //N // Aa: aN //N aN AaAaAa::aAa(Aa a)N //N ////////////////////////////////////////////////////////////////////////N {N // a a a a a'a a aN a *a = A;N a (AaAaAa::aAa->a((a a) a, a)) {N #a AN // a a A a.N // a a'a a a a a, a.N // a a a a a a, a a a aN // (a a a a a a a a a).N AaAaAa *a = (AaAaAa *) a;N a (a != a) {N AaAaAa::a("AaAaAa::aAa",N "a a a 0 a a! a a: %a, a a: %a", a->aAaAa(), aAaAa());N }N #aN }N a {N // Aa a a a a aN AaAaAa::aAa->a((a a) a, a);N }N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a a a a a a a.N // Aa a a a a a a aAa a.N //N // Aa: aN //N aN AaAaAa::aAa(Aa a)N //N ////////////////////////////////////////////////////////////////////////N {N a (aAa != A)N aAa->a((a a) a);N }N N ////////////////////////////////////////////////////////////////////////N //N // Aa:N // Aa a a a a a a a a a aN // a a a a a. Aa a a a a a a a:N // 0) a a aN // 0) A_A_A a aN // 0) $(A)/a/a/AaN // 0) a a a "Aa a a a a"N //N // Aa: aN //N aN AaAaAa::aAaAa(a a *aAa)N //N ////////////////////////////////////////////////////////////////////////N {N a aAa[0];N a aAa[0];N a(aAa, "a ");N N #a 0N // ??? a a a a a a a a Aa. Aa aN // ??? a a a a a a a a a a. (a 0)N //???a- a a a, a a a'a a a.N a a, a, a;N aAaAa(A_A_A, &a); N aAaAa(A_A_A,&a);N aAaAa(A_A_A, &a);N a0_a a = a + a + a;N N N a (a < 0)N a(aAa, "-a "); // a a aN #aN N a a[0];N a(a, "a a > /a/a");N a (a(a) != 0) {N AaAa::aAaAaAa(_aAa, aAaAa, aAaAa);N a;N }N N // a a a a a a a a aN a ( a(aAa, A_A) == 0 ) {N a(aAa, aAa);N a(aAa, " &");N a (a(aAa) != 0)N AaAa::aAaAaAa(_aAa, aAaAa, aAaAa);N a;N }N N // a a a a a a N a *aAa = a("A_A_A");N a (aAa != A) {N a(aAa, aAa);N a(aAa, "/");N a(aAa, aAa);N a ( a(aAa, A_A) == 0 ) {N a(aAa, aAa);N a(aAa, " &");N a (a(aAa) != 0)N AaAa::aAaAaAa(_aAa, aAaAa, aAaAa);N a;N }N }N N // a a a a a aN a(aAa, A "/a/a/Aa/");N a(aAa, aAa);N a ( a(aAa, A_A) == 0 ) {N a(aAa, aAa);N a(aAa, " &");N a (a(aAa) != 0)N AaAa::aAaAaAa(_aAa, aAaAa, aAaAa);N a;N }N N //N // a a a a a a a a a aN //N AaAa::aAaAaAa(_aAa, aAaAa, aAaAa);N }N N N ////////////////////////////////////////////////////////////////////////N //N // Aa a a A - a a a a a.N //N // a aN //N aN AaAaAa::aAa()N //N ////////////////////////////////////////////////////////////////////////N {N #a AN AaAaAa::a("AaAaAa::aAa",N "a a a, a a a a a a a a a.", N "Aa, a a a a a.");N #aN _aAa = A;N }N N //N ////////////////////////////////////////////////////////////////////////N // a a aN ////////////////////////////////////////////////////////////////////////N //N N // Aa a _aAa a a.N aN AaAaAa::aAaA(N Aa, N AaAa aAa, N AaAa)N {N AaAaAa *a = (AaAaAa *) aAa;N a->aAa();N }N N //N // a a a a a a A_A_A aN // (a a a a)N //N aN AaAaAa::aAaAaA(Aa, AaAaAa *a, a *)N {N a (a->aAaAa != A)N (*a->aAaAa) (a->aAaAa, a);N aN a->aAaAa();N }N N //N // a a a a a a a/a (a aN // aAa a a a a a a'a a a)N //N aN AaAaAa::aAaAaA(Aa, AaAaAa *a, Aa *a, Aa *)N {N a (a->a == AaAa) {N // Aa a a-a a a a a a a aN a (a->aAa) {N a->aAaAa();N a->aAa = A;N }N N a->aAa = A;N a->aAaAaAa();N }N a a (a->a == AaAa) {N a->aAa = A;N a->aAaAaAa();N }N }N N //N // a a a a a a a/a (a aN // aAa a a a a a a'a a a)N //N aN AaAaAa::aAaAaA(Aa, AaAaAa *a, Aa *a, Aa *)N {N a (a->a == AaAa) {N a->AaAa = A;N a->aAaAaAa();N }N a a (a->a == AaAa) {N a->AaAa = A;N a->aAaAaAa();N }N }N
[ "Andrew.Jackson@bl.uk" ]
Andrew.Jackson@bl.uk
585b6d7592c1cc4b1d7a36ab145d9cc3280f39f4
4e528dddd0e5d2131fbe673428046e22930348e2
/Engine/Source/Math/ColorHSV.cpp
93c60d7ac1a36be2f4e75ee62c0caafa710473d0
[]
no_license
ConductorRU/Chronopolis
1da11fd782339dd783ecb443ddd0fddf05b7bba5
6ec21a8463a54200bbe937c48fabf01317455261
refs/heads/master
2020-06-24T21:51:48.595659
2018-05-28T11:02:17
2018-05-28T11:02:17
74,618,149
0
0
null
null
null
null
UTF-8
C++
false
false
658
cpp
#include "stdafx.h" #include "ColorRGB.h" #include "ColorHSV.h" namespace DEN { ColorHSV::ColorHSV(const ColorRGB &col) { float r = float(col.r) / 255.0f; float g = float(col.g) / 255.0f; float b = float(col.b) / 255.0f; float cMax = max(max(r, g), b); float cMin = min(min(r, g), b); float del = cMax - cMin; h = 0.0f; if(del > 0.000001f) { if(r >= g && r >= b) h = 60.0f*((g - b) / del); else if(g >= r && g >= b) h = 60.0f*((b - r) / del + 2.0f); else h = 60.0f*((r - g) / del + 4.0f); h = h - float((int(h) / 360) * 360); } v = cMax; s = del; if(del > 0.0f) s /= v; a = float(col.a) / 255.0f; } }
[ "draaks@yandex.ru" ]
draaks@yandex.ru
4e1aa8ccfea39a755a7fbb96f9f6a59ec8edbc3e
b3cf6ac1b9946a0399887bb8875b0c1bf943f9d6
/AudioEvent.cpp
92638ef2a395150c3ebed519f0c52b78dfc96534
[ "MIT" ]
permissive
rogerbusquets97/3D-Engine
19e30b137287eedf1e48ac4dadde63532d4a048d
0995a916664da9950b6d6a6edc34acf64c839057
refs/heads/master
2021-09-05T01:28:37.442597
2017-12-17T12:22:54
2018-01-23T11:14:42
103,663,586
0
1
null
2017-11-12T21:20:44
2017-09-15T14:00:51
C
UTF-8
C++
false
false
897
cpp
#include "AudioEvent.h" #include "ModuleImGui.h" #include "AudioSource.h" AudioEvent::AudioEvent() { } AudioEvent::~AudioEvent() { } void AudioEvent::UnLoad() { } void AudioEvent::Load(JSON_File * file, SoundBank * p, int id) { bool succes = file->MoveToInsideArray("IncludedEvents", id); if (succes) { LOG_OUT("Can be readed"); } this->id = file->GetNumber("Id"); this->name = file->GetString("Name"); this->parent = p; } void AudioEvent::UIDraw(AudioSource* parent ) { if (ImGui::CollapsingHeader(name.c_str())) { if (ImGui::Button("Play")) { //play event parent->obj->PlayEvent(name.c_str()); } ImGui::SameLine(); if (ImGui::Button("Stop")) { AK::SoundEngine::ExecuteActionOnEvent(name.c_str(), AK::SoundEngine::AkActionOnEventType::AkActionOnEventType_Pause); } ImGui::SameLine(); if (ImGui::Button("Send")) { parent->SendEvent(name.c_str()); } } }
[ "duranbusquetsroger@gmail.com" ]
duranbusquetsroger@gmail.com
c47ee5cea456f116b9f63ecbf9830e19c75634f1
ba6dac289a3f95eb8a3b6f4fd018a52d894660a6
/2020-06-25/2020-06-26/2206/2206.cpp
b1dee593122f3015b6a6e02f19a219ff26fe2bf6
[]
no_license
dl57934/Algorithms
7f7b1c06521863c71f0631d78f1b826597101597
f7a2a3c9e67b59c6a6516cbf87b9cba222f494e3
refs/heads/master
2021-06-12T11:10:53.966903
2021-03-16T20:10:17
2021-03-16T20:10:17
162,096,787
1
0
null
null
null
null
UTF-8
C++
false
false
1,733
cpp
#include <cstdio> #include <queue> using namespace std; void input(); void bfs(); void resultPrint(); int N, M; int map[1002][1002]; queue < pair<pair<int, int>, int> > qu; int dis[1002][1002][3]; int check[1002][1002][3]; int xpos[4] = {0, 0, -1, 1}; int ypos[4] = {1, -1, 0, 0}; int main(){ input(); bfs(); resultPrint(); } void input(){ scanf("%d %d", &N, &M); for(int y = 1; y <= N; y++){ for(int x = 1; x <= M; x++){ scanf("%1d", &map[y][x]); } } qu.push(make_pair(make_pair(1, 1),1)); } // 0은 벽을 부심, 방문할 수 있음 // 1은 벽을 부술 수 있음, 방문 함 void bfs(){ dis[1][1][0] = 1; dis[1][1][1] = 1; check[1][1][0] = 0; check[1][1][1] = 0; while(!qu.empty()){ pair<int, int> nowPoint = qu.front().first; int canvisit = qu.front().second; qu.pop(); for(int i = 0; i < 4; i++){ int ny = nowPoint.first + ypos[i]; int nx = nowPoint.second + xpos[i]; if(ny >= 1 && ny <= N && nx >= 1 && nx <= M){ if(map[ny][nx] == 0 && !check[ny][nx][canvisit]){ dis[ny][nx][canvisit] = dis[nowPoint.first][nowPoint.second][canvisit] + 1; check[ny][nx][canvisit] = 1; qu.push(make_pair(make_pair(ny,nx), canvisit)); }else if(map[ny][nx] == 1 && !check[ny][nx][1] && canvisit){ dis[ny][nx][0] = dis[nowPoint.first][nowPoint.second][canvisit] + 1; check[ny][nx][0] = 1; qu.push(make_pair(make_pair(ny,nx), 0)); } } } } } void resultPrint(){ if(!dis[N][M][0] && !dis[N][M][1]){ printf("-1\n"); return ; } if(dis[N][M][0] == 0) printf("%d", dis[N][M][1]); else if(dis[N][M][1] == 0) printf("%d", dis[N][M][0]); else if(dis[N][M][1] < dis[N][M][0]) printf("%d", dis[N][M][1]); else printf("%d", dis[N][M][0]); }
[ "dl57934@naver.com" ]
dl57934@naver.com
1ae15738a4b05f9b0f772df3c61a8b8fc02c31b6
5159d50078fa2945d027050a5bcd016228bb89b8
/algo2.cpp
7c640f4731fab0dd609281e8bd6eac02712af579
[]
no_license
maniteja123/ComputerGraphics
2dacf7668e27139ddc35751b2e5de7231f1271a3
52b42cf9fa58ffc48dae1cc61830bf312583043b
refs/heads/master
2020-12-25T22:20:31.646255
2016-01-01T20:20:57
2016-01-01T20:20:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,924
cpp
#include <stdio.h> #include <GL/gl.h> #include <GL/glut.h> #include "generate_tree.h" #include "circle.h" #include "line.h" const double density = 1.0; const int maxheight = 4; const int XJUMP = 20; const int YJUMP = 50; const int R = 5; const int YMAX = 700; const int WMIN = 0; const int WMAX = 700; int x = 1; pair < Node*, pair <int, int> > Tree; void Fetch(Node* root) { /* This extra pass is an inorder traversal to store the x since drawing a line would be different for left and right children. */ if (root == NULL) return; Fetch(root->left); root->x = x++; Fetch(root->right); } void Draw(Node* root) { /* Inorder traversal to draw the tree */ if (root == NULL) return; Draw(root->left); int fromx = root->x * XJUMP; int fromy = WMAX - 10 - YJUMP * root->depth; midpointcircle(R, fromx, fromy, WMIN, WMAX); if (root != Tree.first) { int tox = root->parent->x * XJUMP; int toy = WMAX - 10 - YJUMP * root->parent->depth; drawline(fromx, fromy, tox, toy, WMIN, WMAX); } Draw(root->right); } void display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); drawaxes(WMIN, WMAX, 100,10); Draw(Tree.first); //midpointcircle(10, 100, 100 , 0, WMAX); //drawline(10, 40, 30, 100, 0, 200); glFlush (); } void init (void) { glClearColor (0.0, 0.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); } int main(int argc, char** argv) { Tree = generate(density, maxheight); Fetch(Tree.first); glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (WMAX, WMAX); glutInitWindowPosition (100, 100); glutCreateWindow ("TREE DRAWING ASSIGNMENT 1 ALGO 2"); init (); glutDisplayFunc(display); glutMainLoop(); return 0; /* ISO C requires main to return int. */ }
[ "manitejanmt@gmail.com" ]
manitejanmt@gmail.com
7800ffd1fee9486932c5f66bcf1a5d1991fc0dc9
e557ce74c9fe34aa2b68441254b7def699067501
/src/libtsduck/base/network/tsTCPServer.h
3b49f9c3f0b27f3c0e3ad3f39757a0a8413dfb1f
[ "BSD-2-Clause" ]
permissive
cedinu/tsduck-mod
53d9b4061d0eab9864d40b1d47b34f5908f99d8a
6c97507b63e7882a146eee3613d4184b7e535101
refs/heads/master
2023-05-10T12:56:33.185589
2023-05-02T09:00:57
2023-05-02T09:00:57
236,732,523
0
0
BSD-2-Clause
2021-09-23T08:36:08
2020-01-28T12:41:10
C++
UTF-8
C++
false
false
5,006
h
//---------------------------------------------------------------------------- // // TSDuck - The MPEG Transport Stream Toolkit // Copyright (c) 2005-2023, Thierry Lelegard // 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. // //---------------------------------------------------------------------------- //! //! @file //! TCP Server //! //---------------------------------------------------------------------------- #pragma once #include "tsTCPConnection.h" namespace ts { //! //! Implementation of a TCP/IP server. //! @ingroup net //! //! The following lists the typical server-side scenario in the correct order. //! Many steps such as setting socket options are optional. The symbol [*] means mandatory. //! Depending on the platform, some options settings are sensitive to the order. //! The following order has proven to work on most platforms. //! //! - [*] open() //! - reusePort() //! - setSendBufferSize() //! - setReceiveBufferSize() //! - setLingerTime() / setNoLinger() //! - setKeepAlive() //! - setNoDelay() //! - setTTL() //! - [*] bind() //! - [*] listen() //! - [*] accept() //! - close() //! //! Invoking close() is optional since the destructor of the class will properly //! close the socket if not already done. //! class TSDUCKDLL TCPServer: public TCPSocket { TS_NOCOPY(TCPServer); public: //! //! Reference to the superclass. //! typedef TCPSocket SuperClass; //! //! Constructor //! TCPServer(): TCPSocket() { } //! //! Start the server. //! //! Here, @e starting the server means starting to listen to incoming //! client connections. Internally to the kernel, the incoming connections //! are queued up to @a backlog. When the method accept() is invoked and //! some incoming connections are already queued in the kernel, the oldest //! one is immediately accepted. Otherwise, accept() blocks until a new //! incoming connection arrives. //! //! @param [in] backlog Maximum number of incoming connections which allowed //! to queue in the kernel until the next call to accept(). Note that this //! value is a minimum queue size. But the kernel may accept more. There is //! no guarantee that additional incoming connections will be rejected if more //! than @a backlog are already queueing. //! @param [in,out] report Where to report error. //! @return True on success, false on error. //! bool listen(int backlog, Report& report = CERR); //! //! Wait for an incoming client connection. //! //! @param [out] client This object receives the new connection. Upon successful //! return from accept(), the TCPConnection object is a properly connected TCP //! session. Once the connection is completed, the TCPConnection objects on the //! client side and the server side are symmetric and can be used the same way. //! @param [out] addr This object receives the socket address of the client. //! If the server wants to filter client connections based on their IP address, //! it may use @a addr for that. //! @param [in,out] report Where to report error. //! @return True on success, false on error. //! @see listen() //! bool accept(TCPConnection& client, IPv4SocketAddress& addr, Report& report = CERR); // Inherited and overridden virtual bool close(Report& report = CERR) override; }; }
[ "thierry@lelegard.fr" ]
thierry@lelegard.fr
f64daf7451ccc9f52d21f8057603ef3f5cab4f75
ed2411e3ca762ba7a1c68ed0b2011cfa533aa5a0
/code/engine.vc2008/xrManagedUILib/xrManagedUILib/ISpectreUILib.cpp
bee9b834cb7c4e8fcc18eabc9bf3cc5baeb79c83
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "Apache-2.0" ]
permissive
andreyholkin/xray-oxygen
59be08e8a7f35577418a459cedc0ef799695e257
663ed0795f84e1b8cec0d6404ded27aad71b067c
refs/heads/master
2020-04-02T12:47:17.244026
2018-10-18T15:42:16
2018-10-18T15:42:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
46
cpp
#include "stdafx.h" #include "ISpectreUILib.h"
[ "vihtarb@gmail.com" ]
vihtarb@gmail.com
f4e4e6866ad32c77fcd24698c34aa8c8adcd6d08
2f10f807d3307b83293a521da600c02623cdda82
/deps/boost/win/debug/include/boost/heap/heap_concepts.hpp
dfd5fca24f6bda5779f159da7e967cdc05f5f6e6
[]
no_license
xpierrohk/dpt-rp1-cpp
2ca4e377628363c3e9d41f88c8cbccc0fc2f1a1e
643d053983fce3e6b099e2d3c9ab8387d0ea5a75
refs/heads/master
2021-05-23T08:19:48.823198
2019-07-26T17:35:28
2019-07-26T17:35:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
129
hpp
version https://git-lfs.github.com/spec/v1 oid sha256:d4d5547c28eec7025bf6170456268dc8da9585c1ae8006e3832c2885747b710c size 2592
[ "YLiLarry@gmail.com" ]
YLiLarry@gmail.com
6e0c112d5566b23328959a66e5c239a7a9251395
39f1e2608183b7d50dbbba336e908fdbc0a2287d
/HANGOVER_SPOJ/main.cpp
b5b63540a0e90fa6073232f254f2d61956c94b55
[]
no_license
Hritiksingh/SPOJ_Solutions
657b51871d408538bbdd9c62216bd5ea830b845c
d32597842167360f4515439cc31cbfc95f2abfdf
refs/heads/master
2022-11-04T20:53:35.398029
2020-06-22T06:45:48
2020-06-22T06:45:48
262,012,971
0
0
null
null
null
null
UTF-8
C++
false
false
559
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); float n; while(true){ float sum=0,i=2; cin>>n; //----If input is 0.00 it will end taking input.------// if(n==0.00)break; while(sum<=n){ //-----we've to only check upto that point when the sum would become greater than given input 'c'-----// sum+=1/i; i++; if(sum>=n)break; } cout<<i-2<<" card(s)\n"; } return 0; }
[ "hritiksingh812@gmail.com" ]
hritiksingh812@gmail.com
b85d02e568236da8a508aced8fd952f075e8dd1a
a3723c8cf87c2b07a0f2726dff10b5a89d1db121
/Zadanie_5/TransmisionOfPackage.h
5fcb53bc6f68b064612b3baecaf11a50a1a97eb2
[]
no_license
ATSP5/Symulacja-Cyfrowa
04d2d3ef610b0dc2b8c2641261d7ca9dbda94ad3
4351cb1d0590b9409cf1e8c31048c54972487524
refs/heads/main
2023-01-22T20:15:04.873965
2020-12-06T12:03:21
2020-12-06T12:03:21
305,356,209
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
883
h
#ifndef TRANSMISIONOFPACKAGE_H #define TRANSMISIONOFPACKAGE_H #include "TelecommunicationSystem.h" #include "EndOfPackageTransmision.h" #include "EndOfChannelQuestioning.h" #include "ApLogger.h" class TransmisionOfPackage { private: bool event_locked_; int source_;// Numer stacji bazowej dla której to zdarzenie występuje TelecommunicationSystem* telecommunication_system_; vector<EndOfChannelQuestioning* > end_of_channel_questioning_; vector<EndOfPackageTransmision* > end_of_package_transmision_; public: void Execute(ApLogger* ap_log_); TransmisionOfPackage(int source_station_, TelecommunicationSystem* telecommunication_sys_, vector<EndOfPackageTransmision* > &end_of_package_transmision_V, vector<EndOfChannelQuestioning* > &end_of_channel_questioning_V_); bool GetEventLockedStatus(); void SetEventLock(bool lock_stat_); }; #endif // !TRANSMISIONOFPACKAGE_H
[ "adamprukala@wp.pl" ]
adamprukala@wp.pl
36ed35eae3c26e36c57746576276357544f14212
99571aa2e9a2b1542ca2d236edef81dd54aa797c
/hpc2017/src/Game.cpp
ff1f7f947a762c7ec45d678c996a0c91ec10a2b7
[]
no_license
kmyk/hallab-progcon-2017
67e2856dc0a589d59bb5626c6d12e7cbb0a08c1d
074d023bb699225b8d5a36b3a8916f3903ba8809
refs/heads/master
2021-07-10T21:33:59.074206
2017-10-15T22:46:30
2017-10-15T22:46:30
106,384,496
0
0
null
null
null
null
UTF-8
C++
false
false
2,501
cpp
//------------------------------------------------------------------------------ /// @file /// @author ハル研究所プログラミングコンテスト実行委員会 /// /// @copyright Copyright (c) 2017 HAL Laboratory, Inc. /// @attention このファイルの利用は、同梱のREADMEにある /// 利用条件に従ってください。 //------------------------------------------------------------------------------ #include "Game.hpp" #include "Assert.hpp" namespace hpc { //------------------------------------------------------------------------------ /// Game クラスのインスタンスを生成します。 Game::Game(RandomSeed aSeed) : mRandom(aSeed) , mRecorder() , mTimer() { } //------------------------------------------------------------------------------ /// シード値を変更します。 /// /// @param[in] aSeed 新しいシード値。 void Game::changeSeed(RandomSeed aSeed) { mRandom = Random(aSeed); } //------------------------------------------------------------------------------ /// ゲームを実行します。 /// /// @param[in] aAnswer ゲームの解答。 void Game::run(Answer& aAnswer) { mTimer.start(); for(int i = 0; i < Parameter::GameStageCount; ++i) { uint w = mRandom.randU32(); uint z = mRandom.randU32(); uint y = mRandom.randU32(); uint x = mRandom.randU32(); RandomSeed seed(x, y, z, w); Stage stage(seed); stage.init(); aAnswer.init(stage); mRecorder.afterInitStage(stage); while(!stage.hasFinished() && stage.turn() < Parameter::GameTurnLimit) { Actions actions; aAnswer.moveItems(stage, actions); stage.moveItems(actions); TargetPositions targetPositions; aAnswer.moveUFOs(stage, targetPositions); stage.moveUFOs(targetPositions); stage.advanceTurn(); mRecorder.afterAdvanceTurn(stage); } mRecorder.afterFinishStage(); aAnswer.finalize(stage); } mRecorder.afterFinishAllStages(); mTimer.stop(); } //------------------------------------------------------------------------------ /// ログ記録器を取得します。 const Recorder& Game::recorder()const { return mRecorder; } //------------------------------------------------------------------------------ /// タイマーを取得します。 const Timer& Game::timer()const { return mTimer; } } // namespace // EOF
[ "kimiyuki95@gmail.com" ]
kimiyuki95@gmail.com
9d118adcb599aab686ea66f93834d5432de670ea
72742d4ee57fb66cfe3f10290ccb596dcde1e59e
/camp2014/day2/c.cpp
6b6f47753e7c2b16f52969e2fb41f5e08f5969b9
[]
no_license
mertsaner/Algorithms
cd5cf84548ea10aafb13b4a3df07c67c1a007aef
f7aecb7e8aadff1e9cf49cc279530bc956d54260
refs/heads/master
2023-03-18T03:18:26.122361
2016-02-14T22:48:31
2016-02-14T22:48:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
918
cpp
#include <iostream> #include <cmath> using namespace std; unsigned long long a[20]; unsigned long long d(unsigned long long a) { unsigned long long res=0; while(a>0) a/=10, res++; return res; } unsigned long long middle(unsigned long long b) { unsigned long long res=b; unsigned long long c=d(b)-1; res%=(unsigned long long)pow(10.0, (double)c); return res/10; } unsigned long long f(unsigned long long b) { if(b<10) return b; unsigned long long res=0,c=b; res += a[d(b)-1]; while(b>=10) b/=10; unsigned long long first=b%10; res += middle(c); if(first!=1 && d(c)>=2) res += (first-1)*(unsigned long long)pow(10.0, (double)d(c)-2); if(c%10>=first) res++; return res; } int main() { unsigned long long int l,r; cin >> l >> r; a[1]=a[2]=9; for(int i=3;i<20;i++) a[i]=a[i-1]*10; for(int i=2;i<20;i++) a[i]+=a[i-1]; cout << (f(r) - f(l-1)) << endl; return 0; }
[ "kadircetinkaya.06.tr@gmail.com" ]
kadircetinkaya.06.tr@gmail.com
6459025ad65a3d035ce78d6239440d44ebc10333
a22f21123e0371039018fb4b46657b3059b372bc
/gdal/gcore/mdreader/reader_geo_eye.h
9cb5dfebf200411f4bae75202dcc14f41f076fd1
[ "MIT", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-info-zip-2005-02", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer", "SunPro" ]
permissive
klokantech/gdal
ddd4ace538691ae2ea4ce1a9eb114b96537f0b13
d8c41274833752b48ca39311816f82c2a16a3971
refs/heads/trunk
2023-09-05T11:27:15.048327
2015-08-08T13:47:17
2015-08-08T13:47:17
33,614,415
1
1
null
2015-04-08T15:10:19
2015-04-08T15:10:19
null
UTF-8
C++
false
false
2,532
h
/****************************************************************************** * $Id$ * * Project: GDAL Core * Purpose: Read metadata from GeoEye imagery. * Author: Alexander Lisovenko * Author: Dmitry Baryshnikov, polimax@mail.ru * ****************************************************************************** * Copyright (c) 2014-2015, NextGIS info@nextgis.ru * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef READER_GEO_EYE_H_INCLUDED #define READER_GEO_EYE_H_INCLUDED #include "../gdal_mdreader.h" /** @brief Metadata reader for Geo Eye TIFF filename: aaaaaaaaaa.tif Metadata filename: *_metadata* RPC filename: aaaaaaaaaa_rpc.txt Common metadata (from metadata filename): SatelliteId: Sensor CloudCover: Percent Cloud Cover AcquisitionDateTime: Acquisition Date/Time */ class GDALMDReaderGeoEye: public GDALMDReaderBase { public: GDALMDReaderGeoEye(const char *pszPath, char **papszSiblingFiles); virtual ~GDALMDReaderGeoEye(); virtual const bool HasRequiredFiles() const; virtual char** GetMetadataFiles() const; protected: virtual void LoadMetadata(); virtual const time_t GetAcquisitionTimeFromString(const char* pszDateTime); char **LoadRPCWktFile() const; char **LoadIMDWktFile() const; protected: CPLString m_osIMDSourceFilename; CPLString m_osRPBSourceFilename; }; #endif // READER_GEO_EYE_H_INCLUDED
[ "polimax at mail.ru" ]
polimax at mail.ru
3afc0731f911195c0df2a8b7c6c44c5368b598ed
dcb7dae56932f62292fd0d607e32dc2f238d5551
/339-B/main.cpp
96bbebf67678478703e0bc7d077d85779f784d1f
[]
no_license
alielrafeiFCIH/Problem_Solving
b5f330d115d3ca1c34613eb2639226c271f0052b
15863cd43012831867fa2035fc92733a059dcfbf
refs/heads/master
2020-06-27T03:33:15.668655
2019-09-03T09:49:26
2019-09-03T09:49:26
199,831,566
0
0
null
null
null
null
UTF-8
C++
false
false
566
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; int m,a; vector<int>v; long long int sum=0; scanf("%d%d",&n,&m); for(int i = 1;i<=m;i++){ cin>>a; v.push_back(a); } int start = 1; int s = v.size(); for(int i =0 ;i<s;i++){ if(v[i]<start){ int temp = abs(v[i]-start+n); sum+=temp; start=v[i]; }else{ int temp = abs(v[i]-start); sum+=temp; start = v[i]; } } cout<<sum; return 0; }
[ "alielrafei.fcih@gmail.com" ]
alielrafei.fcih@gmail.com
2a1d062c4c401e6fabbeb7195150f0f20b262006
16c87360f00b4ea12c024875f4aa3a1be685603d
/ModeRunControl/DlgModeRunCtrl.h
8bd31df89485b0d0bf5323c745a80164a3ac863a
[]
no_license
radiohide/temp
28ffe85e507b189c48c0c399f708f66f0558a4f2
7740a9965524a5a7a88e59291cc1f06382f01c58
refs/heads/master
2021-06-05T17:35:24.721125
2021-04-20T09:04:48
2021-04-20T09:04:48
86,920,856
0
0
null
null
null
null
UTF-8
C++
false
false
1,911
h
#if !defined(AFX_DLGMODERUNCTRL_H__3958F334_C95E_41A7_AB0C_845B6BC2B743__INCLUDED_) #define AFX_DLGMODERUNCTRL_H__3958F334_C95E_41A7_AB0C_845B6BC2B743__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // DlgModeRunCtrl.h : header file // ///////////////////////////////////////////////////////////////////////////// // CDlgModeRunCtrl dialog #include "DlgMCtrlDay.h" #include "DlgMCtrlCycle.h" #include "DlgMCtrlDuty.h" #include "DlgMCtrlMonth.h" #include "DlgMCtrlWeek.h" #include "DlgMCtrlType.h" #include "ModelCalcControl.h" class CDlgModeRunCtrl : public CDialog { // Construction public: CDlgModeRunCtrl(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CDlgModeRunCtrl) enum { IDD = IDD_DIALOG_MODERUN_CONCTRL }; CComboBox m_ComBoTaskType; //}}AFX_DATA public: CArray<CDlgMCtrlType*,CDlgMCtrlType*&> dlgAllTypeArr; ModelCalcControl *m_pMCalControl; public: void SetModelCalcControl(ModelCalcControl *pMCalControl); private: void showMCtrlDlgByIndex(int index); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDlgModeRunCtrl) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CDlgModeRunCtrl) virtual BOOL OnInitDialog(); afx_msg void OnSelchangeComboTasktype(); afx_msg void OnClose(); afx_msg void OnButtonSetRunABSTime(); afx_msg void OnButtonSetRunDataTime(); afx_msg void OnButtonApply(); afx_msg void OnButtonOk(); afx_msg void OnButtonCancle(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DLGMODERUNCTRL_H__3958F334_C95E_41A7_AB0C_845B6BC2B743__INCLUDED_)
[ "chenxi1@gdtianren.com" ]
chenxi1@gdtianren.com
93471e570f963ac8d082e21425538eaee739519f
db1636ffd781a60bc6eb8676eb73d3fa29a6a834
/Workshop_16_09_26/distance.cpp
cad905197ca0bb30b5bdc18636c6042950eb5b4e
[]
no_license
atishay197/machine-learning
6841928822621061df697781aabf33d825ce6007
400dff6cf1b5dd4075aeecd01432dfc9a3af0abe
refs/heads/master
2021-01-17T19:00:38.091677
2016-09-27T07:33:46
2016-09-27T07:33:46
62,532,298
0
0
null
null
null
null
UTF-8
C++
false
false
3,345
cpp
#include <bits/stdc++.h> float distanceMat[10][10] = {9999}; struct cordinate { float x; float y; // float z; cordinate(float x,float y) { this->x = x; this->y = y; // this->x = z; } cordinate() { this->x = 999999; this->y = 999999; } }; struct cluster { float x[10]; float y[10]; int i; cluster() { i = 0; } }; struct cluster addToCluster(cordinate b,struct cluster a) { // printf("Adding : %f , %f to a[%d]\n",b.x,b.y,a.i); a.x[a.i] = b.x; a.y[a.i] = b.y; a.i += 1; return a; } float distCalc(struct cordinate a,struct cordinate b) { return (pow(((pow((a.x-b.x),2))+pow((a.y-b.y),2)),0.5)); //+pow((a->Z-b->Z),2)); } struct cluster mergeCluster(struct cluster a,struct cluster b) { for(int i=0 ; i<b.i ; i++) { b.x[i] = a.x[a.i]; b.y[i] = a.y[a.i]; a.i += 1; } return a; } void updateDistanceMatrix(int points,struct cluster a[10]) { for(int i=0 ; i<points ; i++) { for(int j=0 ; j<points ; j++) { for(int k=0 ; k<a[i].i ; k++) { for(int l=0 ; l<a[j].i ; l++) { float cur = distCalc(cordinate(a[i].x[k],a[i].y[k]),cordinate(a[j].x[l],a[j].y[l])); // printf("%d %d %d %d %f %f = a.x: %f a.y: %f a.x: %f a.y: %f",i,j,k,l,cur,distanceMat[i][j],a[i].x[k],a[i].y[k],a[j].x[l],a[j].y[l]); if(distanceMat[i][j] > cur) distanceMat[i][j] = cur; } } // printf("%f\t",distanceMat[i][j]); } // printf("\n"); } } void printCluster(struct cluster a) { for(int i=0 ; i<a.i ; i++) { printf("(%f,%f)\n",a.x[i],a.y[i]); } printf("\n"); return; } void distanceMatrix(int points) { for(int i=0 ; i<points ; i++) { for(int j=0 ; j<points ; j++) distanceMat[i][j] = 99999; } } void printDistanceMatrix(int points) { for(int i=0 ; i<points ; i++) { for(int j=0 ; j<points ; j++) printf("%f\t",distanceMat[i][j]); printf("\n"); } } struct closestCluster { struct cluster a; struct cluster b; closestCluster(struct cluster a,struct cluster b) { this->a = a; this->b = b; } }; struct closestCluster findClosestCluster(struct cluster a[10], int points) { float mindis = 9999999; int mini=0,minj=0; for(int i=0 ; i<points ; i++) { for(int j=0 ; j<points ; j++) if(distanceMat[i][j] < mindis && distanceMat[i][j] != 0 && i!=j) { mindis = distanceMat[i][j]; mini = i; minj = j; } } return closestCluster(a[mini],a[minj]); } void printClosestCluster(struct closestCluster a) { int i; for(i=0 ; i<a.a.i ; i++) { printf("(%f,%f),",a.a.x[i],a.a.y[i]); } for(i=0 ; i<a.b.i ; i++) { printf("(%f,%f),",a.b.x[i],a.b.y[i]); } return; } int main() { struct cordinate a[10]; struct cluster b[10]; int points = 6; a[0] = cordinate(1,1); a[1] = cordinate(1.5,1.5); a[2] = cordinate(5,5); a[3] = cordinate(3,4); a[4] = cordinate(4,4); a[5] = cordinate(3,3.5); distanceMatrix(points); for(int i=0 ; i<points ; i++) b[i] = addToCluster(a[i],b[i]); for(int i=0 ; i<points ; i++) printCluster(b[i]); updateDistanceMatrix(points,b); int clusterNumber = points; while(clusterNumber != 1) { distanceMatrix(points); updateDistanceMatrix(clusterNumber,b); struct closestCluster c = findClosestCluster(b,clusterNumber); printClosestCluster(c); printf("\n"); // findClosestCluster(struct cluster a[10],int clusterNumber); clusterNumber--; printDistanceMatrix(points); } }
[ "atishay197@gmail.com" ]
atishay197@gmail.com
78c12902a28ad83e4d243f4b040ffe4e871e5d47
7cbfe0520262ed4cdb8e309d51fb13edf2895d04
/SRM656/CorruptedMessage.cpp
79d78b94237b39f89849ba3366133ab755cc440e
[]
no_license
ry0u/SRM
917383d8e2096388b7de7b53edd6e362d00a2126
02a08e74e67f8f929cffcde4075c4d41b580d7c4
refs/heads/master
2020-12-25T17:25:46.661867
2017-02-20T09:26:55
2017-02-20T09:26:55
29,791,579
0
0
null
null
null
null
UTF-8
C++
false
false
1,041
cpp
// BEGIN CUT HERE // END CUT HERE #line 5 "CorruptedMessage.cpp" #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <sstream> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) using namespace std; class CorruptedMessage { public: string reconstructMessage(string s, int k) { string ret = ""; map<char,int> m; rep(i,s.size()) { m[s[i]]++; } bool flag = true; char c = s[0]; rep(i,27) { if(m['a'+i] == s.size()-k) { flag = false; c = (char)('a'+i); break; } } if(!flag) { stringstream ss; ss << c; rep(i,s.size()) { ret += ss.str(); } } else { char t = s[0]; rep(i,27) { if(m['a'+i] == 0) { t = (char)('a'+i); break; } } stringstream ss; ss << t; rep(i,s.size()) ret += ss.str(); } return ret; } }; // BEGIN CUT HERE int main() { CorruptedMessage ___test; cout << ___test.reconstructMessage("abs",3) << endl; } // END CUT HERE
[ "ry0u_yd@yahoo.co.jp" ]
ry0u_yd@yahoo.co.jp
496962d72745862d609a595e37ffadd7856da31a
a998da51959779d30ed25089f25ef5d8606a2f26
/include/FlxState.h
dbcf795c1c10b652d6173ec22e82f188f3c6c194
[]
no_license
ratalaika/FlixelCpp
a9f3ed1cb42f19786bdc75e97b68322442572a5a
8843a3f1c88d96873ec887243dfbad9ea6601b01
refs/heads/master
2021-01-23T20:55:37.108817
2012-10-21T10:14:08
2012-10-21T10:14:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
878
h
/* This file is a part of "Flixel C++ port" project Copyrights (c) by Michał Korman 2012 */ #ifndef _FLX_STATE_H_ #define _FLX_STATE_H_ #include "backend/cpp.h" #include "FlxGroup.h" /** * Basic scene managment class */ class FlxState : public FlxGroup { public: /** * Default destrurctor */ ~FlxState() { clear(); } /** * State creating event. It's called once when state is being set as default. * To override. */ virtual void create() { } /** * State leaving event. It's called once when state is being destroyed (but before destructor). * To override. */ virtual void leave() { } /** * Update state event. * To override. */ virtual void update() { FlxGroup::update(); } /** * Draw event. * To override. */ void draw() { FlxGroup::draw(); } }; #endif
[ "dynax126@gmail.com" ]
dynax126@gmail.com
cf72e6b580802c8a94bd2a17a19208d95abf270b
9e5df111aec78973c26b525622cbcce0fd8eca0c
/UVA/11300-11399/11324.cpp
fb6284b82c115c3d153e1a566bf076c52a1d17ce
[]
no_license
zmix/ACM-Program
c9482d8895447788f051b89e9cd3d0c1b3bd1072
aad8c5ed5c1d733270870b06419ec9045b4b4686
refs/heads/master
2020-07-21T17:33:21.286268
2019-05-31T01:40:52
2019-05-31T01:40:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
875
cpp
#include <stdio.h> #include <string.h> #include <algorithm> #include <vector> using namespace std; #define N 1100 int n, m; int vis[N]; vector<int> G[N]; int dfs(int u) { vis[u] = 1; int ans = 1; for (int i = 0; i < G[u].size(); ++i) { if (!vis[G[u][i] ]) ans += dfs(G[u][i]); } return ans; } int main() { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); int T; scanf("%d", &T); while (T--) { scanf("%d%d", &n, &m); for (int i = 0; i <= n; ++i) G[i].clear(); for (int i = 0; i < m; ++i) { int u, v; scanf("%d%d", &u, &v); G[u].push_back(v); } int ans = 0; for (int i = 1; i <= n; ++i) { memset(vis, 0, sizeof(vis)); ans = max(ans, dfs(i)); } printf("%d\n", ans); } return 0; }
[ "qazxswh111@163.com" ]
qazxswh111@163.com
efaf92ad81ec56dd8da80052a21a78114ec48446
25d540ecc1962b8a818732007668d37fd3156959
/OpenSauce/Halo2/Halo2_Xbox/Objects/Objects.Scripting.inl
36cbd4cfc69e7a698ffde490035d0dc13e053378
[]
no_license
PlayerGamer3547/OpenSauce
01bf5bf3d0e7b97c77130afe47d95c0e31e8ab87
d4a80fca53fd864e48e03b7f0fae6ad1bed88f78
refs/heads/master
2022-12-11T03:30:10.250464
2020-08-02T10:36:36
2020-08-02T10:36:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,396
inl
/* Yelo: Open Sauce SDK Halo 1 (CE) Edition See license\OpenSauce\Halo1_CE for specific license information */ #include "Game/Camera.hpp" #include "Game/GameStateRuntimeData.hpp" #include "Objects/Objects.hpp" #include "Objects/Objects.WeaponSettings.hpp" #include <YeloLib/cseries/value_conversion.hpp> #include <YeloLib/Halo1/objects/objects_yelo.hpp> namespace Yelo { namespace Objects { static void* scripting_objects_distance_to_object_evaluate(void** arguments) { struct s_arguments { datum_index object_list; datum_index dest_object; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.real = -1.0f; if(!args->dest_object.IsNull()) { real min_dist = FLT_MAX; // Get the destination object's origin so that we can compare it, relative to each object in the list real_vector3d dest_object_origin; blam::object_get_origin(args->dest_object, dest_object_origin); // Enumerate the object list, testing each object's origin with dest for(datum_index curr_list_reference, curr_object_index = blam::object_list_get_first(args->object_list, curr_list_reference); !curr_object_index.IsNull(); curr_object_index = blam::object_list_get_next(args->object_list, curr_list_reference)) { // Compare the current object from the list to the destination object real dist = GetObjectDistanceFromPoint(curr_object_index, dest_object_origin); // We want the smallest distance of all the objects if(min_dist > dist) min_dist = dist; } if(min_dist != FLT_MAX) result.real = min_dist; } return result.pointer; } static void* scripting_object_data_get_real_evaluate(void** arguments) { struct s_arguments { datum_index object_index; cstring data_name; cstring subdata_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.real = -1.0f; if(!args->object_index.IsNull()) { s_object_header_datum* object = Objects::ObjectHeader()[args->object_index]; ObjectDataGetRealByName(object, args->data_name, args->subdata_name, result); } return result.pointer; } static void* scripting_object_data_set_real_evaluate(void** arguments) { struct s_arguments { datum_index object_index; cstring data_name; cstring subdata_name; real data_value; }* args = CAST_PTR(s_arguments*, arguments); if(!args->object_index.IsNull()) { s_object_header_datum* object = Objects::ObjectHeader()[args->object_index]; ObjectDataSetRealByName(object, args->data_name, args->subdata_name, args->data_value); } return nullptr; } static void* scripting_object_data_set_vector_evaluate(void** arguments) { struct s_arguments { datum_index object_index; cstring data_name; int16 vector_index; PAD16; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; if(!args->object_index.IsNull()) { s_object_header_datum* object = Objects::ObjectHeader()[args->object_index]; real_vector3d* obj_vector = ObjectDataGetVectorByName(object, args->data_name); const real_vector3d* vector = GameState::RuntimeData::VectorValueGet(args->vector_index); if(obj_vector != nullptr && vector != nullptr) { *obj_vector = *vector; result.boolean = true; } } return result.pointer; } static void* scripting_object_data_save_vector_evaluate(void** arguments) { struct s_arguments { datum_index object_index; cstring data_name; int16 vector_index; PAD16; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; if(!args->object_index.IsNull()) { s_object_header_datum* object = Objects::ObjectHeader()[args->object_index]; real_vector3d* obj_vector = ObjectDataGetVectorByName(object, args->data_name); real_vector3d* vector = GameState::RuntimeData::VectorValueGetForModify(args->vector_index); if(obj_vector != nullptr && vector != nullptr) { *vector = *obj_vector; result.boolean = true; } } return result.pointer; } ////////////////////////////////////////////////////////////////////////// // WEAPONS static void* scripting_weapon_data_get_real_evaluate(void** arguments) { struct s_arguments { datum_index weapon_index; cstring data_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.real = -1.0f; if(!args->weapon_index.IsNull()) { auto weapon = blam::object_try_and_get_and_verify_type<s_weapon_datum>(args->weapon_index); if (weapon != nullptr) WeaponDataGetRealByName(weapon, args->data_name, result); } return result.pointer; } static void* scripting_weapon_data_set_real_evaluate(void** arguments) { struct s_arguments { datum_index weapon_index; cstring data_name; real data_value; }* args = CAST_PTR(s_arguments*, arguments); if(GameState::IsLocal() && !args->weapon_index.IsNull()) { auto weapon = blam::object_try_and_get_and_verify_type<s_weapon_datum>(args->weapon_index); if(weapon != nullptr) WeaponDataSetRealByName(weapon, args->data_name, args->data_value); } return nullptr; } ////////////////////////////////////////////////////////////////////////// // WEAPONS - MAGAZINES static void* scripting_weapon_data_magazine_get_integer_evaluate(void** arguments) { struct s_arguments { datum_index weapon_index; int32 magazine_index; cstring data_name; cstring subdata_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.int32 = NONE; if(GameState::IsLocal() && !args->weapon_index.IsNull()) { auto weapon = blam::object_try_and_get_and_verify_type<s_weapon_datum>(args->weapon_index); if(weapon != nullptr) WeaponDataMagazineGetIntegerByName(weapon, args->magazine_index, args->data_name, args->subdata_name, result); } return result.pointer; } static void* scripting_weapon_data_magazine_set_integer_evaluate(void** arguments) { struct s_arguments { datum_index weapon_index; int32 magazine_index; cstring data_name; cstring subdata_name; int32 data_value; }* args = CAST_PTR(s_arguments*, arguments); if(GameState::IsLocal() && !args->weapon_index.IsNull()) { auto weapon = blam::object_try_and_get_and_verify_type<s_weapon_datum>(args->weapon_index); if(weapon != nullptr) WeaponDataMagazineSetIntegerByName(weapon, args->magazine_index, args->data_name, args->subdata_name, args->data_value); } return nullptr; } ////////////////////////////////////////////////////////////////////////// // WEAPONS - TRIGGERS static void* scripting_weapon_data_trigger_set_real_evaluate(void** arguments) { struct s_arguments { datum_index weapon_index; int32 trigger_index; cstring data_name; cstring subdata_name; real data_value; }* args = CAST_PTR(s_arguments*, arguments); // IF ANY OF YOUR DESIGNERS USE THIS FUCKING SCRIPT FUNCTION, THEN YOU ALL DESERVE TO BE FUCKING SHOT. // SRSLY. // We don't support modifying trigger data in anything but local games because it writes to tag memory if(GameState::IsLocal() && !args->weapon_index.IsNull()) { auto weapon = blam::object_try_and_get_and_verify_type<s_weapon_datum>(args->weapon_index); if(weapon != nullptr) WeaponTagDataTriggerSetRealByName(weapon, args->trigger_index, args->data_name, args->subdata_name, args->data_value); } return nullptr; } ////////////////////////////////////////////////////////////////////////// // UNITS static void* scripting_unit_data_get_object_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring data_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.datum = datum_index::null; if(!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if(!unit) { return result.pointer; } UnitDataGetObjectIndexByName(unit, args->data_name, result); } return result.pointer; } static void* scripting_unit_data_get_integer_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring data_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.int32 = NONE; if(!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if(!unit) { return result.pointer; } UnitDataGetIntegerByName(unit, args->data_name, result); } return result.pointer; } static void* scripting_unit_data_set_integer_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring data_name; int32 data_value; }* args = CAST_PTR(s_arguments*, arguments); if(!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if(!unit) { return nullptr; } UnitDataSetIntegerByName(unit, args->data_name, args->data_value); } return nullptr; } static void* scripting_unit_data_get_real_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring data_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.real = -1.0f; if(!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if(!unit) { return result.pointer; } UnitDataGetRealByName(unit, args->data_name, result); } return result.pointer; } static void* scripting_unit_data_set_real_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring data_name; real data_value; }* args = CAST_PTR(s_arguments*, arguments); if(GameState::IsLocal() && !args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if(!unit) { return nullptr; } UnitDataSetRealByName(unit, args->data_name,args->data_value); } return nullptr; } static void* scripting_vehicle_remapper_enabled_evaluate(void** arguments) { struct s_arguments { cstring state_name; }* args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.boolean = !c_settings_objects::Instance()->m_vehicle_remapper_enabled; if( args->state_name[0] != '\0' && strcmp(args->state_name, "get")!=0 ) { bool value = false; ValueConversion::FromString(args->state_name, value); VehicleRemapperEnable( value ); } return result.pointer; } static void* scripting_unit_is_key_down_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; short keypress; }*args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.boolean = false; if (!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if (!unit) { return result.pointer; } if (GetKeyState (args->keypress) & 0x8000) { result.boolean = true; } } return result.pointer; } static void* scripting_unit_camera_fov_set_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; real fov; }*args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.boolean = false; if (!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if (!unit) { return result.pointer; } if (args->fov) { Fov::GetFieldOfView; Fov::SetFieldOfView(args->fov); result.boolean = true; } } return result.pointer; } static void* scripting_unit_weapon_set_position_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; real weapon_pos_x; real weapon_pos_y; real weapon_pos_z; }*args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.boolean = false; if (!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if (!unit) { return result.pointer; } if (args->weapon_pos_x && args->weapon_pos_y && args->weapon_pos_z, NONE) { real_vector3d weapon_position{ args->weapon_pos_x, args->weapon_pos_y, args->weapon_pos_z }; Weapon::Initialize(); Weapon::GetWeaponPosition(); Weapon::SetWeaponPosition(weapon_position); Weapon::Dispose(); result.boolean = true; } } return result.pointer; } static void* scripting_unit_switch_weapon_evaluate(void** arguments) { struct s_arguments { datum_index unit_index; cstring tag_path; }*args = CAST_PTR(s_arguments*, arguments); TypeHolder result; result.pointer = nullptr; result.boolean = false; if (!args->unit_index.IsNull()) { auto* unit = blam::object_try_and_get_and_verify_type<s_unit_datum>(args->unit_index); if (!unit) { return result.pointer; } if (StrCmp(args->tag_path, "")) { result.boolean = true; } } return result.pointer; } }; };
[ "voidsshadow@hotmail.com" ]
voidsshadow@hotmail.com
bff0a1a53148c02ab3206d8abf72706c7595ad42
ac5efd0ab39d906e3386d7a2f118eb5aa640b01e
/leetcode/Combinations.cpp
8abe364a9676e9745f69934016588c5f6bc785f4
[]
no_license
erickingcs/Interview-Qs
acd0637fa326ffe21cf00f199d1dc4267f98526b
9f11120252aa4206b99615c7bcf77ca71bf21929
refs/heads/master
2021-01-21T00:22:13.181039
2013-05-06T12:27:27
2013-05-06T12:27:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
675
cpp
class Solution { public: void generate(vector<vector<int> > &ans, vector<int> &tuple, int now, int n, int k) { if (k == 0) { ans.push_back(tuple); return; } for (int i = now; i <= n; i++) { tuple.push_back(i); generate(ans, tuple, i + 1, n, k - 1); tuple.pop_back(); } } vector<vector<int> > combine(int n, int k) { // Start typing your C/C++ solution below // DO NOT write int main() function vector<vector<int> > ans; vector<int> tuple(0); generate(ans, tuple, 1, n, k); return ans; } };
[ "watermelonlh@gmail.com" ]
watermelonlh@gmail.com
66576d2bc351366ec99bf0014bbe39e747403f23
56f6eb0a7d89285154cb0fdf1289ea894b5c8592
/src/tasks/task.hpp
a097006647c1f2d5fed88f16ae0032fb8ec19450
[ "MIT" ]
permissive
ATetiukhin/QMathematics
2f6e5914b880907328dbb283f7d95242fb4173d4
7db9084184c9a517a69358713a04de61b0bb40ef
refs/heads/master
2021-01-15T11:11:57.060208
2015-01-20T06:09:06
2015-01-20T06:09:06
28,423,972
2
1
null
null
null
null
UTF-8
C++
false
false
456
hpp
/** * @file task.hpp * @Author ATetiukhin * @date January, 2015 * @brief General class @ref Task for different tasks. */ #ifndef TASK_HPP_INCLUDE #define TASK_HPP_INCLUDE #include <QWidget> #include "type_task.hpp" class Task : public QObject { Q_OBJECT public: virtual ~Task() {} QWidget * getWidget() { return ui_; } protected: TypeTask * task_; QWidget * ui_; }; #endif /* End of 'task.hpp' file */
[ "artemtetiukhin@yandex.ru" ]
artemtetiukhin@yandex.ru
58535051a68ee2cc06b99a12a97dd0528b1747cf
9e21b7819881da8f916dbd0f3299253424a105a5
/include/third_party/WebKit/Source/core/inspector/InspectorAuditsAgent.h
b4eb7b7a0ab3b03f97306e3492973c9a16948ec3
[ "Apache-2.0" ]
permissive
yuske/spitfire
10cc76bedd72871d5cff1a441b20ed54fb03a926
e2e6c70d18473cb29b593e393681a28d03a5f1b3
refs/heads/master
2021-09-07T10:57:40.679242
2018-02-21T22:21:52
2018-02-21T22:21:52
104,356,972
0
0
null
2017-09-21T14:14:01
2017-09-21T14:14:01
null
UTF-8
C++
false
false
1,308
h
// Copyright 2017 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. #ifndef InspectorAuditsAgent_h #define InspectorAuditsAgent_h #include "core/CoreExport.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Audits.h" namespace blink { class CORE_EXPORT InspectorAuditsAgent final : public InspectorBaseAgent<protocol::Audits::Metainfo> { WTF_MAKE_NONCOPYABLE(InspectorAuditsAgent); public: explicit InspectorAuditsAgent(InspectorNetworkAgent*); ~InspectorAuditsAgent() override; void Trace(blink::Visitor*) override; // Protocol methods. protocol::Response getEncodedResponse(const String& request_id, const String& encoding, protocol::Maybe<double> quality, protocol::Maybe<bool> size_only, protocol::Maybe<String>* out_body, int* out_original_size, int* out_encoded_size) override; private: Member<InspectorNetworkAgent> network_agent_; }; } // namespace blink #endif // !defined(InspectorAuditsAgent_h)
[ "yuske.dev@gmail.com" ]
yuske.dev@gmail.com
db5bc358da46ce8bb7e362c43356f49cfdb4e2f6
53e7f3022a2cf3730fb41da48ccf6f8a7ef40818
/test/cplus/iterator.cpp
0ff7a9cfcdcf98bd18595b11d4f29e321b0b77eb
[]
no_license
jeonjonghyeok/c-practice
f38d40303eb9902c505fb1e146a492d902a60397
97c5d9f0997ffb950584ecf24f83b8a50c428508
refs/heads/master
2023-03-07T21:59:49.175614
2021-02-18T16:46:37
2021-02-18T16:46:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
408
cpp
#include <iostream> #include <vector> using namespace std; int main(){ vector<int> v; v.push_back(10); v.push_back(20); v.push_back(30); v.push_back(40); v.push_back(50); vector<int>::iterator iter=v.begin(); cout << iter[3] << endl; iter += 2; cout << *iter << endl; cout << endl; for(iter = v.begin(); iter!=v.end();++iter) { cout << *iter << endl; } return 0; }
[ "tongher1685@gmail.com" ]
tongher1685@gmail.com
c83ac03d4259722f85dc6ab35c70693e22474965
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-lex/include/aws/lex/LexRuntimeServiceEndpointRules.h
5e473b02439ac0229a865d4b901c7dfe5fb3077f
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
470
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <cstddef> #include <aws/lex/LexRuntimeService_EXPORTS.h> namespace Aws { namespace LexRuntimeService { class LexRuntimeServiceEndpointRules { public: static const size_t RulesBlobStrLen; static const size_t RulesBlobSize; static const char* GetRulesBlob(); }; } // namespace LexRuntimeService } // namespace Aws
[ "sdavtaker@users.noreply.github.com" ]
sdavtaker@users.noreply.github.com
547bc50ff3115f2fa0b70ef5404221c6c4f1b733
ce6229f5915f9e6de1238861b4a940d61e56960b
/Sonder/Temp/il2cppOutput/il2cppOutput/mscorlib_System_IO_FileLoadException3198361301.h
fe76a03ba1f71a9316c2bb7f15a68f1d1e6f408d
[ "Apache-2.0" ]
permissive
HackingForGood/GoogleyEyes
d9e36e3dffb4edbd0736ab49a764736a91ecebcf
a92b962ab220686794350560a47e88191e165c05
refs/heads/master
2021-04-15T10:03:59.093464
2017-06-25T17:32:52
2017-06-25T17:32:52
94,575,021
7
0
null
null
null
null
UTF-8
C++
false
false
2,031
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_IO_IOException2458421087.h" // System.String struct String_t; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.IO.FileLoadException struct FileLoadException_t3198361301 : public IOException_t2458421087 { public: // System.String System.IO.FileLoadException::msg String_t* ___msg_12; // System.String System.IO.FileLoadException::fileName String_t* ___fileName_13; // System.String System.IO.FileLoadException::fusionLog String_t* ___fusionLog_14; public: inline static int32_t get_offset_of_msg_12() { return static_cast<int32_t>(offsetof(FileLoadException_t3198361301, ___msg_12)); } inline String_t* get_msg_12() const { return ___msg_12; } inline String_t** get_address_of_msg_12() { return &___msg_12; } inline void set_msg_12(String_t* value) { ___msg_12 = value; Il2CppCodeGenWriteBarrier(&___msg_12, value); } inline static int32_t get_offset_of_fileName_13() { return static_cast<int32_t>(offsetof(FileLoadException_t3198361301, ___fileName_13)); } inline String_t* get_fileName_13() const { return ___fileName_13; } inline String_t** get_address_of_fileName_13() { return &___fileName_13; } inline void set_fileName_13(String_t* value) { ___fileName_13 = value; Il2CppCodeGenWriteBarrier(&___fileName_13, value); } inline static int32_t get_offset_of_fusionLog_14() { return static_cast<int32_t>(offsetof(FileLoadException_t3198361301, ___fusionLog_14)); } inline String_t* get_fusionLog_14() const { return ___fusionLog_14; } inline String_t** get_address_of_fusionLog_14() { return &___fusionLog_14; } inline void set_fusionLog_14(String_t* value) { ___fusionLog_14 = value; Il2CppCodeGenWriteBarrier(&___fusionLog_14, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "anishdhesikan@gmail.com" ]
anishdhesikan@gmail.com
616a06a2a625330c797b57369d6f32c5c7c97764
c5287793dd57fe738ec7aa776a5bc3fba515ea14
/block1/Bar.h
58dac93c834ffb3a6c78354071da7d5b1d322ace
[]
no_license
makoty/myBlock
063a8ac6849243ca1c1fb1cd64859d4ebf2634eb
c144e6bda58589d5c4c4755329dc9b926e99d453
refs/heads/master
2021-01-20T22:26:12.231932
2016-07-26T12:44:53
2016-07-26T12:44:53
62,219,816
0
0
null
null
null
null
UTF-8
C++
false
false
293
h
#ifndef _BAR_H_ #define _BAR_H_ #include "Const.h" #include "BaseObject.h" class Bar : public BaseObject { public: static Bar& getInstance() { static Bar instance; return instance; } void addPos(short x, short y); private: Bar(); ~Bar(); }; #endif // _BAR_H_
[ "v-nishizaka@a-tm.co.jp" ]
v-nishizaka@a-tm.co.jp
b052b0ea7e4f406c49b1a1614c635e20e57e4a5f
7ec0f688286844ad2902365e438c0a181cc07e6c
/test/EventFireTests.cpp
7b7c8201062199029f256ce24ef38d726d168abe
[ "MIT" ]
permissive
gbmhunter/HearYeHearYe
c14b15b9e77fce9b408c533d310c46a16603617c
797b38d69b2f40979f27f589c9e7bfb57e96961f
refs/heads/master
2021-06-19T23:28:37.176807
2017-07-06T16:51:49
2017-07-06T16:51:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
795
cpp
#include "gtest/gtest.h" #include "HearYeHearYe/Event.hpp" using namespace mn::HearYeHearYe; namespace { class EventFireTests : public ::testing::Test { protected: EventFireTests() { } virtual ~EventFireTests() { } }; TEST_F(EventFireTests, VoidEvent) { Event<void()> event; bool listenerCalled = false; event.AddListener([&] () { listenerCalled = true; }); event.Fire(); EXPECT_TRUE(listenerCalled); } TEST_F(EventFireTests, VoidIntEvent) { Event<void(int)> event; int savedNum = 0; event.AddListener([&] (int value) { savedNum = value; }); event.Fire(2); EXPECT_EQ(savedNum, 2); } } // namespace
[ "ghunter@urthecast.com" ]
ghunter@urthecast.com
69d4aeb80cf03b862c6d679f08a62332e7e41fca
711e5c8b643dd2a93fbcbada982d7ad489fb0169
/XPSP1/NT/inetsrv/iis/config/src/inc/catalogcollectionwriter.h
dd8f3a48e296f040aa92af41a63239153abd551f
[]
no_license
aurantst/windows-XP-SP1
629a7763c082fd04d3b881e0d32a1cfbd523b5ce
d521b6360fcff4294ae6c5651c539f1b9a6cbb49
refs/heads/master
2023-03-21T01:08:39.870106
2020-09-28T08:10:11
2020-09-28T08:10:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
839
h
#ifndef _CATALOGCOLLECTIONWRITER_H_ #define _CATALOGCOLLECTIONWRITER_H_ class CCatalogCollectionWriter { public: CCatalogCollectionWriter(); ~CCatalogCollectionWriter(); void Initialize(tTABLEMETARow* i_pCollection, CWriter* i_pcWriter); HRESULT GetPropertyWriter(tCOLUMNMETARow* i_pProperty, ULONG* i_aPropertySize, CCatalogPropertyWriter** o_pProperty); HRESULT WriteCollection(); private: HRESULT ReAllocate(); HRESULT BeginWriteCollection(); HRESULT EndWriteCollection(); CWriter* m_pCWriter; tTABLEMETARow m_Collection; CCatalogPropertyWriter** m_apProperty; ULONG m_cProperty; ULONG m_iProperty; }; // CCatalogCollectionWriter #endif // _CATALOGCOLLECTIONWRITER_H_
[ "112426112@qq.com" ]
112426112@qq.com
cbfd87221d228f36a2cca49a91e06e8b55769791
44ea78720cf1fbbbb57a204d462f08ef8ccb7c42
/ABC/ABC087/B/main.cpp
33dde054485bd96ae7c59a0765a4b3d447ad00aa
[]
no_license
kironbot/AtCoder
854a85d55e2d3c0c8ef76589ad905af20d9c567d
4c05bf806413f5c601baa7432b9d85b102ba34b7
refs/heads/master
2021-06-29T16:14:47.667960
2020-09-27T06:17:02
2020-09-27T06:17:02
138,470,049
0
0
null
null
null
null
UTF-8
C++
false
false
375
cpp
#include <iostream> using namespace std; int main() { int A, B, C, X; cin >> A >> B >> C >> X; int res = 0; for (int a=0; a <= A; ++a){ for (int b=0; b <= B; ++b){ for (int c=0; c <= C; ++c){ int total = 500*a + 100*b + 50*c; if (total == X) ++res; } } } cout << res << endl; }
[ "sgr.araki@gmail.com" ]
sgr.araki@gmail.com
5e5ee04deb25f12663a29e0383e0ff7dcf72b0f0
4c23be1a0ca76f68e7146f7d098e26c2bbfb2650
/h2/3.8/H2O2
bd6a3d71997f6e0b8fe948c4e504db5625797c22
[]
no_license
labsandy/OpenFOAM_workspace
a74b473903ddbd34b31dc93917e3719bc051e379
6e0193ad9dabd613acf40d6b3ec4c0536c90aed4
refs/heads/master
2022-02-25T02:36:04.164324
2019-08-23T02:27:16
2019-08-23T02:27:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
834
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "3.8"; object H2O2; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 2.30129e-06; boundaryField { boundary { type empty; } } // ************************************************************************* //
[ "jfeatherstone123@gmail.com" ]
jfeatherstone123@gmail.com
c60310f1f56b4f699a1e038fe881ab17ffb6be30
3fbe8d05207316fcdb59d9bface41b0a154660b0
/qip_2nd_semester/hw1/HW_histoStretch.cpp
69221017fc0003362e93a20bc5397a663b1ceca7
[]
no_license
dongliang3571/Senior_design_csc599866
7a6091ca9c63a0cc17212829cae10cfd19683ae5
d31a7ccae44e86c2ff6b4dce57cbe2637c585097
refs/heads/master
2020-12-24T08:46:13.871449
2017-01-04T22:53:34
2017-01-04T22:53:34
51,631,712
1
1
null
2017-01-04T22:53:35
2016-02-13T04:16:26
C++
UTF-8
C++
false
false
809
cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // HW_histoStretch: // // Apply histogram stretching to I1. Output is in I2. // Stretch intensity values between t1 and t2 to fill the range [0,255]. // // Written by: Dong Liang, 2016 // void HW_histoStretch(ImagePtr I1, int t1, int t2, ImagePtr I2) { IP_copyImageHeader(I1, I2); int w = I1->width(); int h = I1->height(); int total = w * h; // compute lut[] int i, lut[MXGRAY]; for (i = 0; i < MXGRAY; i++) { lut[i] = CLIP(MaxGray * (i - t1) / (t2 - t1), 0, MaxGray); } int type; ChannelPtr<uchar> p1, p2, endd; for(int ch = 0; IP_getChannel(I1, ch, p1, type); ch++) { IP_getChannel(I2, ch, p2, type); for(endd = p1 + total; p1<endd;) *p2++ = lut[*p1++]; } }
[ "dongliang3571@gmail.com" ]
dongliang3571@gmail.com
5d044cad707478a950abfbb0b13adb73ad6e4da8
df07a7af2464bd7ba6c0099d60f06ec65e1d9d80
/abc098/c_v2.cpp
35ecf3a763eb22a587b98164008b68010eea32e7
[]
no_license
a-lilas/atcoder
8d99ab7f8be3cd05a12823749efb68aa8a9692ba
4abc043cd6b16e7816949a72d16f524e1d91e69c
refs/heads/master
2021-06-25T20:35:55.192092
2019-04-29T09:27:40
2019-04-29T09:27:40
134,447,043
0
0
null
null
null
null
UTF-8
C++
false
false
809
cpp
#include <iostream> #include <cmath> #include <vector> #include <queue> #include <string> #include <map> #include <ios> #include <iomanip> #include <limits> #include <algorithm> #include <sstream> #include <bitset> #define REP(i, n) for(int i=0; i<n; i++) #define FOR(i, s, n) for(int i=s; i<n; i++) using namespace std; int main(){ int N; string S; cin >> N; cin >> S; int W[N] = {}; int E[N] = {}; if (S[0] == 'W') W[0] = 1; else E[0] = 1; FOR(i, 1, N){ if (S[i] == 'W'){ W[i] = W[i-1] + 1; E[i] = E[i-1]; } else{ W[i] = W[i-1]; E[i] = E[i-1] + 1; } } int minans = E[N-1]; REP(i, N){ minans = min(minans, W[i] + E[N-1] - E[i]); } cout << minans << endl; }
[ "a-simada@ics.es.osaka-u.ac.jp" ]
a-simada@ics.es.osaka-u.ac.jp
e96590c16490c4795c55ec2d0a50dbe29dcfa07f
6d1a022d7b639e9eaa8d1595a7897a70bc4b1d54
/eyesee-mpp/awcdr/apps/cdr/source/minigui-cpp/data/fast_delegate_bind.h
f2ffe78b1118c36f26914b0f4632d730df5df2be
[]
no_license
icprog/lindenis-v536-softwinner
c2673b155ab911e82c9c477be3a921c4d098c77d
2fdf6f7aef8b5e1e24a54650fe589e5b6208b24b
refs/heads/master
2020-12-26T06:16:25.103604
2020-01-20T05:32:18
2020-01-21T05:35:58
237,413,679
1
0
null
2020-01-31T11:08:11
2020-01-31T11:08:10
null
UTF-8
C++
false
false
9,498
h
/***************************************************************************** Copyright (C), 2015, AllwinnerTech. Co., Ltd. File name: fast_delegate_bind.h Author: yangy@allwinnertech.com Version: v1.0 Date: 2015-11-24 Description: History: *****************************************************************************/ // FastDelegateBind.h // Helper file for FastDelegates. Provides bind() function, enabling // FastDelegates to be rapidly compared to programs using boost::function and boost::bind. // // Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp // // Original author: Jody Hagins. // Minor changes by Don Clugston. // // Warning: The arguments to 'bind' are ignored! No actual binding is performed. // The behaviour is equivalent to boost::bind only when the basic placeholder // arguments _1, _2, _3, etc are used in order. // // HISTORY: // 1.4 Dec 2004. Initial release as part of FastDelegate 1.4. #ifndef FASTDELEGATEBIND_H #define FASTDELEGATEBIND_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 //////////////////////////////////////////////////////////////////////////////// // FastDelegate bind() // // bind() helper function for boost compatibility. // (Original author: Jody Hagins). // // Add another helper, so FastDelegate can be a dropin replacement // for boost::bind (in a fair number of cases). // Note the elipses, because boost::bind() takes place holders // but FastDelegate does not care about them. Getting the place holder // mechanism to work, and play well with boost is a bit tricky, so // we do the "easy" thing... // Assume we have the following code... // using boost::bind; // bind(&Foo:func, &foo, _1, _2); // we should be able to replace the "using" with... // using fastdelegate::bind; // and everything should work fine... //////////////////////////////////////////////////////////////////////////////// #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX namespace fastdelegate { //N=0 template <class X, class Y, class RetType> FastDelegate< RetType ( ) > bind( RetType (X::*func)( ), Y * y, ...) { return FastDelegate< RetType ( ) >(y, func); } template <class X, class Y, class RetType> FastDelegate< RetType ( ) > bind( RetType (X::*func)( ) const, Y * y, ...) { return FastDelegate< RetType ( ) >(y, func); } //N=1 template <class X, class Y, class RetType, class Param1> FastDelegate< RetType ( Param1 p1 ) > bind( RetType (X::*func)( Param1 p1 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1 ) >(y, func); } template <class X, class Y, class RetType, class Param1> FastDelegate< RetType ( Param1 p1 ) > bind( RetType (X::*func)( Param1 p1 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1 ) >(y, func); } //N=2 template <class X, class Y, class RetType, class Param1, class Param2> FastDelegate< RetType ( Param1 p1, Param2 p2 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2> FastDelegate< RetType ( Param1 p1, Param2 p2 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2 ) >(y, func); } //N=3 template <class X, class Y, class RetType, class Param1, class Param2, class Param3> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) >(y, func); } //N=4 template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) >(y, func); } //N=5 template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) >(y, func); } //N=6 template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) >(y, func); } //N=7 template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) >(y, func); } //N=8 template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ), Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) >(y, func); } template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8> FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) > bind( RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const, Y * y, ...) { return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) >(y, func); } #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX } // namespace fastdelegate #endif // !defined(FASTDELEGATEBIND_H)
[ "given@lindeni.com" ]
given@lindeni.com
97da6cb80324cfa36bd37cf177e908733eca2d4d
785df77400157c058a934069298568e47950e40b
/applications/shapeFit/section/tnbShapeFitSection.cxx
6f167b38d41cc355c21c2d85fb7fb7ad1024d7b3
[]
no_license
amir5200fx/Tonb
cb108de09bf59c5c7e139435e0be008a888d99d5
ed679923dc4b2e69b12ffe621fc5a6c8e3652465
refs/heads/master
2023-08-31T08:59:00.366903
2023-08-31T07:42:24
2023-08-31T07:42:24
230,028,961
9
3
null
2023-07-20T16:53:31
2019-12-25T02:29:32
C++
UTF-8
C++
false
false
12,113
cxx
#include <PtdShapeFit_Section.hxx> #include <PtdShapeFit2d_ScatterMap.hxx> #include <PtdShapeFit_Par.hxx> #include <Global_File.hxx> #include <TnbError.hxx> #include <OSstream.hxx> #include <Galgo.hpp> #include <Standard_Real.hxx> namespace tnbLib { static std::shared_ptr<PtdShapeFit_Section> mySection; static std::shared_ptr<PtdShapeFit2d_ScatterMap> myScatters; static std::shared_ptr<galgo::GeneticAlgorithm<double>> myGA; static double myMutationRate = 0.15; static double myCrossOverRate = 0.5; static int myNbElites = 1; static int myPopSize = 50; static int myNbGens = 40; static unsigned short verbose(0); static bool loadTag = false; static bool exeTag = false; class OptRunTime { /*Private Data*/ std::shared_ptr<galgo::GeneticAlgorithm<double>> theGA_; std::shared_ptr<PtdShapeFit_Section> theSection_; std::shared_ptr<PtdShapeFit2d_ScatterMap> theScatters_; public: // constructor [2/10/2023 Payvand] OptRunTime(); // Public functions and operators [2/10/2023 Payvand] void Perform(); }; void setVerbose(unsigned int i) { Info << endl; Info << " - the verbosity level is set to: " << i << endl; verbose = i; } void setMaxNbGens(int n) { myNbGens = n; if (verbose) { Info << endl << " - the max. no. of gens is set to: " << myNbGens << endl; } } void setPopSize(int n) { myPopSize = n; if (verbose) { Info << endl << " - the pop. size is set to: " << myPopSize << endl; } } void setMutation(double x) { myMutationRate = x; if (verbose) { Info << endl << " - the mutation is set to: " << myMutationRate << endl; } } void setCrossOverRate(double x) { myCrossOverRate = x; if (verbose) { Info << endl << " - the cross over rate is set to: " << myCrossOverRate << endl; } } void checkFolder(const std::string& name) { if (NOT boost::filesystem::is_directory(name)) { FatalErrorIn(FunctionSIG) << "no {" << name << "} directory has been found!" << endl << abort(FatalError); } } void loadSection() { checkFolder("section"); const auto currentPath = boost::filesystem::current_path(); // change the current path [2/7/2023 Payvand] boost::filesystem::current_path(currentPath.string() + R"(\section)"); if (file::IsFile(boost::filesystem::current_path(), ".PATH")) { auto name = file::GetSingleFile(boost::filesystem::current_path(), ".PATH").string(); fileName fn(name + ".PATH"); std::ifstream myFile; myFile.open(fn); if (myFile.is_open()) { std::string address; std::getline(myFile, address); // change the current path [2/6/2023 Payvand] boost::filesystem::current_path(address); { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit_Section::extension).string(); mySection = file::LoadFile<std::shared_ptr<PtdShapeFit_Section>>(name + PtdShapeFit_Section::extension, verbose); if (NOT mySection) { FatalErrorIn(FunctionSIG) << " the section is null." << endl << abort(FatalError); } } } else { FatalErrorIn(FunctionSIG) << "the file is not open: " << name + ".PATH" << endl; } } else { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit_Section::extension).string(); mySection = file::LoadFile<std::shared_ptr<PtdShapeFit_Section>>(name + PtdShapeFit_Section::extension, verbose); if (NOT mySection) { FatalErrorIn(FunctionSIG) << " the section is null." << endl << abort(FatalError); } } //- change back the current path boost::filesystem::current_path(currentPath); } void loadScatterMap() { checkFolder("scatters"); const auto currentPath = boost::filesystem::current_path(); // change the current path [2/7/2023 Payvand] boost::filesystem::current_path(currentPath.string() + R"(\scatters)"); if (file::IsFile(boost::filesystem::current_path(), ".PATH")) { auto name = file::GetSingleFile(boost::filesystem::current_path(), ".PATH").string(); fileName fn(name + ".PATH"); std::ifstream myFile; myFile.open(fn); if (myFile.is_open()) { std::string address; std::getline(myFile, address); // change the current path [2/6/2023 Payvand] boost::filesystem::current_path(address); { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit2d_ScatterMap::extension).string(); myScatters = file::LoadFile<std::shared_ptr<PtdShapeFit2d_ScatterMap>>(name + PtdShapeFit2d_ScatterMap::extension, verbose); if (NOT myScatters) { FatalErrorIn(FunctionSIG) << " the scatter map is null." << endl << abort(FatalError); } } } else { FatalErrorIn(FunctionSIG) << "the file is not open: " << name + ".PATH" << endl; } } else { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit2d_ScatterMap::extension).string(); myScatters = file::LoadFile<std::shared_ptr<PtdShapeFit2d_ScatterMap>>(name + PtdShapeFit2d_ScatterMap::extension, verbose); if (NOT myScatters) { FatalErrorIn(FunctionSIG) << " the scatter map is null." << endl << abort(FatalError); } } //- change back the current path boost::filesystem::current_path(currentPath); } void loadSectionFile(const std::string& name) { file::CheckExtension(name); mySection = file::LoadFile<std::shared_ptr<PtdShapeFit_Section>>(name + PtdShapeFit_Section::extension, verbose); if (NOT mySection) { FatalErrorIn(FunctionSIG) << " the section is null." << endl << abort(FatalError); } } void loadScatterMapFile(const std::string& name) { file::CheckExtension(name); myScatters = file::LoadFile<std::shared_ptr<PtdShapeFit2d_ScatterMap>>(name + PtdShapeFit2d_ScatterMap::extension, verbose); if (NOT myScatters) { FatalErrorIn(FunctionSIG) << " the scatter map is null." << endl << abort(FatalError); } } void loadFiles() { if (boost::filesystem::is_directory("section")) { loadSection(); } else { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit_Section::extension).string(); loadSectionFile(name); } if (boost::filesystem::is_directory("scatters")) { loadScatterMap(); } else { auto name = file::GetSingleFile(boost::filesystem::current_path(), PtdShapeFit2d_ScatterMap::extension).string(); loadScatterMapFile(name); } loadTag = true; } void saveTo(const std::string& name) { if (NOT exeTag) { FatalErrorIn(FunctionSIG) << "the application is not performed!" << endl << abort(FatalError); } file::CheckExtension(name); file::SaveTo(mySection, name + PtdShapeFit_Section::extension, verbose); } void execute() { if (NOT loadTag) { Info << endl << " no file has been loaded." << endl << abort(FatalError); } OptRunTime ga; ga.Perform(); exeTag = true; if (verbose) { Info << endl << " - the application is performed." << endl; } } } tnbLib::OptRunTime::OptRunTime() { theGA_ = std::make_shared<galgo::GeneticAlgorithm<double>>(myPopSize, myNbGens, true); theSection_ = mySection; theScatters_ = myScatters; } void tnbLib::OptRunTime::Perform() { auto costFun = [this](const std::vector<double>& xs) -> std::vector<double> { try { auto cost = theSection_->CalcError(xs, theScatters_); return { -cost }; } catch (const Standard_Failure& x) { Info << x.GetMessageString() << endl; return { RealFirst() }; } catch (...) { Info << " Unknown Error has been detected." << endl; return { RealFirst() }; } }; myGA = theGA_; /**/ auto variables = mySection->RetrieveParList(); int idx = 0; for (const auto& x : variables) { if (NOT x) { FatalErrorIn(FunctionSIG) << "variable is null." << endl << abort(FatalError); } const auto lower = x->LowerVal(); const auto upper = x->UpperVal(); //std::cout << x->Name() << ": " << lower << ", " << upper << std::endl; galgo::Parameter<double> par({ lower,upper }); myGA->param.emplace_back(new galgo::Parameter<double>(par)); myGA->lowerBound.push_back(lower); myGA->upperBound.push_back(upper); if (idx == 0) { myGA->idx.push_back(idx); } else { myGA->idx.push_back(myGA->idx.at(idx - 1) + par.size()); } idx++; } //std::exit(1); myGA->Objective = costFun; myGA->genstep = 1; myGA->mutrate = myMutationRate; myGA->nbparam = variables.size(); myGA->nbbit = variables.size() * 16; myGA->covrate = myCrossOverRate; const int nbElits = myNbElites; //myGA->elitpop = nbElits == 0 ? 1 : nbElits; myGA->run(); const auto& bestResult = myGA->pop(0)->getParam(); mySection->SetParameters(bestResult); const auto& bestParams = mySection->Pars(); if (verbose) { Info << endl; for (const auto& x : bestParams->x) { Info << " - " << x.name << ": " << x.x << endl; } } if (verbose) { Info << endl << " the application is performed, successfully!" << endl; } } #ifdef DebugInfo #undef DebugInfo #endif // DebugInfo #include <chaiscript/chaiscript.hpp> namespace tnbLib { typedef std::shared_ptr<chaiscript::Module> module_t; void setFunctions(const module_t& mod) { //- io functions mod->add(chaiscript::fun([](const std::string& name)-> void {saveTo(name); }), "saveTo"); mod->add(chaiscript::fun([]()-> void {loadFiles(); }), "loadFiles"); //- settings mod->add(chaiscript::fun([](unsigned short i)->void {verbose = i; }), "setVerbose"); mod->add(chaiscript::fun([](double x)-> void {setCrossOverRate(x); }), "setCrossOverRate"); mod->add(chaiscript::fun([](int n)-> void {setMaxNbGens(n); }), "setNbGens"); mod->add(chaiscript::fun([](double x)->void {setMutation(x); }), "setMutationRate"); mod->add(chaiscript::fun([](int n)-> void {setPopSize(n); }), "setPopSize"); // operators [2/10/2023 Payvand] mod->add(chaiscript::fun([]()-> void {execute(); }), "execute"); } std::string getString(char* argv) { std::string argument(argv); return std::move(argument); } Standard_Boolean IsEqualCommand(char* argv, const std::string& command) { auto argument = getString(argv); return argument IS_EQUAL command; } } using namespace tnbLib; int main(int argc, char* argv[]) { //sysLib::init_gl_marine_integration_info(); FatalError.throwExceptions(); if (argc <= 1) { Info << " - No command is entered" << endl << " - For more information use '--help' command" << endl; FatalError.exit(); } if (argc IS_EQUAL 2) { if (IsEqualCommand(argv[1], "--help")) { Info << endl; Info << " This application is aimed to fit a parametric section to scatters." << endl << " - files: section, scatterMap" << endl; Info << endl << " Function list:" << endl << endl << " # IO functions: " << endl << endl << " - loadFiles()" << endl << " - saveTo(name)" << endl << endl << " # Settings: " << endl << endl << " - setCrossOverRate(x)" << endl << " - setMutationRate(x)" << endl << " - setNbGens(n)" << endl << " - setPopSize(n)" << endl << " - setVerbose(unsigned int); - Levels: 0, 1" << endl << endl << " # operators: " << endl << endl << " - execute()" << endl << endl; return 0; } else if (IsEqualCommand(argv[1], "--run")) { chaiscript::ChaiScript chai; auto mod = std::make_shared<chaiscript::Module>(); setFunctions(mod); chai.add(mod); //std::string address = ".\\system\\mesh2dToPlt"; try { fileName myFileName(file::GetSystemFile("tnbShapeFitSection")); chai.eval_file(myFileName); return 0; } catch (const chaiscript::exception::eval_error& x) { Info << x.pretty_print() << endl; } catch (const error& x) { Info << x.message() << endl; } catch (const std::exception& x) { Info << x.what() << endl; } } } else { Info << " - No valid command is entered" << endl << " - For more information use '--help' command" << endl; FatalError.exit(); } return 1; }
[ "aasoleimani86@gmail.com" ]
aasoleimani86@gmail.com
8cfe3b659c083bb8bcbca8f2e6379f0e12674c9b
df2db9b10b66cf4c2f527f5aa9a38ba4d6af6622
/Galactic Polar Wars/src/TitleBackground.h
7b2bcbfe206bb5a9d6f7a929a7acc2daebbfda65
[]
no_license
vashj1995/Galactic-Polar-Wars-Final
f98147216e6cf4a5ae00b56908fc4936eec63a48
ebe0998e6cbba4e49473208d502c24e6bb82b272
refs/heads/main
2023-04-15T07:35:22.770821
2021-04-22T22:02:58
2021-04-22T22:02:58
359,535,746
0
0
null
null
null
null
UTF-8
C++
false
false
547
h
#pragma once #ifndef _TITLE_BACKGROUND_ #define _TITLE_BACKGROUND_ #include "DisplayObject.h" #include "TextureManager.h" class TitleBackground : public DisplayObject { private: public: // constructor(s) TitleBackground(); // destructor ~TitleBackground(); // life-cycle methods inherited from DisplayObject void draw() override; void update() override; void clean() override; //getters and setters void setDestination(glm::vec2 destination); private: //glm::vec2 m_destination; }; #endif /* defined (__FreezerBackground__) */
[ "vashj1995@yahoo.com" ]
vashj1995@yahoo.com
a7c96c1117b072c75aca0d2249f298362c16b6a6
88d8e885fbd686d4ef35d444b80701cff6f43740
/AtCoderBeginnerContest/042/b.cpp
b24ee52f3caadb09172adc5d4c0c5539bda6c82a
[]
no_license
morishitamakoto0330/AtCoder
f18cf0804322775cbb5ee3ac958a8b5f129161c1
2c389f2809ec16cff4128dbbd985e3de94ad7309
refs/heads/master
2020-07-19T19:26:01.497595
2019-10-21T06:13:39
2019-10-21T06:13:39
206,501,162
0
0
null
null
null
null
UTF-8
C++
false
false
661
cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main(void) { int N, L, i; string str_tmp, ans; vector<string> S; // get input -------------------------------- cin >> N >> L; for(i = 0; i < N; i++) { cin >> str_tmp; S.push_back(str_tmp); } // sort ------------------------------------- sort(S.begin(), S.end()); // join ------------------------------------- ans = ""; for(i = 0 ; i < N; i++) { ans += S[i]; } // disp answer ------------------------------ cout << ans << endl; return 0; }
[ "morishita0330@gmail.com" ]
morishita0330@gmail.com
26487956f42c35e13773c56dc735b6eb94367b33
9eb2245869dcc3abd3a28c6064396542869dab60
/benchspec/CPU/523.xalancbmk_r/build/build_base_mytest-64.0001/XalanEntity.cpp
1a4c93bd929fc9aaa711319447b2624de934aa08
[]
no_license
lapnd/CPU2017
882b18d50bd88e0a87500484a9d6678143e58582
42dac4b76117b1ba4a08e41b54ad9cfd3db50317
refs/heads/master
2023-03-23T23:34:58.350363
2021-03-24T10:01:03
2021-03-24T10:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
129
cpp
version https://git-lfs.github.com/spec/v1 oid sha256:d8376ec06acf29a7aa809690c903c0b69f7861e162a499573aa4084a48c459e8 size 1103
[ "abelardojarab@gmail.com" ]
abelardojarab@gmail.com
b11519934991f4dcc6b0cf5525ad85b25a82bad6
c094d381422c2788d67a3402cff047b464bf207b
/Algorithms in C/Algorithms in C/p072链表插入排序.cpp
4c577dba2c03c2fc1388b5f41e01785044693524
[]
no_license
liuxuanhai/C-code
cba822c099fd4541f31001f73ccda0f75c6d9734
8bfeab60ee2f8133593e6aabfeefaf048357a897
refs/heads/master
2020-04-18T04:26:33.246444
2016-09-05T08:32:33
2016-09-05T08:32:33
67,192,848
1
0
null
null
null
null
GB18030
C++
false
false
2,461
cpp
#include <stdio.h> #include <time.h> #include <stdlib.h> typedef struct node *link; typedef int item; struct node { item Item; link next; }; // 倒置链表 link reverse(link); // 返回尾node的指针 int main(void) { struct node headin, headout; // headin, 输入链表哑节点, 包含未排序数据, headout, 输出链表哑节点, 包含排序数据; int i; int N; // 要排序的数据项个数 // 输入项目个数 printf_s("输入项目个数: "); scanf_s("%d", &N); // 产生随机值, 保存在headin链中 link currentin = &headin; // "当前"操作节点为输入表哑节点 srand((unsigned long)time(0)); for (i = 0; i < N; i++) { currentin->next = (link)malloc(sizeof(node)); // "当前"操作节点为新节点 currentin = currentin->next; currentin->next = NULL; currentin->Item = rand() % 1000; } // 输出headin链的数据 currentin = headin.next; // "当前"为输入哑节点后边的一个项 for (i = 0; i < N; i++) { printf ("%d ", currentin->Item); currentin = currentin->next; } // 将headin链的node一个一个的插入到headout链中 link nextin; link currentout; headout.next = NULL; for (currentin = headin.next, headin.next = NULL; currentin != NULL; currentin = nextin) // 一直循环到输入链没有数据节点 { nextin = currentin->next; // 寻找headout中合适的插入位置 for (currentout = &headout; currentout->next != NULL; currentout = currentout->next) if (currentout->next->Item > currentin->Item) break; // 进行插入 currentin->next = currentout->next; currentout->next = currentin; } // 输出headout链 printf("\n\n\n\n"); currentout = headout.next; for (i = 0; i < N; i++) { printf ("%d ", currentout->Item); currentout = currentout->next; } // 倒置链表 printf("\n\n\n\n"); currentout = reverse(&headout);; for (i = 0; i < N; i++) { printf ("%d ", currentout->Item); currentout = currentout->next; } return 0; } link reverse(link li) { link Current, Next, Prev; Prev = NULL; Current = li; while (Current != NULL) { // 生成"下一个"节点 Next = Current->next; // 没有在上面初始化Next是考虑到Current下面没有node的情况, 在这里初始化表明, 只有在Current != NULL的情况下才有Next的存在; // 链接倒置 Current->next = Prev; // 刷新"上一个"和"当前"节点 Prev = Current; Current = Next; } return Prev; }
[ "heabking@gmail.com" ]
heabking@gmail.com
82bc08b9aac5592f66f892f8c533507c6dad1dbe
02b4e557cc3514b94be16928035ed2725cc798b9
/rococo-dst/deptran/batch_start_args_helper.cc
ab593f3c5facf7d2d08cf1acb60312511ce5842f
[ "Apache-2.0" ]
permissive
yanghaomai/dst
b0286d04bd76b7c30d2d065a5f84033c5ca69000
897b929a692642cbf295c105d9d6e64090abb673
refs/heads/main
2023-04-06T19:59:11.487927
2021-04-12T13:19:10
2021-04-12T13:19:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,940
cc
#include "all.h" namespace rococo { //BatchStartArgsHelper::BatchStartArgsHelper(std::vector<Value> *arg) : arg_(arg) { //} // BatchStartArgsHelper::BatchStartArgsHelper() { arg_type_ = ARG_NONE; } int BatchStartArgsHelper::init_input(std::vector<Value> const *input, uint32_t num_piece) { if (arg_type_ != ARG_NONE) return -1; arg_type_ = ARG_INPUT; index_ = 0; piece_count_ = 0; num_piece_ = num_piece; input_ = input; return 0; } int BatchStartArgsHelper::get_next_input(i32 *p_type, i64 *pid, Value const** input, i32 *input_size, i32 *output_size) { verify(arg_type_ == ARG_INPUT); if (piece_count_ >= num_piece_) return -1; *p_type = (*input_)[index_++].get_i32(); *pid = (*input_)[index_++].get_i64(); *input_size = (*input_)[index_++].get_i32(); *output_size = (*input_)[index_++].get_i32(); *input = input_->data() + index_; index_ += *input_size; piece_count_++; return 0; } int BatchStartArgsHelper::init_output(std::vector<Value> *output, uint32_t num_piece, uint32_t expected_output_size) { if (arg_type_ != ARG_NONE) return -1; arg_type_ = ARG_OUTPUT; index_ = 0; piece_count_ = 0; num_piece_ = num_piece; output_ = output; output_->resize(num_piece * 2 + expected_output_size); return 0; } Value *BatchStartArgsHelper::get_output_ptr() { verify(arg_type_ == ARG_OUTPUT); return output_->data() + index_ + 2; } int BatchStartArgsHelper::put_next_output(i32 res, i32 output_size) { verify(arg_type_ == ARG_OUTPUT); if (piece_count_ >= num_piece_) return -1; (*output_)[index_++] = Value(res); (*output_)[index_++] = Value(output_size); index_ += output_size; piece_count_++; return 0; } int BatchStartArgsHelper::done_output() { verify(arg_type_ == ARG_OUTPUT); if (piece_count_ < num_piece_) return -1; output_->resize(index_); return 0; } int BatchStartArgsHelper::init_input_client(std::vector<Value> *input, uint32_t num_piece, uint32_t input_size) { if (arg_type_ != ARG_NONE) return -1; arg_type_ = ARG_INPUT_CLIENT; index_ = 0; piece_count_ = 0; num_piece_ = num_piece; input_client_ = input; input_client_->resize(num_piece * 4 + input_size); return 0; } int BatchStartArgsHelper::put_next_input_client(std::vector<Value> &input, i32 p_type, i64 pid, i32 output_size) { verify(arg_type_ = ARG_INPUT_CLIENT); if (piece_count_ >= num_piece_) return -1; (*input_client_)[index_++] = Value(p_type); (*input_client_)[index_++] = Value(pid); (*input_client_)[index_++] = Value((i32)input.size()); (*input_client_)[index_++] = Value(output_size); size_t i = 0; for (; i < input.size(); i++) (*input_client_)[index_++] = input[i]; piece_count_++; return 0; } int BatchStartArgsHelper::done_input_client() { verify(arg_type_ == ARG_INPUT_CLIENT); if (piece_count_ == num_piece_ && index_ == input_client_->size()) return 0; return -1; } int BatchStartArgsHelper::init_output_client(std::vector<Value> *output, uint32_t num_piece) { if (arg_type_ != ARG_NONE) return -1; arg_type_ = ARG_OUTPUT_CLIENT; index_ = 0; piece_count_ = 0; num_piece_ = num_piece; output_client_ = output; return 0; } int BatchStartArgsHelper::get_next_output_client(i32 *res, Value const** output, uint32_t *output_size) { verify(arg_type_ == ARG_OUTPUT_CLIENT); if (piece_count_ >= num_piece_) return -1; *res = (*output_client_)[index_++].get_i32(); i32 output_size_buf; output_size_buf = (*output_client_)[index_++].get_i32(); *output_size = (uint32_t)output_size_buf; *output = output_client_->data() + index_; index_ += output_size_buf; piece_count_++; return 0; } }
[ "wxdwfc@gmail.com" ]
wxdwfc@gmail.com
a662ffc476a5902bfa223fce62d52022907983a1
057f2783821562579dea238c1073d0ba0839b402
/OCR/OCR/.localhistory/OCR/1477516997$ocr.cpp
c916318efdabfe9aaadbe53e1e069cf8901d0a57
[]
no_license
KrzysztofKozubek/Projects
6cafb2585796c907e8a818da4b51c97197ccbd11
66ef23fbc8a6e6cf3b6ef837b390d7f2113a9847
refs/heads/master
2023-02-07T12:24:49.155221
2022-10-08T18:39:58
2022-10-08T18:39:58
163,520,516
0
0
null
2023-02-04T17:46:12
2018-12-29T15:18:18
null
WINDOWS-1250
C++
false
false
9,049
cpp
#include "ocr.h" // TODO: 1. wyrownanie katu 2. erozja i dylatacja (moze filtr) pozbycie sie szumu // zmiana organizacji // OCR::OCR(QWidget *parent) : QMainWindow(parent) { /* Kontrast & Jasność & Obrót */ ui.setupUi(this); this->image = imread("lena.jpg", 1); showImage = image.clone(); connect(ui.HSContrast1, SIGNAL(sliderReleased()), this, SLOT(changeContrasOrBrightness())); connect(ui.HSBrightness1, SIGNAL(sliderReleased()), this, SLOT(changeContrasOrBrightness())); connect(ui.HSRotate1, SIGNAL(sliderReleased()), this, SLOT(rotate())); connect(ui.BConfirmChange1, SIGNAL(clicked()), this, SLOT(confirmChange())); connect(ui.BLoadImage1, SIGNAL(clicked()), this, SLOT(loadImage())); connect(ui.BSaveImage1, SIGNAL(clicked()), this, SLOT(saveImage())); connect(ui.BLoadImage3, SIGNAL(clicked()), this, SLOT(loadImage2())); connect(ui.HSBinaryElement3, SIGNAL(sliderReleased()), this, SLOT(preProcessing())); connect(ui.HSBinaryKernel3, SIGNAL(sliderReleased()), this, SLOT(preProcessing())); connect(ui.HSErodeElement3, SIGNAL(sliderReleased()), this, SLOT(preProcessing())); connect(ui.HSErodeKernel3, SIGNAL(sliderReleased()), this, SLOT(preProcessing())); connect(ui.BRightImageRow2, SIGNAL(clicked()), this, SLOT(SegmentationIncreaseIndexImageRow())); connect(ui.BLeftImageRow2, SIGNAL(clicked()), this, SLOT(SegmentationReduceIndexImageRow())); connect(ui.BRightImageCell2, SIGNAL(clicked()), this, SLOT(SegmentationIncreaseIndexImageCell())); connect(ui.BLeftImageCell2, SIGNAL(clicked()), this, SLOT(SegmentationReduceIndexImageCell())); connect(ui.BSaveImages2, SIGNAL(clicked()), this, SLOT(saveEffect())); displayImage(this->image.clone()); /* END Kontrast & Jasność & Obrót END */ /* Przetwarzanie wstpne */ this->imageSign = imread("digits12.jpg", CV_BGR2GRAY); this->imageSignO = imageSign.clone(); if(imageSign.type() == 0) imshow("Z", imageSign); waitKey(); //double angle = autorotate(imageSign.clone()); preProcessing(); /* END Przetwarzanie wstpene */ /* Segmentation */ /* END Segmentation END */ } OCR::~OCR() {} #pragma region void OCR::displayImageInLabel(Mat image, QLabel* label) { cvtColor(image, image, CV_GRAY2RGB); Size size(100, 100); QImage imdisplay((uchar*)image.data, image.cols, image.rows, image.step, QImage::Format_RGB888); QImage img2 = imdisplay.scaled(300, 1000, Qt::KeepAspectRatio); label->setPixmap(QPixmap::fromImage(img2)); } Mat OCR::loadImageFrom(QString pathToImage, int flag = 1) { return imread(QStringToString(pathToImage), flag); } #pragma endregion Unversal method #pragma region void OCR::rotate() { Mat tmp = image.clone(); CPreProcessing::rotate(tmp, ui.HSRotate1->value()); displayImage(tmp); } void OCR::changeContrasOrBrightness() { Mat tmp = image.clone(); CPreProcessing::changeContrasOrBrightness(tmp, ui.HSContrast1->value(), ui.HSBrightness1->value()); displayImage(tmp); } void OCR::displayImage(Mat image) { cvtColor(image, image, CV_BGR2RGB); QImage imdisplay((uchar*)image.data, image.cols, image.rows, image.step, QImage::Format_RGB888); ui.LImage1->setPixmap(QPixmap::fromImage(imdisplay)); } void OCR::confirmChange() { image.release(); image = showImage.clone(); } void OCR::loadImage() { Mat tmp = imread(QStringToString(ui.LEPathImageLoad1->text()), 1); if (!tmp.empty()) { image.release(); showImage.release(); image = tmp.clone(); showImage = tmp.clone(); displayImage(image); } } void OCR::saveImage() { imwrite(QStringToString(ui.LEPathImageSave1->text()), image); } #pragma endregion Tab Contrast & Brightness & Rotate #pragma region void OCR::loadImage2() { displayImageInLabel(loadImageFrom(ui.LEPathImageLoad3->text()), ui.LImage3); } void OCR::preProcessing() { Mat tmp = imageSignO.clone(); imageSign = tmp.clone(); CPreProcessing::erode(imageSign, 2, 4); //Binary //threshold(tmp, imageSign, ui.HSBinaryKernel3->value(), 255, ui.HSBinaryElement3->value()); CPreProcessing::toBinary(imageSign, ui.HSBinaryKernel3->value()); imshow("Z", imageSign); waitKey(); //Change angle tmp = imageSign.clone(); Point2f src_center(imageSign.cols / 2.0F, imageSign.rows / 2.0F); Mat rot_mat = getRotationMatrix2D(src_center, -0.5, 1.0); warpAffine(tmp, imageSign, rot_mat, imageSign.size()); //Erode CPreProcessing::erode(imageSign, ui.HSErodeElement3->value(), ui.HSErodeKernel3->value()); displayImageInLabel(imageSign.clone(), ui.LImage3); SegmentationRow(imageSign.clone()); } #pragma endregion Przetwarzanie wstępne #pragma region void OCR::SegmentationLoadImage() { Mat tmp = imread(QStringToString(ui.LEPathImageLoad3->text()), 1); if (!tmp.empty()) { image.release(); showImage.release(); image = tmp.clone(); showImage = tmp.clone(); displayImage(image); } } void OCR::SegmentationSaveImage() { imwrite(QStringToString(ui.LEPathImageSave1->text()), image); } void OCR::SegmentationRow(Mat image) { Mat tmp = imageSign.clone(); int LIMIT_VALUE_LIGHT_BIT = 42; vImageSignRow.clear(); int cols = image.cols; int rows = image.rows; int cutStart = 0, cutEnd = 0; //information about level cutting int fromCut = 0, toCut = 0; //save position column double sum = 0; for (int y = 0; y < rows - 1; y++) { sum = CPreProcessing::advRow(image, y, 15); if (LIMIT_VALUE_LIGHT_BIT >= sum) { if (cutStart == 0) fromCut = y; if (cutStart == 1 && cutEnd == 0) { toCut = y; cutEnd = 1; } if (cutStart == 1 && cutEnd == 1) { tmp = image.clone(); CPreProcessing::cutImage(tmp, 0, fromCut, 0, tmp.rows - toCut); CPreProcessing::removeBlackBackground(tmp); vImageSignRow.push_back(tmp); tmp.release(); cutStart = toCut = cutEnd = 0; fromCut = y; } } else { if (cutStart == 0) cutStart = 1; } } indexImageRow = 0; SegmentationLoadImageRow(); } void OCR::SegmentationCell(Mat image) { int LIMIT_VALUE_LIGHT_BIT = 55; Mat tmp; vImageSignCell.clear(); int cols = image.cols; int rows = image.rows; int cutStart = 0, cutEnd = 0; //information about level cutting int fromCut = 0, toCut = 0; //save position column int size = 65; string help; int sum = 0; for (int y = 0; y < cols - 1; y++) { sum = CPreProcessing::advCol(image, y, 5); if (LIMIT_VALUE_LIGHT_BIT <= sum) { if (cutStart == 0) fromCut = y; if (cutStart == 1 && cutEnd == 0) { toCut = y; cutEnd = 1; } if (cutStart == 1 && cutEnd == 1) { tmp = image.clone(); CPreProcessing::cutImage(tmp, fromCut, 0, tmp.cols - toCut, 0); CPreProcessing::cutImage(tmp, (tmp.cols / 2) - size, (tmp.rows / 2) - size, (tmp.cols / 2) - size, (tmp.rows / 2) - size); vImageSignCell.push_back(tmp); tmp.release(); cutStart = toCut = cutEnd = 0; fromCut = y; } } else { if (cutStart == 0) cutStart = 1; } } indexImageCell = 0; SegmentationLoadImageCell(); } void OCR::SegmentationIncreaseIndexImageRow() { if (indexImageRow < vImageSignRow.size()-1) { indexImageRow++; SegmentationLoadImageRow(); } } void OCR::SegmentationReduceIndexImageRow() { if (indexImageRow > 0) { indexImageRow--; SegmentationLoadImageRow(); } } void OCR::SegmentationIncreaseIndexImageCell() { if (indexImageCell < vImageSignCell.size()-1) { indexImageCell++; SegmentationLoadImageCell(); } } void OCR::SegmentationReduceIndexImageCell() { if (indexImageCell > 0) { indexImageCell--; SegmentationLoadImageCell(); } } void OCR::SegmentationLoadImageRow() { ui.LImageRow2->clear(); if(indexImageRow < vImageSignRow.size()){ Mat image = vImageSignRow[indexImageRow].clone(); QImage imdisplay((uchar*)image.data, image.cols, image.rows, image.step, QImage::Format_Grayscale8); QImage img2 = imdisplay.scaled(600, 1000, Qt::KeepAspectRatio); ui.LImageRow2->setPixmap(QPixmap::fromImage(img2)); SegmentationCell(vImageSignRow[indexImageRow].clone()); } } void OCR::SegmentationLoadImageCell() { if(indexImageCell < vImageSignCell.size()){ ui.LImageCell2->clear(); Mat image = vImageSignCell[indexImageCell].clone(); QImage imdisplay((uchar*)image.data, image.cols, image.rows, image.step, QImage::Format_Grayscale8); QImage img2 = imdisplay.scaled(400, 1000, Qt::KeepAspectRatio); ui.LImageCell2->setPixmap(QPixmap::fromImage(imdisplay)); } } void OCR::saveEffect() { //Nazewnictwo znaków digit0_<user>_<probka> //<user> = {0..20} //<probka> = {0..9} int digit = 0; int user = 0; int sample = 0; vector<Mat> vImages; for (int i = 0; i < vImageSignRow.size(); i++){ SegmentationCell(vImageSignRow[i]); for (int j = 0; j < vImageSignCell.size(); j++) { vImages.push_back(vImageSignCell[j]); } } string fileName; for (int i = 0; i < vImages.size(); i++){ fileName = ("digits//digit" + (itos(digit)) + "_" + (itos(user)) + "_" + (itos(sample)) + ".jpg"); imwrite(fileName, vImages[i]); sample++; if (sample == 10) { user++; sample = 0; } if (user > 20) { digit++; user = 0; } } } #pragma endregion Segmentation
[ "krzysztof.kozubek135@gmail.com" ]
krzysztof.kozubek135@gmail.com
0136c1606fd769b0120cbf10444d3ac13217ddad
c603e00f13957e726f2e94a53a19b268ea0f60d7
/code/Uncertainty/FPG/FPG/source/planner/BrazilAlg.h
47643a0541cd264accbcb4031b38adc11f752c9b
[]
no_license
xuanjianwu/plantool
97015351670732297b5fbe742395c228b7e5ddba
4fe56c6ff8897690cc2a3f185901dfe3faeb819a
refs/heads/master
2021-01-21T20:39:03.688983
2017-05-30T00:57:44
2017-05-30T00:57:44
91,229,802
2
0
null
2017-05-14T08:24:03
2017-05-14T08:24:03
null
UTF-8
C++
false
false
1,345
h
/* * $Id: BrazilState.cpp 107 2006-07-27 03:31:12Z owen $ * * This file is part of the Brazil Planner. Copyright NICTA 2006. * * This file is commercial in confidence. You should no be looking at * it unless you are an employee of NICTA, a student who has signed * their IP to NICTA, or you have signed an NDA covering the Brazil * source code. If you are not one of these people we will poke out * your eyes with a gerkhin while forcing you to sing the Brazilian * national anthem. * */ #ifndef _BrazilAlg_h #define _BrazilAlg_h #include<PGBasics.hh> #include<RLAlg.hh> #include<OLPomdp.hh> #include<GOALPomdp.hh> #include"PlanningListener.h" /** * BrazilAlg is essentially the GOALPomdp alg from the libpg library, * but we need one small change. If there's a PlanningListener we need * to get a most likely plan every so often during optimisation. */ class BrazilAlg : public GOALPomdp { public: BrazilAlg(Controller* controller, Simulator* simulator, double discount, double stepSize) : GOALPomdp(controller, simulator, discount, stepSize) {}; virtual ~BrazilAlg() {}; virtual double learnCore(int stepsPerEpoch, int& totalSteps); virtual void printPerformanceInfo(bool printTitles, int steps, double avgReward, double maxParam, int seconds); }; #endif
[ "787499313@qq.com" ]
787499313@qq.com
1fcd9662db2fb34537ad22e4f2f161e8ddba1b57
338bd4e9ffdb9ab7c260b4f23b20f51d91d4793b
/BattleBoard/vieMainWindow.h
16794465143e102d57a6727d709b46aa30841340
[]
no_license
Greykoil/BattleBoard
e17357b6566eeee8e2acbda1732b161f188d7d40
3796765ae1c2bf78a5b9a15de77138139c40e2ce
refs/heads/master
2021-05-07T15:27:39.189970
2018-03-08T13:15:01
2018-03-08T13:15:01
109,824,659
0
0
null
null
null
null
UTF-8
C++
false
false
1,617
h
//============================================================================= //D The apps main window // // Contains a tab list of the windows where things actually happen // //----------------------------------------------------------------------------- #pragma once // includes from project // QT ui include #include "ui_vieMainWindow.h" //includes from QT #include <QtWidgets/QMainWindow> #include <QDialog> // system includes #include <vector> #include <memory> // class predeclarations to avoid header file inclusion class vieCharacterWindow; class modCharacter; // types: classes, enums, typedefs //============================================================================= class vieMainWindow : public QMainWindow { Q_OBJECT public: vieMainWindow( modCharacter* character_model, QWidget *parent = Q_NULLPTR ); // Constructor vieMainWindow(const vieMainWindow&) = delete; // Deleted copy constructor. vieMainWindow& operator=(const vieMainWindow&) = delete; // Deleted assignment operator. virtual ~vieMainWindow() = default; // Destructor protected: void add_tabs(); // Add the list of tabs that the main window is using private slots: // The list of event actions that can happen // Actions from the file menu drop down void actionOpen(); void actionNew(); void actionSave(); void actionTabChanged(int index); private: modCharacter* m_model; std::vector<std::unique_ptr<QDialog>> m_tab_list; // The vector of tabs that this window is going to show Ui::MainWindowClass m_ui; // The ui helper class provided by the QT framework };
[ "alex.i.j.spencer@gmail.com" ]
alex.i.j.spencer@gmail.com
457354a4b1d062de960c3609332691873d2ee081
62a79652961a4a7e8dab19b5dadb7f6715a17d9d
/src/rotatingheatsource/expliciteuler/adapters/PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1.cpp
ca7d9034e9d399ea6bf140ab1ceec83d94c2729a
[]
no_license
www5sccs/hpvc
624af022f817c028f64ff4c8c74370b18868499a
127dd71562c7d0aecda3bda0c1e8ea035151cde1
refs/heads/master
2021-03-12T22:48:37.594884
2013-04-26T16:28:15
2013-04-26T16:28:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
22,957
cpp
#include "rotatingheatsource/expliciteuler/adapters/PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1.h" #include <sstream> #include "peano/utils/Loop.h" #ifdef Parallel #include "tarch/parallel/Node.h" #endif int rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::_snapshotCounter = 0; peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::touchVertexLastTimeSpecification() { return peano::MappingSpecification(peano::MappingSpecification::Nop,peano::MappingSpecification::AvoidFineGridRaces,true); } peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::touchVertexFirstTimeSpecification() { return peano::MappingSpecification(peano::MappingSpecification::WholeTree,peano::MappingSpecification::Serial,false); } peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::enterCellSpecification() { return peano::MappingSpecification(peano::MappingSpecification::WholeTree,peano::MappingSpecification::Serial,false); } peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::leaveCellSpecification() { return peano::MappingSpecification(peano::MappingSpecification::Nop,peano::MappingSpecification::AvoidFineGridRaces,true); } peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::ascendSpecification() { return peano::MappingSpecification(peano::MappingSpecification::Nop,peano::MappingSpecification::AvoidFineGridRaces,true); } peano::MappingSpecification rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::descendSpecification() { return peano::MappingSpecification(peano::MappingSpecification::Nop,peano::MappingSpecification::AvoidFineGridRaces,true); } std::map<tarch::la::Vector<DIMENSIONS,double> , int, tarch::la::VectorCompare<DIMENSIONS> > rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::_vertex2IndexMap; rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1(): _vtkWriter(0), _vertexWriter(0), _cellWriter(0), _vertexValueWriter(0) { } rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::~PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1() { } #if defined(SharedMemoryParallelisation) rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1(const PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1& masterThread): _vtkWriter(masterThread._vtkWriter), _vertexWriter(masterThread._vertexWriter), _cellWriter(masterThread._cellWriter), _vertexValueWriter(masterThread._vertexValueWriter) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithWorkerThread(const PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1& workerThread) { } #endif void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::plotVertex( const rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX ) { if ( fineGridVertex.getRefinementControl() != rotatingheatsource::expliciteuler::Vertex::Records::Refined && fineGridVertex.getRefinementControl() != rotatingheatsource::expliciteuler::Vertex::Records::Refining && _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() ) { #if defined(Dim2) || defined(Dim3) _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX); #else _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data())); #endif _vertexValueWriter->plotVertex (_vertex2IndexMap[fineGridX],fineGridVertex.getRhs() ); } } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::createHangingVertex( rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { plotVertex( fineGridVertex, fineGridX ); } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::destroyHangingVertex( const rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::createInnerVertex( rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::createBoundaryVertex( rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::destroyVertex( const rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::createCell( rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::destroyCell( const rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { } #ifdef Parallel void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithNeighbour( rotatingheatsource::expliciteuler::Vertex& vertex, const rotatingheatsource::expliciteuler::Vertex& neighbour, int fromRank, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::prepareSendToNeighbour( rotatingheatsource::expliciteuler::Vertex& vertex, int toRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::prepareCopyToRemoteNode( rotatingheatsource::expliciteuler::Vertex& localVertex, int toRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::prepareCopyToRemoteNode( rotatingheatsource::expliciteuler::Cell& localCell, int toRank, const tarch::la::Vector<DIMENSIONS,double>& cellCentre, const tarch::la::Vector<DIMENSIONS,double>& cellSize, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithRemoteDataDueToForkOrJoin( rotatingheatsource::expliciteuler::Vertex& localVertex, const rotatingheatsource::expliciteuler::Vertex& masterOrWorkerVertex, int fromRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithRemoteDataDueToForkOrJoin( rotatingheatsource::expliciteuler::Cell& localCell, const rotatingheatsource::expliciteuler::Cell& masterOrWorkerCell, int fromRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::prepareSendToWorker( rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell, int worker ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::prepareSendToMaster( rotatingheatsource::expliciteuler::Cell& localCell, rotatingheatsource::expliciteuler::Vertex * vertices, const peano::grid::VertexEnumerator& verticesEnumerator, const rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, const rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithMaster( const rotatingheatsource::expliciteuler::Cell& workerGridCell, rotatingheatsource::expliciteuler::Vertex * const workerGridVertices, const peano::grid::VertexEnumerator& workerEnumerator, rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell, int worker, const rotatingheatsource::expliciteuler::State& workerState, rotatingheatsource::expliciteuler::State& masterState ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::receiveDataFromMaster( rotatingheatsource::expliciteuler::Cell& receivedCell, rotatingheatsource::expliciteuler::Vertex * receivedVertices, const peano::grid::VertexEnumerator& receivedVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const receivedCoarseGridVertices, const peano::grid::VertexEnumerator& receivedCoarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& receivedCoarseGridCell, rotatingheatsource::expliciteuler::Vertex * const workersCoarseGridVertices, const peano::grid::VertexEnumerator& workersCoarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& workersCoarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithWorker( rotatingheatsource::expliciteuler::Cell& localCell, const rotatingheatsource::expliciteuler::Cell& receivedMasterCell, const tarch::la::Vector<DIMENSIONS,double>& cellCentre, const tarch::la::Vector<DIMENSIONS,double>& cellSize, int level ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::mergeWithWorker( rotatingheatsource::expliciteuler::Vertex& localVertex, const rotatingheatsource::expliciteuler::Vertex& receivedMasterVertex, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { } #endif void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::touchVertexFirstTime( rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { plotVertex( fineGridVertex, fineGridX ); } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::touchVertexLastTime( rotatingheatsource::expliciteuler::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::enterCell( rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { #ifdef Parallel if (fineGridCell.isLeaf() && !fineGridCell.isAssignedToRemoteRank()) { #else if (fineGridCell.isLeaf()) { #endif assertion( DIMENSIONS==2 || DIMENSIONS==3 ); int vertexIndex[TWO_POWER_D]; dfor2(i) tarch::la::Vector<DIMENSIONS,double> currentVertexPosition = fineGridVerticesEnumerator.getVertexPosition(i); assertion4 ( _vertex2IndexMap.find(currentVertexPosition) != _vertex2IndexMap.end(), currentVertexPosition, fineGridCell.toString(), fineGridVerticesEnumerator.toString(), fineGridVertices[ fineGridVerticesEnumerator(i) ].toString() ); vertexIndex[iScalar] = _vertex2IndexMap[currentVertexPosition]; enddforx if (DIMENSIONS==2) { _cellWriter->plotQuadrangle(vertexIndex); } if (DIMENSIONS==3) { _cellWriter->plotHexahedron(vertexIndex); } } } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::leaveCell( rotatingheatsource::expliciteuler::Cell& fineGridCell, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::beginIteration( rotatingheatsource::expliciteuler::State& solverState ) { assertion( _vtkWriter==0 ); _vtkWriter = new tarch::plotter::griddata::unstructured::vtk::VTKTextFileWriter(); _vertexWriter = _vtkWriter->createVertexWriter(); _cellWriter = _vtkWriter->createCellWriter(); _vertexValueWriter = _vtkWriter->createVertexDataWriter("rhs",1); } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::endIteration( rotatingheatsource::expliciteuler::State& solverState ) { _vertexWriter->close(); _cellWriter->close(); _vertexValueWriter->close(); delete _vertexWriter; delete _cellWriter; delete _vertexValueWriter; _vertexWriter = 0; _cellWriter = 0; _vertexValueWriter = 0; std::ostringstream snapshotFileName; snapshotFileName << "rhs" #ifdef Parallel << "-rank-" << tarch::parallel::Node::getInstance().getRank() #endif << "-" << _snapshotCounter << ".vtk"; _vtkWriter->writeToFile( snapshotFileName.str() ); _snapshotCounter++; _vertex2IndexMap.clear(); delete _vtkWriter; _vtkWriter = 0; } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::descend( rotatingheatsource::expliciteuler::Cell * const fineGridCells, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell ) { } void rotatingheatsource::expliciteuler::adapters::PerformExplicitEulerTimeStepAndPlot2VTKPlotVertexValue_1::ascend( rotatingheatsource::expliciteuler::Cell * const fineGridCells, rotatingheatsource::expliciteuler::Vertex * const fineGridVertices, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator, rotatingheatsource::expliciteuler::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, rotatingheatsource::expliciteuler::Cell& coarseGridCell ) { }
[ "wittmanr@in.tum.de" ]
wittmanr@in.tum.de
dfc10408119d862074952612e53e7bc5c330b30c
fa65e06f2674281d1327640bdb4248e32433a0c3
/2ºAno/1ºSemestre/POO/pratica/aula_19_10_2020/aula_19_10_2020/aula1.cpp
203a8a45e108cdd8cffa9aba14981e1d1b2ac3da
[]
no_license
Coutinho020/Apontamentos-ISEC
18598165e5e68ec09df8ed973067f33a486af89e
0a9d54282a52ce195214cd8fef4513247e0ea4af
refs/heads/master
2023-08-24T00:58:09.928213
2021-10-24T15:33:37
2021-10-24T15:33:37
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,316
cpp
#include <iostream> #include <string> #include <sstream> using namespace std; #define N 15 struct Tabela { int mat[N]; }; void preenches(Tabela &t, int n) { for (int i = 0; i < N; i++) { t.mat[i] = n; } } void mostras(Tabela t) { for (int i = 0; i < N; i++) { cout << t.mat[i] << endl; } } int elementoAt(Tabela t, int pos) { if (pos > 0 && pos < N) { return t.mat[pos]; } else { return 0; } } bool mudaElemento(Tabela &t, int pos, int valor) { if (pos > 0 && pos < N) { t.mat[pos] = valor; return true; } else { return false; } } string &maisCurta(string &s1, string &s2) { if (s1.size() < s2.size()) { return s1; } else { return s2; } } int &elementoEm(Tabela &t, int pos) { if (pos > 0 && pos < N) { return t.mat[pos]; } else { return t.mat[0]; } } /* int main() { Tabela t; preenches(t, 10); */ //mostras(t); //cout << elementoAt(t, 3) << endl; /* if (mudaElemento(t, 3, 3)) { cout << elementoAt(t, 3) << endl; } else { cout << "Não mudou" << endl; } */ /* string a = "Bruno Teixeira"; string b = "bom dia"; cout << maisCurta(a,b) << endl; maisCurta(a, b) = "vou mudar"; cout << maisCurta(a, b) << endl; */ /* cout << elementoEm(t, 10) << endl;; elementoEm(t, 10) = 15; cout << elementoEm(t, 10) << endl; return 0; } */
[ "brunoalexandre3@hotmail.com" ]
brunoalexandre3@hotmail.com
6e207908e2b9353a73a0b9e78a053e3e554962c6
3fbfd657c903442e0c08ace629f560e07a22c2eb
/GTreeLevel.cpp
4b721db6883468b65644bab9609dc098402a6999
[]
no_license
izhbannikov/FPSYNT
03461750f52fe5791d979604521060ba6fffad81
0d6df898be3b0e8ba8cc28421feb75895628deb5
refs/heads/master
2016-09-10T00:39:12.232105
2013-03-06T21:42:29
2013-03-06T21:42:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
238
cpp
/* * File: GTreeLevel.cpp * Author: ilya * * Created on 3 Ноябрь 2011 г., 19:34 */ #include "GTreeLevel.h" GTreeLevel::GTreeLevel() { } GTreeLevel::GTreeLevel(const GTreeLevel& orig) { } GTreeLevel::~GTreeLevel() { }
[ "i.zhbannikov@gmail.com" ]
i.zhbannikov@gmail.com
b8a8063ae3f990f3313c8f2dad7036dfaf8af386
7ea05d5bb9dfd4ca467d32c2af8062452c3feaa4
/Project4/Sensor.cpp
757cfcdfde561804857fa838cc9c2ff41aac6350
[]
no_license
Renat97/CS202
b5e46effa571fc2ae9fe72bdf29f5b2760134bbb
12c9bfe3aaeaa7ab64d00dceabb7a20860dca366
refs/heads/master
2022-12-20T10:14:08.235202
2020-10-03T05:05:16
2020-10-03T05:05:16
296,836,372
0
0
null
null
null
null
UTF-8
C++
false
false
1,805
cpp
// // Sensor.cpp // Project4 // // Created by Renat Norderhaug on 9/23/17. // Copyright © 2017 Renat Norderhaug. All rights reserved. // #include "Sensor.h" #include <iostream> #include <cstring> #include <cstdio> using namespace std; int Sensor::gps_cnt = 0; int Sensor::camera_cnt = 0; int Sensor::lidar_cnt = 0; int Sensor::radar_cnt = 0; Sensor::Sensor() { setType("none"); } Sensor::Sensor(const char* type) { setType(type); } const char* Sensor::getType() const { return m_type; } void Sensor::setType(const char* type){ if(strcmp("gps", type)) { strcpy(m_type, type); m_extracost = 5.0; gps_cnt++; } else if(strcmp("camera", type)) { strcpy(m_type, type); m_extracost = 10.0; camera_cnt++; } else if(strcmp("lidar", type)) { strcpy(m_type, type); m_extracost = 15.0; lidar_cnt++; } else if(strcmp("radar", type)) { strcpy(m_type, type); m_extracost = 20.0; radar_cnt++; } else if(strcmp("none", type)) { strcpy(m_type, type); m_extracost = 0.0; } } float Sensor::getExtraCost() const { return m_extracost; } int Sensor::getGpsCount(){ return gps_cnt; } int Sensor::getCameraCount(){ return camera_cnt; } int Sensor::getLidarCount(){ return lidar_cnt; } int Sensor::getRadarCount(){ return radar_cnt; } void Sensor::resetGpsCount(){ gps_cnt = 0; } void Sensor::resetCameraCount(){ camera_cnt = 0; } void Sensor::resetLidarCount(){ lidar_cnt = 0; } void Sensor::resetRadarCount(){ radar_cnt=0; } void Sensor::printAllSensors() { cout << "gps: " << gps_cnt << " "; cout << "camera: "<< camera_cnt << " "; cout << "lidar: "<< lidar_cnt << " "; cout << "radar: " << radar_cnt << " "; cout << endl; } bool operator == (const Sensor& sensor1, const Sensor& sensor2) { return strcmp(sensor1.m_type, sensor2.m_type) == 0; }
[ "renat97@gmail.com" ]
renat97@gmail.com
eba4d0edea9cf7d52b29e97e8a9d6ef769a97f7d
a504b543d48a2518c770920cc5f8efce7c91ede8
/angrybird/Box2D/birdred.cpp
75029fe9aa4cddfec0ccda1f877dbb56b8a4c4e5
[]
no_license
YifangYu/pd2-Angrybird
f3ab29db365771232b11f015f7f457ee7eb47fc0
e7d444bf0ab80ea22e26c6c5d19a7a47529cdc40
refs/heads/master
2020-05-29T15:06:36.978232
2016-06-19T15:47:16
2016-06-19T15:47:16
61,477,967
0
0
null
null
null
null
UTF-8
C++
false
false
46
cpp
#include "birdred.h" BirdRed::BirdRed() { }
[ "尤怡方" ]
尤怡方
b74821cfe112d700fc61d445fbdf83832be25dd3
5b1dd5d3cc755696c75a423da841daf2aa39afb5
/aliyun-api-ess/2014-08-28/src/ali_ess_describe_scheduled_tasks.cc
50c9a8b4da75caccc4b1878ff21e2806f42da5b7
[ "Apache-2.0" ]
permissive
aliyun-beta/aliyun-openapi-cpp-sdk
1c61ffd2f0f85fb149ba9941c77e193f5db4d364
5e708130870a27e0c749777118f9e26ace96e7d9
refs/heads/master
2016-08-12T06:21:57.634675
2015-12-15T08:14:59
2015-12-15T08:14:59
47,530,214
5
4
null
null
null
null
UTF-8
C++
false
false
12,745
cc
#include <stdio.h> #include "ali_api_core.h" #include "ali_string_utils.h" #include "ali_ess.h" #include "json/value.h" #include "json/reader.h" using namespace aliyun; namespace { void Json2Type(const Json::Value& value, std::string* item); void Json2Type(const Json::Value& value, EssDescribeScheduledTasksScheduledTaskType* item); void Json2Type(const Json::Value& value, EssDescribeScheduledTasksResponseType* item); template<typename T> class Json2Array { public: Json2Array(const Json::Value& value, std::vector<T>* vec) { if(!value.isArray()) { return; } for(int i = 0; i < value.size(); i++) { T val; Json2Type(value[i], &val); vec->push_back(val); } } }; void Json2Type(const Json::Value& value, std::string* item) { *item = value.asString(); } void Json2Type(const Json::Value& value, EssDescribeScheduledTasksScheduledTaskType* item) { if(value.isMember("ScheduledTaskId")) { item->scheduled_task_id = value["ScheduledTaskId"].asString(); } if(value.isMember("ScheduledTaskName")) { item->scheduled_task_name = value["ScheduledTaskName"].asString(); } if(value.isMember("Description")) { item->description = value["Description"].asString(); } if(value.isMember("ScheduledAction")) { item->scheduled_action = value["ScheduledAction"].asString(); } if(value.isMember("RecurrenceEndTime")) { item->recurrence_end_time = value["RecurrenceEndTime"].asString(); } if(value.isMember("LaunchTime")) { item->launch_time = value["LaunchTime"].asString(); } if(value.isMember("RecurrenceType")) { item->recurrence_type = value["RecurrenceType"].asString(); } if(value.isMember("RecurrenceValue")) { item->recurrence_value = value["RecurrenceValue"].asString(); } if(value.isMember("LaunchExpirationTime")) { item->launch_expiration_time = value["LaunchExpirationTime"].asInt(); } if(value.isMember("TaskEnabled")) { item->task_enabled = value["TaskEnabled"].asBool(); } } void Json2Type(const Json::Value& value, EssDescribeScheduledTasksResponseType* item) { if(value.isMember("TotalCount")) { item->total_count = value["TotalCount"].asInt(); } if(value.isMember("PageNumber")) { item->page_number = value["PageNumber"].asInt(); } if(value.isMember("PageSize")) { item->page_size = value["PageSize"].asInt(); } if(value.isMember("ScheduledTasks") && value["ScheduledTasks"].isMember("ScheduledTask")) { Json2Array<EssDescribeScheduledTasksScheduledTaskType>(value["ScheduledTasks"]["ScheduledTask"], &item->scheduled_tasks); } } } int Ess::DescribeScheduledTasks(const EssDescribeScheduledTasksRequestType& req, EssDescribeScheduledTasksResponseType* response, EssErrorInfo* error_info) { std::string str_response; int status_code; int ret = 0; bool parse_success = false; std::string secheme = this->use_tls_ ? "https" : "http"; AliRpcRequest* req_rpc = new AliRpcRequest(version_, appid_, secret_, secheme + "://" + host_); if((!this->use_tls_) && this->proxy_host_ && this->proxy_host_[0]) { req_rpc->SetHttpProxy( this->proxy_host_); } Json::Value val; Json::Reader reader; req_rpc->AddRequestQuery("Action","DescribeScheduledTasks"); if(!req.owner_id.empty()) { req_rpc->AddRequestQuery("OwnerId", req.owner_id); } if(!req.resource_owner_account.empty()) { req_rpc->AddRequestQuery("ResourceOwnerAccount", req.resource_owner_account); } if(!req.resource_owner_id.empty()) { req_rpc->AddRequestQuery("ResourceOwnerId", req.resource_owner_id); } if(!req.page_number.empty()) { req_rpc->AddRequestQuery("PageNumber", req.page_number); } if(!req.page_size.empty()) { req_rpc->AddRequestQuery("PageSize", req.page_size); } if(!req.scheduled_action1.empty()) { req_rpc->AddRequestQuery("ScheduledAction.1", req.scheduled_action1); } if(!req.scheduled_action2.empty()) { req_rpc->AddRequestQuery("ScheduledAction.2", req.scheduled_action2); } if(!req.scheduled_action3.empty()) { req_rpc->AddRequestQuery("ScheduledAction.3", req.scheduled_action3); } if(!req.scheduled_action4.empty()) { req_rpc->AddRequestQuery("ScheduledAction.4", req.scheduled_action4); } if(!req.scheduled_action5.empty()) { req_rpc->AddRequestQuery("ScheduledAction.5", req.scheduled_action5); } if(!req.scheduled_action6.empty()) { req_rpc->AddRequestQuery("ScheduledAction.6", req.scheduled_action6); } if(!req.scheduled_action7.empty()) { req_rpc->AddRequestQuery("ScheduledAction.7", req.scheduled_action7); } if(!req.scheduled_action8.empty()) { req_rpc->AddRequestQuery("ScheduledAction.8", req.scheduled_action8); } if(!req.scheduled_action9.empty()) { req_rpc->AddRequestQuery("ScheduledAction.9", req.scheduled_action9); } if(!req.scheduled_action10.empty()) { req_rpc->AddRequestQuery("ScheduledAction.10", req.scheduled_action10); } if(!req.scheduled_action11.empty()) { req_rpc->AddRequestQuery("ScheduledAction.11", req.scheduled_action11); } if(!req.scheduled_action12.empty()) { req_rpc->AddRequestQuery("ScheduledAction.12", req.scheduled_action12); } if(!req.scheduled_action13.empty()) { req_rpc->AddRequestQuery("ScheduledAction.13", req.scheduled_action13); } if(!req.scheduled_action14.empty()) { req_rpc->AddRequestQuery("ScheduledAction.14", req.scheduled_action14); } if(!req.scheduled_action15.empty()) { req_rpc->AddRequestQuery("ScheduledAction.15", req.scheduled_action15); } if(!req.scheduled_action16.empty()) { req_rpc->AddRequestQuery("ScheduledAction.16", req.scheduled_action16); } if(!req.scheduled_action17.empty()) { req_rpc->AddRequestQuery("ScheduledAction.17", req.scheduled_action17); } if(!req.scheduled_action18.empty()) { req_rpc->AddRequestQuery("ScheduledAction.18", req.scheduled_action18); } if(!req.scheduled_action19.empty()) { req_rpc->AddRequestQuery("ScheduledAction.19", req.scheduled_action19); } if(!req.scheduled_action20.empty()) { req_rpc->AddRequestQuery("ScheduledAction.20", req.scheduled_action20); } if(!req.scheduled_task_id1.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.1", req.scheduled_task_id1); } if(!req.scheduled_task_id2.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.2", req.scheduled_task_id2); } if(!req.scheduled_task_id3.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.3", req.scheduled_task_id3); } if(!req.scheduled_task_id4.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.4", req.scheduled_task_id4); } if(!req.scheduled_task_id5.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.5", req.scheduled_task_id5); } if(!req.scheduled_task_id6.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.6", req.scheduled_task_id6); } if(!req.scheduled_task_id7.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.7", req.scheduled_task_id7); } if(!req.scheduled_task_id8.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.8", req.scheduled_task_id8); } if(!req.scheduled_task_id9.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.9", req.scheduled_task_id9); } if(!req.scheduled_task_id10.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.10", req.scheduled_task_id10); } if(!req.scheduled_task_id11.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.11", req.scheduled_task_id11); } if(!req.scheduled_task_id12.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.12", req.scheduled_task_id12); } if(!req.scheduled_task_id13.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.13", req.scheduled_task_id13); } if(!req.scheduled_task_id14.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.14", req.scheduled_task_id14); } if(!req.scheduled_task_id15.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.15", req.scheduled_task_id15); } if(!req.scheduled_task_id16.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.16", req.scheduled_task_id16); } if(!req.scheduled_task_id17.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.17", req.scheduled_task_id17); } if(!req.scheduled_task_id18.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.18", req.scheduled_task_id18); } if(!req.scheduled_task_id19.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.19", req.scheduled_task_id19); } if(!req.scheduled_task_id20.empty()) { req_rpc->AddRequestQuery("ScheduledTaskId.20", req.scheduled_task_id20); } if(!req.scheduled_task_name1.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.1", req.scheduled_task_name1); } if(!req.scheduled_task_name2.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.2", req.scheduled_task_name2); } if(!req.scheduled_task_name3.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.3", req.scheduled_task_name3); } if(!req.scheduled_task_name4.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.4", req.scheduled_task_name4); } if(!req.scheduled_task_name5.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.5", req.scheduled_task_name5); } if(!req.scheduled_task_name6.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.6", req.scheduled_task_name6); } if(!req.scheduled_task_name7.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.7", req.scheduled_task_name7); } if(!req.scheduled_task_name8.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.8", req.scheduled_task_name8); } if(!req.scheduled_task_name9.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.9", req.scheduled_task_name9); } if(!req.scheduled_task_name10.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.10", req.scheduled_task_name10); } if(!req.scheduled_task_name11.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.11", req.scheduled_task_name11); } if(!req.scheduled_task_name12.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.12", req.scheduled_task_name12); } if(!req.scheduled_task_name13.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.13", req.scheduled_task_name13); } if(!req.scheduled_task_name14.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.14", req.scheduled_task_name14); } if(!req.scheduled_task_name15.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.15", req.scheduled_task_name15); } if(!req.scheduled_task_name16.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.16", req.scheduled_task_name16); } if(!req.scheduled_task_name17.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.17", req.scheduled_task_name17); } if(!req.scheduled_task_name18.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.18", req.scheduled_task_name18); } if(!req.scheduled_task_name19.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.19", req.scheduled_task_name19); } if(!req.scheduled_task_name20.empty()) { req_rpc->AddRequestQuery("ScheduledTaskName.20", req.scheduled_task_name20); } if(!req.owner_account.empty()) { req_rpc->AddRequestQuery("OwnerAccount", req.owner_account); } if(this->region_id_ && this->region_id_[0]) { req_rpc->AddRequestQuery("RegionId", this->region_id_); } if(req_rpc->CommitRequest() != 0) { if(error_info) { error_info->code = "connect to host failed"; } ret = -1; goto out; } status_code = req_rpc->WaitResponseHeaderComplete(); req_rpc->ReadResponseBody(str_response); if(status_code > 0 && !str_response.empty()){ parse_success = reader.parse(str_response, val); } if(!parse_success) { if(error_info) { error_info->code = "parse response failed"; } ret = -1; goto out; } if(status_code!= 200 && error_info && parse_success) { error_info->request_id = val.isMember("RequestId") ? val["RequestId"].asString(): ""; error_info->code = val.isMember("Code") ? val["Code"].asString(): ""; error_info->host_id = val.isMember("HostId") ? val["HostId"].asString(): ""; error_info->message = val.isMember("Message") ? val["Message"].asString(): ""; } if(status_code== 200 && response) { Json2Type(val, response); } ret = status_code; out: delete req_rpc; return ret; }
[ "zcy421593@126.com" ]
zcy421593@126.com
efc4f9cd4bcfa847d9e1e37bef8bb0f52c6fbd84
aec08f03a4c200a8bf42cbfa2b9c04c46f5a3699
/src/programs/gsa/TornadoPlot.cpp
05df35d87447a10434bb1ddd1aca8c1cf957e98e
[ "LicenseRef-scancode-warranty-disclaimer", "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
dwelter/pestpp
0d1b51df904a14d50492dfe240b7272034f3a042
921d04b83f161787bfc2137baadfa665a6b1b48c
refs/heads/master
2021-01-24T09:34:48.682006
2018-08-04T20:11:35
2018-08-04T20:11:35
4,577,568
29
29
null
2019-03-28T01:00:26
2012-06-06T20:22:15
C++
UTF-8
C++
false
false
7,255
cpp
#include <vector> #include <cassert> #include <numeric> #include <math.h> #include <errno.h> #include <fstream> #include <iostream> #include <map> #include <vector> #include <algorithm> #include <regex> #include "TornadoPlot.h" #include "Transformable.h" #include "RunManagerAbstract.h" #include "ParamTransformSeq.h" #include "ModelRunPP.h" #include "utilities.h" #include "FileManager.h" using namespace std; using namespace pest_utils; TornadoPlot::TornadoPlot(const vector<string> &_adj_par_name_vec, const Parameters &_fixed_pars, const Parameters &_init_pars, const Parameters &_lower_bnd, const Parameters &_upper_bnd, const set<string> &_log_trans_pars, ParamTransformSeq *_base_partran_seq_ptr, const std::vector<std::string> &_obs_name_vec, FileManager *file_manager_ptr, const ObservationInfo *_obs_info_ptr, bool _calc_obs_sen) //: GsaAbstractBase(_base_partran_seq_ptr, _adj_par_name_vec, _fixed_pars, _lower_bnd, _upper_bnd, //_obs_name_vec, file_manager_ptr), init_pars(_init_pars), obs_info_ptr(_obs_info_ptr), calc_obs_sen(_calc_obs_sen) { log_trans_pars = _log_trans_pars; } void TornadoPlot::assemble_runs(RunManagerAbstract &run_manager) { Parameters pars = fixed_ctl_pars; pars.insert(init_pars); // Assemble run Based on the inital Parameter values Parameters tmp_pars; tmp_pars = pars; base_partran_seq_ptr->ctl2model_ip(tmp_pars); int run_id = run_manager.add_run(tmp_pars, "base_run", Parameters::no_data); // Assemble runs which perturb each parameter to its max and min value for (const auto &ipar : adj_par_name_vec) { tmp_pars = pars; double low_value = lower_bnd.get_rec(ipar); tmp_pars[ipar] = low_value; base_partran_seq_ptr->ctl2model_ip(tmp_pars); run_id = run_manager.add_run(tmp_pars, ipar + " L", Parameters::no_data); tmp_pars = pars; double hi_value = upper_bnd.get_rec(ipar); tmp_pars[ipar] = hi_value; base_partran_seq_ptr->ctl2model_ip(tmp_pars); run_id = run_manager.add_run(tmp_pars, ipar + " U", Parameters::no_data); } } void TornadoPlot::calc_sen(RunManagerAbstract &run_manager, ModelRun model_run) { int n_runs = run_manager.get_nruns(); bool run_ok = false; int run_status; string run_name; double par_value_not_used; cout << endl; if (n_runs <= 1) { cerr << "Can not perform tornado calculations: insufficient number of runs (" << n_runs << ")" << endl; return; } run_manager.get_info(0, run_status, run_name, par_value_not_used); if (run_status <= 0) { cerr << "Cannot perform tornado calculations: base run failed " << endl; return; } ofstream &fout_tor = file_manager_ptr->open_ofile_ext("tor"); tornado_calc(run_manager, model_run, fout_tor, ""); file_manager_ptr->close_file("tor"); ofstream &fout_toi = file_manager_ptr->open_ofile_ext("toi"); if (calc_obs_sen) { for (const string &iobs : obs_name_vec) { tornado_calc(run_manager, model_run, fout_toi, iobs); } } file_manager_ptr->close_file("toi"); } void TornadoPlot::tornado_calc(RunManagerAbstract &run_manager, ModelRun model_run, ofstream &fout, const string obs_name) { // if obs_name == "" compute Tornado Polt for the global phi. // Otherwise, compute Tornada Plot for the named observation. ModelRun base_run = model_run; ModelRun run1 = model_run; Parameters pars_init; Parameters pars; Observations obs; const vector<string> &run_mngr_obs_name_vec = run_manager.get_obs_name_vec(); int n_runs = run_manager.get_nruns(); bool run_ok = false; stringstream message; cout << endl; if (n_runs <= 1) { cerr << "Can not perform tornado calculations: insufficient number of runs (" << n_runs << ")" << endl; return; } run_ok = run_manager.get_run(0, pars_init, obs); if (!run_ok) { cerr << "Cannot perform tornado calculations: base run failed " << endl; return; } base_partran_seq_ptr->model2ctl_ip(pars_init); model_run.update_ctl(pars_init, obs); double phi_base = 0; if (obs_name.empty()) { phi_base = model_run.get_phi(DynamicRegularization::get_zero_reg_instance()); } else { phi_base = obs[obs_name]; } int run_status; string par_name; string run_name; char run_type; double par_value_not_used; map<string, map<string, double> > phi_tornado_map; for (const auto &ipar : adj_par_name_vec) { phi_tornado_map[ipar] = map<string, double>(); } for (int i_run = 1; i_run < n_runs; ++i_run) { std::cout << string(message.str().size(), '\b'); message.str(""); message << "processing run " << i_run + 1 << " / " << n_runs; std::cout << message.str(); run_manager.get_info(i_run, run_status, run_name, par_value_not_used); strip_ip(run_name); run_type = run_name.back(); par_name = run_name.substr(0, run_name.size() - 2); run_ok = run_manager.get_run(i_run, pars, obs); if (run_ok) { base_partran_seq_ptr->model2ctl_ip(pars); double phi; if (obs_name.empty()) { model_run.update_ctl(pars, obs); phi= model_run.get_phi(DynamicRegularization::get_zero_reg_instance()); } else { phi = obs[obs_name]; } if (run_type == 'L') { phi_tornado_map[par_name]["lo"] = phi; } else if (run_type == 'U') { phi_tornado_map[par_name]["hi"] = phi; } } } //sort tornado plots vector< pair<string, double> > phi_range_vec; for (const auto &irec : phi_tornado_map) { double range = 0; map<string, double>::const_iterator map_end = irec.second.end(); map<string, double>::const_iterator iter_lo = irec.second.find("lo"); map<string, double>::const_iterator iter_hi = irec.second.find("hi"); if (iter_lo != map_end && iter_hi != map_end) { range = max(iter_hi->second, max(phi_base, iter_lo->second)) - min(iter_hi->second, min(phi_base, iter_lo->second)); range = abs(range); } else if (iter_hi != map_end) { range = iter_hi->second - phi_base; range = abs(range); } else if (iter_lo != map_end) { range = phi_base - iter_lo->second; range = abs(range); } phi_range_vec.push_back(make_pair(irec.first, range)); } std::sort(phi_range_vec.begin(), phi_range_vec.end(), [](pair<string, double> a, pair<string, double> b) { return std::abs(a.second) > std::abs(b.second); }); if (obs_name.empty()) { fout << "Observation: Global Phi" << endl; } else { fout << "Observation: " << obs_name << endl; } fout << "parameter_name, phi_lo, phi_init, phi_hi, par_lo, par_init, par_hi" << endl; for (const auto &i : phi_range_vec) { const string &par_name = i.first; const auto irec = phi_tornado_map.find(par_name); if (irec != phi_tornado_map.end()) { map<string, double>::const_iterator map_end = irec->second.end(); map<string, double>::const_iterator iter_lo = irec->second.find("lo"); map<string, double>::const_iterator iter_hi = irec->second.find("hi"); stringstream phi_hi; if (iter_hi != map_end) { phi_hi << iter_hi->second; } else { phi_hi << "na"; } stringstream phi_lo; if (iter_lo != map_end) { phi_lo << iter_lo->second; } else { phi_lo << "na"; } fout << par_name << ", " << phi_lo.str() << ", " << phi_base << ", " << phi_hi.str() << ", " << lower_bnd[par_name] << ", " << init_pars[par_name] << ", " << upper_bnd[par_name] << endl; } } } TornadoPlot::~TornadoPlot() { }
[ "dwelter1@bellsouth.net" ]
dwelter1@bellsouth.net
6152d2b042b2ab3c1da404b804986fc20fd96d37
38630abe38b4b4d1c629df4f4de7e6b5f097d3c5
/Classes/AppDelegate.cpp
abb6194906e0bdf2cb961b30632f8ca3255b2baa
[]
no_license
xiaolizi521/pogoda
2e8c4d3e5904aa6f4ff3e972fe4ce1fce3a82bb5
2c7d2d08da50464915915a39236917db02c50748
refs/heads/master
2021-01-17T21:39:23.520819
2013-04-26T12:20:29
2013-04-26T12:20:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,979
cpp
#include "cocos2d.h" #include "CCEGLView.h" #include "AppDelegate.h" #include "HelloWorldScene.h" #include "SimpleAudioEngine.h" #include "SceneManager.h" #include "UserData.h" using namespace CocosDenshion; USING_NS_CC; AppDelegate::AppDelegate() { } AppDelegate::~AppDelegate() { SimpleAudioEngine::end(); } bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize(); CCSize designSize = CCSizeMake(640, 960); pDirector->setContentScaleFactor(1); CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width,designSize.height, kResolutionNoBorder); // turn on display FPS //pDirector->setDisplayStats(true); pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object //CCScene *pScene = HelloWorld::scene(); // run //pDirector->runWithScene(pScene); srand((unsigned)time(0)); SceneManager::initLoading(); return true; } // This function will be called when the app is inactive. When comes a phone call,it's be invoked too void AppDelegate::applicationDidEnterBackground() { CCDirector::sharedDirector()->stopAnimation(); if(SceneManager::music) SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); } // this function will be called when the app is active again void AppDelegate::applicationWillEnterForeground() { CCDirector::sharedDirector()->startAnimation(); if(SceneManager::music) SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); //CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //Loading *loading = new Loading(); //CCDirector::sharedDirector()->getRunningScene()->addChild((CCNode *)loading); }
[ "wyklion@qq.com" ]
wyklion@qq.com
7a6b3625fb83fbcdd67f28db1178ba27a59021cd
8727d1a506114c2bbab2f74db9bdaf68b5a6c83e
/test6.cpp
2f3b7e0c87c48ffa427a00770544399ab4580a89
[]
no_license
BaiXious/Accelerated-cpp
5c5525eb9678ad98475208f82ea63b1606e31a86
26ad13fe83aa36c8d3ca1caf89b04e90f441d7d7
refs/heads/master
2022-01-13T08:11:14.337940
2018-08-28T04:06:10
2018-08-28T04:06:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
360
cpp
#include <iostream> #include <string> #include <vector> class A; void doanother(A* a) ; class dosth { public : void haha() { doanother(p); } private : A* p; }; class A { friend class dosth; private : std::vector<std::string> data; }; void doanother(A* a) { std::cout << a->data.size() << std::endl; } int main() { A a; return 0; }
[ "1051378379@qq.com" ]
1051378379@qq.com
afdec558f8c70197c44073506ad1d0a92af1d1bb
f8f50d7e520b374dfa75c7ef0cfd62735e06bb27
/C++/EngineDevBox/EngineDevBox/main.cpp
138b3c8ce23075bb09f42ca9d78ca36d964e7983
[]
no_license
samratnagarjuna/CodeSamples
cba310b94bbd3dbeac3fe1d4a280a7d8b702acd0
8955cd85ce95416799b6d87727a548abaf452854
refs/heads/master
2021-05-01T22:43:28.574082
2017-01-21T19:07:04
2017-01-21T19:07:04
77,611,958
0
0
null
null
null
null
UTF-8
C++
false
false
2,279
cpp
#include <Windows.h> #define _USE_MATH_DEFINES #include <cmath> #include <iostream> #include "NEngine.h" #include "Message\NMessageManager.h" #include "Math\NMatrix4.h" #include "Math\NVector4.h" #include "Utility\NHashedString.h" #include "Utility\NConsolePrint.h" #include "Game\Game.h" #if defined _DEBUG #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #endif // _DEBUG using namespace Illehc; class TestMessageHandler : public MessageSystem::IMessageHandler { void OnReceive(const HashedString & i_Message, void * i_Data); }; void TestMessageHandler :: OnReceive(const HashedString & i_Message, void * i_Data) { DEBUG_PRINT("Test Message Handler Triggered\n"); } void MessageHandlerUnitTest() { MessageSystem::Init(); MessageSystem::IMessageHandler * handler = new TestMessageHandler(); MessageSystem::RegisterMessageHandler("Test", handler); MessageSystem::NotifyMessage("Test", NULL); MessageSystem::DeRegisterMessageHandler("Test", handler); MessageSystem::ShutDown(); delete handler; } void MatrixUnitTest() { Vector4 invector = Vector4 (1.0f, 0.0f, 0.0f, 1.0f); Matrix4 transmatrix = Matrix4::CreateTranslationCV(10.0f, 0.0f, 0.0f); Vector4 outvector = transmatrix.MultiplyRight(invector); DEBUG_PRINT("Expected Output = 11.0 , Produced Output = %f\n",outvector.getX()); Matrix4 rotmatrix = Matrix4::CreateZRotationCV((float)M_PI_2); outvector = rotmatrix.MultiplyRight(invector); DEBUG_PRINT("Expected Output = 1.0 , Produced Output = %f\n", outvector.getY()); Matrix4 transrotmatrix = transmatrix * rotmatrix; outvector = transrotmatrix.MultiplyRight(invector); DEBUG_PRINT("Expected Output = (10.0, 1.0) , Produced Output = (%f, %f)\n", outvector.getX(), outvector.getY()); } int WINAPI wWinMain(HINSTANCE i_hInstance, HINSTANCE i_hPrevInstance, LPWSTR i_lpCmdLine, int i_nCmdShow) { /* NOTE:: When loading Serialize Scene Press B (BackUp) to Serialize Data and L(Load) to Deserialize */ if (GameEngine::Init("Engine Illehc Dev Box", i_hInstance, i_nCmdShow)) { if (Game::Init()) { GameEngine::Run(); Game::ShutDown(); } GameEngine::ShutDown(); } #if defined _DEBUG _CrtDumpMemoryLeaks(); #endif // _DEBUG return 0; }
[ "samratnagarjuna@gmail.com" ]
samratnagarjuna@gmail.com
ee7451640373244525b5ef7eeff2e54c58115d12
0af5f0cf42c45876acc531b1fb51544166ec43ae
/tests/sources/core/test_interpolation_utils.cpp
0daae8974b34cb69357efad0def846e6ce02cc85
[ "MIT" ]
permissive
nfrechette/acl
8cda80428ab81260d59611f2bf6848b2847897b5
427b948f87d43f666ac9983073790621c3848ae3
refs/heads/develop
2023-08-31T09:14:10.347985
2023-08-26T02:18:40
2023-08-26T11:16:11
91,615,309
1,172
89
MIT
2023-09-09T13:39:44
2017-05-17T20:02:25
C++
UTF-8
C++
false
false
21,689
cpp
//////////////////////////////////////////////////////////////////////////////// // The MIT License (MIT) // // Copyright (c) 2018 Nicholas Frechette & Animation Compression Library contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #include <catch2/catch.hpp> #include <acl/core/interpolation_utils.h> #include <rtm/scalarf.h> using namespace acl; using namespace rtm; TEST_CASE("interpolation utils", "[core][utils]") { const float error_threshold = 1.0E-6F; { // Clamped looping policy uint32_t key0; uint32_t key1; float alpha; find_linear_interpolation_samples_with_duration(31, 1.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 1); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 1.0F / 30.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 1); CHECK(key1 == 2); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 2.5F / 30.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.5F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 1.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 30); CHECK(key1 == 30); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 2.5F / 30.0F, sample_rounding_policy::floor, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 2.5F / 30.0F, sample_rounding_policy::ceil, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 2.4F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(31, 1.0F, 2.6F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); // Test a static pose find_linear_interpolation_samples_with_duration(1, 0.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 0.0F, 0.0F, sample_rounding_policy::floor, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 0.0F, 0.0F, sample_rounding_policy::ceil, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 0.0F, 0.0F, sample_rounding_policy::nearest, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); } { // Wrapping looping policy uint32_t key0; uint32_t key1; float alpha; find_linear_interpolation_samples_with_duration(30, 1.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 1); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 1.0F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 1); CHECK(key1 == 2); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 2.5F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.5F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 1.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 2.5F / 30.0F, sample_rounding_policy::floor, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 2.5F / 30.0F, sample_rounding_policy::ceil, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 2.4F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(30, 1.0F, 2.6F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); // Test a static pose find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 0.0F, sample_rounding_policy::floor, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 0.0F, sample_rounding_policy::ceil, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 0.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); // When we wrap, even a static pose has some duration find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 1.0F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK((scalar_near_equal(alpha, 0.0F, error_threshold) || scalar_near_equal(alpha, 1.0F, error_threshold))); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 0.5F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.5F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 1.0F / 30.0F, sample_rounding_policy::floor, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 1.0F / 30.0F, sample_rounding_policy::ceil, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_duration(1, 1.0F / 30.0F, 1.0F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK((scalar_near_equal(alpha, 0.0F, error_threshold) || scalar_near_equal(alpha, 1.0F, error_threshold))); } ////////////////////////////////////////////////////////////////////////// { // Clamped looping policy uint32_t key0; uint32_t key1; float alpha; find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 1); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 1.0F / 30.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 1); CHECK(key1 == 2); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 2.5F / 30.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.5F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 1.0F, sample_rounding_policy::none, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 30); CHECK(key1 == 30); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 2.5F / 30.0F, sample_rounding_policy::floor, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 2.5F / 30.0F, sample_rounding_policy::ceil, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 2.4F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(31, 30.0F, 2.6F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::clamp, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); } { // Wrapping looping policy uint32_t key0; uint32_t key1; float alpha; find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 0.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 1); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 1.0F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 1); CHECK(key1 == 2); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 2.5F / 30.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.5F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 1.0F, sample_rounding_policy::none, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 0); CHECK(key1 == 0); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 2.5F / 30.0F, sample_rounding_policy::floor, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 2.5F / 30.0F, sample_rounding_policy::ceil, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 2.4F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 0.0F, error_threshold)); find_linear_interpolation_samples_with_sample_rate(30, 30.0F, 2.6F / 30.0F, sample_rounding_policy::nearest, sample_looping_policy::wrap, key0, key1, alpha); CHECK(key0 == 2); CHECK(key1 == 3); CHECK(scalar_near_equal(alpha, 1.0F, error_threshold)); } ////////////////////////////////////////////////////////////////////////// { // Clamping looping policy CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::none, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::none, sample_looping_policy::clamp), 0.5F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::none, sample_looping_policy::clamp), 0.75F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::none, sample_looping_policy::clamp), 0.5F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::none, sample_looping_policy::clamp), 0.16666667F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::floor, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::floor, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::floor, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::floor, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::floor, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::ceil, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::ceil, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::ceil, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::ceil, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::ceil, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::nearest, sample_looping_policy::clamp), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::nearest, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::nearest, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::nearest, sample_looping_policy::clamp), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::nearest, sample_looping_policy::clamp), 0.0F, error_threshold)); } { // Wrapping looping policy CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::none, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::none, sample_looping_policy::wrap), 0.5F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::none, sample_looping_policy::wrap), 0.75F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::none, sample_looping_policy::wrap), 0.5F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::none, sample_looping_policy::wrap), 0.16666667F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(2.5F, 2, 0, sample_rounding_policy::none, sample_looping_policy::wrap), 0.5F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(2.5F, 2, 0, sample_rounding_policy::floor, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(2.5F, 2, 0, sample_rounding_policy::ceil, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(0.0F, 1, 1, sample_rounding_policy::nearest, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 2, sample_rounding_policy::nearest, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 2, sample_rounding_policy::nearest, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 0, 3, sample_rounding_policy::nearest, sample_looping_policy::wrap), 1.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(1.5F, 1, 4, sample_rounding_policy::nearest, sample_looping_policy::wrap), 0.0F, error_threshold)); CHECK(scalar_near_equal(find_linear_interpolation_alpha(2.5F, 2, 0, sample_rounding_policy::nearest, sample_looping_policy::wrap), 1.0F, error_threshold)); } ////////////////////////////////////////////////////////////////////////// CHECK(scalar_near_equal(apply_rounding_policy(0.2F, sample_rounding_policy::none), 0.2F, error_threshold)); CHECK(apply_rounding_policy(0.2F, sample_rounding_policy::floor) == 0.0F); CHECK(apply_rounding_policy(0.2F, sample_rounding_policy::ceil) == 1.0F); CHECK(apply_rounding_policy(0.2F, sample_rounding_policy::nearest) == 0.0F); CHECK(scalar_near_equal(apply_rounding_policy(0.2F, sample_rounding_policy::per_track), 0.2F, error_threshold)); CHECK(scalar_near_equal(apply_rounding_policy(0.8F, sample_rounding_policy::none), 0.8F, error_threshold)); CHECK(apply_rounding_policy(0.8F, sample_rounding_policy::floor) == 0.0F); CHECK(apply_rounding_policy(0.8F, sample_rounding_policy::ceil) == 1.0F); CHECK(apply_rounding_policy(0.8F, sample_rounding_policy::nearest) == 1.0F); CHECK(scalar_near_equal(apply_rounding_policy(0.8F, sample_rounding_policy::per_track), 0.8F, error_threshold)); }
[ "zeno490@gmail.com" ]
zeno490@gmail.com
e81f643c0e0f410a6193baf497097800c7f65540
0a9fbcf64062f0118d2e6b8b5d6e6a66a9a0299d
/PSYCHON.cpp
fb7a9db19ed2dd90d5c7c5e5e5799a81e94505aa
[]
no_license
mayank2903/SPOJSolutions
1991a7dddae4d7f8d0ba2caeab8cfb20fbee1415
c3a1e723c228e83d34ed8794f57c4f9a6ad16e7d
refs/heads/master
2016-09-09T21:54:24.181944
2015-02-01T00:45:18
2015-02-01T00:45:18
30,131,657
1
2
null
null
null
null
UTF-8
C++
false
false
1,711
cpp
#include <iostream> #include <cmath> using namespace std; #define ll unsigned long long #define MAX 10000000 #define LMT 3200 unsigned flag[MAX/64]; unsigned prime[664581], total; #define chkC(n) (flag[n>>6]&(1<<((n>>1)&31))) #define setC(n) (flag[n>>6]|=(1<<((n>>1)&31))) void sieve() { unsigned i, j, k; for(i=3;i<LMT;i+=2) if(!chkC(i)) for(j=i*i,k=i<<1;j<MAX;j+=k) setC(j); prime[1] = 2; for(i=3,j=2;i<MAX;i+=2) { if(!chkC(i)) { prime[j++] = i; } } total = j; } int f(int a) { unsigned int v=0; int h=a; int cntev=0; int cntod=0; for(int j=1,t=prime[j];t*t<=h; t = prime[++j]) { v=0; if(h%t==0) { while(h%t==0) { v++; h/=t; } if(v%2==0) cntev++; else cntod++; } if(h==1) break; } if(h!=1) cntod++; if(cntev>cntod) return 1; else return 0; } int main() { sieve(); int t,a; scanf("%d",&t); while(t--) { scanf("%d",&a); int cnt=f(a); if(cnt==1) printf("Psycho Number\n"); else printf("Ordinary Number\n"); } return 0; }
[ "pc.mayank@gmail.com" ]
pc.mayank@gmail.com
2f75cf3cb6fa27440a0ae3394f14cccd7170f08f
b72698e6ff8c36a35e34dd5c80f3499e59ca5169
/libs/system/include/mrpt/system/WorkerThreadsPool.h
fd890a404fd973e97806445e8358644205b62864
[ "BSD-3-Clause" ]
permissive
jolting/mrpt
1d76a8811bbf09866bc9620fe720383f3badd257
2cfcd3a97aebd49290df5405976b15f8923c35cb
refs/heads/develop
2023-04-10T01:39:58.757569
2021-02-06T17:57:26
2021-02-06T17:57:26
54,604,509
1
2
BSD-3-Clause
2023-04-04T01:28:54
2016-03-24T01:15:39
C++
UTF-8
C++
false
false
3,038
h
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2021, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See: https://www.mrpt.org/License | +------------------------------------------------------------------------+ */ #pragma once #include <atomic> #include <condition_variable> #include <cstdint> #include <functional> #include <future> #include <mutex> #include <queue> #include <thread> #include <vector> namespace mrpt::system { /** * @brief A simple thread pool * * \note Partly based on: https://github.com/progschj/ThreadPool (ZLib license) */ class WorkerThreadsPool { public: enum queue_policy_t : uint8_t { /** Default policy: all tasks are executed in FIFO order */ POLICY_FIFO, /** If a task arrives and there are more pending tasks than worker threads, drop previous tasks. */ POLICY_DROP_OLD }; WorkerThreadsPool() = default; WorkerThreadsPool(std::size_t num_threads, queue_policy_t p = POLICY_FIFO) : policy_(p) { resize(num_threads); } ~WorkerThreadsPool() { clear(); } void resize(std::size_t num_threads); void clear(); //!< Stops all working jobs /** Enqueue one new working item, to be executed by threads when any is * available. */ template <class F, class... Args> auto enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type>; /** Returns the number of enqueued tasks, currently waiting for a free * working thread to process them. */ std::size_t pendingTasks() const noexcept; private: std::vector<std::thread> threads_; std::atomic_bool do_stop_{false}; std::mutex queue_mutex_; std::condition_variable condition_; std::queue<std::function<void()>> tasks_; queue_policy_t policy_{POLICY_FIFO}; }; template <class F, class... Args> auto WorkerThreadsPool::enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type> { using return_type = typename std::result_of<F(Args...)>::type; auto task = std::make_shared<std::packaged_task<return_type()>>( std::bind(std::forward<F>(f), std::forward<Args>(args)...)); std::future<return_type> res = task->get_future(); { std::unique_lock<std::mutex> lock(queue_mutex_); // don't allow enqueueing after stopping the pool if (do_stop_) throw std::runtime_error("enqueue on stopped ThreadPool"); // policy check: drop pending tasks if we have more tasks than threads if (policy_ == POLICY_DROP_OLD) { while (tasks_.size() >= threads_.size()) { tasks_.pop(); } } // Enqeue the new task: tasks_.emplace([task]() { (*task)(); }); } condition_.notify_one(); return res; } } // namespace mrpt::system
[ "joseluisblancoc@gmail.com" ]
joseluisblancoc@gmail.com
4ca0f7c65ed4eb4cd1f9651e983c6536c7ac0524
fd10d9751c5ef6cbcad14c0bf2ba3a92bc08de78
/analyzer/DanglingDelegateCommon.cpp
dadffd5486e0d25af6d69e3f8902611f6ef3b920
[ "BSD-3-Clause", "NCSA" ]
permissive
harite/facebook-clang-plugins
963a33cbd984d5519154fdc4c674415f72a7cee8
3faedd34d17438ff177270acd7ca7c6d84e8d3f6
refs/heads/master
2021-01-18T03:48:28.901789
2015-09-09T12:38:51
2015-09-09T13:55:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,950
cpp
/** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #include <clang/StaticAnalyzer/Core/Checker.h> #include <clang/StaticAnalyzer/Core/BugReporter/BugType.h> #include <clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h> #include <clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h> #include "DanglingDelegateCommon.h" using namespace clang; using namespace ento; namespace DanglingDelegate { const ObjCInterfaceDecl *getCurrentTopClassInterface(const CheckerContext &context) { const StackFrameContext *sfc = context.getStackFrame(); while (sfc && !sfc->inTopFrame()) { sfc = sfc->getParent()->getCurrentStackFrame(); } if (!sfc) { return NULL; } const ObjCMethodDecl *md = dyn_cast_or_null<ObjCMethodDecl>(sfc->getDecl()); if (!md) { return NULL; } return md->getClassInterface(); } // strips expressions a bit more than IgnoreParenImpCasts const Expr *ignoreOpaqueValParenImpCasts(const Expr *expr) { if (!expr) { return NULL; } const Expr *E = expr; do { expr = E; E = E->IgnoreParenImpCasts(); const OpaqueValueExpr *ove = dyn_cast_or_null<OpaqueValueExpr>(E); if (ove) { E = ove->getSourceExpr(); } } while (E != NULL && E != expr); return E; } bool isObjCSelfExpr(const Expr *expr) { expr = ignoreOpaqueValParenImpCasts(expr); if (!expr) { return false; } return expr->isObjCSelfExpr(); } const Expr *getArgOfObjCMessageExpr(const ObjCMessageExpr &expr, unsigned index) { if (expr.getNumArgs() < index + 1) { return NULL; } return expr.getArg(index); } const std::string getPropertyNameFromSetterSelector(const Selector &selector) { StringRef selectorStr = selector.getAsString(); // fancy names for setters are not supported if (!selectorStr.startswith("set")) { return ""; } std::string propName = selectorStr.substr(3, selectorStr.size()-4); if (propName.size() < 1) { return ""; } char x = propName[0]; propName[0] = (x >= 'A' && x <= 'Z' ? x - 'A' + 'a' : x); return propName; } const ObjCPropertyDecl *matchObjCMessageWithPropertyGetter(const ObjCMessageExpr &expr) { const ObjCMethodDecl *methDecl = expr.getMethodDecl(); if (!methDecl) { return NULL; } if (!methDecl->isPropertyAccessor() || methDecl->param_size() != 0) { return NULL; } const ObjCInterfaceDecl *intDecl = expr.getReceiverInterface(); if (!intDecl) { return NULL; } StringRef propName = expr.getSelector().getAsString(); IdentifierInfo &ii = intDecl->getASTContext().Idents.get(propName); return intDecl->FindPropertyDeclaration(&ii); } const ObjCPropertyDecl *matchObjCMessageWithPropertySetter(const ObjCMessageExpr &expr) { const ObjCMethodDecl *methDecl = expr.getMethodDecl(); if (!methDecl) { return NULL; } if (!methDecl->isPropertyAccessor() || methDecl->param_size() != 1) { return NULL; } const ObjCInterfaceDecl *intDecl = expr.getReceiverInterface(); if (!intDecl) { return NULL; } Selector selector = expr.getSelector(); std::string propName = getPropertyNameFromSetterSelector(selector); if (propName == "") { return NULL; } IdentifierInfo &II = intDecl->getASTContext().Idents.get(propName); return intDecl->FindPropertyDeclaration(&II); } // matches expressions _x and self.x const ObjCIvarDecl *matchIvarLValueExpression(const Expr &expr) { const Expr *normExpr = ignoreOpaqueValParenImpCasts(&expr); if (!normExpr) { return NULL; } // ivar? const ObjCIvarRefExpr *ivarRef = dyn_cast<ObjCIvarRefExpr>(normExpr); if (ivarRef) { return ivarRef->getDecl(); } // getter on self? const PseudoObjectExpr *poe = dyn_cast<PseudoObjectExpr>(normExpr); if (!poe) { return NULL; } const ObjCPropertyRefExpr *pre = dyn_cast_or_null<ObjCPropertyRefExpr>(poe->getSyntacticForm()); if (!pre) { return NULL; } // we want a getter corresponding to a real ivar of the current class if (!pre->isMessagingGetter() || pre->isImplicitProperty()) { return NULL; } const Expr *base = ignoreOpaqueValParenImpCasts(pre->getBase()); if (!base || !base->isObjCSelfExpr()) { return NULL; } ObjCPropertyDecl *propDecl = pre->getExplicitProperty(); if (!propDecl) { return NULL; } return propDecl->getPropertyIvarDecl(); } // matches [NSNotificationCenter defaultCenter] etc and make a string out of it const std::string matchObservableSingletonObject(const Expr &expr) { const ObjCMessageExpr *msg = dyn_cast_or_null<ObjCMessageExpr>(ignoreOpaqueValParenImpCasts(&expr)); if (!msg || msg->getReceiverKind() != ObjCMessageExpr::Class || !msg->getReceiverInterface()) { return ""; } std::string intName = msg->getReceiverInterface()->getNameAsString(); std::string selectorStr = msg->getSelector().getAsString(); if (intName == "NSNotificationCenter" && selectorStr == "defaultCenter") { return "+[" + intName + " " + selectorStr + "]"; } return ""; } bool isKnownToBeNil(const clang::ento::SVal &sVal, clang::ento::CheckerContext &context) { Optional<DefinedSVal> dv = sVal.getAs<DefinedSVal>(); if (dv) { ConstraintManager &manager = context.getConstraintManager(); ProgramStateRef stateNotNull = manager.assume(context.getState(), *dv, true); if (!stateNotNull) { // the value cannot be "not null" return true; } } return false; } } // end of namespace
[ "mathieubaudet@fb.com" ]
mathieubaudet@fb.com
69eca6d929e429912ea850e544f7074da81b1acb
730a591e0bbef0d9abb7adbf45e0968b5f6bd7f0
/cpputils/Utils/Common/CommonUtils.cpp
78dda52f89a7f821904715ab540df1a4330c522c
[]
no_license
KAndQ/cocos2dx-utils
5c574287a9c46037838d348b0ce8b8b565c1bed8
497de1e41a660a6b4308061b14740b31534611d4
refs/heads/master
2021-01-01T18:54:49.746170
2015-06-04T11:56:22
2015-06-04T11:56:22
35,252,503
2
0
null
null
null
null
UTF-8
C++
false
false
10,654
cpp
// // CommonUtils.cpp // AndroidaBooM // // Created by Zhenyu Yao on 13-4-12. // // #include <stdio.h> #include <sstream> #include <math.h> #include <ctype.h> #include "CommonUtils.h" using namespace std; float PTM_RATIO = 32; //////////////////////////////////////////////////////////////////////////////////////////////////// // 一些常用功能 //////////////////////////////////////////////////////////////////////////////////////////////////// float32 floatValueFromDictionary(CCDictionary * dict, const string & key) { CCString * result = dynamic_cast<CCString *>(dict->objectForKey(key)); if (result != NULL) { return result->floatValue(); } else { return 0.0f; } } int32 intValueFromDictionary(CCDictionary * dict, const string & key) { CCString * result = dynamic_cast<CCString *>(dict->objectForKey(key)); if (result != NULL) { return result->intValue(); } else { return 0; } } uint32 uintValueFromDictionary(CCDictionary * dict, const string & key) { CCString * result = dynamic_cast<CCString *>(dict->objectForKey(key)); if (result != NULL) { return result->uintValue(); } else { return 0; } } bool boolValueFromDictionary(CCDictionary * dict, const string & key) { CCString * result = dynamic_cast<CCString *>(dict->objectForKey(key)); if (result != NULL) { return result->boolValue(); } else { return false; } } string stringValueFromDictionary(CCDictionary * dict, const string & key) { CCString * result = dynamic_cast<CCString *>(dict->objectForKey(key)); if (result != NULL) { return string(result->getCString()); } else { return string(); } } void tintAllSprite(CCNode * root, const ccColor4B & color) { Vector<CCNode *>::const_iterator beg = root->getChildren().begin(); Vector<CCNode *>::const_iterator end = root->getChildren().end(); for (; beg != end; ++beg) { CCNode * child = (CCNode *)*beg; tintAllSprite(child, color); } if (dynamic_cast<CCRGBAProtocol *>(root) != NULL) { CCRGBAProtocol * p = dynamic_cast<CCRGBAProtocol *>(root); p->setColor(ccc3(color.r, color.g, color.b)); p->setOpacity(color.a); } } void pauseAll(cocos2d::CCNode* node) { Vector<CCNode *>::const_iterator beg = node->getChildren().begin(); Vector<CCNode *>::const_iterator end = node->getChildren().end(); for (; beg != end; ++beg) { CCNode * child = (CCNode *)*beg; pauseAll(child); } node->pause(); } void resumeAll(cocos2d::CCNode* node) { Vector<CCNode *>::const_iterator beg = node->getChildren().begin(); Vector<CCNode *>::const_iterator end = node->getChildren().end(); for (; beg != end; ++beg) { CCNode * child = (CCNode *)*beg; resumeAll(child); } node->resume(); } //////////////////////////////////////////////////////////////////////////////////////////////////// // 几何/数学 //////////////////////////////////////////////////////////////////////////////////////////////////// float convertRadianToDegree(float radian) { return radian / M_PI * 180.0f; } float convertDegreeToRadian(float degree) { return degree / 180.0f * M_PI; } #if (ENABLED_BOX2D) CCPoint pointFromVec(const b2Vec2 & vec) { return ccp(vec.x, vec.y); } b2Vec2 vecFromPoint(const CCPoint & point) { return b2Vec2(point.x, point.y); } CCPoint pointFromVec_meter(const b2Vec2 & vec) { return ccp(vec.x * PTM_RATIO, vec.y * PTM_RATIO); } b2Vec2 vecFromPoint_meter(const CCPoint & point) { return b2Vec2(point.x / PTM_RATIO, point.y / PTM_RATIO); } #endif // ENABLED_BOX2D float pointFromMeter(float meterUnit) { return meterUnit * PTM_RATIO; } float meterFromPoint(float pointUnit) { return pointUnit / PTM_RATIO; } bool CCRectContainsRect(cocos2d::CCRect& rect1, cocos2d::CCRect& rect2) { if ((rect2.origin.x - rect1.origin.x <= rect1.size.width - rect2.size.width) &&rect2.origin.x >= rect1.origin.x &&rect2.origin.y >= rect1.origin.y && (rect2.origin.y - rect1.origin.y < rect1.size.height - rect2.size.height)) { return true; } return false; } //////////////////////////////////////////////////////////////////////////////////////////////////// // 分辨率处理 //////////////////////////////////////////////////////////////////////////////////////////////////// void adapterLandscapeResolution(float contentScale) { CCDirector * pDirector = CCDirector::sharedDirector(); // 屏幕适配 CCSize designSize = pDirector->getWinSize(); if ((designSize.width == 960 && designSize.height == 640) // iPhone4, 4S, iPod4 || (designSize.width == 1136 && designSize.height == 640) // iPhone5, iPod5 || (designSize.width == 1024 && designSize.height == 768)) // iPad1,2, iPad mini { // designSize.width /= contentScale; // designSize.height /= contentScale; designSize.width = 960 / contentScale; designSize.height = 640 / contentScale; } else if (designSize.width == 2048 && designSize.height == 1536) // iPad3 { // designSize.width /= contentScale * 2.0f; // designSize.height /= contentScale * 2.0f; designSize.width = 960 / contentScale; designSize.height = 640 / contentScale; } else // 其他分辨率 & iPhone3GS { designSize.width = 960 / contentScale; designSize.height = 640 / contentScale; } pDirector->setContentScaleFactor(contentScale); // pDirector->getOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionFixedHeight); pDirector->getOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); } void adapterPortraitResolution(float contentScale) { CCDirector * pDirector = CCDirector::sharedDirector(); CCSize designSize = pDirector->getWinSize(); if ((designSize.width == 640 && designSize.height == 960) || (designSize.width == 640 && designSize.height == 1136) || (designSize.width == 768 && designSize.height == 1024)) { designSize.width /= contentScale; designSize.height /= contentScale; } else if (designSize.width == 1536 && designSize.height == 2048) { designSize.width /= contentScale * 2.0f; designSize.height /= contentScale * 2.0f; } else { designSize.width = 640 / contentScale; designSize.height = 960 / contentScale; } pDirector->setContentScaleFactor(contentScale); pDirector->getOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionFixedHeight); } //////////////////////////////////////////////////////////////////////////////////////////////////// // 字符串处理 //////////////////////////////////////////////////////////////////////////////////////////////////// string int32ToString(int32 value) { char str[32] = {0}; sprintf(str, "%d", value); return string(str); } string uint32ToString(uint32 value) { char str[32] = {0}; sprintf(str, "%u", value); return string(str); } string uint64ToString(uint64 value) { char str[32] = {0}; sprintf(str, "%llu", value); return string(str); } string float32ToString(float32 value) { char str[32] = {0}; sprintf(str, "%f", value); return string(str); } string boolToString(bool value) { if (value) return string("true"); else return string("false"); } int32 int32FromString(const std::string & value) { if (value.empty()) return 0; istringstream iss(value); int32 number; iss >> number; return number; } uint32 uint32FromString(const std::string & value) { if (value.empty()) return 0; istringstream iss(value); uint32 number; iss >> number; return number; } uint64 uint64FromString(const std::string & value) { if (value.empty()) return 0; istringstream iss(value); uint64 number; iss >> number; return number; } float32 float32FromString(const std::string & value) { if (value.empty()) return 0.0f; istringstream iss(value); float32 number; iss >> number; return number; } bool boolFromString(const std::string & value) { std::string tmp = value; asciiToLower(tmp); if (tmp == "false" || tmp == "no" || tmp == "0") return false; return true; } void asciiToLower(std::string & origin) { for (size_t i = 0; i < origin.length(); ++i) origin[i] = tolower(origin[i]); } void asciiToUpper(std::string & origin) { for (size_t i = 0; i < origin.length(); ++i) origin[i] = toupper(origin[i]); } void slitStringBySeperator(const string & origin, vector<string> & others, const string & seperator) { size_t beg = 0; size_t end = 0; size_t originLen = origin.length(); size_t seperatorLen = seperator.length(); while (beg < originLen) { end = origin.find(seperator, beg); // 如果起始位置与终止位置在同一个地方, 那么将不记录字符串, 因为不存在截断的字符串. if (beg != end) { if (end == string::npos) { // 如果 (beg == 0 && end == string::npos), 那么表示的是没有搜索到分割符, 那么将不分离各个字符串. // 而下面的代码表示的是, 从当前位置切割字符串, 直到字符串末尾. if (beg != 0) { others.push_back(origin.substr(beg, end)); } break; } else { others.push_back(origin.substr(beg, end - beg)); } } beg = end + seperatorLen; } } string trimCharacterFromLast(const std::string & origin, char chTrim) { for (size_t i = origin.length() - 1; i < 0xffffffff; --i) { if (origin[i] != chTrim) { return origin.substr(0, i + 1); } } static string s_reuslt(""); return s_reuslt; } string subStringWithCharacterFromHead(const std::string& origin, char chSign) { size_t pos = origin.rfind(chSign); if (pos == string::npos) return origin; return origin.substr(0,pos); } string subStringWithCharacterFromLast(const std::string& origin, char chSign) { size_t pos = origin.rfind(chSign); if (pos == string::npos) return origin; return origin.substr(pos + 1); } string stringByDeletingPathExtension(const std::string & origin) { size_t pos = origin.rfind("."); return origin.substr(0, pos); } string stringByAppendingPathExtension(const std::string & origin, const std::string & extension) { return origin + "." + extension; } string pathExtensionWithString(const std::string & file) { size_t pos = file.rfind("."); if (pos == string::npos) return ""; if (pos == file.length() - 1) return ""; return file.substr(pos + 1); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // end file
[ "qingkaka@gmail.com" ]
qingkaka@gmail.com
3f60cd7782b1a1dc3c0adc87672c3823c1163564
ef1173942b5783df6bda77dbfaa04966960782d0
/src/dialogs/RemoteDialog.h
c82961f7cb8a8c724c32f9144d44a891ce172536
[ "MIT" ]
permissive
dgalli1/gitahead
4e1d97226df9852a69af5117b25387c66c8c62cf
7304964210a5c216e17f2f86db2250a8dabc4333
refs/heads/master
2020-06-23T16:45:43.372139
2019-11-07T11:35:26
2019-11-07T11:35:26
198,684,774
0
0
MIT
2019-07-24T17:54:42
2019-07-24T17:54:41
null
UTF-8
C++
false
false
862
h
// // Copyright (c) 2016, Scientific Toolworks, Inc. // // This software is licensed under the MIT License. The LICENSE.md file // describes the conditions under which this software may be distributed. // // Author: Jason Haslam // #ifndef REMOTEDIALOG_H #define REMOTEDIALOG_H #include <QDialog> #include "git/Repository.h" class ReferenceList; class RepoView; class QCheckBox; class QComboBox; class QLineEdit; namespace git { class Reference; class Remote; } class RemoteDialog : public QDialog { public: enum Kind { Fetch, Pull, Push }; RemoteDialog(Kind kind, RepoView *parent); private: QComboBox *mRemotes; ReferenceList *mRefs = nullptr; QComboBox *mAction = nullptr; QCheckBox *mTags = nullptr; QCheckBox *mSetUpstream = nullptr; QCheckBox *mForce = nullptr; QLineEdit *mRemoteRef = nullptr; }; #endif
[ "jason@scitools.com" ]
jason@scitools.com
ca497fb44fe3735a7e4e2f6c4b16231c06f3e536
8d227ac6d2a8b70e545845824caa561a34c35483
/P08/full_credit/tool.h
2841a07a3849db532a9f9d4c3fb297ccbd32c8cb
[]
no_license
zakyqalawi/cse1325
91585e7202773a33fa1d015b2b8f43e5484d2a1c
eedfa02fe0e9cce384b73ba6a92e027a7acf0e98
refs/heads/master
2023-01-24T17:56:21.288902
2020-12-08T06:32:53
2020-12-08T06:32:53
292,068,396
0
0
null
null
null
null
UTF-8
C++
false
false
176
h
#ifndef __TOOL_H #define __TOOL_H #include "product.h" class Tool : public Product { public: Tool(std::string name, double price, std::string description); }; #endif
[ "zaky.qalawi@mavs.uta.edu" ]
zaky.qalawi@mavs.uta.edu
78f35111dd3b413e2bbeb307f0bae21ebd7ede26
9a9e7d9eafad23d3690f7f8104daf35f08c03aab
/HelloGit/HelloGit.cpp
924bf65874c8d084f822e3d00aa038ffd3b8f113
[]
no_license
0I00II000I00I0I0/TestGit
80718460048baa565259d34f9193b5625c9d746f
df235eff4f0e2a2731f209c6a7a8f2ab07f012ee
refs/heads/master
2023-05-31T10:46:04.867955
2021-06-30T15:40:06
2021-06-30T15:40:06
381,754,818
0
0
null
null
null
null
UTF-8
C++
false
false
101
cpp
#include <iostream> int main() { std::cout << "Hello Git!\n"; system("pause"); return 0; }
[ "1357669331@qq.com" ]
1357669331@qq.com
7bb0dc5645963cf0bb61414db3593dfda0716dfe
854a3640d1811db7ba5713cc08d0a85940bd9987
/Tutorial/STL/Set1.cpp
a16d4e15883a333a91e3587ff507e58e4f01f7ea
[]
no_license
Anupam-USP/CP
0c2f0f7aba7086f2abc2f260d9c1bb156a83e491
fb501111592f60c59bf47775b160d2fa26327f1b
refs/heads/main
2023-07-14T16:41:11.885280
2021-08-21T03:56:46
2021-08-21T03:56:46
366,267,553
0
0
null
null
null
null
UTF-8
C++
false
false
539
cpp
#include <bits/stdc++.h> using namespace std; ll main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ll arr[] = {10, 20, 30, 30, 40, 50}; ll n = sizeof(arr) / sizeof(ll); set<ll> s; for (ll i = 0; i < n; i++) s.insert(arr[i]); for (auto it = s.begin(); it != s.end(); it++) cout << *it << endl; s.erase(30); for (auto it = s.begin(); it != s.end(); it++) cout << *it << " -> "; return 0; }
[ "ianupam1509@gmail.com" ]
ianupam1509@gmail.com
108439f7fa1e281bc390d1af1a1d06c1d3cfaaa8
72d9009d19e92b721d5cc0e8f8045e1145921130
/iBATCGH/src/prXImixture.cpp
7d04ed9d86ad3d4cd8ee5d317fd47db0a270cf0d
[]
no_license
akhikolla/TestedPackages-NoIssues
be46c49c0836b3f0cf60e247087089868adf7a62
eb8d498cc132def615c090941bc172e17fdce267
refs/heads/master
2023-03-01T09:10:17.227119
2021-01-25T19:44:44
2021-01-25T19:44:44
332,027,727
1
0
null
null
null
null
UTF-8
C++
false
false
1,175
cpp
// [[Rcpp::depends(iBATCGH]] #include <prMixture.h> // [[Rcpp::interfaces(cpp)]] double pr2(int choice,int m,int chg,double add,double* mGam,double* mOm1,double* mOm2,double* mGamNew,double* mOm1New,double* mOm2New,int* mR, int mg){ arma::icolvec R(mR,mg,false); arma::colvec gamma(mGam,m,false); arma::colvec omega1(mOm1,m,false); arma::colvec omega2(mOm2,m,false); arma::colvec gammanew(mGamNew,m,false); arma::colvec omega1new(mOm1New,m,false); arma::colvec omega2new(mOm2New,m,false); double out=0; if(choice==0){ out=out+pRedge(gammanew[choice],omega2new[choice],R[chg+choice],R[chg+choice+1],add); out=out-pRedge(gamma[choice],omega2[choice],R[chg+choice],R[chg+choice+1],add); } if(choice==(m-1)){ out=out+pRedge(gammanew[choice],omega1new[choice],R[chg+choice],R[chg+choice-1],add); out=out-pRedge(gamma[choice],omega1[choice],R[chg+choice],R[chg+choice-1],add); } if(choice>0 && choice<(m-1)){ out=out+pRmiddle(gammanew[choice],omega1new[choice],omega2new[choice],R[chg+choice],R[chg+choice-1],R[chg+choice+1],add); out=out-pRmiddle(gamma[choice],omega1[choice],omega2[choice],R[chg+choice],R[chg+choice-1],R[chg+choice+1],add); } return out; }
[ "akhilakollasrinu424jf@gmail.com" ]
akhilakollasrinu424jf@gmail.com
afac4dcbaf61694d1c00e8aea61c10d557252a5f
eb69a246a9dbd9d12512db28513e54e56ed5461f
/src/eeprom_emu.h
d1a9079a52261f408870a2f4361bdb6d9901bd57
[ "MIT" ]
permissive
erwzqsdsdsf/dispenser
9c0de83ac6248c4b81df86c6eee5c1ef7201b83b
e0283af232a65a840dedb15feaaccf1294a3a7cb
refs/heads/master
2023-02-26T00:26:58.783689
2021-01-21T23:51:58
2021-01-21T23:51:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,678
h
#ifndef __EEPROM_EMU__ #define __EEPROM_EMU__ #include <stdint.h> /* Driver class FlashDriver { public: enum { BankSize = XXXX }; static void erase(uint8_t bank) {}; static uint32_t read(uint8_t bank, uint16_t addr); // If 32bit write requires multiple operations, those MUST follow from // least significant bits to most significant bits. static uint32_t write(uint8_t bank, uint16_t addr, uint32_t data); } */ /* Bank structure: [ 8 bytes bank marker ] [ 8 bytes record ] [ 8 bytes record ]... Bank Marker: - [ 0x77EE, 0xFFFF, 0xFFFF, 0xFFFF ] => active, current - [ 0x77EE, NOT_EMPTY, 0xFFFF, 0xFFFF ] => ready to erase (!active) - [ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF ] => erased OR on progress of transfer Data record: [ 0x55AA, address_16, data_lo_16, data_hi_16 ] 2-phase commits used to guarantee data consistency. Commit mark (0x55AA) is stored separate, because many modern flashes use additional ECC bits and not allow old data partial override with zero bits. Value 0x55AA at record start means write was completed with success */ template <typename FLASH_DRIVER> class EepromEmu { enum { EMPTY = 0xFFFF, RECORD_SIZE = 8, BANK_HEADER_SIZE = 8, COMMIT_MARK = 0x55AA, BANK_MARK = 0x77EE, BANK_DIRTY_MARK = 0x5555 }; bool initialized = false; uint8_t current_bank = 0; uint32_t next_write_offset; bool is_clear(uint8_t bank) { for (uint32_t i = 0; i < FLASH_DRIVER::BankSize; i += 2) { if (flash.read_u16(bank, i) != EMPTY) return false; } return true; } bool is_active(uint8_t bank) { if ((flash.read_u16(bank, 0) == BANK_MARK) && (flash.read_u16(bank, 2) == EMPTY) && (flash.read_u16(bank, 4) == EMPTY) && (flash.read_u16(bank, 6) == EMPTY)) return true; return false; } uint32_t find_write_offset() { uint32_t ofs = BANK_HEADER_SIZE; for (; ofs <= FLASH_DRIVER::BankSize - RECORD_SIZE; ofs += RECORD_SIZE) { if ((flash.read_u16(current_bank, ofs + 0) == EMPTY) && (flash.read_u16(current_bank, ofs + 2) == EMPTY) && (flash.read_u16(current_bank, ofs + 4) == EMPTY) && (flash.read_u16(current_bank, ofs + 6) == EMPTY)) break; } return ofs; } void move_bank(uint8_t from, uint8_t to, uint16_t ignore_addr=UINT16_MAX) { if (!is_clear(to)) flash.erase(to); uint32_t dst_end_addr = BANK_HEADER_SIZE; for (uint32_t ofs = BANK_HEADER_SIZE; ofs < next_write_offset; ofs += RECORD_SIZE) { // Skip invalid records if (flash.read_u16(from, ofs + 0) != COMMIT_MARK) continue; uint16_t addr = flash.read_u16(from, ofs + 2); // Skip variable with ignored address if (addr == ignore_addr) continue; uint16_t lo = flash.read_u16(from, ofs + 4); uint16_t hi = flash.read_u16(from, ofs + 6); bool more_fresh_exists = false; // Check if more fresh record exists for (uint32_t i = ofs + RECORD_SIZE; i < next_write_offset; i += RECORD_SIZE) { // Skip invalid records if (flash.read_u16(from, i + 0) != COMMIT_MARK) continue; // Skip different addresses if (flash.read_u16(from, i + 2) != addr) continue; // More fresh (=> already copied) found more_fresh_exists = true; break; } if (more_fresh_exists) continue; flash.write_u16(to, dst_end_addr + 2, addr); flash.write_u16(to, dst_end_addr + 4, lo); flash.write_u16(to, dst_end_addr + 6, hi); flash.write_u16(to, dst_end_addr + 0, COMMIT_MARK); dst_end_addr += RECORD_SIZE; } // Mark new bank active flash.write_u16(to, 0, BANK_MARK); current_bank = to; next_write_offset = dst_end_addr; // Clean old bank in 2 steps to avoid UB: destroy header & run erase flash.write_u16(from, 2, BANK_DIRTY_MARK); flash.write_u16(from, 4, BANK_DIRTY_MARK); flash.write_u16(from, 6, BANK_DIRTY_MARK); flash.erase(from); } void init() { initialized = true; if (is_active(0)) current_bank = 0; else if (is_active(1)) current_bank = 1; else { // Both banks have no valid markers => prepare first one if (!is_clear(0)) flash.erase(0); flash.write_u16(0, 0, BANK_MARK); current_bank = 0; } next_write_offset = find_write_offset(); return; } public: FLASH_DRIVER flash; uint32_t read_u32(uint16_t addr, uint32_t dflt) { if (!initialized) init(); // Reverse scan, stop on first valid for (uint32_t ofs = next_write_offset;;) { if (ofs <= BANK_HEADER_SIZE) break; ofs -= RECORD_SIZE; if (flash.read_u16(current_bank, ofs + 0) != COMMIT_MARK) continue; if (flash.read_u16(current_bank, ofs + 2) != addr) continue; uint16_t lo = flash.read_u16(current_bank, ofs + 4); uint16_t hi = flash.read_u16(current_bank, ofs + 6); return (hi << 16) + lo; } return dflt; } void write_u32(uint16_t addr, uint32_t val) { if (!initialized) init(); uint8_t bank = current_bank; // Don't write the same value uint32_t previous = read_u32(addr, val+1); if (previous == val) return; // Check free space and swap banks if needed if (next_write_offset + RECORD_SIZE > FLASH_DRIVER::BankSize) { move_bank(bank, bank ^ 1, addr); bank ^= 1; } // Write data flash.write_u16(bank, next_write_offset + 2, addr); flash.write_u16(bank, next_write_offset + 4, val & 0xFFFF); flash.write_u16(bank, next_write_offset + 6, (uint16_t)(val >> 16) & 0xFFFF); flash.write_u16(bank, next_write_offset + 0, COMMIT_MARK); next_write_offset += RECORD_SIZE; } float read_float(uint16_t addr, float dflt) { union { uint32_t i; float f; } x; x.f = dflt; x.i = read_u32(addr, x.i); return x.f; } void write_float(uint16_t addr, float val) { union { uint32_t i; float f; } x; x.f = val; write_u32(addr, x.i); } }; #endif
[ "vitaly@rcdesign.ru" ]
vitaly@rcdesign.ru
c54ebe53971e408f526576a1bfe102d150a21a05
948f2d98cde85de3f5463fbd8fbdfd58d44b3a0e
/Stack/Valid Parentheses.cpp
58faac3dd6b6128d63d039b640a5add6baa692f0
[]
no_license
AlmoonYsl/Algorithm
1391a72bc59b09a874a4acb485e0de81d7223f8d
f9e1305e738751afc93d0212071484ac474d9d89
refs/heads/master
2022-12-25T10:19:16.670388
2020-09-30T00:12:42
2020-09-30T00:12:42
247,688,359
1
0
null
null
null
null
UTF-8
C++
false
false
637
cpp
/** * leetcode no.20 * */ bool isValid(string s) { int len = s.length(); if (len % 2 != 0) return false; stack<char> stack; for (int i = 0; i < len; ++i) { switch (s[i]){ case '(': stack.push(')'); break; case '{': stack.push('}'); break; case '[': stack.push(']'); break; default: if (stack.empty() || stack.size() > len / 2 || stack.top() != s[i]) return false; else stack.pop(); } } return stack.empty(); }
[ "784748497@qq.com" ]
784748497@qq.com
2dccb6ce2484c676f9e117a75dd28d887d43ebad
8b4525741a33753a982788fdee97dc3d6c9d2789
/src/net.h
d4bf5c31e6b2675f7ebbf3b2665c7c4082dc1d96
[ "MIT" ]
permissive
ygtars/revu
b6fb59628cd9bf67aac86786b4cfee865feb3e4b
b824a844b8b8f508a00b05e09915b44ece32a844
refs/heads/master
2020-04-22T18:25:48.229140
2019-02-15T17:58:01
2019-02-15T17:58:01
170,576,715
0
0
null
null
null
null
UTF-8
C++
false
false
21,093
h
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2015-2017 The PIVX developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NET_H #define BITCOIN_NET_H #include "bloom.h" #include "compat.h" #include "hash.h" #include "limitedmap.h" #include "mruset.h" #include "netbase.h" #include "protocol.h" #include "random.h" #include "streams.h" #include "sync.h" #include "uint256.h" #include "utilstrencodings.h" #include <deque> #include <stdint.h> #ifndef WIN32 #include <arpa/inet.h> #endif #include <boost/filesystem/path.hpp> #include <boost/foreach.hpp> #include <boost/signals2/signal.hpp> class CAddrMan; class CBlockIndex; class CNode; namespace boost { class thread_group; } // namespace boost /** Time between pings automatically sent out for latency probing and keepalive (in seconds). */ static const int PING_INTERVAL = 2 * 60; /** Time after which to disconnect, after waiting for a ping response (or inactivity). */ static const int TIMEOUT_INTERVAL = 20 * 60; /** The maximum number of entries in an 'inv' protocol message */ static const unsigned int MAX_INV_SZ = 50000; /** The maximum number of new addresses to accumulate before announcing. */ static const unsigned int MAX_ADDR_TO_SEND = 1000; /** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */ static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024; /** -listen default */ static const bool DEFAULT_LISTEN = true; /** -upnp default */ #ifdef USE_UPNP static const bool DEFAULT_UPNP = USE_UPNP; #else static const bool DEFAULT_UPNP = false; #endif /** The maximum number of entries in mapAskFor */ static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ; unsigned int ReceiveFloodSize(); unsigned int SendBufferSize(); void AddOneShot(std::string strDest); bool RecvLine(SOCKET hSocket, std::string& strLine); void AddressCurrentlyConnected(const CService& addr); CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const std::string& addrName); CNode* FindNode(const CService& ip); CNode* ConnectNode(CAddress addrConnect, const char* pszDest = NULL, bool obfuScationMaster = false); bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant* grantOutbound = NULL, const char* strDest = NULL, bool fOneShot = false); void MapPort(bool fUseUPnP); unsigned short GetListenPort(); bool BindListenPort(const CService& bindAddr, std::string& strError, bool fWhitelisted = false); void StartNode(boost::thread_group& threadGroup); bool StopNode(); void SocketSendData(CNode* pnode); typedef int NodeId; // Signals for message handling struct CNodeSignals { boost::signals2::signal<int()> GetHeight; boost::signals2::signal<bool(CNode*)> ProcessMessages; boost::signals2::signal<bool(CNode*, bool)> SendMessages; boost::signals2::signal<void(NodeId, const CNode*)> InitializeNode; boost::signals2::signal<void(NodeId)> FinalizeNode; }; CNodeSignals& GetNodeSignals(); enum { LOCAL_NONE, // unknown LOCAL_IF, // address a local interface listens on LOCAL_BIND, // address explicit bound to LOCAL_UPNP, // address reported by UPnP LOCAL_MANUAL, // address explicitly specified (-externalip=) LOCAL_MAX }; bool IsPeerAddrLocalGood(CNode* pnode); void AdvertizeLocal(CNode* pnode); void SetLimited(enum Network net, bool fLimited = true); bool IsLimited(enum Network net); bool IsLimited(const CNetAddr& addr); bool AddLocal(const CService& addr, int nScore = LOCAL_NONE); bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE); bool RemoveLocal(const CService& addr); bool SeenLocal(const CService& addr); bool IsLocal(const CService& addr); bool GetLocal(CService& addr, const CNetAddr* paddrPeer = NULL); bool IsReachable(enum Network net); bool IsReachable(const CNetAddr& addr); void SetReachable(enum Network net, bool fFlag = true); CAddress GetLocalAddress(const CNetAddr* paddrPeer = NULL); extern bool fDiscover; extern bool fListen; extern uint64_t nLocalServices; extern uint64_t nLocalHostNonce; extern CAddrMan addrman; extern int nMaxConnections; extern std::vector<CNode*> vNodes; extern CCriticalSection cs_vNodes; extern std::map<CInv, CDataStream> mapRelay; extern std::deque<std::pair<int64_t, CInv> > vRelayExpiration; extern CCriticalSection cs_mapRelay; extern limitedmap<CInv, int64_t> mapAlreadyAskedFor; extern std::vector<std::string> vAddedNodes; extern CCriticalSection cs_vAddedNodes; extern NodeId nLastNodeId; extern CCriticalSection cs_nLastNodeId; struct LocalServiceInfo { int nScore; int nPort; }; extern CCriticalSection cs_mapLocalHost; extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost; class CNodeStats { public: NodeId nodeid; uint64_t nServices; int64_t nLastSend; int64_t nLastRecv; int64_t nTimeConnected; std::string addrName; int nVersion; std::string cleanSubVer; bool fInbound; int nStartingHeight; uint64_t nSendBytes; uint64_t nRecvBytes; bool fWhitelisted; double dPingTime; double dPingWait; std::string addrLocal; }; class CNetMessage { public: bool in_data; // parsing header (false) or data (true) CDataStream hdrbuf; // partially received header CMessageHeader hdr; // complete header unsigned int nHdrPos; CDataStream vRecv; // received message data unsigned int nDataPos; int64_t nTime; // time (in microseconds) of message receipt. CNetMessage(int nTypeIn, int nVersionIn) : hdrbuf(nTypeIn, nVersionIn), vRecv(nTypeIn, nVersionIn) { hdrbuf.resize(24); in_data = false; nHdrPos = 0; nDataPos = 0; nTime = 0; } bool complete() const { if (!in_data) return false; return (hdr.nMessageSize == nDataPos); } void SetVersion(int nVersionIn) { hdrbuf.SetVersion(nVersionIn); vRecv.SetVersion(nVersionIn); } int readHeader(const char* pch, unsigned int nBytes); int readData(const char* pch, unsigned int nBytes); }; /** Information about a peer */ class CNode { public: // socket uint64_t nServices; SOCKET hSocket; CDataStream ssSend; size_t nSendSize; // total size of all vSendMsg entries size_t nSendOffset; // offset inside the first vSendMsg already sent uint64_t nSendBytes; std::deque<CSerializeData> vSendMsg; CCriticalSection cs_vSend; std::deque<CInv> vRecvGetData; std::deque<CNetMessage> vRecvMsg; CCriticalSection cs_vRecvMsg; uint64_t nRecvBytes; int nRecvVersion; int64_t nLastSend; int64_t nLastRecv; int64_t nTimeConnected; CAddress addr; std::string addrName; CService addrLocal; int nVersion; // strSubVer is whatever byte array we read from the revu. However, this field is intended // to be printed out, displayed to humans in various forms and so on. So we sanitize it and // store the sanitized version in cleanSubVer. The original should be used when dealing with // the network or revu types and the cleaned string used when displayed or logged. std::string strSubVer, cleanSubVer; bool fWhitelisted; // This peer can bypass DoS banning. bool fOneShot; bool fClient; bool fInbound; bool fNetworkNode; bool fSuccessfullyConnected; bool fDisconnect; // We use fRelayTxes for two purposes - // a) it allows us to not relay tx invs before receiving the peer's version message // b) the peer may tell us in their version message that we should not relay tx invs // until they have initialized their bloom filter. bool fRelayTxes; // Should be 'true' only if we connected to this node to actually mix funds. // In this case node will be released automatically via CMasternodeMan::ProcessMasternodeConnections(). // Connecting to verify connectability/status or connecting for sending/relaying single message // (even if it's relative to mixing e.g. for blinding) should NOT set this to 'true'. // For such cases node should be released manually (preferably right after corresponding code). bool fObfuScationMaster; CSemaphoreGrant grantOutbound; CCriticalSection cs_filter; CBloomFilter* pfilter; int nRefCount; NodeId id; protected: // Denial-of-service detection/prevention // Key is IP address, value is banned-until-time static std::map<CNetAddr, int64_t> setBanned; static CCriticalSection cs_setBanned; std::vector<std::string> vecRequestsFulfilled; //keep track of what client has asked for // Whitelisted ranges. Any node connecting from these is automatically // whitelisted (as well as those connecting to whitelisted binds). static std::vector<CSubNet> vWhitelistedRange; static CCriticalSection cs_vWhitelistedRange; // Basic fuzz-testing void Fuzz(int nChance); // modifies ssSend public: uint256 hashContinue; int nStartingHeight; // flood relay std::vector<CAddress> vAddrToSend; mruset<CAddress> setAddrKnown; bool fGetAddr; std::set<uint256> setKnown; // inventory based relay mruset<CInv> setInventoryKnown; std::vector<CInv> vInventoryToSend; CCriticalSection cs_inventory; std::multimap<int64_t, CInv> mapAskFor; std::vector<uint256> vBlockRequested; // Ping time measurement: // The pong reply we're expecting, or 0 if no pong expected. uint64_t nPingNonceSent; // Time (in usec) the last ping was sent, or 0 if no ping was ever sent. int64_t nPingUsecStart; // Last measured round-trip time. int64_t nPingUsecTime; // Whether a ping is requested. bool fPingQueued; CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn = false); ~CNode(); private: // Network usage totals static CCriticalSection cs_totalBytesRecv; static CCriticalSection cs_totalBytesSent; static uint64_t nTotalBytesRecv; static uint64_t nTotalBytesSent; CNode(const CNode&); void operator=(const CNode&); public: NodeId GetId() const { return id; } int GetRefCount() { assert(nRefCount >= 0); return nRefCount; } // requires LOCK(cs_vRecvMsg) unsigned int GetTotalRecvSize() { unsigned int total = 0; BOOST_FOREACH (const CNetMessage& msg, vRecvMsg) total += msg.vRecv.size() + 24; return total; } // requires LOCK(cs_vRecvMsg) bool ReceiveMsgBytes(const char* pch, unsigned int nBytes); // requires LOCK(cs_vRecvMsg) void SetRecvVersion(int nVersionIn) { nRecvVersion = nVersionIn; BOOST_FOREACH (CNetMessage& msg, vRecvMsg) msg.SetVersion(nVersionIn); } CNode* AddRef() { nRefCount++; return this; } void Release() { nRefCount--; } void AddAddressKnown(const CAddress& addr) { setAddrKnown.insert(addr); } void PushAddress(const CAddress& addr) { // Known checking here is only to save space from duplicates. // SendMessages will filter it again for knowns that were added // after addresses were pushed. if (addr.IsValid() && !setAddrKnown.count(addr)) { if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) { vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr; } else { vAddrToSend.push_back(addr); } } } void AddInventoryKnown(const CInv& inv) { { LOCK(cs_inventory); setInventoryKnown.insert(inv); } } void PushInventory(const CInv& inv) { { LOCK(cs_inventory); if (!setInventoryKnown.count(inv)) vInventoryToSend.push_back(inv); } } void AskFor(const CInv& inv); // TODO: Document the postcondition of this function. Is cs_vSend locked? void BeginMessage(const char* pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend); // TODO: Document the precondition of this function. Is cs_vSend locked? void AbortMessage() UNLOCK_FUNCTION(cs_vSend); // TODO: Document the precondition of this function. Is cs_vSend locked? void EndMessage() UNLOCK_FUNCTION(cs_vSend); void PushVersion(); void PushMessage(const char* pszCommand) { try { BeginMessage(pszCommand); EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1> void PushMessage(const char* pszCommand, const T1& a1) { try { BeginMessage(pszCommand); ssSend << a1; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2) { try { BeginMessage(pszCommand); ssSend << a1 << a2; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9, const T10& a10) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9, const T10& a10, const T11& a11) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11; EndMessage(); } catch (...) { AbortMessage(); throw; } } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9, const T10& a10, const T11& a11, const T12& a12) { try { BeginMessage(pszCommand); ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11 << a12; EndMessage(); } catch (...) { AbortMessage(); throw; } } bool HasFulfilledRequest(std::string strRequest) { BOOST_FOREACH (std::string& type, vecRequestsFulfilled) { if (type == strRequest) return true; } return false; } void ClearFulfilledRequest(std::string strRequest) { std::vector<std::string>::iterator it = vecRequestsFulfilled.begin(); while (it != vecRequestsFulfilled.end()) { if ((*it) == strRequest) { vecRequestsFulfilled.erase(it); return; } ++it; } } void FulfilledRequest(std::string strRequest) { if (HasFulfilledRequest(strRequest)) return; vecRequestsFulfilled.push_back(strRequest); } bool IsSubscribed(unsigned int nChannel); void Subscribe(unsigned int nChannel, unsigned int nHops = 0); void CancelSubscribe(unsigned int nChannel); void CloseSocketDisconnect(); bool DisconnectOldProtocol(int nVersionRequired, std::string strLastCommand = ""); // Denial-of-service detection/prevention // The idea is to detect peers that are behaving // badly and disconnect/ban them, but do it in a // one-coding-mistake-won't-shatter-the-entire-network // way. // IMPORTANT: There should be nothing I can give a // node that it will forward on that will make that // node's peers drop it. If there is, an attacker // can isolate a node and/or try to split the network. // Dropping a node for sending stuff that is invalid // now but might be valid in a later version is also // dangerous, because it can cause a network split // between nodes running old code and nodes running // new code. static void ClearBanned(); // needed for unit testing static bool IsBanned(CNetAddr ip); static bool Ban(const CNetAddr& ip); void copyStats(CNodeStats& stats); static bool IsWhitelistedRange(const CNetAddr& ip); static void AddWhitelistedRange(const CSubNet& subnet); // Network stats static void RecordBytesRecv(uint64_t bytes); static void RecordBytesSent(uint64_t bytes); static uint64_t GetTotalBytesRecv(); static uint64_t GetTotalBytesSent(); }; class CExplicitNetCleanup { public: static void callCleanup(); }; class CTransaction; void RelayTransaction(const CTransaction& tx); void RelayTransaction(const CTransaction& tx, const CDataStream& ss); void RelayTransactionLockReq(const CTransaction& tx, bool relayToAll = false); void RelayInv(CInv& inv); /** Access to the (IP) address database (peers.dat) */ class CAddrDB { private: boost::filesystem::path pathAddr; public: CAddrDB(); bool Write(const CAddrMan& addr); bool Read(CAddrMan& addr); }; #endif // BITCOIN_NET_H
[ "arslanyigit357@gmail.com" ]
arslanyigit357@gmail.com
a955ed7762bb7bcf1e8a2e1e253468b64aeccb8d
39586ec324eb4f52bb98c92fa385096c70cc97f5
/RNet/Socket.h
99f9d68594beb75321a4c87678e93467092723e2
[]
no_license
rvdweerd/RNet
5da7945931e1d38b24a2f3d01a41b95e414f9582
fff9942f237e1dedd75f0e0abbf98d1c939426a6
refs/heads/master
2020-09-25T08:10:37.697166
2019-12-07T14:16:24
2019-12-07T14:16:24
225,958,809
0
0
null
null
null
null
UTF-8
C++
false
false
523
h
#pragma once #include "SocketHandle.h" #include "RResult.h" #include "IPVersion.h" #include "SocketOptions.h" #include "IPEndPoint.h" namespace RNet { class Socket { public: Socket( IPVersion ipversion = IPVersion::IPv4, SocketHandle handle = INVALID_SOCKET); RResult Create(); RResult Close(); SocketHandle GetHandle(); IPVersion GetIPVersion(); private: RResult SetSocketOption(SocketOption option, BOOL value); IPVersion ipversion = IPVersion::IPv4; SocketHandle handle = INVALID_SOCKET; }; }
[ "rogerscode@gmail.com" ]
rogerscode@gmail.com
662b1f422f8c45987a133372f672e295c509c9a7
af8f0279f0a89b91bbe17fe6f13c4f5c72a45a13
/UVa/uva1588.cpp
93629c5caebb2be2e2df6a6b9fcedaa9bb438edd
[]
no_license
duguyue100/acm-training
3669a5e80093c9fa4040dfa9ba433330acf9fe8d
c0911c6a12d578c0da7458a68db586926bc594c0
refs/heads/master
2022-09-18T17:40:24.837083
2022-08-20T13:20:08
2022-08-20T13:20:08
11,473,607
62
43
null
2020-09-30T19:28:19
2013-07-17T10:41:42
C++
UTF-8
C++
false
false
1,540
cpp
// UVa 1588 Kickdown #include<bits/stdc++.h> using namespace std; int main() { // freopen("input.in", "r", stdin); // freopen("output.out", "w", stdout); string line1, line2; while (cin >> line1 >> line2) { if (line1.size() < line2.size()) { swap(line1, line2); } size_t lin1_l = line1.size(); size_t lin2_l = line2.size(); string padding(line2.size()-1, '0'); line1 = padding+line1+padding; int min_len = lin1_l+lin2_l; for (size_t i=0; i<lin1_l+lin2_l-1; i++) { int flag = true; for (size_t j=0; j<lin2_l; j++) { if ((line2[j]-'0')+(line1[i+j]-'0') > 3) { flag = false; break; } } if (flag == true) { int len = 0; // output length if (i >= lin2_l-1 && i<= lin1_l-1) { len = lin1_l; min_len = len; break; } else if (i<lin2_l-1) { len = lin1_l+lin2_l-1-i; } else if (i>lin1_l-2) { len = i+1; } if (min_len > len) { min_len = len; } } } cout << min_len << endl; } return 0; }
[ "duguyue100@gmail.com" ]
duguyue100@gmail.com
ef8c3bcb0722068fc2eb384eb45b5827cbd3a6e2
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/MdtCalibData/MdtSlewCorFuncHardcoded.h
c97f039df854215943acd3baa8020c2f3fb39411
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
797
h
/* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCALIB_MdtSlewCorFuncHardcoded_H #define MUONCALIB_MdtSlewCorFuncHardcoded_H #include "MdtCalibData/IMdtSlewCorFunc.h" #include "map" namespace MuonCalib { /** implementation of a slewing correction function */ class MdtSlewCorFuncHardcoded : public IMdtSlewCorFunc { public: explicit MdtSlewCorFuncHardcoded( const CalibFunc::ParVec& vec ) : IMdtSlewCorFunc(vec){} inline virtual std::string name() const { return "MdtSlewCorFuncHardCoded"; } static unsigned int nUsedPar() { return 0; } virtual double correction(double t, double adc) const; double calibrated_p(const double & adc) const; static std::map<short, float> m_LUT; }; } //namespace MuonCalib #endif
[ "rushioda@lxplus754.cern.ch" ]
rushioda@lxplus754.cern.ch
f08684476e3018d0ec5127442321cf4623e640d6
ebbe390ffdd7653730017fdb73dd5b4f6c15fd1e
/Tonya_earthquakescreens.ino
1e6de4cae2b1cec91545e79af6635aef244e87f9
[]
no_license
benthejack-vuw/Tonya-earthquakescreens
1b2719e4dba86d4f094fb4b62f8ef9240ec8d289
920ea70282e251c0b30c2cc7b55c29cdaf365541
refs/heads/master
2021-01-13T03:01:50.636689
2016-12-22T00:17:25
2016-12-22T00:17:25
77,018,217
0
0
null
null
null
null
UTF-8
C++
false
false
2,225
ino
//DONT CHANGE THESE, RATHER USE THE NAMES IN SETUP TO SET IT TO THE CORRECT ZONE //THE RASPBERRY PI USES THESE ADDRESSES SO IT'S IMPORTANT THAT THEY ARE LEFT AS IS #define ALASKA 1 #define CENTRAL_AMERICA 2 #define SOUTH_AMERICA 3 #define NEW_ZEALAND 4 #define JAPAN 5 //PINS USED FOR OLED SCREEN #define dc 9 #define rst 8 #define cs 7 // Color definitions #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1351.h> #include <SPI.h> //Option 2: use the hardware SPI pins (pins 11 & 13) Adafruit_SSD1351 tft = Adafruit_SSD1351(cs, dc, rst); bool motor = false; int earthquakeVibrationTime = 10; //time in seconds void setup() { //THE FOLLOWING LINE YOU NEED TO PUT IN THE CORRECT ZONE BEFORE UPLOADING TO THE ARDUINO Wire.begin(5`); Wire.onReceive(receiveEvent); // register event //-------------------------------------------------------------------------------------- tft.begin();//begins the OLED screen tft.fillScreen(BLACK); pinMode(2, OUTPUT); //for debugging LED - put an led between pin 9 and gnd with a 220ohm resistor for data testing digitalWrite(2, LOW); } void loop() { if(motor){ digitalWrite(2, HIGH); delay(earthquakeVibrationTime*1000); digitalWrite(2, LOW); motor = false; } delay(100); } void drawData(int data){ //YOUR EARTHQUAKE ELLIPSE DRAWING GOES HERE the data variable contains the magnitude of the quake //THIS FUNCTION WILL ONLY BE CALLED WHEN THERE IS A QUAKE IN THE CORRECT VICINITY //-------replace this drawing code, it currently only shows the data variable as text------------- tft.fillScreen(BLACK); tft.setCursor(0, 5); tft.setTextColor(BLUE); tft.setTextSize(3); tft.print(data); } // this function is registered as an event, it is triggered on an I2C commnication to this board. void receiveEvent(int howMany) { int x = Wire.read(); // receive byte as an integer drawData(x); motor = x > 0; }
[ "benthejack@gmail.com" ]
benthejack@gmail.com
b8378fad4c7804af04710d83efe0461dbee3bcf3
b367fe5f0c2c50846b002b59472c50453e1629bc
/xbox_leak_may_2020/xbox trunk/xbox/private/vc7addon/vs/src/vc/ide/pkgs/projbld/stdconversion/dirmgr.cpp
8d2e38484ec236c68f57eb09532bdba8cc5a7040
[]
no_license
sgzwiz/xbox_leak_may_2020
11b441502a659c8da8a1aa199f89f6236dd59325
fd00b4b3b2abb1ea6ef9ac64b755419741a3af00
refs/heads/master
2022-12-23T16:14:54.706755
2020-09-27T18:24:48
2020-09-27T18:24:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,034
cpp
// DIRMGR.CPP // ---------- // Implementation of CDirMgr and CToolset class. // // History // ======= // 28-Aug-93 mattg Created // 10-Jan-94 colint Added CToolset class // //////////////////////////////////////////////////////////// // Include files #include "stdafx.h" #pragma hdrstop #include "dirmgr.h" #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif //////////////////////////////////////////////////////////// // Global variables CDirMgr g_theDirMgr; // The one and only CDirMgr CDirMgr * GetDirMgr() {return &g_theDirMgr;} //////////////////////////////////////////////////////////// // Helper routines static VOID DestroyListContents ( CObList * pList ) { POSITION pos = pList->GetHeadPosition(); while (pos != NULL) delete pList->GetNext(pos); pList->RemoveAll(); } //////////////////////////////////////////////////////////// // CToolset Class //////////////////////////////////////////////////////////// // Constructors, destructors CToolset::CToolset ( ) { INT type; for (type=0; type<C_DIRLIST_TYPES ; ++type) m_Dirs[type] = new CObList; } CToolset::~CToolset ( ) { INT type; CObList * pList; for (type=0; type<C_DIRLIST_TYPES ; ++type) { if ((pList = m_Dirs[(DIRLIST_TYPE)type]) != NULL) { DestroyListContents(pList); delete pList; } } } //////////////////////////////////////////////////////////// // CToolset::GetDirList CObList * CToolset::GetDirList ( DIRLIST_TYPE type ) { VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); return (m_Dirs[type]); } ///////////////////////////////////////////////////////////// // CToolset::GetDirListString VOID CToolset::GetDirListString ( CString& str, DIRLIST_TYPE type ) { str.Empty(); VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); if (type < DIRLIST_PATH || type >= C_DIRLIST_TYPES) return; CObList* pList = GetDirList(type); if (pList == NULL) return; POSITION pos = pList->GetHeadPosition(); while (pos != (POSITION)NULL) { if (!str.IsEmpty()) str += _T(";"); str += (const TCHAR *)*(CDir *)pList->GetNext(pos); } } ///////////////////////////////////////////////////////////// // CToolset::RefreshAllCachedStrings VOID CToolset::RefreshAllCachedStrings ( ) { INT type; for ( type = 0; type < C_DIRLIST_TYPES ; ++type ) { CString &str = m_DirString[type]; CObList *pList = m_Dirs[type]; str.Empty(); if ( pList != NULL ) { POSITION pos = pList->GetHeadPosition(); while ( pos != NULL ) { if (!str.IsEmpty()) str += _T(';'); str += (const TCHAR *)*(CDir *)pList->GetNext(pos); } } } } //////////////////////////////////////////////////////////// // CToolset::SetDirList VOID CToolset::SetDirList ( DIRLIST_TYPE type, CObList * pListNew ) { VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); VSASSERT(pListNew != NULL, "Cannot add NULL list"); if (m_Dirs[type] != NULL) { DestroyListContents(m_Dirs[type]); delete m_Dirs[type]; } m_Dirs[type] = pListNew; RefreshAllCachedStrings( ); } //////////////////////////////////////////////////////////// // CDirMgr Class //////////////////////////////////////////////////////////// // Constructors, destructors CDirMgr::CDirMgr ( ) { m_nCurrentToolset = 0; } CDirMgr::~CDirMgr ( ) { POSITION pos; CToolset * pToolset; pos = m_Toolsets.GetHeadPosition(); while (pos != NULL) { pToolset = (CToolset *)m_Toolsets.GetNext(pos); delete pToolset; } m_Toolsets.RemoveAll(); } //////////////////////////////////////////////////////////// // CDirMgr::GetCurrentToolset // // This returns the current toolset for the project, if // one exists. If we don't have a project then we will // return whatever m_nCurrentToolset was last set to. INT CDirMgr::GetCurrentToolset ( ) { int nToolset = g_BldSysIFace.GetProjectToolset(ACTIVE_PROJECT); if( nToolset == -1 ) nToolset = m_nCurrentToolset; return nToolset; } //////////////////////////////////////////////////////////// // CDirMgr::SetCurrentToolset VOID CDirMgr::SetCurrentToolset ( INT nToolset ) { if (nToolset >= 0 && nToolset < m_Toolsets.GetCount()) m_nCurrentToolset = nToolset; } //////////////////////////////////////////////////////////// // CDirMgr::GetNumberOfToolsets INT CDirMgr::GetNumberOfToolsets ( ) { return (INT)m_Toolsets.GetCount(); } //////////////////////////////////////////////////////////// // CDirMgr::AddToolset INT CDirMgr::AddToolset ( const CString & strTargetPlatform ) { INT nToolset; CToolset * pToolset; nToolset = (INT)m_Toolsets.GetCount(); pToolset = new CToolset; m_Toolsets.AddTail(pToolset); m_ToolsetNames.AddTail(strTargetPlatform); return nToolset; } //////////////////////////////////////////////////////////// // CDirMgr::DeleteToolset VOID CDirMgr::DeleteToolset ( INT nToolset ) { POSITION pos; CToolset * pToolset; if (nToolset >= 0 && nToolset < m_Toolsets.GetCount()) { pos = m_Toolsets.FindIndex(nToolset); pToolset = (CToolset *)m_Toolsets.GetAt(pos); delete pToolset; m_Toolsets.RemoveAt(pos); m_ToolsetNames.RemoveAt(pos); } } //////////////////////////////////////////////////////////// // CDirMgr::GetToolset CToolset * CDirMgr::GetToolset ( INT nToolset ) { POSITION pos = m_Toolsets.FindIndex(nToolset); if (pos != NULL) return (CToolset *) (m_Toolsets.GetAt(pos)); else return NULL; } //////////////////////////////////////////////////////////// // CDirMgr::GetDirList const CObList * CDirMgr::GetDirList ( DIRLIST_TYPE type, INT nToolset /* = -1 */ ) { if (nToolset == -1) nToolset = GetCurrentToolset(); VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); CToolset * pToolset = GetToolset(nToolset); if (pToolset != NULL) return(pToolset->GetDirList(type)); else return NULL; } //////////////////////////////////////////////////////////// // CDirMgr::GetDirListString VOID CDirMgr::GetDirListString ( CString & strRet, DIRLIST_TYPE type, INT nToolset /* = -1 */ ) { if (nToolset == -1) nToolset = GetCurrentToolset(); VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); CToolset * pToolset = GetToolset(nToolset); if (pToolset != NULL) pToolset->GetDirListString(strRet, type); else strRet.Empty(); } //////////////////////////////////////////////////////////// // CDirMgr::CloneDirList CObList * CDirMgr::CloneDirList ( DIRLIST_TYPE type, INT nToolset ) { POSITION pos; CObList * pListSrc; CObList * pListDst; CDir * pDirSrc; CDir * pDirDst; VSASSERT((type >= (DIRLIST_TYPE)0) && (type < C_DIRLIST_TYPES), "DirList type out of bounds"); pListSrc = GetToolset(nToolset)->GetDirList(type); pListDst = new CObList; pos = pListSrc->GetHeadPosition(); while (pos != NULL) { pDirSrc = (CDir *)pListSrc->GetNext(pos); VSASSERT(pDirSrc->IsKindOf(RUNTIME_CLASS(CDir)), "DirList can only contain CDirs"); pDirDst = new CDir(*pDirSrc); pListDst->AddTail(pDirDst); } return(pListDst); } //////////////////////////////////////////////////////////// // CDirMgr::SetDirList VOID CDirMgr::SetDirList ( DIRLIST_TYPE type, INT nToolset, CObList * pListNew ) { CObList * pList; VSASSERT(pListNew != NULL, "Cannot set NULL list"); pList = GetToolset(nToolset)->GetDirList(type); GetToolset(nToolset)->SetDirList(type, pListNew); } //////////////////////////////////////////////////////////// // CDirMgr::SetDirListFromString VOID CDirMgr::SetDirListFromString ( DIRLIST_TYPE type, INT nToolset, const TCHAR * sz, BOOL fMustExist /* FALSE */ ) { TCHAR * pchCopy; TCHAR * pchDir; CString str = sz; CObList * pList; CDir * pDir; pList = GetToolset(nToolset)->GetDirList(type); if (pList == NULL) pList = new CObList; else DestroyListContents(pList); pchCopy = str.GetBuffer(1); pchDir = _tcstok(pchCopy, _T(";")); while (pchDir != NULL) { pDir = new CDir; if (!pDir->CreateFromString(pchDir)) { VSASSERT(FALSE, "Failed to create directory path!"); delete pDir; pchDir = _tcstok(NULL, _T(";")); continue; } // Check that the directory is not already // in the list. We do not add duplicates. BOOL fAddDir = TRUE; POSITION pos = pList->GetHeadPosition(); while (pos != NULL) { CDir * pTempDir = (CDir *)pList->GetNext(pos); if (*pTempDir == *pDir) { fAddDir = FALSE; break; // found, break-out } } // If we are to add this and it must exist, make // sure it does, otherwise don't add it if (fMustExist && fAddDir) fAddDir = pDir->ExistsOnDisk(); // If the directory is not a duplicate then add it, // else de-allocate if (fAddDir) pList->AddTail(pDir); else delete pDir; pchDir = _tcstok(NULL, _T(";")); } GetToolset(nToolset)->RefreshAllCachedStrings(); str.ReleaseBuffer(); } //////////////////////////////////////////////////////////// // CDirMgr::GetPlatformToolset INT CDirMgr::GetPlatformToolset ( const CString & strPlatform ) { POSITION pos; CString strToolsetName; INT nToolset = 0; pos = m_ToolsetNames.GetHeadPosition(); while (pos != NULL) { strToolsetName = m_ToolsetNames.GetNext(pos); if (strToolsetName == strPlatform) return nToolset; nToolset++; } return -1; } //////////////////////////////////////////////////////////// // CDirMgr::GetToolsetName CString & CDirMgr::GetToolsetName ( INT nToolset ) { POSITION pos = m_ToolsetNames.FindIndex(nToolset); VSASSERT (pos != NULL, "Toolset number not found!"); return m_ToolsetNames.GetAt(pos); } BOOL IsFileThere(const CString& strDir, const CString& strFName, CString& strFullPath) { VSASSERT(!strFName.IsEmpty(), "File name is blank!"); const TCHAR *pch = strFName; if ((strFName[0] != _T('\\')) && ((strFName.GetLength() < 2) || (*_tcsinc(pch) != _T(':')))) { if (strDir.IsEmpty()) return FALSE; strFullPath = strDir; // Add a backslash between path and fname if needed // chauv - crystal 1529 // can't use CString.Right(1).Compare("\\")) since this won't work with trailing backslash char in MBCS // if (strFullPath.Right(1).Compare("\\")) if ( _tcsrchr(strFullPath, '\\') != strFullPath.Right(1) ) strFullPath += "\\"; } strFullPath += strFName; if (_access(strFullPath, 04) == 0) // check for read privs return TRUE; return FALSE; }
[ "benjamin.barratt@icloud.com" ]
benjamin.barratt@icloud.com
e82904aba1edc72a0597f4655d528bc09440da5d
0d32e5d45461a1edffd4c90cf63b915e9832eb6c
/assignment-7 Select Command/Attribute.cpp
1e8605c9d222dc8e8847eac82a87e9266ad46d47
[ "Apache-2.0" ]
permissive
Arda-Bati/Relational-Database
262c3ddf4b70a97cde6631872a7eb757ae5da65b
e3b121b5d8587552cc7177228ba5a5bea5c2cf68
refs/heads/main
2023-02-26T15:00:22.988177
2021-01-28T22:14:21
2021-01-28T22:14:21
310,962,752
3
0
null
null
null
null
UTF-8
C++
false
false
4,218
cpp
// // Attribute.cpp // Datatabase4 // // Created by rick gessner on 4/12/19. // Copyright © 2019 rick gessner. All rights reserved. // #include "Attribute.hpp" #include "Storage.hpp" #include "MemoryStream.hpp" #include "Helpers.hpp" namespace ECE141 { Attribute::Attribute(std::string aName, DataType aType, uint8_t aSize, bool autoIncr, bool aPrimary) : name(aName), type(aType), size(aSize) { autoIncrement=autoIncr; primary=aPrimary; nullable=true; } Attribute::Attribute(DataType aType) : type(aType) { autoIncrement=primary=false; nullable=true; } Attribute::Attribute(const Attribute &aCopy) : name(aCopy.name), type(aCopy.type), size(aCopy.size) { autoIncrement=aCopy.autoIncrement; nullable=aCopy.nullable; primary=aCopy.primary; } Attribute::~Attribute() { } Attribute& Attribute::setName(std::string &aName) {name=aName; return *this;} Attribute& Attribute::setType(DataType aType) {type=aType; return *this;} Attribute& Attribute::setSize(int aSize) {size=aSize; return *this;} Attribute& Attribute::setAutoIncrement(bool anAuto) {autoIncrement=anAuto; return *this;} Attribute& Attribute::setPrimaryKey(bool aPrimary) {primary=aPrimary; return *this;} Attribute& Attribute::setNullable(bool aNullable) {nullable=aNullable; return *this;} bool Attribute::isValid() { return true; } bool Attribute::isCompatible(DataType aType) const { return false; /* switch(aType) { case TokenType::number: return isNumericKeyword(type); case TokenType::identifier: case TokenType::string: return Keywords::varchar_kw==type; default: return false; } */ return false; } //how big a given attribute... size_t Attribute::getSize() const { switch(type) { case DataType::timestamp_type: case DataType::int_type: return sizeof(int32_t); case DataType::float_type: return sizeof(float); case DataType::varchar_type: return size; default: break; } return 0; } std::string Attribute::describeTabular() { std::string theResult; char theBuffer[100]; std::string nullableStr; std::string autoInc; nullable ? nullableStr = "Y" : nullableStr = "N"; autoIncrement ? autoInc = "auto" : autoInc = "" ; std::sprintf(theBuffer, "| %-17s |",name.c_str()); theResult+=theBuffer; std::sprintf(theBuffer," %-12s |", Helpers::dataTypeToString(type)); theResult+=theBuffer; std::sprintf(theBuffer," %-4s |", nullableStr.c_str()); theResult+=theBuffer; //nullable... static const char* keys[]={" ","PRI"}; const char *temp = keys[autoIncrement]; std::sprintf(theBuffer," %-4s |", temp); theResult+=theBuffer; //key... std::sprintf(theBuffer," %-14s |", " "); theResult+=theBuffer; std::sprintf(theBuffer," %-16s |", autoInc.c_str()); theResult+=theBuffer; return theResult; } bool Attribute::operator==(Attribute& anAttribute) { if (name==anAttribute.getName() && type==anAttribute.getType()) { return true; } return false; } // USE: read attribute properties from memory stream... BufferReader& operator >> (BufferReader& aReader, Attribute &aValue) { char theCharType; bool theIncr, thePrimary, theNull; uint8_t theSize; aReader >> aValue.name; aReader >> theCharType; aValue.type=static_cast<DataType>(theCharType); aReader >> theSize >> theIncr >> thePrimary >> theNull; aValue.size=theSize; aValue.autoIncrement=theIncr; aValue.primary=thePrimary; aValue.nullable=theNull; return aReader; } // USE: Write attribute properties into a memory stream... BufferWriter& operator << (BufferWriter& aWriter, const Attribute &aValue) { aWriter << aValue.name << static_cast<char>(aValue.type) << static_cast<uint8_t>(aValue.size) << static_cast<bool>(aValue.autoIncrement) << static_cast<bool>(aValue.primary) << static_cast<bool>(aValue.nullable); return aWriter; } }
[ "cankatbati@gmail.com" ]
cankatbati@gmail.com
ea179c89937753402bba98e1aebde4078deb2c55
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/c++/cm-compiler/2019/4/gen8_vme.h
7b0cb62e9169af3a627308ff40e62f1d34724a82
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
C++
false
false
155,862
h
/* * Copyright (c) 2019, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #if (__INCLUDE_LEVEL__ == 1) static_assert(0, "CM:w:gen8_vme.h should not be included explicitly - only " "<cm/cm.h> is required"); #endif #ifndef _CLANG_gen8_VME_H_ #define _CLANG_gen8_VME_H_ #include "cm_send.h" #include "cm_util.h" #define __SFID_VME 8 #define __SFID_CRE 13 #define S13_2TOS16(value) \ (((value >> 2) & 0x1fff) | (((value >> 15) & 0x1) << 15)) #define S16TOS13_2(value) \ (((value & 0x1fff) << 2) | (((value >> 15) & 0x1) << 15)) // Select one element from the input payload #ifdef VME_Input_S1 #undef VME_Input_S1 #endif #define VME_Input_S1(p, t, r, c) p.row(r).format<t>().select<1, 1>(c) #ifdef VME_Input_G1 #undef VME_Input_G1 #endif #define VME_Input_G1(p, t, r, c) p.row(r).format<t>().select<1, 1>(c)(0) // Select one element from the output result #ifdef VME_Output_S1 #undef VME_Output_S1 #endif #define VME_Output_S1(p, t, r, c) p.row(r).format<t>().select<1, 1>(c)(0) // Input // SET methods // Format = S15 #define VME_SET_UNIInput_Ref0X(p, v) (VME_Input_S1(p, ushort, 0, 0) = v) #define VME_SET_UNIInput_Ref0Y(p, v) (VME_Input_S1(p, ushort, 0, 1) = v) // Format = S15 #define VME_SET_UNIInput_Ref1X(p, v) (VME_Input_S1(p, ushort, 0, 2) = v) #define VME_SET_UNIInput_Ref1Y(p, v) (VME_Input_S1(p, ushort, 0, 3) = v) // Format = U16 #define VME_SET_UNIInput_SrcX(p, v) (VME_Input_S1(p, ushort, 0, 4) = v) // Format = U16 #define VME_SET_UNIInput_SrcY(p, v) (VME_Input_S1(p, ushort, 0, 5) = v) // Set - FieldBased // Clear - FrameBased #define VME_SET_UNIInput_SrcAccess(p) (VME_Input_S1(p, uchar, 0, 12) |= 0x40) #define VME_CLEAR_UNIInput_SrcAccess(p) (VME_Input_S1(p, uchar, 0, 12) &= 0xBF) // Set - FieldBased // Clear - FrameBased #define VME_SET_UNIInput_RefAccess(p) (VME_Input_S1(p, uchar, 0, 12) |= 0x80) #define VME_CLEAR_UNIInput_RefAccess(p) (VME_Input_S1(p, uchar, 0, 12) &= 0x7F) // Set - different paths // Clear - same path #define VME_SET_UNIInput_DualSearchPath(p) \ (VME_Input_S1(p, uchar, 0, 13) |= 0x08) #define VME_CLEAR_UNIInput_DualSearchPath(p) \ (VME_Input_S1(p, uchar, 0, 13) &= 0xF7) // #define INT_MODE 0x0 // #define HALF_PEL_MODE 0x1 // #define QUARTER_PEL_MODE 0x3 #define VME_SET_UNIInput_SubPelMode(p, v) \ (VME_Input_S1(p, uchar, 0, 13) = \ VME_Input_S1(p, uchar, 0, 13) & 0xCF | (v << 4)) // Set - 4MVP // Clear - 1MVP #define VME_SET_UNIInput_SkipModeType(p) (VME_Input_S1(p, uchar, 0, 13) |= 0x40) #define VME_CLEAR_UNIInput_SkipModeType(p) \ (VME_Input_S1(p, uchar, 0, 13) &= 0xBF) #define VME_SET_UNIInput_DisableFieldCacheAllocation(p) \ (VME_Input_S1(p, uchar, 0, 13) |= 0x80) #define VME_CLEAR_UNIInput_DisableFieldCacheAllocation(p) \ (VME_Input_S1(p, uchar, 0, 13) &= 0x7F) // Set - Chroma mode // Clear - Luma mode #define VME_SET_UNIInput_InterChromaMode(p) \ (VME_Input_S1(p, uchar, 0, 14) |= 0x1) #define VME_CLEAR_UNIInput_InterChromaMode(p) \ (VME_Input_S1(p, uchar, 0, 14) &= 0xFE) #define VME_SET_UNIInput_FTEnable(p) (VME_Input_S1(p, uchar, 0, 14) |= 0x2) #define VME_CLEAR_UNIInput_FTEnable(p) (VME_Input_S1(p, uchar, 0, 14) &= 0xFD) #define VME_SET_UNIInput_BMEDisableFBR(p) (VME_Input_S1(p, uchar, 0, 14) |= 0x4) #define VME_CLEAR_UNIInput_BMEDisableFBR(p) \ (VME_Input_S1(p, uchar, 0, 14) &= 0xFB) // v is a 7-bit mask with the following definition: // xxxxxx1 : 16x16 sub-macroblock disabled // xxxxx1x : 2x(16x8) sub-macroblock within 16x16 disabled // xxxx1xx : 2x(8x16) sub-macroblock within 16x16 disabled // xxx1xxx : 1x(8x8) sub-partition for 4x(8x8) within 16x16 disabled // xx1xxxx : 2x(8x4) sub-partition for 4x(8x8) within 16x16 disabled // x1xxxxx : 2x(4x8) sub-partition for 4x(8x8) within 16x16 disabled // 1xxxxxx : 4x(4x4) sub-partition for 4x(8x8) within 16x16 disabled #define VME_SET_UNIInput_SubMbPartMask(p, v) (VME_Input_S1(p, uchar, 0, 15) = v) // The value must be a multiple of 4. Range = [20, 64] #define VME_SET_UNIInput_RefW(p, v) (VME_Input_S1(p, uchar, 0, 22) = v) // The value must be a multiple of 4. Range = [20, 64] #define VME_SET_UNIInput_RefH(p, v) (VME_Input_S1(p, uchar, 0, 23) = v) #define VME_SET_UNIInput_SkipModeEn(p) (VME_Input_S1(p, uchar, 1, 0) |= 0x1) #define VME_CLEAR_UNIInput_SkipModeEn(p) (VME_Input_S1(p, uchar, 1, 0) &= 0xFE) #define VME_SET_UNIInput_AdaptiveEn(p) (VME_Input_S1(p, uchar, 1, 0) |= 0x2) #define VME_CLEAR_UNIInput_AdaptiveEn(p) (VME_Input_S1(p, uchar, 1, 0) &= 0xFD) #define VME_SET_UNIInput_EarlyImeSuccessEn(p) \ (VME_Input_S1(p, uchar, 1, 0) |= 0x20) #define VME_CLEAR_UNIInput_EarlyImeSuccessEn(p) \ (VME_Input_S1(p, uchar, 1, 0) &= 0xDF) #define VME_SET_UNIInput_T8x8FlagForInterEn(p) \ (VME_Input_S1(p, uchar, 1, 0) |= 0x80) #define VME_CLEAR_UNIInput_T8x8FlagForInterEn(p) \ (VME_Input_S1(p, uchar, 1, 0) &= 0x7F) #define VME_SET_UNIInput_EarlyImeStop(p, v) (VME_Input_S1(p, uchar, 1, 3) = v) #define VME_SET_UNIInput_MaxNumMVs(p, v) (VME_Input_S1(p, uchar, 1, 4) = v) #define VME_SET_UNIInput_Ref0Polarity(p, v) \ (VME_Input_S1(p, uchar, 1, 5) = VME_Input_S1(p, uchar, 1, 5) & 0xF0 | v) #define VME_SET_UNIInput_Ref1Polarity(p, v) \ (VME_Input_S1(p, uchar, 1, 5) = \ VME_Input_S1(p, uchar, 1, 5) & 0x0F | (v << 4)) // Format = U6, Valid Values: [16, 21, 32, 43, 48] #define VME_SET_UNIInput_BiWeight(p, v) (VME_Input_S1(p, uchar, 1, 6) = v) #define VME_SET_UNIInput_RefPixelBiasEnable(p) \ (VME_Input_S1(p, uchar, 1, 7) |= 0x20) #define VME_CLEAR_UNIInput_RefPixelBiasEnable(p) \ (VME_Input_S1(p, uchar, 1, 7) &= 0xDF) #define VME_SET_UNIInput_UniMixDisable(p) (VME_Input_S1(p, uchar, 1, 7) |= 0x10) #define VME_CLEAR_UNIInput_UniMixDisable(p) \ (VME_Input_S1(p, uchar, 1, 7) &= 0xEF) // Format = U8, Valid range [1,63] #define VME_SET_UNIInput_LenSP(p, v) (VME_Input_S1(p, uchar, 1, 8) = v) // Format = U8, Valid range [1,63] #define VME_SET_UNIInput_MaxNumSU(p, v) (VME_Input_S1(p, uchar, 1, 9) = v) // Format = U4 #define VME_SET_UNIInput_StartCenter0(p, StartCenter0X, StartCenter0Y) \ (VME_Input_S1(p, uchar, 1, 10) = StartCenter0X | (StartCenter0Y << 4)) // Format = U4 #define VME_SET_UNIInput_StartCenter1(p, StartCenter1X, StartCenter1Y) \ (VME_Input_S1(p, uchar, 1, 11) = StartCenter1X | (StartCenter1Y << 4)) // Format = U8 #define VME_SET_UNIInput_WeightedSADCtrl0_3(p, v) \ (VME_Input_S1(p, uchar, 1, 12) = v) #define VME_SET_UNIInput_WeightedSADCtrl4_7(p, v) \ (VME_Input_S1(p, uchar, 1, 13) = v) #define VME_SET_UNIInput_WeightedSADCtrl8_11(p, v) \ (VME_Input_S1(p, uchar, 1, 14) = v) #define VME_SET_UNIInput_WeightedSADCtrl12_15(p, v) \ (VME_Input_S1(p, uchar, 1, 15) = v) // Format = U4 #define VME_SET_UNIInput_Blk0RefID(p, FwdBlk0RefID, BwdBlk0RefID) \ (VME_Input_S1(p, uchar, 1, 24) = FwdBlk0RefID | (BwdBlk0RefID << 4)) // Format = U4 #define VME_SET_UNIInput_Blk1RefID(p, FwdBlk1RefID, BwdBlk1RefID) \ (VME_Input_S1(p, uchar, 1, 25) = FwdBlk1RefID | (BwdBlk1RefID << 4)) // Format = U4 #define VME_SET_UNIInput_Blk2RefID(p, FwdBlk2RefID, BwdBlk2RefID) \ (VME_Input_S1(p, uchar, 1, 26) = FwdBlk2RefID | (BwdBlk2RefID << 4)) // Format = U4 #define VME_SET_UNIInput_Blk3RefID(p, FwdBlk3RefID, BwdBlk3RefID) \ (VME_Input_S1(p, uchar, 1, 27) = FwdBlk3RefID | (BwdBlk3RefID << 4)) #define VME_SET_UNIInput_IntraFlags(p, v) (VME_Input_S1(p, uchar, 1, 28) = v) // v is a 8-bit mask with the following definition: // Bit-7 Reserved : MBZ (for IntraPredAvailFlagF - F (pixel[-1,7] // available // for MbAff) // Bit-6 Reserved : MBZ (for IntraPredAvailFlagA/E - A (left neighbor top // half for MbAff) // Bit-5 IntraPredAvailFlagE/A - A (Left neighbor or Left bottom half) // Bit-4 IntraPredAvailFlagB - B (Upper neighbor) // Bit-3 IntraPredAvailFlagC - C (Upper left neighbor) // Bit-2 IntraPredAvailFlagD - D (Upper right neighbor) // Bit-1:0 Reserved: MBZ (ChromaIntraPredMode) #define VME_SET_UNIInput_MbIntraStruct(p, v) (VME_Input_S1(p, uchar, 1, 29) = v) // v is a 2-bit value: // 00: qpel [Qpel difference between MV and cost center: eff cost range 0-15pel] // 01: hpel [Hpel difference between MV and cost center: eff cost range 0-31pel] // 10: pel [Pel difference between MV and cost center: eff cost range 0-63pel] // 11: 2pel [2Pel difference between MV and cost center: eff cost range // 0-127pel] #define VME_SET_UNIInput_MVCostScaleFactor(p, v) \ (VME_Input_S1(p, uchar, 1, 30) = VME_Input_S1(p, uchar, 1, 30) & 0xFC | v) #define VME_SET_UNIInput_SrcFieldPolarity(p) \ (VME_Input_S1(p, uchar, 1, 30) |= 0x08) #define VME_CLEAR_UNIInput_SrcFieldPolarity(p) \ (VME_Input_S1(p, uchar, 1, 30) &= 0xF7) #define VME_SET_UNIInput_BilinearEnable(p) \ (VME_Input_S1(p, uchar, 1, 30) |= 0x04) #define VME_CLEAR_UNIInput_BilinearEnable(p) \ (VME_Input_S1(p, uchar, 1, 30) &= 0xFB) #define VME_SET_UNIInput_WeightedSADHAAR(p) \ (VME_Input_S1(p, uchar, 1, 30) |= 0x10) #define VME_CLEAR_UNIInput_WeightedSADHAAR(p) \ (VME_Input_S1(p, uchar, 1, 30) &= 0xEF) #define VME_SET_UNIInput_AConlyHAAR(p) (VME_Input_S1(p, uchar, 1, 30) |= 0x20) #define VME_CLEAR_UNIInput_AConlyHAAR(p) (VME_Input_S1(p, uchar, 1, 30) &= 0xDF) #define VME_SET_UNIInput_RefIDCostMode(p) \ (VME_Input_S1(p, uchar, 1, 30) |= 0x40) #define VME_CLEAR_UNIInput_RefIDCostMode(p) \ (VME_Input_S1(p, uchar, 1, 30) &= 0xBF) #define VME_SET_UNIInput_IDMShapeMode(p) (VME_Input_S1(p, uchar, 1, 30) |= 0x80) #define VME_CLEAR_UNIInput_IDMShapeMode(p) \ (VME_Input_S1(p, uchar, 1, 30) &= 0x7F) // v is a 8-bit mask with the following definition: // xxxx xxx1: Ref0 Skip Center 0 is enabled [corresponds to M2.0] // xxxx xx1x: Ref1 Skip Center 0 is enabled [corresponds to M2.1] // xxxx x1xx: Ref0 Skip Center 1 is enabled [corresponds to M2.2] // xxxx 1xxx: Ref1 Skip Center 1 is enabled [corresponds to M2.3] // xxx1 xxxx: Ref0 Skip Center 2 is enabled [corresponds to M2.4] // xx1x xxxx: Ref1 Skip Center 2 is enabled [corresponds to M2.5] // x1xx xxxx: Ref0 Skip Center 3 is enabled [corresponds to M2.6] // 1xxx xxxx: Ref1 Skip Center 3 is enabled [corresponds to M2.7] #define VME_SET_UNIInput_SkipCenterMask(p, v) \ (VME_Input_S1(p, uchar, 1, 31) = v) // NOTE: replace v with U4U4 type with // (shift_count, shift_val) and set the value as (shift_val | (shift_count << // 4)) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_SET_UNIInput_Mode0Cost(p, v) (VME_Input_S1(p, uchar, 2, 0) = v) #define VME_SET_UNIInput_Mode1Cost(p, v) (VME_Input_S1(p, uchar, 2, 1) = v) #define VME_SET_UNIInput_Mode2Cost(p, v) (VME_Input_S1(p, uchar, 2, 2) = v) #define VME_SET_UNIInput_Mode3Cost(p, v) (VME_Input_S1(p, uchar, 2, 3) = v) #define VME_SET_UNIInput_Mode4Cost(p, v) (VME_Input_S1(p, uchar, 2, 4) = v) #define VME_SET_UNIInput_Mode5Cost(p, v) (VME_Input_S1(p, uchar, 2, 5) = v) #define VME_SET_UNIInput_Mode6Cost(p, v) (VME_Input_S1(p, uchar, 2, 6) = v) #define VME_SET_UNIInput_Mode7Cost(p, v) (VME_Input_S1(p, uchar, 2, 7) = v) #define VME_SET_UNIInput_Mode8Cost(p, v) (VME_Input_S1(p, uchar, 2, 8) = v) #define VME_SET_UNIInput_Mode9Cost(p, v) (VME_Input_S1(p, uchar, 2, 9) = v) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_SET_UNIInput_RefIDCost(p, v) (VME_Input_S1(p, uchar, 2, 10) = v) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_SET_UNIInput_ChromaIntraModeCost(p, v) \ (VME_Input_S1(p, uchar, 2, 11) = v) // Format = U4U4 (encoded value must fit in 10-bits) #define VME_SET_UNIInput_MV0Cost(p, v) (VME_Input_S1(p, uchar, 2, 12) = v) #define VME_SET_UNIInput_MV1Cost(p, v) (VME_Input_S1(p, uchar, 2, 13) = v) #define VME_SET_UNIInput_MV2Cost(p, v) (VME_Input_S1(p, uchar, 2, 14) = v) #define VME_SET_UNIInput_MV3Cost(p, v) (VME_Input_S1(p, uchar, 2, 15) = v) #define VME_SET_UNIInput_MV4Cost(p, v) (VME_Input_S1(p, uchar, 2, 16) = v) #define VME_SET_UNIInput_MV5Cost(p, v) (VME_Input_S1(p, uchar, 2, 17) = v) #define VME_SET_UNIInput_MV6Cost(p, v) (VME_Input_S1(p, uchar, 2, 18) = v) #define VME_SET_UNIInput_MV7Cost(p, v) (VME_Input_S1(p, uchar, 2, 19) = v) // Format = U8 #define VME_SET_UNIInput_FBRMbModeInput(p, v) \ (VME_Input_S1(p, uchar, 2, 20) = v) // Format = U8 #define VME_SET_UNIInput_FBRSubMBShapeInput(p, v) \ (VME_Input_S1(p, uchar, 2, 21) = v) // Format = U8 #define VME_SET_UNIInput_FBRSubPredModeInput(p, v) \ (VME_Input_S1(p, uchar, 2, 22) = v) // Format = U16 #define VME_SET_UNIInput_SICFwdTCoeffThreshold0(p, v) \ (VME_Input_S1(p, ushort, 2, 12) = v) // Format = U8 #define VME_SET_UNIInput_SICFwdTCoeffThreshold1(p, v) \ (VME_Input_S1(p, uchar, 2, 26) = v) #define VME_SET_UNIInput_SICFwdTCoeffThreshold2(p, v) \ (VME_Input_S1(p, uchar, 2, 27) = v) #define VME_SET_UNIInput_SICFwdTCoeffThreshold3(p, v) \ (VME_Input_S1(p, uchar, 2, 28) = v) #define VME_SET_UNIInput_SICFwdTCoeffThreshold4(p, v) \ (VME_Input_S1(p, uchar, 2, 29) = v) #define VME_SET_UNIInput_SICFwdTCoeffThreshold5(p, v) \ (VME_Input_S1(p, uchar, 2, 30) = v) #define VME_SET_UNIInput_SICFwdTCoeffThreshold6(p, v) \ (VME_Input_S1(p, uchar, 2, 31) = v) // Format = S13.2, DletaX Valid Range: [-2048.00 to 2047.75], DletaY Valid // Range: [-512.00 to 511.75] #define VME_SET_UNIInput_FWDCostCenter0(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 0) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_BWDCostCenter0(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 1) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_FWDCostCenter1(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 2) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_BWDCostCenter1(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 3) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_FWDCostCenter2(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 4) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_BWDCostCenter2(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 5) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_FWDCostCenter3(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 6) = DeltaX | (DeltaY << 16)) #define VME_SET_UNIInput_BWDCostCenter3(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 3, 7) = DeltaX | (DeltaY << 16)) // Format = U8, with the following definition: // [7:4] (Y) - specifies relative Y distance to the next SU from previous SU in // units of SU // [3:0] (X) - specifies relative X distance to the next SU from previous SU in // units of SU // Format = U8, with the following definition: // [7:4] (Y) - specifies relative Y distance to the next SU from previous SU in // units of SU // [3:0] (X) - specifies relative X distance to the next SU from previous SU in // units of SU #define VME_SET_IMEInput_IMESearchPathDelta0(p, v) \ (VME_Input_G1(p, uchar, 0, 0) = v) #define VME_SET_IMEInput_IMESearchPathDelta1(p, v) \ (VME_Input_G1(p, uchar, 0, 1) = v) #define VME_SET_IMEInput_IMESearchPathDelta2(p, v) \ (VME_Input_G1(p, uchar, 0, 2) = v) #define VME_SET_IMEInput_IMESearchPathDelta3(p, v) \ (VME_Input_G1(p, uchar, 0, 3) = v) #define VME_SET_IMEInput_IMESearchPathDelta4(p, v) \ (VME_Input_G1(p, uchar, 0, 4) = v) #define VME_SET_IMEInput_IMESearchPathDelta5(p, v) \ (VME_Input_G1(p, uchar, 0, 5) = v) #define VME_SET_IMEInput_IMESearchPathDelta6(p, v) \ (VME_Input_G1(p, uchar, 0, 6) = v) #define VME_SET_IMEInput_IMESearchPathDelta7(p, v) \ (VME_Input_G1(p, uchar, 0, 7) = v) #define VME_SET_IMEInput_IMESearchPathDelta8(p, v) \ (VME_Input_G1(p, uchar, 0, 8) = v) #define VME_SET_IMEInput_IMESearchPathDelta9(p, v) \ (VME_Input_G1(p, uchar, 0, 9) = v) #define VME_SET_IMEInput_IMESearchPathDelta10(p, v) \ (VME_Input_G1(p, uchar, 0, 10) = v) #define VME_SET_IMEInput_IMESearchPathDelta11(p, v) \ (VME_Input_G1(p, uchar, 0, 11) = v) #define VME_SET_IMEInput_IMESearchPathDelta12(p, v) \ (VME_Input_G1(p, uchar, 0, 12) = v) #define VME_SET_IMEInput_IMESearchPathDelta13(p, v) \ (VME_Input_G1(p, uchar, 0, 13) = v) #define VME_SET_IMEInput_IMESearchPathDelta14(p, v) \ (VME_Input_G1(p, uchar, 0, 14) = v) #define VME_SET_IMEInput_IMESearchPathDelta15(p, v) \ (VME_Input_G1(p, uchar, 0, 15) = v) #define VME_SET_IMEInput_IMESearchPathDelta16(p, v) \ (VME_Input_G1(p, uchar, 0, 16) = v) #define VME_SET_IMEInput_IMESearchPathDelta17(p, v) \ (VME_Input_G1(p, uchar, 0, 17) = v) #define VME_SET_IMEInput_IMESearchPathDelta18(p, v) \ (VME_Input_G1(p, uchar, 0, 18) = v) #define VME_SET_IMEInput_IMESearchPathDelta19(p, v) \ (VME_Input_G1(p, uchar, 0, 19) = v) #define VME_SET_IMEInput_IMESearchPathDelta20(p, v) \ (VME_Input_G1(p, uchar, 0, 20) = v) #define VME_SET_IMEInput_IMESearchPathDelta21(p, v) \ (VME_Input_G1(p, uchar, 0, 21) = v) #define VME_SET_IMEInput_IMESearchPathDelta22(p, v) \ (VME_Input_G1(p, uchar, 0, 22) = v) #define VME_SET_IMEInput_IMESearchPathDelta23(p, v) \ (VME_Input_G1(p, uchar, 0, 23) = v) #define VME_SET_IMEInput_IMESearchPathDelta24(p, v) \ (VME_Input_G1(p, uchar, 0, 24) = v) #define VME_SET_IMEInput_IMESearchPathDelta25(p, v) \ (VME_Input_G1(p, uchar, 0, 25) = v) #define VME_SET_IMEInput_IMESearchPathDelta26(p, v) \ (VME_Input_G1(p, uchar, 0, 26) = v) #define VME_SET_IMEInput_IMESearchPathDelta27(p, v) \ (VME_Input_G1(p, uchar, 0, 27) = v) #define VME_SET_IMEInput_IMESearchPathDelta28(p, v) \ (VME_Input_G1(p, uchar, 0, 28) = v) #define VME_SET_IMEInput_IMESearchPathDelta29(p, v) \ (VME_Input_G1(p, uchar, 0, 29) = v) #define VME_SET_IMEInput_IMESearchPathDelta30(p, v) \ (VME_Input_G1(p, uchar, 0, 30) = v) #define VME_SET_IMEInput_IMESearchPathDelta31(p, v) \ (VME_Input_G1(p, uchar, 0, 31) = v) #define VME_SET_IMEInput_IMESearchPathDelta32(p, v) \ (VME_Input_G1(p, uchar, 1, 0) = v) #define VME_SET_IMEInput_IMESearchPathDelta33(p, v) \ (VME_Input_G1(p, uchar, 1, 1) = v) #define VME_SET_IMEInput_IMESearchPathDelta34(p, v) \ (VME_Input_G1(p, uchar, 1, 2) = v) #define VME_SET_IMEInput_IMESearchPathDelta35(p, v) \ (VME_Input_G1(p, uchar, 1, 3) = v) #define VME_SET_IMEInput_IMESearchPathDelta36(p, v) \ (VME_Input_G1(p, uchar, 1, 4) = v) #define VME_SET_IMEInput_IMESearchPathDelta37(p, v) \ (VME_Input_G1(p, uchar, 1, 5) = v) #define VME_SET_IMEInput_IMESearchPathDelta38(p, v) \ (VME_Input_G1(p, uchar, 1, 6) = v) #define VME_SET_IMEInput_IMESearchPathDelta39(p, v) \ (VME_Input_G1(p, uchar, 1, 7) = v) #define VME_SET_IMEInput_IMESearchPathDelta40(p, v) \ (VME_Input_G1(p, uchar, 1, 8) = v) #define VME_SET_IMEInput_IMESearchPathDelta41(p, v) \ (VME_Input_G1(p, uchar, 1, 9) = v) #define VME_SET_IMEInput_IMESearchPathDelta42(p, v) \ (VME_Input_G1(p, uchar, 1, 10) = v) #define VME_SET_IMEInput_IMESearchPathDelta43(p, v) \ (VME_Input_G1(p, uchar, 1, 11) = v) #define VME_SET_IMEInput_IMESearchPathDelta44(p, v) \ (VME_Input_G1(p, uchar, 1, 12) = v) #define VME_SET_IMEInput_IMESearchPathDelta45(p, v) \ (VME_Input_G1(p, uchar, 1, 13) = v) #define VME_SET_IMEInput_IMESearchPathDelta46(p, v) \ (VME_Input_G1(p, uchar, 1, 14) = v) #define VME_SET_IMEInput_IMESearchPathDelta47(p, v) \ (VME_Input_G1(p, uchar, 1, 15) = v) #define VME_SET_IMEInput_IMESearchPathDelta48(p, v) \ (VME_Input_G1(p, uchar, 1, 16) = v) #define VME_SET_IMEInput_IMESearchPathDelta49(p, v) \ (VME_Input_G1(p, uchar, 1, 17) = v) #define VME_SET_IMEInput_IMESearchPathDelta50(p, v) \ (VME_Input_G1(p, uchar, 1, 18) = v) #define VME_SET_IMEInput_IMESearchPathDelta51(p, v) \ (VME_Input_G1(p, uchar, 1, 19) = v) #define VME_SET_IMEInput_IMESearchPathDelta52(p, v) \ (VME_Input_G1(p, uchar, 1, 20) = v) #define VME_SET_IMEInput_IMESearchPathDelta53(p, v) \ (VME_Input_G1(p, uchar, 1, 21) = v) #define VME_SET_IMEInput_IMESearchPathDelta54(p, v) \ (VME_Input_G1(p, uchar, 1, 22) = v) #define VME_SET_IMEInput_IMESearchPathDelta55(p, v) \ (VME_Input_G1(p, uchar, 1, 23) = v) // Format = U16 #define VME_SET_IMEInput_Rec0_16x8_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 0) = v) #define VME_SET_IMEInput_Rec0_16x8_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 1) = v) #define VME_SET_IMEInput_Rec0_8x16_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 2) = v) #define VME_SET_IMEInput_Rec0_8x16_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 3) = v) #define VME_SET_IMEInput_Rec0_8x8_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 4) = v) #define VME_SET_IMEInput_Rec0_8x8_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 5) = v) #define VME_SET_IMEInput_Rec0_8x8_2Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 6) = v) #define VME_SET_IMEInput_Rec0_8x8_3Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 7) = v) #define VME_SET_IMEInput_Rec0_16x16_Distortion(p, v) \ (VME_Input_S1(p, ushort, 2, 8) = v) // Format = U4 #define VME_SET_IMEInput_Rec0_16x16_RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 18) = v) // Format = S13.2 #define VME_SET_IMEInput_Rec0_16x16_X(p, v) (VME_Input_S1(p, ushort, 2, 10) = v) #define VME_SET_IMEInput_Rec0_16x16_Y(p, v) (VME_Input_S1(p, ushort, 2, 11) = v) // Format = U4 #define VME_SET_IMEInput_Rec0_16x8_0RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 24) = VME_Input_S1(p, uchar, 2, 24) & 0xF0 | v) #define VME_SET_IMEInput_Rec0_16x8_1RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 24) = \ VME_Input_S1(p, uchar, 2, 24) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec0_8x16_0RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 25) = VME_Input_S1(p, uchar, 2, 25) & 0xF0 | v) #define VME_SET_IMEInput_Rec0_8x16_1RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 25) = \ VME_Input_S1(p, uchar, 2, 25) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec0_8x8_0RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 26) = VME_Input_S1(p, uchar, 2, 26) & 0xF0 | v) #define VME_SET_IMEInput_Rec0_8x8_1RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 26) = \ VME_Input_S1(p, uchar, 2, 26) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec0_8x8_2RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 27) = VME_Input_S1(p, uchar, 2, 27) & 0xF0 | v) #define VME_SET_IMEInput_Rec0_8x8_3RefID(p, v) \ (VME_Input_S1(p, uchar, 2, 27) = \ VME_Input_S1(p, uchar, 2, 27) & 0x0F | (v << 4)) // Format = S13.2 #define VME_SET_IMEInput_Rec0_16x8_0X(p, v) (VME_Input_S1(p, ushort, 3, 0) = v) #define VME_SET_IMEInput_Rec0_16x8_0Y(p, v) (VME_Input_S1(p, ushort, 3, 1) = v) #define VME_SET_IMEInput_Rec0_16x8_1X(p, v) (VME_Input_S1(p, ushort, 3, 2) = v) #define VME_SET_IMEInput_Rec0_16x8_1Y(p, v) (VME_Input_S1(p, ushort, 3, 3) = v) #define VME_SET_IMEInput_Rec0_8x16_0X(p, v) (VME_Input_S1(p, ushort, 3, 4) = v) #define VME_SET_IMEInput_Rec0_8x16_0Y(p, v) (VME_Input_S1(p, ushort, 3, 5) = v) #define VME_SET_IMEInput_Rec0_8x16_1X(p, v) (VME_Input_S1(p, ushort, 3, 6) = v) #define VME_SET_IMEInput_Rec0_8x16_1Y(p, v) (VME_Input_S1(p, ushort, 3, 7) = v) #define VME_SET_IMEInput_Rec0_8x8_0X(p, v) (VME_Input_S1(p, ushort, 3, 8) = v) #define VME_SET_IMEInput_Rec0_8x8_0Y(p, v) (VME_Input_S1(p, ushort, 3, 9) = v) #define VME_SET_IMEInput_Rec0_8x8_1X(p, v) (VME_Input_S1(p, ushort, 3, 10) = v) #define VME_SET_IMEInput_Rec0_8x8_1Y(p, v) (VME_Input_S1(p, ushort, 3, 11) = v) #define VME_SET_IMEInput_Rec0_8x8_2X(p, v) (VME_Input_S1(p, ushort, 3, 12) = v) #define VME_SET_IMEInput_Rec0_8x8_2Y(p, v) (VME_Input_S1(p, ushort, 3, 13) = v) #define VME_SET_IMEInput_Rec0_8x8_3X(p, v) (VME_Input_S1(p, ushort, 3, 14) = v) #define VME_SET_IMEInput_Rec0_8x8_3Y(p, v) (VME_Input_S1(p, ushort, 3, 15) = v) // Format = U16 #define VME_SET_IMEInput_Rec1_16x8_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 0) = v) #define VME_SET_IMEInput_Rec1_16x8_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 1) = v) #define VME_SET_IMEInput_Rec1_8x16_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 2) = v) #define VME_SET_IMEInput_Rec1_8x16_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 3) = v) #define VME_SET_IMEInput_Rec1_8x8_0Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 4) = v) #define VME_SET_IMEInput_Rec1_8x8_1Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 5) = v) #define VME_SET_IMEInput_Rec1_8x8_2Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 6) = v) #define VME_SET_IMEInput_Rec1_8x8_3Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 7) = v) #define VME_SET_IMEInput_Rec1_16x16_Distortion(p, v) \ (VME_Input_S1(p, ushort, 4, 8) = v) // Format = U4 #define VME_SET_IMEInput_Rec1_16x16_RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 18) = v) // Format = S13.2 #define VME_SET_IMEInput_Rec1_16x16_X(p, v) (VME_Input_S1(p, ushort, 4, 10) = v) #define VME_SET_IMEInput_Rec1_16x16_Y(p, v) (VME_Input_S1(p, ushort, 4, 11) = v) // Format = U4 #define VME_SET_IMEInput_Rec1_16x8_0RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 24) = VME_Input_S1(p, uchar, 4, 24) & 0xF0 | v) #define VME_SET_IMEInput_Rec1_16x8_1RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 24) = \ VME_Input_S1(p, uchar, 4, 24) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec1_8x16_0RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 25) = VME_Input_S1(p, uchar, 4, 25) & 0xF0 | v) #define VME_SET_IMEInput_Rec1_8x16_1RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 25) = \ VME_Input_S1(p, uchar, 4, 25) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec1_8x8_0RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 26) = VME_Input_S1(p, uchar, 4, 26) & 0xF0 | v) #define VME_SET_IMEInput_Rec1_8x8_1RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 26) = \ VME_Input_S1(p, uchar, 4, 26) & 0x0F | (v << 4)) #define VME_SET_IMEInput_Rec1_8x8_2RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 27) = VME_Input_S1(p, uchar, 4, 27) & 0xF0 | v) #define VME_SET_IMEInput_Rec1_8x8_3RefID(p, v) \ (VME_Input_S1(p, uchar, 4, 27) = \ VME_Input_S1(p, uchar, 4, 27) & 0x0F | (v << 4)) // Format = S13.2 #define VME_SET_IMEInput_Rec1_16x8_0X(p, v) (VME_Input_S1(p, ushort, 5, 0) = v) #define VME_SET_IMEInput_Rec1_16x8_0Y(p, v) (VME_Input_S1(p, ushort, 5, 1) = v) #define VME_SET_IMEInput_Rec1_16x8_1X(p, v) (VME_Input_S1(p, ushort, 5, 2) = v) #define VME_SET_IMEInput_Rec1_16x8_1Y(p, v) (VME_Input_S1(p, ushort, 5, 3) = v) #define VME_SET_IMEInput_Rec1_8x16_0X(p, v) (VME_Input_S1(p, ushort, 5, 4) = v) #define VME_SET_IMEInput_Rec1_8x16_0Y(p, v) (VME_Input_S1(p, ushort, 5, 5) = v) #define VME_SET_IMEInput_Rec1_8x16_1X(p, v) (VME_Input_S1(p, ushort, 5, 6) = v) #define VME_SET_IMEInput_Rec1_8x16_1Y(p, v) (VME_Input_S1(p, ushort, 5, 7) = v) #define VME_SET_IMEInput_Rec1_8x8_0X(p, v) (VME_Input_S1(p, ushort, 5, 8) = v) #define VME_SET_IMEInput_Rec1_8x8_0Y(p, v) (VME_Input_S1(p, ushort, 5, 9) = v) #define VME_SET_IMEInput_Rec1_8x8_1X(p, v) (VME_Input_S1(p, ushort, 5, 10) = v) #define VME_SET_IMEInput_Rec1_8x8_1Y(p, v) (VME_Input_S1(p, ushort, 5, 11) = v) #define VME_SET_IMEInput_Rec1_8x8_2X(p, v) (VME_Input_S1(p, ushort, 5, 12) = v) #define VME_SET_IMEInput_Rec1_8x8_2Y(p, v) (VME_Input_S1(p, ushort, 5, 13) = v) #define VME_SET_IMEInput_Rec1_8x8_3X(p, v) (VME_Input_S1(p, ushort, 5, 14) = v) #define VME_SET_IMEInput_Rec1_8x8_3Y(p, v) (VME_Input_S1(p, ushort, 5, 15) = v) // Format = S13.2, Valid Range: [-2048.00 to 2047.75] // For chroma skip: Format = S12.3, Hardware Range: [-1024.000 to 1023.875] #define VME_SET_SICInput_Ref0SkipCenter0DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 0) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref1SkipCenter0DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 1) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref0SkipCenter1DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 2) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref1SkipCenter1DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 3) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref0SkipCenter2DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 4) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref1SkipCenter2DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 5) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref0SkipCenter3DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 6) = DeltaX | (DeltaY << 16)) #define VME_SET_SICInput_Ref1SkipCenter3DeltaXY(p, DeltaX, DeltaY) \ (VME_Input_S1(p, uint, 0, 7) = DeltaX | (DeltaY << 16)) // 2-bit field with the following definition // 00: Luma + Chroma enabled // 01: Luma only // 1X: Intra disabled #define VME_SET_SICInput_IntraComputeType(p, v) \ (VME_Input_S1(p, uchar, 1, 5) = v) #define VME_SET_SICInput_CornerNeighborPixel0(p, v) \ (VME_Input_S1(p, uchar, 1, 7) = v) // NOTE: combine into one vector assignment #define VME_SET_SICInput_NeighborPixelLum0(p, v) \ (VME_Input_S1(p, uchar, 1, 8) = v) #define VME_SET_SICInput_NeighborPixelLum1(p, v) \ (VME_Input_S1(p, uchar, 1, 9) = v) #define VME_SET_SICInput_NeighborPixelLum2(p, v) \ (VME_Input_S1(p, uchar, 1, 10) = v) #define VME_SET_SICInput_NeighborPixelLum3(p, v) \ (VME_Input_S1(p, uchar, 1, 11) = v) #define VME_SET_SICInput_NeighborPixelLum4(p, v) \ (VME_Input_S1(p, uchar, 1, 12) = v) #define VME_SET_SICInput_NeighborPixelLum5(p, v) \ (VME_Input_S1(p, uchar, 1, 13) = v) #define VME_SET_SICInput_NeighborPixelLum6(p, v) \ (VME_Input_S1(p, uchar, 1, 14) = v) #define VME_SET_SICInput_NeighborPixelLum7(p, v) \ (VME_Input_S1(p, uchar, 1, 15) = v) #define VME_SET_SICInput_NeighborPixelLum8(p, v) \ (VME_Input_S1(p, uchar, 1, 16) = v) #define VME_SET_SICInput_NeighborPixelLum9(p, v) \ (VME_Input_S1(p, uchar, 1, 17) = v) #define VME_SET_SICInput_NeighborPixelLum10(p, v) \ (VME_Input_S1(p, uchar, 1, 18) = v) #define VME_SET_SICInput_NeighborPixelLum11(p, v) \ (VME_Input_S1(p, uchar, 1, 19) = v) #define VME_SET_SICInput_NeighborPixelLum12(p, v) \ (VME_Input_S1(p, uchar, 1, 20) = v) #define VME_SET_SICInput_NeighborPixelLum13(p, v) \ (VME_Input_S1(p, uchar, 1, 21) = v) #define VME_SET_SICInput_NeighborPixelLum14(p, v) \ (VME_Input_S1(p, uchar, 1, 22) = v) #define VME_SET_SICInput_NeighborPixelLum15(p, v) \ (VME_Input_S1(p, uchar, 1, 23) = v) #define VME_SET_SICInput_NeighborPixelLum16(p, v) \ (VME_Input_S1(p, uchar, 1, 24) = v) #define VME_SET_SICInput_NeighborPixelLum17(p, v) \ (VME_Input_S1(p, uchar, 1, 25) = v) #define VME_SET_SICInput_NeighborPixelLum18(p, v) \ (VME_Input_S1(p, uchar, 1, 26) = v) #define VME_SET_SICInput_NeighborPixelLum19(p, v) \ (VME_Input_S1(p, uchar, 1, 27) = v) #define VME_SET_SICInput_NeighborPixelLum20(p, v) \ (VME_Input_S1(p, uchar, 1, 28) = v) #define VME_SET_SICInput_NeighborPixelLum21(p, v) \ (VME_Input_S1(p, uchar, 1, 29) = v) #define VME_SET_SICInput_NeighborPixelLum22(p, v) \ (VME_Input_S1(p, uchar, 1, 30) = v) #define VME_SET_SICInput_NeighborPixelLum23(p, v) \ (VME_Input_S1(p, uchar, 1, 31) = v) #define VME_SET_SICInput_NeighborPixelLum24(p, v) \ (VME_Input_S1(p, uchar, 2, 0) = v) #define VME_SET_SICInput_NeighborPixelLum25(p, v) \ (VME_Input_S1(p, uchar, 2, 1) = v) #define VME_SET_SICInput_NeighborPixelLum26(p, v) \ (VME_Input_S1(p, uchar, 2, 2) = v) #define VME_SET_SICInput_NeighborPixelLum27(p, v) \ (VME_Input_S1(p, uchar, 2, 3) = v) #define VME_SET_SICInput_NeighborPixelLum28(p, v) \ (VME_Input_S1(p, uchar, 2, 4) = v) #define VME_SET_SICInput_NeighborPixelLum29(p, v) \ (VME_Input_S1(p, uchar, 2, 5) = v) #define VME_SET_SICInput_NeighborPixelLum30(p, v) \ (VME_Input_S1(p, uchar, 2, 6) = v) #define VME_SET_SICInput_NeighborPixelLum31(p, v) \ (VME_Input_S1(p, uchar, 2, 7) = v) #define VME_SET_SICInput_NeighborPixelLum32(p, v) \ (VME_Input_S1(p, uchar, 2, 8) = v) #define VME_SET_SICInput_NeighborPixelLum33(p, v) \ (VME_Input_S1(p, uchar, 2, 9) = v) #define VME_SET_SICInput_NeighborPixelLum34(p, v) \ (VME_Input_S1(p, uchar, 2, 10) = v) #define VME_SET_SICInput_NeighborPixelLum35(p, v) \ (VME_Input_S1(p, uchar, 2, 11) = v) #define VME_SET_SICInput_NeighborPixelLum36(p, v) \ (VME_Input_S1(p, uchar, 2, 12) = v) #define VME_SET_SICInput_NeighborPixelLum37(p, v) \ (VME_Input_S1(p, uchar, 2, 13) = v) #define VME_SET_SICInput_NeighborPixelLum38(p, v) \ (VME_Input_S1(p, uchar, 2, 14) = v) #define VME_SET_SICInput_CornerNeighborPixel1(p, v) \ (VME_Input_S1(p, uchar, 2, 15) = v) // Format = U4 #define VME_SET_SICInput_IntraMxMPredModeA5(p, v) \ (VME_Input_S1(p, uchar, 2, 16) = VME_Input_S1(p, uchar, 2, 16) & 0xF0 | v) #define VME_SET_SICInput_IntraMxMPredModeA7(p, v) \ (VME_Input_S1(p, uchar, 2, 16) = \ VME_Input_S1(p, uchar, 2, 16) & 0x0F | (v << 4)) #define VME_SET_SICInput_IntraMxMPredModeA13(p, v) \ (VME_Input_S1(p, uchar, 2, 17) = VME_Input_S1(p, uchar, 2, 17) & 0xF0 | v) #define VME_SET_SICInput_IntraMxMPredModeA15(p, v) \ (VME_Input_S1(p, uchar, 2, 17) = \ VME_Input_S1(p, uchar, 2, 17) & 0x0F | (v << 4)) #define VME_SET_SICInput_IntraMxMPredModeB10(p, v) \ (VME_Input_S1(p, uchar, 2, 18) = VME_Input_S1(p, uchar, 2, 18) & 0xF0 | v) #define VME_SET_SICInput_IntraMxMPredModeB11(p, v) \ (VME_Input_S1(p, uchar, 2, 18) = \ VME_Input_S1(p, uchar, 2, 18) & 0x0F | (v << 4)) #define VME_SET_SICInput_IntraMxMPredModeB14(p, v) \ (VME_Input_S1(p, uchar, 2, 19) = VME_Input_S1(p, uchar, 2, 19) & 0xF0 | v) #define VME_SET_SICInput_IntraMxMPredModeB15(p, v) \ (VME_Input_S1(p, uchar, 2, 19) = \ VME_Input_S1(p, uchar, 2, 19) & 0x0F | (v << 4)) // Format = U8 pair #define VME_SET_SICInput_CornerNeighborPixelChroma(p, v) \ (VME_Input_S1(p, ushort, 2, 10) = v) #if 0 // Format = U4U4 #define VME_SET_SICInput_PenaltyIntra4x4NonDC(p, v) \ (VME_Input_S1(p, uchar, 2, 28) = v) // Format = U2 #define VME_SET_SICInput_ScaleFactorIntra8x8NonDC(p, v) \ (VME_Input_S1(p, uchar, 2, 29) = VME_Input_S1(p, uchar, 2, 29) & 0xFC | v) // Format = U2 #define VME_SET_SICInput_ScaleFactorIntra16x16NonDC(p, v) \ (VME_Input_S1(p, uchar, 2, 29) = \ VME_Input_S1(p, uchar, 2, 29) & 0xF3 | (v << 2)) #else // BSPEC Update Rev1.6 // Format = U8 #define VME_SET_SICInput_PenaltyIntra4x4NonDC(p, v) \ (VME_Input_G1(p, uchar, 2, 30) = v) // Format = U8 #define VME_SET_SICInput_PenaltyIntra8x8NonDC(p, v) \ (VME_Input_G1(p, uchar, 2, 29) = v) // Format = U8 #define VME_SET_SICInput_PenaltyIntra16x16NonDC(p, v) \ (VME_Input_G1(p, uchar, 2, 28) = v) #endif #define VME_SET_SICInput_NeighborPixelChroma0(p, v) \ (VME_Input_G1(p, uchar, 3, 0) = v) #define VME_SET_SICInput_NeighborPixelChroma1(p, v) \ (VME_Input_G1(p, uchar, 3, 1) = v) #define VME_SET_SICInput_NeighborPixelChroma2(p, v) \ (VME_Input_G1(p, uchar, 3, 2) = v) #define VME_SET_SICInput_NeighborPixelChroma3(p, v) \ (VME_Input_G1(p, uchar, 3, 3) = v) #define VME_SET_SICInput_NeighborPixelChroma4(p, v) \ (VME_Input_G1(p, uchar, 3, 4) = v) #define VME_SET_SICInput_NeighborPixelChroma5(p, v) \ (VME_Input_G1(p, uchar, 3, 5) = v) #define VME_SET_SICInput_NeighborPixelChroma6(p, v) \ (VME_Input_G1(p, uchar, 3, 6) = v) #define VME_SET_SICInput_NeighborPixelChroma7(p, v) \ (VME_Input_G1(p, uchar, 3, 7) = v) #define VME_SET_SICInput_NeighborPixelChroma8(p, v) \ (VME_Input_G1(p, uchar, 3, 8) = v) #define VME_SET_SICInput_NeighborPixelChroma9(p, v) \ (VME_Input_G1(p, uchar, 3, 9) = v) #define VME_SET_SICInput_NeighborPixelChroma10(p, v) \ (VME_Input_G1(p, uchar, 3, 10) = v) #define VME_SET_SICInput_NeighborPixelChroma11(p, v) \ (VME_Input_G1(p, uchar, 3, 11) = v) #define VME_SET_SICInput_NeighborPixelChroma12(p, v) \ (VME_Input_G1(p, uchar, 3, 12) = v) #define VME_SET_SICInput_NeighborPixelChroma13(p, v) \ (VME_Input_G1(p, uchar, 3, 13) = v) #define VME_SET_SICInput_NeighborPixelChroma14(p, v) \ (VME_Input_G1(p, uchar, 3, 14) = v) #define VME_SET_SICInput_NeighborPixelChroma15(p, v) \ (VME_Input_G1(p, uchar, 3, 15) = v) #define VME_SET_SICInput_NeighborPixelChroma16(p, v) \ (VME_Input_G1(p, uchar, 3, 16) = v) #define VME_SET_SICInput_NeighborPixelChroma17(p, v) \ (VME_Input_G1(p, uchar, 3, 17) = v) #define VME_SET_SICInput_NeighborPixelChroma18(p, v) \ (VME_Input_G1(p, uchar, 3, 18) = v) #define VME_SET_SICInput_NeighborPixelChroma19(p, v) \ (VME_Input_G1(p, uchar, 3, 19) = v) #define VME_SET_SICInput_NeighborPixelChroma20(p, v) \ (VME_Input_G1(p, uchar, 3, 20) = v) #define VME_SET_SICInput_NeighborPixelChroma21(p, v) \ (VME_Input_G1(p, uchar, 3, 21) = v) #define VME_SET_SICInput_NeighborPixelChroma22(p, v) \ (VME_Input_G1(p, uchar, 3, 22) = v) #define VME_SET_SICInput_NeighborPixelChroma23(p, v) \ (VME_Input_G1(p, uchar, 3, 23) = v) #define VME_SET_SICInput_NeighborPixelChroma24(p, v) \ (VME_Input_G1(p, uchar, 3, 24) = v) #define VME_SET_SICInput_NeighborPixelChroma25(p, v) \ (VME_Input_G1(p, uchar, 3, 25) = v) #define VME_SET_SICInput_NeighborPixelChroma26(p, v) \ (VME_Input_G1(p, uchar, 3, 26) = v) #define VME_SET_SICInput_NeighborPixelChroma27(p, v) \ (VME_Input_G1(p, uchar, 3, 27) = v) #define VME_SET_SICInput_NeighborPixelChroma28(p, v) \ (VME_Input_G1(p, uchar, 3, 28) = v) #define VME_SET_SICInput_NeighborPixelChroma29(p, v) \ (VME_Input_G1(p, uchar, 3, 29) = v) #define VME_SET_SICInput_NeighborPixelChroma30(p, v) \ (VME_Input_G1(p, uchar, 3, 30) = v) #define VME_SET_SICInput_NeighborPixelChroma31(p, v) \ (VME_Input_G1(p, uchar, 3, 31) = v) #define VME_SET_FBRInput_Ref0SubBlockX0(p, v) \ (VME_Input_S1(p, ushort, 0, 0) = v) #define VME_SET_FBRInput_Ref0SubBlockY0(p, v) \ (VME_Input_S1(p, ushort, 0, 1) = v) #define VME_SET_FBRInput_Ref1SubBlockX0(p, v) \ (VME_Input_S1(p, ushort, 0, 2) = v) #define VME_SET_FBRInput_Ref1SubBlockY0(p, v) \ (VME_Input_S1(p, ushort, 0, 3) = v) #define VME_SET_FBRInput_Ref0SubBlockX1(p, v) \ (VME_Input_S1(p, ushort, 0, 4) = v) #define VME_SET_FBRInput_Ref0SubBlockY1(p, v) \ (VME_Input_S1(p, ushort, 0, 5) = v) #define VME_SET_FBRInput_Ref1SubBlockX1(p, v) \ (VME_Input_S1(p, ushort, 0, 6) = v) #define VME_SET_FBRInput_Ref1SubBlockY1(p, v) \ (VME_Input_S1(p, ushort, 0, 7) = v) #define VME_SET_FBRInput_Ref0SubBlockX2(p, v) \ (VME_Input_S1(p, ushort, 0, 8) = v) #define VME_SET_FBRInput_Ref0SubBlockY2(p, v) \ (VME_Input_S1(p, ushort, 0, 9) = v) #define VME_SET_FBRInput_Ref1SubBlockX2(p, v) \ (VME_Input_S1(p, ushort, 0, 10) = v) #define VME_SET_FBRInput_Ref1SubBlockY2(p, v) \ (VME_Input_S1(p, ushort, 0, 11) = v) #define VME_SET_FBRInput_Ref0SubBlockX3(p, v) \ (VME_Input_S1(p, ushort, 0, 12) = v) #define VME_SET_FBRInput_Ref0SubBlockY3(p, v) \ (VME_Input_S1(p, ushort, 0, 13) = v) #define VME_SET_FBRInput_Ref1SubBlockX3(p, v) \ (VME_Input_S1(p, ushort, 0, 14) = v) #define VME_SET_FBRInput_Ref1SubBlockY3(p, v) \ (VME_Input_S1(p, ushort, 0, 15) = v) #define VME_SET_FBRInput_Ref0SubBlockX4(p, v) \ (VME_Input_S1(p, ushort, 1, 0) = v) #define VME_SET_FBRInput_Ref0SubBlockY4(p, v) \ (VME_Input_S1(p, ushort, 1, 1) = v) #define VME_SET_FBRInput_Ref1SubBlockX4(p, v) \ (VME_Input_S1(p, ushort, 1, 2) = v) #define VME_SET_FBRInput_Ref1SubBlockY4(p, v) \ (VME_Input_S1(p, ushort, 1, 3) = v) #define VME_SET_FBRInput_Ref0SubBlockX5(p, v) \ (VME_Input_S1(p, ushort, 1, 4) = v) #define VME_SET_FBRInput_Ref0SubBlockY5(p, v) \ (VME_Input_S1(p, ushort, 1, 5) = v) #define VME_SET_FBRInput_Ref1SubBlockX5(p, v) \ (VME_Input_S1(p, ushort, 1, 6) = v) #define VME_SET_FBRInput_Ref1SubBlockY5(p, v) \ (VME_Input_S1(p, ushort, 1, 7) = v) #define VME_SET_FBRInput_Ref0SubBlockX6(p, v) \ (VME_Input_S1(p, ushort, 1, 8) = v) #define VME_SET_FBRInput_Ref0SubBlockY6(p, v) \ (VME_Input_S1(p, ushort, 1, 9) = v) #define VME_SET_FBRInput_Ref1SubBlockX6(p, v) \ (VME_Input_S1(p, ushort, 1, 10) = v) #define VME_SET_FBRInput_Ref1SubBlockY6(p, v) \ (VME_Input_S1(p, ushort, 1, 11) = v) #define VME_SET_FBRInput_Ref0SubBlockX7(p, v) \ (VME_Input_S1(p, ushort, 1, 12) = v) #define VME_SET_FBRInput_Ref0SubBlockY7(p, v) \ (VME_Input_S1(p, ushort, 1, 13) = v) #define VME_SET_FBRInput_Ref1SubBlockX7(p, v) \ (VME_Input_S1(p, ushort, 1, 14) = v) #define VME_SET_FBRInput_Ref1SubBlockY7(p, v) \ (VME_Input_S1(p, ushort, 1, 15) = v) #define VME_SET_FBRInput_Ref0SubBlockX8(p, v) \ (VME_Input_S1(p, ushort, 2, 0) = v) #define VME_SET_FBRInput_Ref0SubBlockY8(p, v) \ (VME_Input_S1(p, ushort, 2, 1) = v) #define VME_SET_FBRInput_Ref1SubBlockX8(p, v) \ (VME_Input_S1(p, ushort, 2, 2) = v) #define VME_SET_FBRInput_Ref1SubBlockY8(p, v) \ (VME_Input_S1(p, ushort, 2, 3) = v) #define VME_SET_FBRInput_Ref0SubBlockX9(p, v) \ (VME_Input_S1(p, ushort, 2, 4) = v) #define VME_SET_FBRInput_Ref0SubBlockY9(p, v) \ (VME_Input_S1(p, ushort, 2, 5) = v) #define VME_SET_FBRInput_Ref1SubBlockX9(p, v) \ (VME_Input_S1(p, ushort, 2, 6) = v) #define VME_SET_FBRInput_Ref1SubBlockY9(p, v) \ (VME_Input_S1(p, ushort, 2, 7) = v) #define VME_SET_FBRInput_Ref0SubBlockX10(p, v) \ (VME_Input_S1(p, ushort, 2, 8) = v) #define VME_SET_FBRInput_Ref0SubBlockY10(p, v) \ (VME_Input_S1(p, ushort, 2, 9) = v) #define VME_SET_FBRInput_Ref1SubBlockX10(p, v) \ (VME_Input_S1(p, ushort, 2, 10) = v) #define VME_SET_FBRInput_Ref1SubBlockY10(p, v) \ (VME_Input_S1(p, ushort, 2, 11) = v) #define VME_SET_FBRInput_Ref0SubBlockX11(p, v) \ (VME_Input_S1(p, ushort, 2, 12) = v) #define VME_SET_FBRInput_Ref0SubBlockY11(p, v) \ (VME_Input_S1(p, ushort, 2, 13) = v) #define VME_SET_FBRInput_Ref1SubBlockX11(p, v) \ (VME_Input_S1(p, ushort, 2, 14) = v) #define VME_SET_FBRInput_Ref1SubBlockY11(p, v) \ (VME_Input_S1(p, ushort, 2, 15) = v) #define VME_SET_FBRInput_Ref0SubBlockX12(p, v) \ (VME_Input_S1(p, ushort, 3, 0) = v) #define VME_SET_FBRInput_Ref0SubBlockY12(p, v) \ (VME_Input_S1(p, ushort, 3, 1) = v) #define VME_SET_FBRInput_Ref1SubBlockX12(p, v) \ (VME_Input_S1(p, ushort, 3, 2) = v) #define VME_SET_FBRInput_Ref1SubBlockY12(p, v) \ (VME_Input_S1(p, ushort, 3, 3) = v) #define VME_SET_FBRInput_Ref0SubBlockX13(p, v) \ (VME_Input_S1(p, ushort, 3, 4) = v) #define VME_SET_FBRInput_Ref0SubBlockY13(p, v) \ (VME_Input_S1(p, ushort, 3, 5) = v) #define VME_SET_FBRInput_Ref1SubBlockX13(p, v) \ (VME_Input_S1(p, ushort, 3, 6) = v) #define VME_SET_FBRInput_Ref1SubBlockY13(p, v) \ (VME_Input_S1(p, ushort, 3, 7) = v) #define VME_SET_FBRInput_Ref0SubBlockX14(p, v) \ (VME_Input_S1(p, ushort, 3, 8) = v) #define VME_SET_FBRInput_Ref0SubBlockY14(p, v) \ (VME_Input_S1(p, ushort, 3, 9) = v) #define VME_SET_FBRInput_Ref1SubBlockX14(p, v) \ (VME_Input_S1(p, ushort, 3, 10) = v) #define VME_SET_FBRInput_Ref1SubBlockY14(p, v) \ (VME_Input_S1(p, ushort, 3, 11) = v) #define VME_SET_FBRInput_Ref0SubBlockX15(p, v) \ (VME_Input_S1(p, ushort, 3, 12) = v) #define VME_SET_FBRInput_Ref0SubBlockY15(p, v) \ (VME_Input_S1(p, ushort, 3, 13) = v) #define VME_SET_FBRInput_Ref1SubBlockX15(p, v) \ (VME_Input_S1(p, ushort, 3, 14) = v) #define VME_SET_FBRInput_Ref1SubBlockY15(p, v) \ (VME_Input_S1(p, ushort, 3, 15) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow0(p, v) \ (VME_Input_S1(p, ushort, 0, 0) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow1(p, v) \ (VME_Input_S1(p, ushort, 0, 1) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow2(p, v) \ (VME_Input_S1(p, ushort, 0, 2) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow3(p, v) \ (VME_Input_S1(p, ushort, 0, 3) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow4(p, v) \ (VME_Input_S1(p, ushort, 0, 4) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow5(p, v) \ (VME_Input_S1(p, ushort, 0, 5) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow6(p, v) \ (VME_Input_S1(p, ushort, 0, 6) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow7(p, v) \ (VME_Input_S1(p, ushort, 0, 7) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow8(p, v) \ (VME_Input_S1(p, ushort, 0, 8) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow9(p, v) \ (VME_Input_S1(p, ushort, 0, 9) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow10(p, v) \ (VME_Input_S1(p, ushort, 0, 10) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow11(p, v) \ (VME_Input_S1(p, ushort, 0, 11) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow12(p, v) \ (VME_Input_S1(p, ushort, 0, 12) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow13(p, v) \ (VME_Input_S1(p, ushort, 0, 13) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow14(p, v) \ (VME_Input_S1(p, ushort, 0, 14) = v) #define VME_SET_IDMInput_SrcMBPixelMaskRow15(p, v) \ (VME_Input_S1(p, ushort, 0, 15) = v) // GET methods // Format = I16 #define VME_GET_UNIInput_Ref0X(p) (VME_Input_G1(p, ushort, 0, 0)) #define VME_GET_UNIInput_Ref0Y(p) (VME_Input_G1(p, ushort, 0, 1)) #define VME_GET_UNIInput_Ref1X(p) (VME_Input_G1(p, ushort, 0, 2)) #define VME_GET_UNIInput_Ref1Y(p) (VME_Input_G1(p, ushort, 0, 3)) // Format = U16 #define VME_GET_UNIInput_SrcX(p) (VME_Input_G1(p, ushort, 0, 4)) // Format = U16 #define VME_GET_UNIInput_SrcY(p) (VME_Input_G1(p, ushort, 0, 5)) // Format = U8 #define VME_GET_UNIInput_SrcType(p) (VME_Input_G1(p, uchar, 0, 12)) // Format = U8 #define VME_GET_UNIInput_VmeModes(p) (VME_Input_G1(p, uchar, 0, 13)) // Format = U8 #define VME_GET_UNIInput_SadType(p) (VME_Input_G1(p, uchar, 0, 14)) // Format = U8 #define VME_GET_UNIInput_ShapeMask(p) (VME_Input_G1(p, uchar, 0, 15)) // The value must be a multiple of 4. Range = [20, 64] #define VME_GET_UNIInput_RefW(p) (VME_Input_G1(p, uchar, 0, 22)) // The value must be a multiple of 4. Range = [20, 64] #define VME_GET_UNIInput_RefH(p) (VME_Input_G1(p, uchar, 0, 23)) // Format = U8 #define VME_GET_UNIInput_VmeFlags(p) (VME_Input_G1(p, uchar, 1, 0)) // Format = U8 #define VME_GET_UNIInput_EarlyImeStop(p) (VME_Input_G1(p, uchar, 1, 3)) // Format = U8 #define VME_GET_UNIInput_MaxNumMVs(p) (VME_Input_G1(p, uchar, 1, 4)) #define VME_GET_UNIInput_Ref0Polarity(p) (VME_Input_G1(p, uchar, 1, 5) & 0x0F) #define VME_GET_UNIInput_Ref1Polarity(p) (VME_Input_G1(p, uchar, 1, 5) >> 4) // Format = U6, Valid Values: [16, 21, 32, 43, 48] #define VME_GET_UNIInput_BiWeight(p) (VME_Input_G1(p, uchar, 1, 6)) #define VME_GET_UNIInput_RefPixelBiasEnable(p) \ ((VME_Input_G1(p, uchar, 1, 7) & 0x20) ? 1 : 0) #define VME_GET_UNIInput_UniMixDisable(p) \ ((VME_Input_G1(p, uchar, 1, 7) & 0x10) ? 1 : 0) // Format = U8 // #define VME_GET_UNIInput_BiDirMask(p) ((VME_Input_G1(p, uchar, 1, 7) & 0x10) // ? 1 : 0) // Format = U8, Valid range [1,63] #define VME_GET_UNIInput_LenSP(p) (VME_Input_G1(p, uchar, 1, 8)) // Format = U8, Valid range [1,63] #define VME_GET_UNIInput_MaxNumSU(p) (VME_Input_G1(p, uchar, 1, 9)) // Format = U8 #define VME_GET_UNIInput_StartCenter0(p) (VME_Input_G1(p, uchar, 1, 10)) // Format = U8 #define VME_GET_UNIInput_StartCenter1(p) (VME_Input_G1(p, uchar, 1, 11)) // Format = U8 #define VME_GET_UNIInput_WeightedSADCtrl0_3(p) (VME_Input_G1(p, uchar, 1, 12)) #define VME_GET_UNIInput_WeightedSADCtrl4_7(p) (VME_Input_G1(p, uchar, 1, 13)) #define VME_GET_UNIInput_WeightedSADCtrl8_11(p) (VME_Input_G1(p, uchar, 1, 14)) #define VME_GET_UNIInput_WeightedSADCtrl12_15(p) (VME_Input_G1(p, uchar, 1, 15)) // Format = U8 #define VME_GET_UNIInput_Blk0RefID(p) (VME_Input_G1(p, uchar, 1, 24)) #define VME_GET_UNIInput_Blk1RefID(p) (VME_Input_G1(p, uchar, 1, 25)) #define VME_GET_UNIInput_Blk2RefID(p) (VME_Input_G1(p, uchar, 1, 26)) #define VME_GET_UNIInput_Blk3RefID(p) (VME_Input_G1(p, uchar, 1, 27)) // Format = U8 #define VME_GET_UNIInput_IntraFlags(p) (VME_Input_G1(p, uchar, 1, 28)) // v is a 8-bit mask with the following definition: // Bit-7 Reserved : MBZ (for IntraPredAvailFlagF - F (pixel[-1,7] // available // for MbAff) // Bit-6 Reserved : MBZ (for IntraPredAvailFlagA/E - A (left neighbor top // half for MbAff) // Bit-5 IntraPredAvailFlagE/A - A (Left neighbor or Left bottom half) // Bit-4 IntraPredAvailFlagB - B (Upper neighbor) // Bit-3 IntraPredAvailFlagC - C (Upper left neighbor) // Bit-2 IntraPredAvailFlagD - D (Upper right neighbor) // Bit-1:0 Reserved: MBZ (ChromaIntraPredMode) #define VME_GET_UNIInput_MbIntraStruct(p) (VME_Input_G1(p, uchar, 1, 29)) // Format = U8 #define VME_GET_UNIInput_MvFlags(p) (VME_Input_G1(p, uchar, 1, 30)) // v is a 8-bit mask with the following definition: // xxxx xxx1: Ref0 Skip Center 0 is enabled [corresponds to M2.0] // xxxx xx1x: Ref1 Skip Center 0 is enabled [corresponds to M2.1] // xxxx x1xx: Ref0 Skip Center 1 is enabled [corresponds to M2.2] // xxxx 1xxx: Ref1 Skip Center 1 is enabled [corresponds to M2.3] // xxx1 xxxx: Ref0 Skip Center 2 is enabled [corresponds to M2.4] // xx1x xxxx: Ref1 Skip Center 2 is enabled [corresponds to M2.5] // x1xx xxxx: Ref0 Skip Center 3 is enabled [corresponds to M2.6] // 1xxx xxxx: Ref1 Skip Center 3 is enabled [corresponds to M2.7] #define VME_GET_UNIInput_SkipCenterMask(p) (VME_Input_G1(p, uchar, 1, 31)) // NOTE: replace v with U4U4 type with // (shift_count, shift_val) and set the value as (shift_val | (shift_count << // 4)) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_GET_UNIInput_Mode0Cost(p) (VME_Input_G1(p, uchar, 2, 0)) #define VME_GET_UNIInput_Mode1Cost(p) (VME_Input_G1(p, uchar, 2, 1)) #define VME_GET_UNIInput_Mode2Cost(p) (VME_Input_G1(p, uchar, 2, 2)) #define VME_GET_UNIInput_Mode3Cost(p) (VME_Input_G1(p, uchar, 2, 3)) #define VME_GET_UNIInput_Mode4Cost(p) (VME_Input_G1(p, uchar, 2, 4)) #define VME_GET_UNIInput_Mode5Cost(p) (VME_Input_G1(p, uchar, 2, 5)) #define VME_GET_UNIInput_Mode6Cost(p) (VME_Input_G1(p, uchar, 2, 6)) #define VME_GET_UNIInput_Mode7Cost(p) (VME_Input_G1(p, uchar, 2, 7)) #define VME_GET_UNIInput_Mode8Cost(p) (VME_Input_G1(p, uchar, 2, 8)) #define VME_GET_UNIInput_Mode9Cost(p) (VME_Input_G1(p, uchar, 2, 9)) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_GET_UNIInput_RefIDCost(p) (VME_Input_G1(p, uchar, 2, 10)) // Format = U4U4 (encoded value must fit in 12-bits) #define VME_GET_UNIInput_ChromaIntraModeCost(p) (VME_Input_G1(p, uchar, 2, 11)) // Format = U4U4 (encoded value must fit in 10-bits) #define VME_GET_UNIInput_MV0Cost(p) (VME_Input_G1(p, uchar, 2, 12)) #define VME_GET_UNIInput_MV1Cost(p) (VME_Input_G1(p, uchar, 2, 13)) #define VME_GET_UNIInput_MV2Cost(p) (VME_Input_G1(p, uchar, 2, 14)) #define VME_GET_UNIInput_MV3Cost(p) (VME_Input_G1(p, uchar, 2, 15)) #define VME_GET_UNIInput_MV4Cost(p) (VME_Input_G1(p, uchar, 2, 16)) #define VME_GET_UNIInput_MV5Cost(p) (VME_Input_G1(p, uchar, 2, 17)) #define VME_GET_UNIInput_MV6Cost(p) (VME_Input_G1(p, uchar, 2, 18)) #define VME_GET_UNIInput_MV7Cost(p) (VME_Input_G1(p, uchar, 2, 19)) // Format = U8 #define VME_GET_UNIInput_FBRMbModeInput(p) (VME_Input_G1(p, uchar, 2, 20) & 0x3) // Format = U8 #define VME_GET_UNIInput_FBRSubMBShapeInput(p) (VME_Input_G1(p, uchar, 2, 21)) // Format = U8 #define VME_GET_UNIInput_FBRSubPredModeInput(p) (VME_Input_G1(p, uchar, 2, 22)) // Format = U16 #define VME_GET_UNIInput_SICFwdTCoeffThreshold0(p) \ (VME_Input_G1(p, ushort, 2, 12)) // Format = U8 #define VME_GET_UNIInput_SICFwdTCoeffThreshold1(p) \ (VME_Input_G1(p, uchar, 2, 26)) #define VME_GET_UNIInput_SICFwdTCoeffThreshold2(p) \ (VME_Input_G1(p, uchar, 2, 27)) #define VME_GET_UNIInput_SICFwdTCoeffThreshold3(p) \ (VME_Input_G1(p, uchar, 2, 28)) #define VME_GET_UNIInput_SICFwdTCoeffThreshold4(p) \ (VME_Input_G1(p, uchar, 2, 29)) #define VME_GET_UNIInput_SICFwdTCoeffThreshold5(p) \ (VME_Input_G1(p, uchar, 2, 30)) #define VME_GET_UNIInput_SICFwdTCoeffThreshold6(p) \ (VME_Input_G1(p, uchar, 2, 31)) // Return DeltaX in the lower 16 bit and DeltaY in the higher 16 bits // Format = S13.2, DletaX Valid Range: [-2048.00 to 2047.75], DletaY Valid // Range: [-512.00 to 511.75] #define VME_GET_UNIInput_FWDCostCenter0_X(p) (VME_Input_G1(p, ushort, 3, 0)) #define VME_GET_UNIInput_FWDCostCenter0_Y(p) (VME_Input_G1(p, ushort, 3, 1)) #define VME_GET_UNIInput_BWDCostCenter0_X(p) (VME_Input_G1(p, ushort, 3, 2)) #define VME_GET_UNIInput_BWDCostCenter0_Y(p) (VME_Input_G1(p, ushort, 3, 3)) #define VME_GET_UNIInput_FWDCostCenter1_X(p) (VME_Input_G1(p, ushort, 3, 4)) #define VME_GET_UNIInput_FWDCostCenter1_Y(p) (VME_Input_G1(p, ushort, 3, 5)) #define VME_GET_UNIInput_BWDCostCenter1_X(p) (VME_Input_G1(p, ushort, 3, 6)) #define VME_GET_UNIInput_BWDCostCenter1_Y(p) (VME_Input_G1(p, ushort, 3, 7)) #define VME_GET_UNIInput_FWDCostCenter2_X(p) (VME_Input_G1(p, ushort, 3, 8)) #define VME_GET_UNIInput_FWDCostCenter2_Y(p) (VME_Input_G1(p, ushort, 3, 9)) #define VME_GET_UNIInput_BWDCostCenter2_X(p) (VME_Input_G1(p, ushort, 3, 10)) #define VME_GET_UNIInput_BWDCostCenter2_Y(p) (VME_Input_G1(p, ushort, 3, 11)) #define VME_GET_UNIInput_FWDCostCenter3_X(p) (VME_Input_G1(p, ushort, 3, 12)) #define VME_GET_UNIInput_FWDCostCenter3_Y(p) (VME_Input_G1(p, ushort, 3, 13)) #define VME_GET_UNIInput_BWDCostCenter3_X(p) (VME_Input_G1(p, ushort, 3, 14)) #define VME_GET_UNIInput_BWDCostCenter3_Y(p) (VME_Input_G1(p, ushort, 3, 15)) // Format = U8, with the following definition: // [7:4] (Y) - specifies relative Y distance to the next SU from previous SU in // units of SU // [3:0] (X) - specifies relative X distance to the next SU from previous SU in // units of SU #define VME_GET_IMEInput_IMESearchPathDelta0(p) (VME_Input_G1(p, uchar, 0, 0)) #define VME_GET_IMEInput_IMESearchPathDelta1(p) (VME_Input_G1(p, uchar, 0, 1)) #define VME_GET_IMEInput_IMESearchPathDelta2(p) (VME_Input_G1(p, uchar, 0, 2)) #define VME_GET_IMEInput_IMESearchPathDelta3(p) (VME_Input_G1(p, uchar, 0, 3)) #define VME_GET_IMEInput_IMESearchPathDelta4(p) (VME_Input_G1(p, uchar, 0, 4)) #define VME_GET_IMEInput_IMESearchPathDelta5(p) (VME_Input_G1(p, uchar, 0, 5)) #define VME_GET_IMEInput_IMESearchPathDelta6(p) (VME_Input_G1(p, uchar, 0, 6)) #define VME_GET_IMEInput_IMESearchPathDelta7(p) (VME_Input_G1(p, uchar, 0, 7)) #define VME_GET_IMEInput_IMESearchPathDelta8(p) (VME_Input_G1(p, uchar, 0, 8)) #define VME_GET_IMEInput_IMESearchPathDelta9(p) (VME_Input_G1(p, uchar, 0, 9)) #define VME_GET_IMEInput_IMESearchPathDelta10(p) (VME_Input_G1(p, uchar, 0, 10)) #define VME_GET_IMEInput_IMESearchPathDelta11(p) (VME_Input_G1(p, uchar, 0, 11)) #define VME_GET_IMEInput_IMESearchPathDelta12(p) (VME_Input_G1(p, uchar, 0, 12)) #define VME_GET_IMEInput_IMESearchPathDelta13(p) (VME_Input_G1(p, uchar, 0, 13)) #define VME_GET_IMEInput_IMESearchPathDelta14(p) (VME_Input_G1(p, uchar, 0, 14)) #define VME_GET_IMEInput_IMESearchPathDelta15(p) (VME_Input_G1(p, uchar, 0, 15)) #define VME_GET_IMEInput_IMESearchPathDelta16(p) (VME_Input_G1(p, uchar, 0, 16)) #define VME_GET_IMEInput_IMESearchPathDelta17(p) (VME_Input_G1(p, uchar, 0, 17)) #define VME_GET_IMEInput_IMESearchPathDelta18(p) (VME_Input_G1(p, uchar, 0, 18)) #define VME_GET_IMEInput_IMESearchPathDelta19(p) (VME_Input_G1(p, uchar, 0, 19)) #define VME_GET_IMEInput_IMESearchPathDelta20(p) (VME_Input_G1(p, uchar, 0, 20)) #define VME_GET_IMEInput_IMESearchPathDelta21(p) (VME_Input_G1(p, uchar, 0, 21)) #define VME_GET_IMEInput_IMESearchPathDelta22(p) (VME_Input_G1(p, uchar, 0, 22)) #define VME_GET_IMEInput_IMESearchPathDelta23(p) (VME_Input_G1(p, uchar, 0, 23)) #define VME_GET_IMEInput_IMESearchPathDelta24(p) (VME_Input_G1(p, uchar, 0, 24)) #define VME_GET_IMEInput_IMESearchPathDelta25(p) (VME_Input_G1(p, uchar, 0, 25)) #define VME_GET_IMEInput_IMESearchPathDelta26(p) (VME_Input_G1(p, uchar, 0, 26)) #define VME_GET_IMEInput_IMESearchPathDelta27(p) (VME_Input_G1(p, uchar, 0, 27)) #define VME_GET_IMEInput_IMESearchPathDelta28(p) (VME_Input_G1(p, uchar, 0, 28)) #define VME_GET_IMEInput_IMESearchPathDelta29(p) (VME_Input_G1(p, uchar, 0, 29)) #define VME_GET_IMEInput_IMESearchPathDelta30(p) (VME_Input_G1(p, uchar, 0, 30)) #define VME_GET_IMEInput_IMESearchPathDelta31(p) (VME_Input_G1(p, uchar, 0, 31)) #define VME_GET_IMEInput_IMESearchPathDelta32(p) (VME_Input_G1(p, uchar, 1, 0)) #define VME_GET_IMEInput_IMESearchPathDelta33(p) (VME_Input_G1(p, uchar, 1, 1)) #define VME_GET_IMEInput_IMESearchPathDelta34(p) (VME_Input_G1(p, uchar, 1, 2)) #define VME_GET_IMEInput_IMESearchPathDelta35(p) (VME_Input_G1(p, uchar, 1, 3)) #define VME_GET_IMEInput_IMESearchPathDelta36(p) (VME_Input_G1(p, uchar, 1, 4)) #define VME_GET_IMEInput_IMESearchPathDelta37(p) (VME_Input_G1(p, uchar, 1, 5)) #define VME_GET_IMEInput_IMESearchPathDelta38(p) (VME_Input_G1(p, uchar, 1, 6)) #define VME_GET_IMEInput_IMESearchPathDelta39(p) (VME_Input_G1(p, uchar, 1, 7)) #define VME_GET_IMEInput_IMESearchPathDelta40(p) (VME_Input_G1(p, uchar, 1, 8)) #define VME_GET_IMEInput_IMESearchPathDelta41(p) (VME_Input_G1(p, uchar, 1, 9)) #define VME_GET_IMEInput_IMESearchPathDelta42(p) (VME_Input_G1(p, uchar, 1, 10)) #define VME_GET_IMEInput_IMESearchPathDelta43(p) (VME_Input_G1(p, uchar, 1, 11)) #define VME_GET_IMEInput_IMESearchPathDelta44(p) (VME_Input_G1(p, uchar, 1, 12)) #define VME_GET_IMEInput_IMESearchPathDelta45(p) (VME_Input_G1(p, uchar, 1, 13)) #define VME_GET_IMEInput_IMESearchPathDelta46(p) (VME_Input_G1(p, uchar, 1, 14)) #define VME_GET_IMEInput_IMESearchPathDelta47(p) (VME_Input_G1(p, uchar, 1, 15)) #define VME_GET_IMEInput_IMESearchPathDelta48(p) (VME_Input_G1(p, uchar, 1, 16)) #define VME_GET_IMEInput_IMESearchPathDelta49(p) (VME_Input_G1(p, uchar, 1, 17)) #define VME_GET_IMEInput_IMESearchPathDelta50(p) (VME_Input_G1(p, uchar, 1, 18)) #define VME_GET_IMEInput_IMESearchPathDelta51(p) (VME_Input_G1(p, uchar, 1, 19)) #define VME_GET_IMEInput_IMESearchPathDelta52(p) (VME_Input_G1(p, uchar, 1, 20)) #define VME_GET_IMEInput_IMESearchPathDelta53(p) (VME_Input_G1(p, uchar, 1, 21)) #define VME_GET_IMEInput_IMESearchPathDelta54(p) (VME_Input_G1(p, uchar, 1, 22)) #define VME_GET_IMEInput_IMESearchPathDelta55(p) (VME_Input_G1(p, uchar, 1, 23)) // Format = U16 #define VME_GET_IMEInput_Rec0_16x8_0Distortion(p) \ (VME_Input_G1(p, ushort, 2, 0)) #define VME_GET_IMEInput_Rec0_16x8_1Distortion(p) \ (VME_Input_G1(p, ushort, 2, 1)) #define VME_GET_IMEInput_Rec0_8x16_0Distortion(p) \ (VME_Input_G1(p, ushort, 2, 2)) #define VME_GET_IMEInput_Rec0_8x16_1Distortion(p) \ (VME_Input_G1(p, ushort, 2, 3)) #define VME_GET_IMEInput_Rec0_8x8_0Distortion(p) (VME_Input_G1(p, ushort, 2, 4)) #define VME_GET_IMEInput_Rec0_8x8_1Distortion(p) (VME_Input_G1(p, ushort, 2, 5)) #define VME_GET_IMEInput_Rec0_8x8_2Distortion(p) (VME_Input_G1(p, ushort, 2, 6)) #define VME_GET_IMEInput_Rec0_8x8_3Distortion(p) (VME_Input_G1(p, ushort, 2, 7)) #define VME_GET_IMEInput_Rec0_16x16_Distortion(p) \ (VME_Input_G1(p, ushort, 2, 8)) // Format = U4 #define VME_GET_UNIInput_Rec0_16x16_RefID(p) \ (VME_Input_G1(p, uchar, 2, 18) & 0x0F) // Format = S13.2 #define VME_GET_IMEInput_Rec0_16x16_X(p) (VME_Input_G1(p, ushort, 2, 10)) #define VME_GET_IMEInput_Rec0_16x16_Y(p) (VME_Input_G1(p, ushort, 2, 11)) // Format = U4 #define VME_GET_IMEInput_Rec0_16x8_0to1RefID(p) (VME_Input_G1(p, uchar, 2, 24)) #define VME_GET_IMEInput_Rec0_8x16_0to1RefID(p) (VME_Input_G1(p, uchar, 2, 25)) #define VME_GET_IMEInput_Rec0_8x8_0to1RefID(p) (VME_Input_G1(p, uchar, 2, 26)) #define VME_GET_IMEInput_Rec0_8x8_2to3RefID(p) (VME_Input_G1(p, uchar, 2, 27)) // Format = S13.2 #define VME_GET_IMEInput_Rec0_16x8_0X(p) (VME_Input_G1(p, ushort, 3, 0)) #define VME_GET_IMEInput_Rec0_16x8_0Y(p) (VME_Input_G1(p, ushort, 3, 1)) #define VME_GET_IMEInput_Rec0_16x8_1X(p) (VME_Input_G1(p, ushort, 3, 2)) #define VME_GET_IMEInput_Rec0_16x8_1Y(p) (VME_Input_G1(p, ushort, 3, 3)) #define VME_GET_IMEInput_Rec0_8x16_0X(p) (VME_Input_G1(p, ushort, 3, 4)) #define VME_GET_IMEInput_Rec0_8x16_0Y(p) (VME_Input_G1(p, ushort, 3, 5)) #define VME_GET_IMEInput_Rec0_8x16_1X(p) (VME_Input_G1(p, ushort, 3, 6)) #define VME_GET_IMEInput_Rec0_8x16_1Y(p) (VME_Input_G1(p, ushort, 3, 7)) #define VME_GET_IMEInput_Rec0_8x8_0X(p) (VME_Input_G1(p, ushort, 3, 8)) #define VME_GET_IMEInput_Rec0_8x8_0Y(p) (VME_Input_G1(p, ushort, 3, 9)) #define VME_GET_IMEInput_Rec0_8x8_1X(p) (VME_Input_G1(p, ushort, 3, 10)) #define VME_GET_IMEInput_Rec0_8x8_1Y(p) (VME_Input_G1(p, ushort, 3, 11)) #define VME_GET_IMEInput_Rec0_8x8_2X(p) (VME_Input_G1(p, ushort, 3, 12)) #define VME_GET_IMEInput_Rec0_8x8_2Y(p) (VME_Input_G1(p, ushort, 3, 13)) #define VME_GET_IMEInput_Rec0_8x8_3X(p) (VME_Input_G1(p, ushort, 3, 14)) #define VME_GET_IMEInput_Rec0_8x8_3Y(p) (VME_Input_G1(p, ushort, 3, 15)) // Format = U16 #define VME_GET_IMEInput_Rec1_16x8_0Distortion(p) \ (VME_Input_G1(p, ushort, 4, 0)) #define VME_GET_IMEInput_Rec1_16x8_1Distortion(p) \ (VME_Input_G1(p, ushort, 4, 1)) #define VME_GET_IMEInput_Rec1_8x16_0Distortion(p) \ (VME_Input_G1(p, ushort, 4, 2)) #define VME_GET_IMEInput_Rec1_8x16_1Distortion(p) \ (VME_Input_G1(p, ushort, 4, 3)) #define VME_GET_IMEInput_Rec1_8x8_0Distortion(p) (VME_Input_G1(p, ushort, 4, 4)) #define VME_GET_IMEInput_Rec1_8x8_1Distortion(p) (VME_Input_G1(p, ushort, 4, 5)) #define VME_GET_IMEInput_Rec1_8x8_2Distortion(p) (VME_Input_G1(p, ushort, 4, 6)) #define VME_GET_IMEInput_Rec1_8x8_3Distortion(p) (VME_Input_G1(p, ushort, 4, 7)) #define VME_GET_IMEInput_Rec1_16x16_Distortion(p) \ (VME_Input_G1(p, ushort, 4, 8)) // Format = U4 #define VME_GET_UNIInput_Rec1_16x16_RefID(p) (VME_Input_G1(p, uchar, 4, 18)) // Format = S13.2 #define VME_GET_IMEInput_Rec1_16x16_X(p) (VME_Input_G1(p, ushort, 4, 10)) #define VME_GET_IMEInput_Rec1_16x16_Y(p) (VME_Input_G1(p, ushort, 4, 11)) // Format = U4 #define VME_GET_IMEInput_Rec1_16x8_0to1RefID(p) (VME_Input_G1(p, uchar, 4, 24)) #define VME_GET_IMEInput_Rec1_8x16_0to1RefID(p) (VME_Input_G1(p, uchar, 4, 25)) #define VME_GET_IMEInput_Rec1_8x8_0to1RefID(p) (VME_Input_G1(p, uchar, 4, 26)) #define VME_GET_IMEInput_Rec1_8x8_2to3RefID(p) (VME_Input_G1(p, uchar, 4, 27)) // Format = S13.2 #define VME_GET_IMEInput_Rec1_16x8_0X(p) (VME_Input_G1(p, ushort, 5, 0)) #define VME_GET_IMEInput_Rec1_16x8_0Y(p) (VME_Input_G1(p, ushort, 5, 1)) #define VME_GET_IMEInput_Rec1_16x8_1X(p) (VME_Input_G1(p, ushort, 5, 2)) #define VME_GET_IMEInput_Rec1_16x8_1Y(p) (VME_Input_G1(p, ushort, 5, 3)) #define VME_GET_IMEInput_Rec1_8x16_0X(p) (VME_Input_G1(p, ushort, 5, 4)) #define VME_GET_IMEInput_Rec1_8x16_0Y(p) (VME_Input_G1(p, ushort, 5, 5)) #define VME_GET_IMEInput_Rec1_8x16_1X(p) (VME_Input_G1(p, ushort, 5, 6)) #define VME_GET_IMEInput_Rec1_8x16_1Y(p) (VME_Input_G1(p, ushort, 5, 7)) #define VME_GET_IMEInput_Rec1_8x8_0X(p) (VME_Input_G1(p, ushort, 5, 8)) #define VME_GET_IMEInput_Rec1_8x8_0Y(p) (VME_Input_G1(p, ushort, 5, 9)) #define VME_GET_IMEInput_Rec1_8x8_1X(p) (VME_Input_G1(p, ushort, 5, 10)) #define VME_GET_IMEInput_Rec1_8x8_1Y(p) (VME_Input_G1(p, ushort, 5, 11)) #define VME_GET_IMEInput_Rec1_8x8_2X(p) (VME_Input_G1(p, ushort, 5, 12)) #define VME_GET_IMEInput_Rec1_8x8_2Y(p) (VME_Input_G1(p, ushort, 5, 13)) #define VME_GET_IMEInput_Rec1_8x8_3X(p) (VME_Input_G1(p, ushort, 5, 14)) #define VME_GET_IMEInput_Rec1_8x8_3Y(p) (VME_Input_G1(p, ushort, 5, 15)) // Format = S13.2, Valid Range: [-2048.00 to 2047.75] // For chroma skip: Format = S12.3, Hardware Range: [-1024.000 to 1023.875] #define VME_GET_SICInput_Ref0SkipCenter0DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 0)) #define VME_GET_SICInput_Ref0SkipCenter0DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 1)) #define VME_GET_SICInput_Ref1SkipCenter0DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 2)) #define VME_GET_SICInput_Ref1SkipCenter0DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 3)) #define VME_GET_SICInput_Ref0SkipCenter1DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 4)) #define VME_GET_SICInput_Ref0SkipCenter1DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 5)) #define VME_GET_SICInput_Ref1SkipCenter1DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 6)) #define VME_GET_SICInput_Ref1SkipCenter1DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 7)) #define VME_GET_SICInput_Ref0SkipCenter2DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 8)) #define VME_GET_SICInput_Ref0SkipCenter2DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 9)) #define VME_GET_SICInput_Ref1SkipCenter2DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 10)) #define VME_GET_SICInput_Ref1SkipCenter2DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 11)) #define VME_GET_SICInput_Ref0SkipCenter3DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 12)) #define VME_GET_SICInput_Ref0SkipCenter3DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 13)) #define VME_GET_SICInput_Ref1SkipCenter3DeltaX(p) \ (VME_Input_G1(p, ushort, 0, 14)) #define VME_GET_SICInput_Ref1SkipCenter3DeltaY(p) \ (VME_Input_G1(p, ushort, 0, 15)) #define VME_GET_SICInput_Intra4x4ModeMask(p) (VME_Input_G1(p, uchar, 1, 0)) #define VME_GET_SICInput_Intra8x8ModeMask(p) (VME_Input_G1(p, uchar, 1, 2)) #define VME_GET_SICInput_IntraModeMask(p) (VME_Input_G1(p, uchar, 1, 4)) // 2-bit field with the following definition // 00: Luma + Chroma enabled // 01: Luma only // 1X: Intra disabled #define VME_GET_SICInput_IntraComputeType(p) \ (VME_Input_G1(p, uchar, 1, 5) & 0x3) #define VME_GET_SICInput_CornerNeighborPixel0(p) (VME_Input_G1(p, uchar, 1, 7)) #define VME_GET_SICInput_NeighborPixelLum0(p) (VME_Input_G1(p, uchar, 1, 8)) #define VME_GET_SICInput_NeighborPixelLum1(p) (VME_Input_G1(p, uchar, 1, 9)) #define VME_GET_SICInput_NeighborPixelLum2(p) (VME_Input_G1(p, uchar, 1, 10)) #define VME_GET_SICInput_NeighborPixelLum3(p) (VME_Input_G1(p, uchar, 1, 11)) #define VME_GET_SICInput_NeighborPixelLum4(p) (VME_Input_G1(p, uchar, 1, 12)) #define VME_GET_SICInput_NeighborPixelLum5(p) (VME_Input_G1(p, uchar, 1, 13)) #define VME_GET_SICInput_NeighborPixelLum6(p) (VME_Input_G1(p, uchar, 1, 14)) #define VME_GET_SICInput_NeighborPixelLum7(p) (VME_Input_G1(p, uchar, 1, 15)) #define VME_GET_SICInput_NeighborPixelLum8(p) (VME_Input_G1(p, uchar, 1, 16)) #define VME_GET_SICInput_NeighborPixelLum9(p) (VME_Input_G1(p, uchar, 1, 17)) #define VME_GET_SICInput_NeighborPixelLum10(p) (VME_Input_G1(p, uchar, 1, 18)) #define VME_GET_SICInput_NeighborPixelLum11(p) (VME_Input_G1(p, uchar, 1, 19)) #define VME_GET_SICInput_NeighborPixelLum12(p) (VME_Input_G1(p, uchar, 1, 20)) #define VME_GET_SICInput_NeighborPixelLum13(p) (VME_Input_G1(p, uchar, 1, 21)) #define VME_GET_SICInput_NeighborPixelLum14(p) (VME_Input_G1(p, uchar, 1, 22)) #define VME_GET_SICInput_NeighborPixelLum15(p) (VME_Input_G1(p, uchar, 1, 23)) #define VME_GET_SICInput_NeighborPixelLum16(p) (VME_Input_G1(p, uchar, 1, 24)) #define VME_GET_SICInput_NeighborPixelLum17(p) (VME_Input_G1(p, uchar, 1, 25)) #define VME_GET_SICInput_NeighborPixelLum18(p) (VME_Input_G1(p, uchar, 1, 26)) #define VME_GET_SICInput_NeighborPixelLum19(p) (VME_Input_G1(p, uchar, 1, 27)) #define VME_GET_SICInput_NeighborPixelLum20(p) (VME_Input_G1(p, uchar, 1, 28)) #define VME_GET_SICInput_NeighborPixelLum21(p) (VME_Input_G1(p, uchar, 1, 29)) #define VME_GET_SICInput_NeighborPixelLum22(p) (VME_Input_G1(p, uchar, 1, 30)) #define VME_GET_SICInput_NeighborPixelLum23(p) (VME_Input_G1(p, uchar, 1, 31)) #define VME_GET_SICInput_NeighborPixelLum24(p) (VME_Input_G1(p, uchar, 2, 0)) #define VME_GET_SICInput_NeighborPixelLum25(p) (VME_Input_G1(p, uchar, 2, 1)) #define VME_GET_SICInput_NeighborPixelLum26(p) (VME_Input_G1(p, uchar, 2, 2)) #define VME_GET_SICInput_NeighborPixelLum27(p) (VME_Input_G1(p, uchar, 2, 3)) #define VME_GET_SICInput_NeighborPixelLum28(p) (VME_Input_G1(p, uchar, 2, 4)) #define VME_GET_SICInput_NeighborPixelLum29(p) (VME_Input_G1(p, uchar, 2, 5)) #define VME_GET_SICInput_NeighborPixelLum30(p) (VME_Input_G1(p, uchar, 2, 6)) #define VME_GET_SICInput_NeighborPixelLum31(p) (VME_Input_G1(p, uchar, 2, 7)) #define VME_GET_SICInput_NeighborPixelLum32(p) (VME_Input_G1(p, uchar, 2, 8)) #define VME_GET_SICInput_NeighborPixelLum33(p) (VME_Input_G1(p, uchar, 2, 9)) #define VME_GET_SICInput_NeighborPixelLum34(p) (VME_Input_G1(p, uchar, 2, 10)) #define VME_GET_SICInput_NeighborPixelLum35(p) (VME_Input_G1(p, uchar, 2, 11)) #define VME_GET_SICInput_NeighborPixelLum36(p) (VME_Input_G1(p, uchar, 2, 12)) #define VME_GET_SICInput_NeighborPixelLum37(p) (VME_Input_G1(p, uchar, 2, 13)) #define VME_GET_SICInput_NeighborPixelLum38(p) (VME_Input_G1(p, uchar, 2, 14)) #define VME_GET_SICInput_CornerNeighborPixel1(p) (VME_Input_G1(p, uchar, 2, 15)) #define VME_GET_SICInput_LeftModes(p) (VME_Input_G1(p, ushort, 2, 8)) #define VME_GET_SICInput_TopModes(p) (VME_Input_G1(p, ushort, 2, 9)) // Format = U8 pair #define VME_GET_SICInput_CornerNeighborPixelChroma(p) \ (VME_Input_G1(p, ushort, 2, 10)) #if 0 // Format = U4U4 #define VME_GET_SICInput_PenaltyIntra4x4NonDC(p) (VME_Input_G1(p, uchar, 2, 28)) // Format = U2 #define VME_GET_SICInput_ScaleFactorIntra8x8NonDC(p) \ (VME_Input_G1(p, uchar, 2, 29) & 0x3) // Format = U2 #define VME_GET_SICInput_ScaleFactorIntra16x16NonDC(p) \ ((VME_Input_G1(p, uchar, 2, 29) & 0xC) >> 2) #else // BSPEC Update Rev1.6 // Format = U8 #define VME_GET_SICInput_PenaltyIntra4x4NonDC(p) (VME_Input_G1(p, uchar, 2, 30)) // Format = U8 #define VME_GET_SICInput_PenaltyIntra8x8NonDC(p) (VME_Input_G1(p, uchar, 2, 29)) // Format = U8 #define VME_GET_SICInput_PenaltyIntra16x16NonDC(p) \ (VME_Input_G1(p, uchar, 2, 28)) #endif #define VME_GET_SICInput_NeighborPixelChroma0(p) (VME_Input_G1(p, uchar, 3, 0)) #define VME_GET_SICInput_NeighborPixelChroma1(p) (VME_Input_G1(p, uchar, 3, 1)) #define VME_GET_SICInput_NeighborPixelChroma2(p) (VME_Input_G1(p, uchar, 3, 2)) #define VME_GET_SICInput_NeighborPixelChroma3(p) (VME_Input_G1(p, uchar, 3, 3)) #define VME_GET_SICInput_NeighborPixelChroma4(p) (VME_Input_G1(p, uchar, 3, 4)) #define VME_GET_SICInput_NeighborPixelChroma5(p) (VME_Input_G1(p, uchar, 3, 5)) #define VME_GET_SICInput_NeighborPixelChroma6(p) (VME_Input_G1(p, uchar, 3, 6)) #define VME_GET_SICInput_NeighborPixelChroma7(p) (VME_Input_G1(p, uchar, 3, 7)) #define VME_GET_SICInput_NeighborPixelChroma8(p) (VME_Input_G1(p, uchar, 3, 8)) #define VME_GET_SICInput_NeighborPixelChroma9(p) (VME_Input_G1(p, uchar, 3, 9)) #define VME_GET_SICInput_NeighborPixelChroma10(p) \ (VME_Input_G1(p, uchar, 3, 10)) #define VME_GET_SICInput_NeighborPixelChroma11(p) \ (VME_Input_G1(p, uchar, 3, 11)) #define VME_GET_SICInput_NeighborPixelChroma12(p) \ (VME_Input_G1(p, uchar, 3, 12)) #define VME_GET_SICInput_NeighborPixelChroma13(p) \ (VME_Input_G1(p, uchar, 3, 13)) #define VME_GET_SICInput_NeighborPixelChroma14(p) \ (VME_Input_G1(p, uchar, 3, 14)) #define VME_GET_SICInput_NeighborPixelChroma15(p) \ (VME_Input_G1(p, uchar, 3, 15)) #define VME_GET_SICInput_NeighborPixelChroma16(p) \ (VME_Input_G1(p, uchar, 3, 16)) #define VME_GET_SICInput_NeighborPixelChroma17(p) \ (VME_Input_G1(p, uchar, 3, 17)) #define VME_GET_SICInput_NeighborPixelChroma18(p) \ (VME_Input_G1(p, uchar, 3, 18)) #define VME_GET_SICInput_NeighborPixelChroma19(p) \ (VME_Input_G1(p, uchar, 3, 19)) #define VME_GET_SICInput_NeighborPixelChroma20(p) \ (VME_Input_G1(p, uchar, 3, 20)) #define VME_GET_SICInput_NeighborPixelChroma21(p) \ (VME_Input_G1(p, uchar, 3, 21)) #define VME_GET_SICInput_NeighborPixelChroma22(p) \ (VME_Input_G1(p, uchar, 3, 22)) #define VME_GET_SICInput_NeighborPixelChroma23(p) \ (VME_Input_G1(p, uchar, 3, 23)) #define VME_GET_SICInput_NeighborPixelChroma24(p) \ (VME_Input_G1(p, uchar, 3, 24)) #define VME_GET_SICInput_NeighborPixelChroma25(p) \ (VME_Input_G1(p, uchar, 3, 25)) #define VME_GET_SICInput_NeighborPixelChroma26(p) \ (VME_Input_G1(p, uchar, 3, 26)) #define VME_GET_SICInput_NeighborPixelChroma27(p) \ (VME_Input_G1(p, uchar, 3, 27)) #define VME_GET_SICInput_NeighborPixelChroma28(p) \ (VME_Input_G1(p, uchar, 3, 28)) #define VME_GET_SICInput_NeighborPixelChroma29(p) \ (VME_Input_G1(p, uchar, 3, 29)) #define VME_GET_SICInput_NeighborPixelChroma30(p) \ (VME_Input_G1(p, uchar, 3, 30)) #define VME_GET_SICInput_NeighborPixelChroma31(p) \ (VME_Input_G1(p, uchar, 3, 31)) #define VME_GET_FBRInput_Ref0SubBlockX0(p) (VME_Input_G1(p, ushort, 0, 0)) #define VME_GET_FBRInput_Ref0SubBlockY0(p) (VME_Input_G1(p, ushort, 0, 1)) #define VME_GET_FBRInput_Ref1SubBlockX0(p) (VME_Input_G1(p, ushort, 0, 2)) #define VME_GET_FBRInput_Ref1SubBlockY0(p) (VME_Input_G1(p, ushort, 0, 3)) #define VME_GET_FBRInput_Ref0SubBlockX1(p) (VME_Input_G1(p, ushort, 0, 4)) #define VME_GET_FBRInput_Ref0SubBlockY1(p) (VME_Input_G1(p, ushort, 0, 5)) #define VME_GET_FBRInput_Ref1SubBlockX1(p) (VME_Input_G1(p, ushort, 0, 6)) #define VME_GET_FBRInput_Ref1SubBlockY1(p) (VME_Input_G1(p, ushort, 0, 7)) #define VME_GET_FBRInput_Ref0SubBlockX2(p) (VME_Input_G1(p, ushort, 0, 8)) #define VME_GET_FBRInput_Ref0SubBlockY2(p) (VME_Input_G1(p, ushort, 0, 9)) #define VME_GET_FBRInput_Ref1SubBlockX2(p) (VME_Input_G1(p, ushort, 0, 10)) #define VME_GET_FBRInput_Ref1SubBlockY2(p) (VME_Input_G1(p, ushort, 0, 11)) #define VME_GET_FBRInput_Ref0SubBlockX3(p) (VME_Input_G1(p, ushort, 0, 12)) #define VME_GET_FBRInput_Ref0SubBlockY3(p) (VME_Input_G1(p, ushort, 0, 13)) #define VME_GET_FBRInput_Ref1SubBlockX3(p) (VME_Input_G1(p, ushort, 0, 14)) #define VME_GET_FBRInput_Ref1SubBlockY3(p) (VME_Input_G1(p, ushort, 0, 15)) #define VME_GET_FBRInput_Ref0SubBlockX4(p) (VME_Input_G1(p, ushort, 1, 0)) #define VME_GET_FBRInput_Ref0SubBlockY4(p) (VME_Input_G1(p, ushort, 1, 1)) #define VME_GET_FBRInput_Ref1SubBlockX4(p) (VME_Input_G1(p, ushort, 1, 2)) #define VME_GET_FBRInput_Ref1SubBlockY4(p) (VME_Input_G1(p, ushort, 1, 3)) #define VME_GET_FBRInput_Ref0SubBlockX5(p) (VME_Input_G1(p, ushort, 1, 4)) #define VME_GET_FBRInput_Ref0SubBlockY5(p) (VME_Input_G1(p, ushort, 1, 5)) #define VME_GET_FBRInput_Ref1SubBlockX5(p) (VME_Input_G1(p, ushort, 1, 6)) #define VME_GET_FBRInput_Ref1SubBlockY5(p) (VME_Input_G1(p, ushort, 1, 7)) #define VME_GET_FBRInput_Ref0SubBlockX6(p) (VME_Input_G1(p, ushort, 1, 8)) #define VME_GET_FBRInput_Ref0SubBlockY6(p) (VME_Input_G1(p, ushort, 1, 9)) #define VME_GET_FBRInput_Ref1SubBlockX6(p) (VME_Input_G1(p, ushort, 1, 10)) #define VME_GET_FBRInput_Ref1SubBlockY6(p) (VME_Input_G1(p, ushort, 1, 11)) #define VME_GET_FBRInput_Ref0SubBlockX7(p) (VME_Input_G1(p, ushort, 1, 12)) #define VME_GET_FBRInput_Ref0SubBlockY7(p) (VME_Input_G1(p, ushort, 1, 13)) #define VME_GET_FBRInput_Ref1SubBlockX7(p) (VME_Input_G1(p, ushort, 1, 14)) #define VME_GET_FBRInput_Ref1SubBlockY7(p) (VME_Input_G1(p, ushort, 1, 15)) #define VME_GET_FBRInput_Ref0SubBlockX8(p) (VME_Input_G1(p, ushort, 2, 0)) #define VME_GET_FBRInput_Ref0SubBlockY8(p) (VME_Input_G1(p, ushort, 2, 1)) #define VME_GET_FBRInput_Ref1SubBlockX8(p) (VME_Input_G1(p, ushort, 2, 2)) #define VME_GET_FBRInput_Ref1SubBlockY8(p) (VME_Input_G1(p, ushort, 2, 3)) #define VME_GET_FBRInput_Ref0SubBlockX9(p) (VME_Input_G1(p, ushort, 2, 4)) #define VME_GET_FBRInput_Ref0SubBlockY9(p) (VME_Input_G1(p, ushort, 2, 5)) #define VME_GET_FBRInput_Ref1SubBlockX9(p) (VME_Input_G1(p, ushort, 2, 6)) #define VME_GET_FBRInput_Ref1SubBlockY9(p) (VME_Input_G1(p, ushort, 2, 7)) #define VME_GET_FBRInput_Ref0SubBlockX10(p) (VME_Input_G1(p, ushort, 2, 8)) #define VME_GET_FBRInput_Ref0SubBlockY10(p) (VME_Input_G1(p, ushort, 2, 9)) #define VME_GET_FBRInput_Ref1SubBlockX10(p) (VME_Input_G1(p, ushort, 2, 10)) #define VME_GET_FBRInput_Ref1SubBlockY10(p) (VME_Input_G1(p, ushort, 2, 11)) #define VME_GET_FBRInput_Ref0SubBlockX11(p) (VME_Input_G1(p, ushort, 2, 12)) #define VME_GET_FBRInput_Ref0SubBlockY11(p) (VME_Input_G1(p, ushort, 2, 13)) #define VME_GET_FBRInput_Ref1SubBlockX11(p) (VME_Input_G1(p, ushort, 2, 14)) #define VME_GET_FBRInput_Ref1SubBlockY11(p) (VME_Input_G1(p, ushort, 2, 15)) #define VME_GET_FBRInput_Ref0SubBlockX12(p) (VME_Input_G1(p, ushort, 3, 0)) #define VME_GET_FBRInput_Ref0SubBlockY12(p) (VME_Input_G1(p, ushort, 3, 1)) #define VME_GET_FBRInput_Ref1SubBlockX12(p) (VME_Input_G1(p, ushort, 3, 2)) #define VME_GET_FBRInput_Ref1SubBlockY12(p) (VME_Input_G1(p, ushort, 3, 3)) #define VME_GET_FBRInput_Ref0SubBlockX13(p) (VME_Input_G1(p, ushort, 3, 4)) #define VME_GET_FBRInput_Ref0SubBlockY13(p) (VME_Input_G1(p, ushort, 3, 5)) #define VME_GET_FBRInput_Ref1SubBlockX13(p) (VME_Input_G1(p, ushort, 3, 6)) #define VME_GET_FBRInput_Ref1SubBlockY13(p) (VME_Input_G1(p, ushort, 3, 7)) #define VME_GET_FBRInput_Ref0SubBlockX14(p) (VME_Input_G1(p, ushort, 3, 8)) #define VME_GET_FBRInput_Ref0SubBlockY14(p) (VME_Input_G1(p, ushort, 3, 9)) #define VME_GET_FBRInput_Ref1SubBlockX14(p) (VME_Input_G1(p, ushort, 3, 10)) #define VME_GET_FBRInput_Ref1SubBlockY14(p) (VME_Input_G1(p, ushort, 3, 11)) #define VME_GET_FBRInput_Ref0SubBlockX15(p) (VME_Input_G1(p, ushort, 3, 12)) #define VME_GET_FBRInput_Ref0SubBlockY15(p) (VME_Input_G1(p, ushort, 3, 13)) #define VME_GET_FBRInput_Ref1SubBlockX15(p) (VME_Input_G1(p, ushort, 3, 14)) #define VME_GET_FBRInput_Ref1SubBlockY15(p) (VME_Input_G1(p, ushort, 3, 15)) #define VME_GET_IDMInput_SrcMBPixelMaskRow0(p) (VME_Input_G1(p, ushort, 0, 0)) #define VME_GET_IDMInput_SrcMBPixelMaskRow1(p) (VME_Input_G1(p, ushort, 0, 1)) #define VME_GET_IDMInput_SrcMBPixelMaskRow2(p) (VME_Input_G1(p, ushort, 0, 2)) #define VME_GET_IDMInput_SrcMBPixelMaskRow3(p) (VME_Input_G1(p, ushort, 0, 3)) #define VME_GET_IDMInput_SrcMBPixelMaskRow4(p) (VME_Input_G1(p, ushort, 0, 4)) #define VME_GET_IDMInput_SrcMBPixelMaskRow5(p) (VME_Input_G1(p, ushort, 0, 5)) #define VME_GET_IDMInput_SrcMBPixelMaskRow6(p) (VME_Input_G1(p, ushort, 0, 6)) #define VME_GET_IDMInput_SrcMBPixelMaskRow7(p) (VME_Input_G1(p, ushort, 0, 7)) #define VME_GET_IDMInput_SrcMBPixelMaskRow8(p) (VME_Input_G1(p, ushort, 0, 8)) #define VME_GET_IDMInput_SrcMBPixelMaskRow9(p) (VME_Input_G1(p, ushort, 0, 9)) #define VME_GET_IDMInput_SrcMBPixelMaskRow10(p) (VME_Input_G1(p, ushort, 0, 10)) #define VME_GET_IDMInput_SrcMBPixelMaskRow11(p) (VME_Input_G1(p, ushort, 0, 11)) #define VME_GET_IDMInput_SrcMBPixelMaskRow12(p) (VME_Input_G1(p, ushort, 0, 12)) #define VME_GET_IDMInput_SrcMBPixelMaskRow13(p) (VME_Input_G1(p, ushort, 0, 13)) #define VME_GET_IDMInput_SrcMBPixelMaskRow14(p) (VME_Input_G1(p, ushort, 0, 14)) #define VME_GET_IDMInput_SrcMBPixelMaskRow15(p) (VME_Input_G1(p, ushort, 0, 15)) // Output #define MODE_INTER_16X16 0x00 #define MODE_INTER_16X8 0x01 #define MODE_INTER_8X16 0x02 #define MODE_INTER_8X8 0x03 #define MODE_INTER_MINOR 0x03 #define VME_GET_UNIOutput_InterMbMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x3) #define MODE_INTRA_16X16 0x00 #define MODE_INTRA_8X8 0x10 #define MODE_INTRA_4X4 0x20 #define MODE_INTRA_PCM 0x30 #define VME_GET_UNIOutput_IntraMbMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x30) #define MODE_FIELD_MB_POLARITY 0x80 #define VME_GET_UNIOutput_FieldMbPolarityFlag(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x80) #define VME_GET_UNIOutput_InterMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 1) & 0x1F) #define VME_GET_UNIOutput_FieldMbFlag(p, v) \ (v = VME_Output_S1(p, uchar, 0, 1) & 0x40) #define VME_GET_UNIOutput_IntraMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 2) & 0x1F) #define VME_GET_UNIOutput_IntraMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 2) & 0x1F) #define VME_GET_UNIOutput_MvQuantity(p, v) \ (v = VME_Output_S1(p, uchar, 0, 3) & 0x1F) // Format = U16 #define VME_GET_UNIOutput_BestInterDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 4)) // Format = U16 #define VME_GET_UNIOutput_SkipRawDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 5)) // Format = U16 #define VME_GET_UNIOutput_BestIntraDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 6)) // Format = U16 #define VME_GET_UNIOutput_BestChromaIntraDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 7)) #define VME_GET_UNIOutput_LumaIntraPredMode0(p, v) \ (v = VME_Output_S1(p, ushort, 0, 8)) #define VME_GET_UNIOutput_LumaIntraPredMode1(p, v) \ (v = VME_Output_S1(p, ushort, 0, 9)) #define VME_GET_UNIOutput_LumaIntraPredMode2(p, v) \ (v = VME_Output_S1(p, ushort, 0, 10)) #define VME_GET_UNIOutput_LumaIntraPredMode3(p, v) \ (v = VME_Output_S1(p, ushort, 0, 11)) // 8-bit field with the following definition: // 7 Reserved : MBZ (for IntraPredAvailFlagF - F (pixel[-1,7] available for // MbAff) // 6 Reserved : MBZ (for IntraPredAvailFlagA/E - A (left neighbor top half // for MbAff) // 5 IntraPredAvailFlagE/A - A (Left neighbor or Left bottom half) // 4 IntraPredAvailFlagB - B (Upper neighbor) // 3 IntraPredAvailFlagC - C (Upper left neighbor) // 2 IntraPredAvailFlagD - D (Upper right neighbor) // 1:0 ChromaIntraPredMode #define VME_GET_UNIOutput_MbIntraStruct(p, v) \ (v = VME_Output_S1(p, uchar, 0, 24)) // 8-bit field with the following definition: // Bits [1:0]: SubMbShape[0] // Bits [3:2]: SubMbShape[1] // Bits [5:4]: SubMbShape[2] // Bits [7:6]: SubMbShape[3] #define VME_GET_UNIOutput_SubMbShape(p, v) (v = VME_Output_S1(p, uchar, 0, 25)) // 8-bit field with the following definition: // Bits [1:0]: SubMbPredMode[0] // Bits [3:2]: SubMbPredMode[1] // Bits [5:4]: SubMbPredMode[2] // Bits [7:6]: SubMbPredMode[3] #define VME_GET_UNIOutput_SubMbPredMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 26)) // v is a 4x16 short type matrix that stores the motion vectors as follows: // MVa[0].x, MVa[0].y, MVb[0].x, MVb[0].x // MVa[1].x, MVa[1].y, MVb[1].x, MVb[1].x // ... // MVa[15].x, MVa[15].y, MVb[15].x, MVb[15].x #define VME_GET_UNIOutput_Mvs(p, v) \ (v = p.format<short, 7, 32 / sizeof(short)>().select<4, 1, 16, 1>(1, 0)) // v is a 1x16 short type matrix that stores the inter distortions as follows: // InterDistortion[0], InterDistortion[1], ..., InterDistortion[15] #define VME_GET_UNIOutput_InterDistortion(p, v) \ (v = p.format<short, 7, 32 / sizeof(short)>().select<1, 1, 16, 1>(5, 0)) // Format = U4 #define VME_GET_UNIOutput_FwdBlk0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 0) & 0xF) #define VME_GET_UNIOutput_BwdBlk0RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 0) >> 4) & 0xF) #define VME_GET_UNIOutput_FwdBlk1RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 1) & 0xF) #define VME_GET_UNIOutput_BwdBlk1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 1) >> 4) & 0xF) #define VME_GET_UNIOutput_FwdBlk2RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 2) & 0xF) #define VME_GET_UNIOutput_BwdBlk2RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 2) >> 4) & 0xF) #define VME_GET_UNIOutput_FwdBlk3RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 3) & 0xF) #define VME_GET_UNIOutput_BwdBlk3RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 3) >> 4) & 0xF) #define VME_GET_UNIOutput_Blk0LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 4)) #define VME_GET_UNIOutput_Blk1LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 5)) #define VME_GET_UNIOutput_Blk2LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 6)) #define VME_GET_UNIOutput_Blk3LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 7)) // Format = U8 #define VME_GET_UNIOutput_Blk0ChromaCbNZC(p, v) \ (v = VME_Output_S1(p, uchar, 6, 16)) #define VME_GET_UNIOutput_Blk0ChromaCrNZC(p, v) \ (v = VME_Output_S1(p, uchar, 6, 17)) #define VME_GET_UNIOutput_SumInterDistL0(p, v) \ (v = VME_Output_S1(p, uint, 6, 6) & 0x3FFFFFF) #define VME_GET_UNIOutput_SumInterDistL1(p, v) \ (v = VME_Output_S1(p, ushort, 6, 9) + \ ((VME_Output_S1(p, ushort, 0, 3) & 0x3FF) << 16)) #define VME_GET_UNIOutput_MaxRef0InterDist(p, v) \ (v = VME_Output_S1(p, ushort, 6, 14)) #define VME_GET_UNIOutput_MaxRef1InterDist(p, v) \ (v = VME_Output_S1(p, ushort, 6, 15)) #define MODE_INTER_16X16 0x00 #define MODE_INTER_16X8 0x01 #define MODE_INTER_8X16 0x02 #define MODE_INTER_8X8 0x03 #define MODE_INTER_MINOR 0x03 #define VME_GET_IMEOutput_InterMbMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x3) #define MODE_INTRA_16X16 0x00 #define MODE_INTRA_8X8 0x10 #define MODE_INTRA_4X4 0x20 #define MODE_INTRA_PCM 0x30 #define VME_GET_IMEOutput_IntraMbMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x30) #define MODE_FIELD_MB_POLARITY 0x80 #define VME_GET_IMEOutput_FieldMbPolarityFlag(p, v) \ (v = VME_Output_S1(p, uchar, 0, 0) & 0x80) #define VME_GET_IMEOutput_InterMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 1) & 0x1F) #define VME_GET_IMEOutput_FieldMbFlag(p, v) \ (v = VME_Output_S1(p, uchar, 0, 1) & 0x40) #define VME_GET_IMEOutput_IntraMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 2) & 0x1F) #define VME_GET_IMEOutput_IntraMbType(p, v) \ (v = VME_Output_S1(p, uchar, 0, 2) & 0x1F) #define VME_GET_IMEOutput_MvQuantity(p, v) \ (v = VME_Output_S1(p, uchar, 0, 3) & 0x1F) // Format = U16 #define VME_GET_IMEOutput_BestInterDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 4)) // Format = U16 #define VME_GET_IMEOutput_SkipRawDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 5)) // Format = U16 #define VME_GET_IMEOutput_BestIntraDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 6)) // Format = U16 #define VME_GET_IMEOutput_BestChromaIntraDistortion(p, v) \ (v = VME_Output_S1(p, ushort, 0, 7)) #define VME_GET_IMEOutput_LumaIntraPredMode0(p, v) \ (v = VME_Output_S1(p, ushort, 0, 8)) #define VME_GET_IMEOutput_LumaIntraPredMode1(p, v) \ (v = VME_Output_S1(p, ushort, 0, 9)) #define VME_GET_IMEOutput_LumaIntraPredMode2(p, v) \ (v = VME_Output_S1(p, ushort, 0, 10)) #define VME_GET_IMEOutput_LumaIntraPredMode3(p, v) \ (v = VME_Output_S1(p, ushort, 0, 11)) // 8-bit field with the following definition: // 7 Reserved : MBZ (for IntraPredAvailFlagF - F (pixel[-1,7] available for // MbAff) // 6 Reserved : MBZ (for IntraPredAvailFlagA/E - A (left neighbor top half // for MbAff) // 5 IntraPredAvailFlagE/A - A (Left neighbor or Left bottom half) // 4 IntraPredAvailFlagB - B (Upper neighbor) // 3 IntraPredAvailFlagC - C (Upper left neighbor) // 2 IntraPredAvailFlagD - D (Upper right neighbor) // 1:0 ChromaIntraPredMode #define VME_GET_IMEOutput_MbIntraStruct(p, v) \ (v = VME_Output_S1(p, uchar, 0, 24)) // 8-bit field with the following definition: // Bits [1:0]: SubMbShape[0] // Bits [3:2]: SubMbShape[1] // Bits [5:4]: SubMbShape[2] // Bits [7:6]: SubMbShape[3] #define VME_GET_IMEOutput_SubMbShape(p, v) (v = VME_Output_S1(p, uchar, 0, 25)) // 8-bit field with the following definition: // Bits [1:0]: SubMbPredMode[0] // Bits [3:2]: SubMbPredMode[1] // Bits [5:4]: SubMbPredMode[2] // Bits [7:6]: SubMbPredMode[3] #define VME_GET_IMEOutput_SubMbPredMode(p, v) \ (v = VME_Output_S1(p, uchar, 0, 26)) // v is a 4x16 short type matrix that stores the motion vectors as follows: // MVa[0].x, MVa[0].y, MVb[0].x, MVb[0].x // MVa[1].x, MVa[1].y, MVb[1].x, MVb[1].x // ... // MVa[15].x, MVa[15].y, MVb[15].x, MVb[15].x #define VME_GET_IMEOutput_Mvs(p, v) \ (v = p.format<short, 7, 32 / sizeof(short)>().select<4, 1, 16, 1>(1, 0)) // v is a 1x16 short type matrix that stores the inter distortions as follows: // InterDistortion[0], InterDistortion[1], ..., InterDistortion[15] #define VME_GET_IMEOutput_InterDistortion(p, v) \ (v = p.format<short, 7, 32 / sizeof(short)>().select<1, 1, 16, 1>(5, 0)) // Format = U4 #define VME_GET_IMEOutput_FwdBlk0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 0) & 0xF) #define VME_GET_IMEOutput_BwdBlk0RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 0) >> 4) & 0xF) #define VME_GET_IMEOutput_FwdBlk1RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 1) & 0xF) #define VME_GET_IMEOutput_BwdBlk1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 1) >> 4) & 0xF) #define VME_GET_IMEOutput_FwdBlk2RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 2) & 0xF) #define VME_GET_IMEOutput_BwdBlk2RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 2) >> 4) & 0xF) #define VME_GET_IMEOutput_FwdBlk3RefID(p, v) \ (v = VME_Output_S1(p, uchar, 6, 3) & 0xF) #define VME_GET_IMEOutput_BwdBlk3RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 6, 3) >> 4) & 0xF) #define VME_GET_IMEOutput_Blk0LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 4)) #define VME_GET_IMEOutput_Blk1LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 5)) #define VME_GET_IMEOutput_Blk2LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 6)) #define VME_GET_IMEOutput_Blk3LumaNZC(p, v) (v = VME_Output_S1(p, uchar, 6, 7)) // Format = U8 #define VME_GET_IMEOutput_Blk0ChromaCbNZC(p, v) \ (v = VME_Output_S1(p, uchar, 6, 16)) #define VME_GET_IMEOutput_Blk0ChromaCrNZC(p, v) \ (v = VME_Output_S1(p, uchar, 6, 17)) // Format = U16 #define VME_GET_IMEOutput_Rec0_16x8_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 0)) #define VME_GET_IMEOutput_Rec0_16x8_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 1)) #define VME_GET_IMEOutput_Rec0_8x16_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 2)) #define VME_GET_IMEOutput_Rec0_8x16_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 3)) #define VME_GET_IMEOutput_Rec0_8x8_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 4)) #define VME_GET_IMEOutput_Rec0_8x8_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 5)) #define VME_GET_IMEOutput_Rec0_8x8_2Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 6)) #define VME_GET_IMEOutput_Rec0_8x8_3Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 7)) #define VME_GET_IMEOutput_Rec0_16x16_Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 7, 8)) // Format = U4 #define VME_GET_IMEOutput_Rec0_16x16_RefID(p, v) \ (v = VME_Output_S1(p, uchar, 7, 18)) // Format = U16 #define VME_GET_IMEOutput_Rec0_16x16_X(p, v) \ (v = VME_Output_S1(p, ushort, 7, 10)) #define VME_GET_IMEOutput_Rec0_16x16_Y(p, v) \ (v = VME_Output_S1(p, ushort, 7, 11)) // Format = U4 #define VME_GET_IMEOutput_Rec0_16x8_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 7, 24) & 0xF) #define VME_GET_IMEOutput_Rec0_16x8_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 7, 24) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec0_8x16_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 7, 25) & 0xF) #define VME_GET_IMEOutput_Rec0_8x16_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 7, 25) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec0_8x8_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 7, 26) & 0xF) #define VME_GET_IMEOutput_Rec0_8x8_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 7, 26) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec0_8x8_2RefID(p, v) \ (v = VME_Output_S1(p, uchar, 7, 27) & 0xF) #define VME_GET_IMEOutput_Rec0_8x8_3RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 7, 27) & 0xF0) >> 4) // Format = U16 #define VME_GET_IMEOutput_Rec0_16x8_0X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 0)) #define VME_GET_IMEOutput_Rec0_16x8_0Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 1)) #define VME_GET_IMEOutput_Rec0_16x8_1X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 2)) #define VME_GET_IMEOutput_Rec0_16x8_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 3)) #define VME_GET_IMEOutput_Rec0_8x16_0X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 4)) #define VME_GET_IMEOutput_Rec0_8x16_0Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 5)) #define VME_GET_IMEOutput_Rec0_8x16_1X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 6)) #define VME_GET_IMEOutput_Rec0_8x16_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 7)) #define VME_GET_IMEOutput_Rec0_8x8_0X(p, v) (v = VME_Output_S1(p, ushort, 8, 8)) #define VME_GET_IMEOutput_Rec0_8x8_0Y(p, v) (v = VME_Output_S1(p, ushort, 8, 9)) #define VME_GET_IMEOutput_Rec0_8x8_1X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 10)) #define VME_GET_IMEOutput_Rec0_8x8_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 11)) #define VME_GET_IMEOutput_Rec0_8x8_2X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 12)) #define VME_GET_IMEOutput_Rec0_8x8_2Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 13)) #define VME_GET_IMEOutput_Rec0_8x8_3X(p, v) \ (v = VME_Output_S1(p, ushort, 8, 14)) #define VME_GET_IMEOutput_Rec0_8x8_3Y(p, v) \ (v = VME_Output_S1(p, ushort, 8, 15)) // Format = U16 #define VME_GET_IMEOutput_Rec1_16x8_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 0)) #define VME_GET_IMEOutput_Rec1_16x8_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 1)) #define VME_GET_IMEOutput_Rec1_8x16_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 2)) #define VME_GET_IMEOutput_Rec1_8x16_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 3)) #define VME_GET_IMEOutput_Rec1_8x8_0Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 4)) #define VME_GET_IMEOutput_Rec1_8x8_1Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 5)) #define VME_GET_IMEOutput_Rec1_8x8_2Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 6)) #define VME_GET_IMEOutput_Rec1_8x8_3Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 7)) #define VME_GET_IMEOutput_Rec1_16x16_Distortion(p, v) \ (v = VME_Output_S1(p, ushort, 9, 8)) // Format = U4 #define VME_GET_IMEOutput_Rec1_16x16_RefID(p, v) \ (v = VME_Output_S1(p, uchar, 9, 18)) // Format = U16 #define VME_GET_IMEOutput_Rec1_16x16_X(p, v) \ (v = VME_Output_S1(p, ushort, 9, 10)) #define VME_GET_IMEOutput_Rec1_16x16_Y(p, v) \ (v = VME_Output_S1(p, ushort, 9, 11)) // Format = U4 #define VME_GET_IMEOutput_Rec1_16x8_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 9, 24) & 0xF) #define VME_GET_IMEOutput_Rec1_16x8_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 9, 24) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec1_8x16_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 9, 25) & 0xF) #define VME_GET_IMEOutput_Rec1_8x16_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 9, 25) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec1_8x8_0RefID(p, v) \ (v = VME_Output_S1(p, uchar, 9, 26) & 0xF) #define VME_GET_IMEOutput_Rec1_8x8_1RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 9, 26) & 0xF0) >> 4) #define VME_GET_IMEOutput_Rec1_8x8_2RefID(p, v) \ (v = VME_Output_S1(p, uchar, 9, 27) & 0xF) #define VME_GET_IMEOutput_Rec1_8x8_3RefID(p, v) \ (v = (VME_Output_S1(p, uchar, 9, 27) & 0xF0) >> 4) // Format = U16 #define VME_GET_IMEOutput_Rec1_16x8_0X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 0)) #define VME_GET_IMEOutput_Rec1_16x8_0Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 1)) #define VME_GET_IMEOutput_Rec1_16x8_1X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 2)) #define VME_GET_IMEOutput_Rec1_16x8_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 3)) #define VME_GET_IMEOutput_Rec1_8x16_0X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 4)) #define VME_GET_IMEOutput_Rec1_8x16_0Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 5)) #define VME_GET_IMEOutput_Rec1_8x16_1X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 6)) #define VME_GET_IMEOutput_Rec1_8x16_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 7)) #define VME_GET_IMEOutput_Rec1_8x8_0X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 8)) #define VME_GET_IMEOutput_Rec1_8x8_0Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 9)) #define VME_GET_IMEOutput_Rec1_8x8_1X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 10)) #define VME_GET_IMEOutput_Rec1_8x8_1Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 11)) #define VME_GET_IMEOutput_Rec1_8x8_2X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 12)) #define VME_GET_IMEOutput_Rec1_8x8_2Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 13)) #define VME_GET_IMEOutput_Rec1_8x8_3X(p, v) \ (v = VME_Output_S1(p, ushort, 10, 14)) #define VME_GET_IMEOutput_Rec1_8x8_3Y(p, v) \ (v = VME_Output_S1(p, ushort, 10, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 0, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 0, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 0, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 0, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 0, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 0, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 0, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 0, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 0, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 0, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 0, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 0, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 0, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 0, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 0, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock0_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 0, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 1, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 1, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 1, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 1, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 1, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 1, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 1, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 1, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 1, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 1, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 1, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 1, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 1, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 1, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 1, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock1_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 1, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 2, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 2, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 2, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 2, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 2, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 2, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 2, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 2, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 2, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 2, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 2, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 2, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 2, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 2, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 2, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock2_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 2, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 3, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 3, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 3, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 3, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 3, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 3, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 3, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 3, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 3, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 3, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 3, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 3, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 3, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 3, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 3, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock3_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 3, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 4, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 4, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 4, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 4, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 4, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 4, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 4, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 4, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 4, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 4, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 4, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 4, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 4, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 4, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 4, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock4_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 4, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 5, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 5, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 5, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 5, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 5, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 5, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 5, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 5, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 5, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 5, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 5, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 5, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 5, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 5, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 5, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock5_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 5, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 6, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 6, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 6, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 6, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 6, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 6, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 6, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 6, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 6, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 6, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 6, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 6, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 6, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 6, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 6, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock6_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 6, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 7, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 7, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 7, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 7, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 7, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 7, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 7, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 7, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 7, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 7, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 7, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 7, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 7, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 7, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 7, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock7_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 7, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 8, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 8, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 8, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 8, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 8, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 8, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 8, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 8, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 8, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 8, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 8, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 8, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 8, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 8, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 8, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock8_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 8, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 9, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 9, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 9, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 9, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 9, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 9, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 9, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 9, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 9, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 9, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 9, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 9, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 9, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 9, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 9, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock9_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 9, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 10, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 10, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 10, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 10, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 10, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 10, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 10, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 10, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 10, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 10, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 10, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 10, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 10, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 10, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 10, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock10_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 10, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 11, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 11, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 11, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 11, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 11, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 11, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 11, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 11, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 11, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 11, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 11, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 11, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 11, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 11, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 11, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock11_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 11, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 12, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 12, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 12, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 12, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 12, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 12, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 12, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 12, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 12, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 12, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 12, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 12, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 12, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 12, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 12, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock12_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 12, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 13, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 13, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 13, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 13, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 13, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 13, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 13, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 13, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 13, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 13, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 13, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 13, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 13, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 13, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 13, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock13_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 13, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 14, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 14, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 14, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 14, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 14, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 14, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 14, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 14, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 14, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 14, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 14, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 14, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 14, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 14, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 14, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock14_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 14, 15)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint0(p, v) \ (v = VME_Output_S1(p, ushort, 15, 0)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint1(p, v) \ (v = VME_Output_S1(p, ushort, 15, 1)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoshort(p, v) \ (v = VME_Output_S1(p, ushort, 15, 2)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint3(p, v) \ (v = VME_Output_S1(p, ushort, 15, 3)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint4(p, v) \ (v = VME_Output_S1(p, ushort, 15, 4)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint5(p, v) \ (v = VME_Output_S1(p, ushort, 15, 5)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint6(p, v) \ (v = VME_Output_S1(p, ushort, 15, 6)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint7(p, v) \ (v = VME_Output_S1(p, ushort, 15, 7)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint8(p, v) \ (v = VME_Output_S1(p, ushort, 15, 8)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint9(p, v) \ (v = VME_Output_S1(p, ushort, 15, 9)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint10(p, v) \ (v = VME_Output_S1(p, ushort, 15, 10)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint11(p, v) \ (v = VME_Output_S1(p, ushort, 15, 11)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint12(p, v) \ (v = VME_Output_S1(p, ushort, 15, 12)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint13(p, v) \ (v = VME_Output_S1(p, ushort, 15, 13)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint14(p, v) \ (v = VME_Output_S1(p, ushort, 15, 14)) #define VME_GET_IDMOutput_DistortionMeshBlock15_SearchPoint15(p, v) \ (v = VME_Output_S1(p, ushort, 15, 15)) // Set the default values for VME input payload #define INIT_VME_UNIINPUT(p) \ { /* M0 */ \ VME_Input_S1(p, uint, 0, 0) = 0x00000000; \ VME_Input_S1(p, uint, 0, 1) = 0x00000000; \ VME_Input_S1(p, uint, 0, 2) = 0x00000000; \ VME_Input_S1(p, uint, 0, 3) = 0x00A80000; \ VME_Input_S1(p, uint, 0, 4) = 0x00000000; \ VME_Input_S1(p, uint, 0, 5) = 0x00000000; \ VME_Input_S1(p, uint, 0, 6) = 0x00000000; \ VME_Input_S1(p, uint, 0, 7) = 0x00000000; \ /* M1 */ \ VME_Input_S1(p, uint, 1, 0) = 0x00000000; \ VME_Input_S1(p, uint, 1, 1) = 0x00000008; \ VME_Input_S1(p, uint, 1, 2) = 0x00000000; \ VME_Input_S1(p, uint, 1, 3) = 0x00000000; \ VME_Input_S1(p, uint, 1, 4) = 0x00000000; \ VME_Input_S1(p, uint, 1, 5) = 0x00000000; \ VME_Input_S1(p, uint, 1, 6) = 0x00000000; \ VME_Input_S1(p, uint, 1, 7) = 0x00400060; \ /* M2 */ \ VME_Input_S1(p, uint, 2, 0) = 0x00000000; \ VME_Input_S1(p, uint, 2, 1) = 0x00000000; \ VME_Input_S1(p, uint, 2, 2) = 0x00000000; \ VME_Input_S1(p, uint, 2, 3) = 0x00000000; \ VME_Input_S1(p, uint, 2, 4) = 0x00000000; \ VME_Input_S1(p, uint, 2, 5) = 0x00000000; \ VME_Input_S1(p, uint, 2, 6) = 0x00000000; \ VME_Input_S1(p, uint, 2, 7) = 0x00000000; \ /* M3 */ \ VME_Input_S1(p, uint, 3, 0) = 0x00000000; \ VME_Input_S1(p, uint, 3, 1) = 0x00000000; \ VME_Input_S1(p, uint, 3, 2) = 0x00000000; \ VME_Input_S1(p, uint, 3, 3) = 0x00000000; \ VME_Input_S1(p, uint, 3, 4) = 0x00000000; \ VME_Input_S1(p, uint, 3, 5) = 0x00000000; \ VME_Input_S1(p, uint, 3, 6) = 0x00000000; \ VME_Input_S1(p, uint, 3, 7) = 0x00000000; \ } // TBD: set different default values for each payload field #define INIT_VME_IMEINPUT(p) \ { p = 0; } #define INIT_VME_SICINPUT(p) \ { p = 0; } #define INIT_VME_FBRINPUT(p) \ { p = 0; } #define INIT_VME_IDMINPUT(p) \ { p = 0; } #define RESET_VME_UNIINPUT(p) \ { p.format<uint, 4, 8>() = 0; } #define RESET_VME_IMEINPUT(p, sz) \ { p.format<uint, sz, 8>() = 0; } #define RESET_VME_SICINPUT(p) \ { p.format<uint, 4, 8>() = 0; } #define RESET_VME_FBRINPUT(p) \ { p.format<uint, 4, 8>() = 0; } #define RESET_VME_IDMINPUT(p) \ { p.format<uint, 1, 8>() = 0; } // Run VME APIs typedef enum _VMEStreamMode_ { VME_STREAM_DISABLE = 0, VME_STREAM_OUT = 1, VME_STREAM_IN = 2, VME_STREAM_IN_OUT = 3 } VMEStreamMode; typedef enum _VMESearchCtrl_ { VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START = 0, VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START = 1, VME_SEARCH_SINGLE_REF_DUAL_REC = 3, VME_SEARCH_DUAL_REF_DUAL_REC = 7 } VMESearchCtrl; typedef enum _VMEMsgType_ { VME_SIC_MSG = 0, VME_FBR_MSG = 1, VME_IME_MSG = 2, VME_IDM_MSG = 3 } VMEMsgType; static CM_INLINE constexpr unsigned getVMEInputSize(unsigned size, VMEStreamMode mode, VMESearchCtrl ctrl) { return (mode != VME_STREAM_IN && mode != VME_STREAM_IN_OUT) ? size + 2 : (ctrl == VME_SEARCH_DUAL_REF_DUAL_REC) ? (size + 6) : (size + 4); } template <VMEStreamMode streamMode, VMESearchCtrl searchCtrl, int N1, int N2> CM_INLINE void _run_vme_ime_impl(matrix<uchar, 4, 32> UNIInput, matrix<uchar, N1, 32> IMEInput, SurfaceIndex curSurfIndex, vector<short, 2> ref0, vector<short, 2> ref1, vector<ushort, 16> costCenter, matrix_ref<uchar, N2, 32> IMEOutput) { // HSW: 3; otherwise 4 to invoke below function constexpr unsigned inputSize = getVMEInputSize(4, streamMode, searchCtrl); constexpr unsigned remaining = (inputSize - 4) * 8; matrix<uint, inputSize, 8> src = 0; // mov (24) VX(0,0)<1>, UNIInput src.format<uint>().select<32, 1>(0) = UNIInput.format<uint>().select<32, 1>(0); // mov (16) VX(3,0)<1>, IMEInput src.format<uint>().select<remaining, 1>(32) = IMEInput.format<uint>().select<remaining, 1>(0); // and (1) VX(0,13)<1>, VX(0,13):ub, 0xF8 src.format<uchar>()(13) &= 0xF8; // or (1) VX(0,13)<1>, VX(0,13):ub, searchCtrl src.format<uchar>()(13) |= (unsigned)searchCtrl; // mov (2) VA(0,0)<1>, ref0 // since ref0 is converted from UW to UD, move it as 1 UD src(0, 0) = ref0.format<uint>()(0); // mov (2) VA(0,2)<1>, ref1 // since ref1 is converted from UW to UD, move it as 1 UD src(0, 1) = ref1.format<uint>()(0); // mov (8) VA(3,0)<1>, costCenter src.select<1, 1, 8, 1>(3, 0) = costCenter.format<uint>().select<8, 1>(0); unsigned fCtrl = 0; // Bit 7-0 of message descriptor fCtrl += 0x2 << 13; // Bit 14-13 of message descriptor fCtrl += streamMode << 15; // Bit 16-15 of message descriptor unsigned rspLength = 288 / 32; if ((streamMode != VME_STREAM_OUT) && (streamMode != VME_STREAM_IN_OUT)) { rspLength = 224 / 32; } else if (searchCtrl == VME_SEARCH_DUAL_REF_DUAL_REC) { rspLength = 352 / 32; } // Function control (bit 0:18) // Header present (bit 19) // Response length (bit 20:24) // Message length (bit 25:28) uint Descriptor = (fCtrl & 0x7FFFF) + (1 << 19) + ((rspLength & 0x1f) << 20) + ((inputSize & 0xF) << 25); Descriptor = cm_get_value(curSurfIndex) + Descriptor; /*Implementing VME based on cm_send() for gen7_5 template <int N1, int N2> void cm_send(matrix_ref<ushort, N1, 16> IMEOutput, matrix<ushort, inputSize, 16>src, uint exDesc, uint msgDesc, uint sendc);*/ cm_send(IMEOutput.format<ushort, N2, 16>(), src.format<ushort, inputSize, 16>(), __SFID_VME, Descriptor, 0u); } template <int N1, int N2> CM_NODEBUG CM_INLINE void run_vme_ime(matrix<uchar, 4, 32> UNIInput, matrix<uchar, N1, 32> IMEInput, VMEStreamMode streamMode, VMESearchCtrl searchCtrl, SurfaceIndex curSurfIndex, vector<short, 2> ref0, vector<short, 2> ref1, vector<ushort, 16> costCenter, matrix_ref<uchar, N2, 32> IMEOutput) { #define VME_IME(mode, ctrl) \ _run_vme_ime_impl<mode, ctrl>(UNIInput, IMEInput, curSurfIndex, ref0, ref1, \ costCenter, IMEOutput) if (N1 == 2 && N2 == 7) { if (streamMode == VME_STREAM_DISABLE) { if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START) VME_IME(VME_STREAM_DISABLE, VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START); if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START) VME_IME(VME_STREAM_DISABLE, VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START); if (searchCtrl == VME_SEARCH_SINGLE_REF_DUAL_REC) VME_IME(VME_STREAM_DISABLE, VME_SEARCH_SINGLE_REF_DUAL_REC); if (searchCtrl == VME_SEARCH_DUAL_REF_DUAL_REC) VME_IME(VME_STREAM_DISABLE, VME_SEARCH_DUAL_REF_DUAL_REC); } } else if (N1 == 2 && N2 == 9) { if (streamMode == VME_STREAM_OUT) { // searchCtrl != VME_SEARCH_DUAL_REF_DUAL_REC if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START) { VME_IME(VME_STREAM_OUT, VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START) { VME_IME(VME_STREAM_OUT, VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_DUAL_REC) { VME_IME(VME_STREAM_OUT, VME_SEARCH_SINGLE_REF_DUAL_REC); } } } else if (N1 == 2 && N2 == 11) { if (streamMode == VME_STREAM_OUT && searchCtrl == VME_SEARCH_DUAL_REF_DUAL_REC) { VME_IME(VME_STREAM_OUT, VME_SEARCH_DUAL_REF_DUAL_REC); } } else if (N1 == 4 && N2 == 7) { if (streamMode == VME_STREAM_IN) { // searchCtrl != VME_SEARCH_DUAL_REF_DUAL_REC if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START) { VME_IME(VME_STREAM_IN, VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START) { VME_IME(VME_STREAM_IN, VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_DUAL_REC) { VME_IME(VME_STREAM_IN, VME_SEARCH_SINGLE_REF_DUAL_REC); } } } else if (N1 == 4 && N2 == 9) { if (streamMode == VME_STREAM_IN_OUT) { // searchCtrl != VME_SEARCH_DUAL_REF_DUAL_REC if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START) { VME_IME(VME_STREAM_IN_OUT, VME_SEARCH_SINGLE_REF_SINGLE_REC_SINGLE_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START) { VME_IME(VME_STREAM_IN_OUT, VME_SEARCH_SINGLE_REF_SINGLE_REC_DUAL_START); } if (searchCtrl == VME_SEARCH_SINGLE_REF_DUAL_REC) { VME_IME(VME_STREAM_IN_OUT, VME_SEARCH_SINGLE_REF_DUAL_REC); } } } else if (N1 == 6 && N2 == 7) { if (streamMode == VME_STREAM_IN && searchCtrl == VME_SEARCH_DUAL_REF_DUAL_REC) { VME_IME(VME_STREAM_IN, VME_SEARCH_DUAL_REF_DUAL_REC); } } else if (N1 == 6 && N2 == 11) { if (streamMode == VME_STREAM_IN_OUT && searchCtrl == VME_SEARCH_DUAL_REF_DUAL_REC) { VME_IME(VME_STREAM_IN_OUT, VME_SEARCH_DUAL_REF_DUAL_REC); } } } template <typename Dummy = void> CM_INLINE void run_vme_fbr(matrix<uchar, 4, 32> UNIInput, matrix<uchar, 4, 32> FBRInput, SurfaceIndex curSurfIndex, uchar FBRMbMode, uchar FBRSubMbShape, uchar FBRSubPredMode, matrix_ref<uchar, 7, 32> FBROutput) { matrix<uint, 8, 8> src = 0; // mov(96) VX(0, 0)<1>, UNIInput src.format<uint>().select<32, 1>(0) = UNIInput.format<uint>().select<32, 1>(0); // mov (128) VX(3,0)<1>, FBRInput src.format<uint>().select<32, 1>(32) = FBRInput.format<uint>().select<32, 1>(0); // mov (1) VX(2,20)<1>, FBRMbMode src.format<uchar, 8, 32>()(2, 20) = FBRMbMode; // mov (1) VX(2,21)<1>, FBRSubMbShape src.format<uchar, 8, 32>()(2, 21) = FBRSubMbShape; // mov (1) VX(2,22)<1>, FBRSubPredMode src.format<uchar, 8, 32>()(2, 22) = FBRSubPredMode; unsigned fCtrl = 0x3 << 13; unsigned rspLength = 7; unsigned msglength = 8; uint Descriptor = (fCtrl & 0x7FFFF) + (1 << 19) + ((rspLength & 0x1f) << 20) + ((msglength & 0xF) << 25); Descriptor = cm_get_value(curSurfIndex) + Descriptor; cm_send(FBROutput.format<ushort, 7, 16>(), src.format<ushort, 8, 16>(), __SFID_CRE, Descriptor, 0u); } template <typename Dummy = void> CM_INLINE void run_vme_sic(matrix<uchar, 4, 32> UNIInput, matrix<uchar, 4, 32> SICInput, SurfaceIndex curSurfIndex, matrix_ref<uchar, 7, 32> UNIOutput) { matrix<uint, 8, 8> src = 0; // mov (96) VX(0,0)<1>, UNIInput src.format<uint>().select<32, 1>(0) = UNIInput.format<uint>().select<32, 1>(0); // mov (128) VX(3,0)<1>, SICInput src.format<uint>().select<32, 1>(32) = SICInput.format<uint>().select<32, 1>(0); unsigned fCtrl = 0x1 << 13; unsigned rspLength = 7; unsigned msgLength = 8; uint Descriptor = (fCtrl & 0x7FFFF) + (1 << 19) + ((rspLength & 0x1f) << 20) + ((msgLength & 0xF) << 25); Descriptor = cm_get_value(curSurfIndex) + Descriptor; cm_send(UNIOutput.format<ushort, 7, 16>(), src.format<ushort, 8, 16>(), __SFID_CRE, Descriptor, 0u); } template <typename Dummy = void> CM_INLINE void run_vme_idm(matrix<uchar, 4, 32> UNIInput, matrix<uchar, 1, 32> IDMInput, SurfaceIndex curSurfIndex, matrix_ref<uchar, 16, 32> IDMOutput) { matrix<uint, 5, 8> src = 0; // mov(96) VX(0, 0)<1>, UNIInput src.format<uint>().select<32, 1>(0) = UNIInput.format<uint>().select<32, 1>(0); // mov (128) VX(3,0)<1>, IDMInput src.format<uint>().select<8, 1>(32) = IDMInput.format<uint>().select<8, 1>(0); unsigned fCtrl = 0; unsigned rspLength = 16; unsigned msglength = 5; uint Descriptor = (fCtrl & 0x7FFFF) + (1 << 19) + ((rspLength & 0x1f) << 20) + ((msglength & 0xF) << 25); Descriptor = cm_get_value(curSurfIndex) + Descriptor; cm_send(IDMOutput.format<ushort, 16, 16>(), src.format<ushort, 5, 16>(), __SFID_VME, Descriptor, 0u); } #endif /* _CLANG_gen8_VME_H_ */
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
3dc68864596b71dda8c442bdac177670ecc593c4
48d5dbf4475448f5df6955f418d7c42468d2a165
/SDK/SoT_BP_hair_col_brown_03_Desc_parameters.hpp
4191a0a2b810f5184f05df1d424dd64e8433e048
[]
no_license
Outshynd/SoT-SDK-1
80140ba84fe9f2cdfd9a402b868099df4e8b8619
8c827fd86a5a51f3d4b8ee34d1608aef5ac4bcc4
refs/heads/master
2022-11-21T04:35:29.362290
2020-07-10T14:50:55
2020-07-10T14:50:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
380
hpp
#pragma once // Sea of Thieves (1.4.16) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "SoT_BP_hair_col_brown_03_Desc_classes.hpp" namespace SDK { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "53855178+Shat-sky@users.noreply.github.com" ]
53855178+Shat-sky@users.noreply.github.com
bddf6454464696764ba67e4ee039e54a55cb26cb
2399db04cc7e656106cc65fa5121d47e02413a0a
/Stack.cpp
c3d999fbd3e4430dee2cf9df5b711a69cca601d7
[]
no_license
ChoiSunPil/dataStructure
b0fd5bd88c1ecf8812831aa57ad0a2b7ee06b931
9a16782390c99aad7562ac36ffc9dbeecc38f36d
refs/heads/master
2020-04-20T17:18:47.871072
2019-02-07T11:08:44
2019-02-07T11:08:44
168,985,332
0
0
null
null
null
null
UTF-8
C++
false
false
856
cpp
// // Created by 최선필 on 03/02/2019. // #include "Stack.h" using namespace std; template <typename T> int Stack<T>::getSize() { return top+1; } template <typename T> bool Stack<T>::isEmpty() { if(top == -1) return true; else return false; } template <typename T> T Stack<T>::pop() { if(!isEmpty()) return array[top--]; else return 0; } template <typename T> void Stack<T>::push(T node) { top++; array[top] = node; if(getSize() == capacity) { T * tmp = new T[capacity*2]; for(int i = 0 ; i < capacity ; i++) { tmp[i] = array[i]; } delete array; array = tmp; } } template <typename T> Stack<T>::Stack() { top = -1; capacity =20; array = new T[capacity]; } template <typename T> Stack<T>::~Stack() { delete array; cout<<"delete stack"<<endl; }
[ "roung4119@gmail.com" ]
roung4119@gmail.com
527c4b8a3c882129936096c242e8500ee1ece0de
baf968b497038ae6e640fb2b71f32ae2e7befe4b
/celsiustofahrenheitconverter.hpp
eeeafe87e46aafe74062c8d35da392813cd07c8c
[]
no_license
elmeyer/software-engineering-ws15
3d86a94e1b68fbcea00183de9b6507ea89f11834
3e7d7f8a6a7c26548639b1b7e82e4758f35bcb87
refs/heads/master
2021-01-22T00:10:14.706519
2016-01-27T14:21:09
2016-01-27T14:21:09
44,805,521
0
0
null
2015-10-23T10:12:50
2015-10-23T10:12:49
C
UTF-8
C++
false
false
399
hpp
#ifndef CELSIUSTOFAHRENHEITCONVERTER_H #define CELSIUSTOFAHRENHEITCONVERTER_H #include "temperatureconverter.hpp" class celsiusToFahrenheitConverter: public temperatureConverter { public: celsiusToFahrenheitConverter(); celsiusToFahrenheitConverter(std::shared_ptr<UnitConverter> c); double convert(double inValue) const; // std::string toString() const; }; #endif
[ "lars.meyer@uni-weimar.de" ]
lars.meyer@uni-weimar.de
5684490ce5484319bcc83ba2530e42e8df5d9e4c
513d32ec47f5c47a24e8b8fecd32e2c710617852
/png-write/png-write.cc
4cbad849cf859fee19cd64185da0beefc5cddb09
[]
no_license
stephen-opet/CPlusPlus-samples
6af4ddbd6438d59fbba4774a18006ba7c3e558b8
8d8d8ced7ee8d348f76c83df01f3525446324fc8
refs/heads/master
2022-08-10T18:01:17.479548
2020-05-24T05:49:16
2020-05-24T05:49:16
266,464,629
0
0
null
null
null
null
UTF-8
C++
false
false
7,228
cc
/* A Demonstration of Writing a PNG via NANOSVG library https://github.com/memononen/nanosvg/tree/master/example Written by Stephen Opet III, https://github.com/stephen-opet Published May 24, 2020 [in SARS-COV-2 quarentine :) ] This program demonstrates the following: Dynamic memory allocation via new/delete copy & move constructor implementation on bitmap class Writing a PNG via the nnosvg library operator overload The program uses a comprehensive and straightforward library to write a proper PNG image file!! Doing so from scratch is difficult and ugly - using a bitmap w/ this library is easy and fun! Designed and tested on UbuntuLinux w/ g++ compiler */ using namespace std; //seems to include swap()? used in operator= #include <iostream> #include <string> //using strings duh #include <cstring> //memcpy() #include <cmath> //round() -> Bresenham's_line_algorithm #define STB_IMAGE_WRITE_IMPLEMENTATION //writing to png lib #include "stb_image_write.h" inline void textcolor(char c){ switch(c) { case 'n': {cout << "\33[1;30m";break;} //black case 'r': {cout << "\33[1;31m";break;} //red case 'g': {cout << "\33[1;32m";break;} //green case 'b': {cout << "\33[1;34m";break;} //blue case 'y': {cout << "\33[1;33m";break;} //yellow case 'w': {cout << "\33[1;37m";break;} //white case 'd': {cout << "\33[0m";break;} //reset } } int endProgram(int v){ //eloquently abort main() textcolor('r'); cout << "\n\tEnd Program\n\n"; textcolor('d'); //restore defaults return v; } class DynamicBitmap { private: uint32_t w, h; uint32_t *p; public: //Constructor DynamicBitmap(uint32_t width, uint32_t height, uint32_t defaultBG) : w(width), h(height), p(new uint32_t[width*height]){ for(int k = 0; k < w*h; k++) //iterate through p(width) array p[k] = defaultBG; //set every pixel to default background color (black in our case) }//end constructor //Destructor ~DynamicBitmap(){ delete []p; }//end destructor //copy constructor DynamicBitmap(const DynamicBitmap& orig) : w(orig.w), h(orig.h), p(new uint32_t[orig.w * orig.h]) { memcpy(p, orig.p, orig.w * orig.h * sizeof(uint32_t)); }//end copy constructor //Operator = DynamicBitmap& operator =(DynamicBitmap copy){ // a2=a2 w = copy.w; h = copy.h; swap(p, copy.p); return *this; }//end operator= //move constructor DynamicBitmap(DynamicBitmap&& orig) : w(orig.w), h(orig.h), p(orig.p){ orig.p = nullptr; } uint32_t &operator ()(uint32_t x, uint32_t y){ cout << hex; //want to see hex value, not decimal return p[y*w + x]; } //set 1 | this is triggered by both get and set, for some reason??? //sets a pixel given coordinates & color //multiplication makes inefficient for simple shapes, but useful for complex algorithms void set(uint32_t x, uint32_t y, uint32_t color){ p[y*w + x] = color; } //set void horizLine(uint32_t x1, uint32_t x2, uint32_t y, uint32_t color){ uint32_t i = y*w+x1; //only uses multiplication once - more efficient than using set() for(; x1 <= x2; x1++) p[i++] = color; } void vertLine(uint32_t y1, uint32_t y2, uint32_t x, uint32_t color){ uint32_t index = y1*w+x; //only uses multiplication once - more efficient than using set() for(uint32_t i = 0; i < (y2-y1); i++){ p[index] = color; index+=w; } } //draws simple, hollow rectangle using horizontal & vertical line functions void drawRect(uint32_t x1, uint32_t y1, uint32_t rectW, uint32_t rectH, uint32_t color){ horizLine(x1,x1+rectW,y1,color); vertLine(y1,y1+rectH,x1,color); horizLine(x1,x1+rectW,y1+rectH,color); vertLine(y1,y1+rectH,x1+rectW,color); } //uses horzontal line function to fill in a rectangle void fillRect(uint32_t x1, uint32_t y1, uint32_t rectW, uint32_t rectH, uint32_t color){ for(uint32_t i = 0; i<=rectH; i++) horizLine(x1, x1+rectW, y1+i, color); } //assuming arguments are given as x0,y0,x1,y1,color - this order was not explicit void line(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t color){ int64_t slope = 2 * (x1 - x0); //slope int64_t epsilon = slope - (y1 - y0); //error for (int64_t y = y0, x = x0; y <= y1; y++) { set(x,y,color); epsilon += slope; if (epsilon >= 0){ x++; epsilon -= 2*(y1 - y0); } } } //draw an ellipse void ellipse(int xcenter, int ycenter, int xd, int yd, uint32_t color){ double rad_conversion = 3.14159265359 / 180; //need conversion for C++ radian trig functions //compute angular eccentricity; //must account for either x or y acting as either major/minor axis double a,b; if(yd < xd){ b = yd/2; a = xd/2; } else{ b = xd/2; a = yd/2; } double alpha = acos(b/a); //arbitrarily choose to draw four points per degree about center of ellipse for (double theta = 0; theta < 360; theta += 0.25) { int64_t x = a * cos(rad_conversion * theta) * cos(rad_conversion * alpha) + b * sin(rad_conversion * theta) * sin(rad_conversion * alpha); int64_t y = b * sin(rad_conversion * theta) * cos(rad_conversion * alpha) - a * cos(rad_conversion * theta) * sin(rad_conversion * alpha); set(xcenter+x,ycenter-y,color); } } //write the PNG void save(string filename) const{ stbi_write_png(filename.c_str(), w, h, 4, p, w*4); cout << "\n\n\tData written to file, " + filename + "\n\n"; //formatting on main() textcolor('w'); } }; int main() { ///////////////////////////////////////////////////////////////////////////////////////////////////// Pretty Header textcolor('g'); cout << "\n\n_________________________________________________________________________________\n\n"; cout << "A Demonstration of Writing a PNG via NANOSVG library\n"; cout << "Written by Stephen Opet III\n"; cout << "https://github.com/stephen-opet\n\n\n"; textcolor('w'); constexpr uint32_t BLACK = 0xFF000000; // black opaque constexpr uint32_t RED = 0xFF0000FF; // red opaque constexpr uint32_t BLUE = 0xFFFF0000; // blue opaque constexpr uint32_t WHITE = 0xFFFFFFFF; // white opaque constexpr uint32_t YELLOW = 0xFF00FFFF; // yellow opaque constexpr uint32_t GREEN = 0xFF00FF00; // green opaque int xcenter = 100; int ycenter = 100; int xdiameter = 200; int ydiameter = 100; DynamicBitmap b(1024, 1024, BLACK); // Potentially dynamic size (Now: 1024 x 1024 pixels) b(32,32) = RED; cout << b(32,32); b.horizLine(0, 500, 200, RED); // Red horizontal line, from x=0 to x=500, at y = 200 b.vertLine(0, 399, 300, RED); // Red vertical line, from y=0 to y=399, at x = 300 b.drawRect(200,200, 100,50, BLUE); // Blue rectangle, TOP-LEFT at x=200, y=200. width=100, height=50 b.fillRect(201,201, 98,48, WHITE); // White rectangle, same rules as above, but filled with color b.line(400,0, 550,300, YELLOW); // Line drawn using https://en.wikipedia.org/wiki/Bresenham's_line_algorithm b.ellipse(xcenter, ycenter, xdiameter, ydiameter, GREEN); //Ellipse using specs from above b.save("bitmap2.png"); //create the png file endProgram(0); }
[ "slsh123456@gmail.com" ]
slsh123456@gmail.com
85f1cb4b50eac0c2a1d8c5dabe92f6653ffc136b
3c6deda46fa37a42feebde0fb50dd0d6123b82b1
/0152/src/mame/includes/pgm.h
90e5748d3f1afc6f8405b5f4eb1b75321ef50fa5
[]
no_license
AreaScout/mame-libretro
9fdb724edb58070162c1bd4e8b351a8f2da250ea
dd16543e4f77a2e42f5662a445f03079e2324221
refs/heads/master
2020-12-24T21:01:44.571706
2014-11-26T06:36:49
2014-11-26T06:36:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,752
h
#include "machine/v3021.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "cpu/arm7/arm7.h" #include "sound/ics2115.h" #include "cpu/arm7/arm7core.h" #include "machine/nvram.h" #include "machine/pgmcrypt.h" #include "machine/igs025.h" #include "machine/igs022.h" #include "machine/igs028.h" #define PGMARM7LOGERROR 0 class pgm_state : public driver_device { public: pgm_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoregs(*this, "videoregs"), m_videoram(*this, "videoram"), m_z80_mainram(*this, "z80_mainram"), m_mainram(*this, "sram"), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu") { m_irq4_disabled = 0; } /* memory pointers */ required_shared_ptr<UINT16> m_videoregs; required_shared_ptr<UINT16> m_videoram; required_shared_ptr<UINT8> m_z80_mainram; required_shared_ptr<UINT16> m_mainram; UINT16 * m_bg_videoram; UINT16 * m_tx_videoram; UINT16 * m_rowscrollram; UINT8 * m_sprite_a_region; size_t m_sprite_a_region_size; UINT16 * m_spritebufferram; // buffered spriteram // UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; tilemap_t *m_tx_tilemap; UINT16 *m_sprite_temp_render; bitmap_rgb32 m_tmppgmbitmap; /* devices */ required_device<cpu_device> m_maincpu; required_device<cpu_device> m_soundcpu; device_t *m_ics; /* used by rendering */ UINT8 *m_bdata; size_t m_bdatasize; int m_aoffset; int m_boffset; /* hack */ int m_irq4_disabled; /* calendar */ UINT8 m_cal_val; UINT8 m_cal_mask; UINT8 m_cal_com; UINT8 m_cal_cnt; system_time m_systime; DECLARE_READ16_MEMBER(pgm_videoram_r); DECLARE_WRITE16_MEMBER(pgm_videoram_w); DECLARE_WRITE16_MEMBER(pgm_coin_counter_w); DECLARE_READ16_MEMBER(z80_ram_r); DECLARE_WRITE16_MEMBER(z80_ram_w); DECLARE_WRITE16_MEMBER(z80_reset_w); DECLARE_WRITE16_MEMBER(z80_ctrl_w); DECLARE_WRITE16_MEMBER(m68k_l1_w); DECLARE_WRITE8_MEMBER(z80_l3_w); DECLARE_WRITE16_MEMBER(pgm_tx_videoram_w); DECLARE_WRITE16_MEMBER(pgm_bg_videoram_w); DECLARE_DRIVER_INIT(pgm); TILE_GET_INFO_MEMBER(get_pgm_tx_tilemap_tile_info); TILE_GET_INFO_MEMBER(get_pgm_bg_tilemap_tile_info); DECLARE_VIDEO_START(pgm); DECLARE_MACHINE_START(pgm); DECLARE_MACHINE_RESET(pgm); UINT32 screen_update_pgm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_pgm(screen_device &screen, bool state); TIMER_DEVICE_CALLBACK_MEMBER(pgm_interrupt); inline void pgm_draw_pix( int xdrawpos, int pri, UINT16* dest, UINT8* destpri, UINT16 srcdat); inline void pgm_draw_pix_nopri( int xdrawpos, UINT16* dest, UINT8* destpri, UINT16 srcdat); inline void pgm_draw_pix_pri( int xdrawpos, UINT16* dest, UINT8* destpri, UINT16 srcdat); void draw_sprite_line( int wide, UINT16* dest, UINT8* destpri, int xzoom, int xgrow, int flip, int xpos, int pri, int realxsize, int palt, int draw ); void draw_sprite_new_zoomed( int wide, int high, int xpos, int ypos, int palt, int flip, bitmap_ind16 &bitmap, bitmap_ind8 &priority_bitmap, UINT32 xzoom, int xgrow, UINT32 yzoom, int ygrow, int pri ); void draw_sprite_line_basic( int wide, UINT16* dest, UINT8* destpri, int flip, int xpos, int pri, int realxsize, int palt, int draw ); void draw_sprite_new_basic( int wide, int high, int xpos, int ypos, int palt, int flip, bitmap_ind16 &bitmap, bitmap_ind8 &priority_bitmap, int pri ); void draw_sprites( bitmap_ind16& spritebitmap, UINT16 *sprite_source, bitmap_ind8& priority_bitmap ); void expand_32x32x5bpp(); void expand_colourdata( ); void pgm_basic_init( bool set_bank = true); }; /* for machine/pgmprot_orlegend.c type games */ class pgm_asic3_state : public pgm_state { public: pgm_asic3_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag) { } // ASIC 3 (oriental legends protection) UINT8 m_asic3_reg; UINT8 m_asic3_latch[3]; UINT8 m_asic3_x; UINT16 m_asic3_hilo; UINT16 m_asic3_hold; DECLARE_DRIVER_INIT(orlegend); void asic3_compute_hold(int,int); DECLARE_READ16_MEMBER( pgm_asic3_r ); DECLARE_WRITE16_MEMBER( pgm_asic3_w ); DECLARE_WRITE16_MEMBER( pgm_asic3_reg_w ); }; /* for machine/pgmprot1.c type games */ class pgm_arm_type1_state : public pgm_state { public: pgm_arm_type1_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_arm7_shareram(*this, "arm7_shareram"), m_prot(*this, "prot") { m_curslots = 0; m_puzzli_54_trigger = 0; } /////////////// simulations UINT16 m_value0; UINT16 m_value1; UINT16 m_valuekey; UINT16 m_ddp3lastcommand; UINT32 m_valueresponse; int m_curslots; UINT32 m_slots[0x100]; // pstars / oldsplus / kov UINT16 m_pstar_e7_value; UINT16 m_pstar_b1_value; UINT16 m_pstar_ce_value; UINT16 m_kov_c0_value; UINT16 m_kov_cb_value; UINT16 m_kov_fe_value; UINT16 m_extra_ram[0x100]; // puzzli2 INT32 m_puzzli_54_trigger; typedef void (pgm_arm_type1_state::*pgm_arm_sim_command_handler)(int pc); pgm_arm_sim_command_handler arm_sim_handler; /////////////// emulation UINT16 m_pgm_arm_type1_highlatch_arm_w; UINT16 m_pgm_arm_type1_lowlatch_arm_w; UINT16 m_pgm_arm_type1_highlatch_68k_w; UINT16 m_pgm_arm_type1_lowlatch_68k_w; UINT32 m_pgm_arm_type1_counter; optional_shared_ptr<UINT32> m_arm7_shareram; optional_device<cpu_device> m_prot; DECLARE_DRIVER_INIT(photoy2k); DECLARE_DRIVER_INIT(kovsh); DECLARE_DRIVER_INIT(kovshp); DECLARE_DRIVER_INIT(kovshxas); DECLARE_DRIVER_INIT(kovlsqh2); DECLARE_DRIVER_INIT(kovqhsgs); DECLARE_DRIVER_INIT(ddp3); DECLARE_DRIVER_INIT(ket); DECLARE_DRIVER_INIT(espgal); DECLARE_DRIVER_INIT(puzzli2); DECLARE_DRIVER_INIT(py2k2); DECLARE_DRIVER_INIT(pgm3in1); DECLARE_DRIVER_INIT(pstar); DECLARE_DRIVER_INIT(kov); DECLARE_DRIVER_INIT(kovboot); DECLARE_DRIVER_INIT(oldsplus); DECLARE_MACHINE_START(pgm_arm_type1); DECLARE_READ32_MEMBER( pgm_arm7_type1_protlatch_r ); DECLARE_WRITE32_MEMBER( pgm_arm7_type1_protlatch_w ); DECLARE_READ16_MEMBER( pgm_arm7_type1_68k_protlatch_r ); DECLARE_WRITE16_MEMBER( pgm_arm7_type1_68k_protlatch_w ); DECLARE_READ16_MEMBER( pgm_arm7_type1_ram_r ); DECLARE_WRITE16_MEMBER( pgm_arm7_type1_ram_w ); DECLARE_READ32_MEMBER( pgm_arm7_type1_unk_r ); DECLARE_READ32_MEMBER( pgm_arm7_type1_exrom_r ); DECLARE_READ32_MEMBER( pgm_arm7_type1_shareram_r ); DECLARE_WRITE32_MEMBER( pgm_arm7_type1_shareram_w ); void pgm_arm7_type1_latch_init(); DECLARE_READ16_MEMBER( kovsh_fake_region_r ); DECLARE_WRITE16_MEMBER( kovshp_asic27a_write_word ); void pgm_decode_kovlsqh2_tiles(); void pgm_decode_kovlsqh2_sprites(UINT8 *src ); void pgm_decode_kovlsqh2_samples(); void pgm_decode_kovqhsgs_program(); void pgm_decode_kovqhsgs2_program(); DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_r ); void command_handler_ddp3(int pc); void command_handler_puzzli2(int pc); void command_handler_py2k2(int pc); void command_handler_pstars(int pc); void command_handler_kov(int pc); void command_handler_oldsplus(int pc); DECLARE_WRITE16_MEMBER( pgm_arm7_type1_sim_w ); DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_protram_r ); DECLARE_READ16_MEMBER( pstars_arm7_type1_sim_protram_r ); int m_simregion; /* puzzli2 protection internal state stuff */ int stage; int tableoffs; int tableoffs2; int entries_left; int currentcolumn; int currentrow; int num_entries; int full_entry; int prev_tablloc; int numbercolumns; int depth; UINT16 m_row_bitmask; int hackcount; int hackcount2; int hack_47_value; int hack_31_table_offset; int hack_31_table_offset2; int p2_31_retcounter; UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure int command_31_write_type; // the maximum level size returned or read by the device appears to be this size UINT16 level_structure[8][10]; int puzzli2_take_leveldata_value(UINT8 datvalue); }; /* for machine/pgmprot2.c type games */ class pgm_arm_type2_state : public pgm_state { public: pgm_arm_type2_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_arm_ram(*this, "arm_ram"), m_arm7_shareram(*this, "arm7_shareram"), m_prot(*this, "prot") { } // kov2 UINT32 m_kov2_latchdata_68k_w; UINT32 m_kov2_latchdata_arm_w; required_shared_ptr<UINT32> m_arm_ram; required_shared_ptr<UINT32> m_arm7_shareram; optional_device<cpu_device> m_prot; DECLARE_DRIVER_INIT(kov2); DECLARE_DRIVER_INIT(kov2p); DECLARE_DRIVER_INIT(martmast); DECLARE_DRIVER_INIT(ddp2); DECLARE_DRIVER_INIT(dw2001); DECLARE_DRIVER_INIT(dwpc); DECLARE_MACHINE_START(pgm_arm_type2); DECLARE_READ32_MEMBER( arm7_latch_arm_r ); DECLARE_WRITE32_MEMBER( arm7_latch_arm_w ); DECLARE_READ32_MEMBER( arm7_shareram_r ); DECLARE_WRITE32_MEMBER( arm7_shareram_w ); DECLARE_READ16_MEMBER( arm7_latch_68k_r ); DECLARE_WRITE16_MEMBER( arm7_latch_68k_w ); DECLARE_READ16_MEMBER( arm7_ram_r ); DECLARE_WRITE16_MEMBER( arm7_ram_w ); void kov2_latch_init(); DECLARE_WRITE32_MEMBER( martmast_arm_region_w ); DECLARE_WRITE32_MEMBER( kov2_arm_region_w ); DECLARE_WRITE32_MEMBER( kov2p_arm_region_w ); DECLARE_READ32_MEMBER( ddp2_speedup_r ); DECLARE_READ16_MEMBER( ddp2_main_speedup_r ); }; /* for machine/pgmprot3.c type games */ class pgm_arm_type3_state : public pgm_state { public: pgm_arm_type3_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_arm_ram(*this, "arm_ram"), m_arm_ram2(*this, "arm_ram2"), m_prot(*this, "prot") { } // svg int m_svg_ram_sel; UINT32 * m_svg_shareram[2]; //for 5585G MACHINE UINT32 m_svg_latchdata_68k_w; UINT32 m_svg_latchdata_arm_w; required_shared_ptr<UINT32> m_arm_ram; required_shared_ptr<UINT32> m_arm_ram2; UINT32* m_armrom; optional_device<cpu_device> m_prot; DECLARE_DRIVER_INIT(theglad); DECLARE_DRIVER_INIT(theglada); DECLARE_DRIVER_INIT(svg); DECLARE_DRIVER_INIT(svgpcb); DECLARE_DRIVER_INIT(killbldp); DECLARE_DRIVER_INIT(dmnfrnt); DECLARE_DRIVER_INIT(happy6); DECLARE_MACHINE_START(pgm_arm_type3); DECLARE_WRITE32_MEMBER( svg_arm7_ram_sel_w ); DECLARE_READ32_MEMBER( svg_arm7_shareram_r ); DECLARE_WRITE32_MEMBER( svg_arm7_shareram_w ); DECLARE_READ16_MEMBER( svg_m68k_ram_r ); DECLARE_WRITE16_MEMBER( svg_m68k_ram_w ); DECLARE_READ16_MEMBER( svg_68k_nmi_r ); DECLARE_WRITE16_MEMBER( svg_68k_nmi_w ); DECLARE_WRITE16_MEMBER( svg_latch_68k_w ); DECLARE_READ16_MEMBER( svg_latch_68k_r ); DECLARE_READ32_MEMBER( svg_latch_arm_r ); DECLARE_WRITE32_MEMBER( svg_latch_arm_w ); void svg_basic_init(); void pgm_create_dummy_internal_arm_region(int size); void pgm_patch_external_arm_rom_jumptable_theglada(int base); void pgm_patch_external_arm_rom_jumptable_svg(int base); void pgm_create_dummy_internal_arm_region_theglad(int is_svg); void pgm_descramble_happy6(UINT8* src); void pgm_descramble_happy6_2(UINT8* src); void svg_latch_init(); DECLARE_READ32_MEMBER( dmnfrnt_speedup_r ); DECLARE_READ16_MEMBER( dmnfrnt_main_speedup_r ); DECLARE_READ32_MEMBER( killbldp_speedup_r ); DECLARE_READ32_MEMBER( theglad_speedup_r ); DECLARE_READ32_MEMBER( svg_speedup_r ); DECLARE_MACHINE_RESET(pgm_arm_type3_reset); }; /* for machine/pgmprot4.c type games */ class pgm_022_025_state : public pgm_state { public: pgm_022_025_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_sharedprotram(*this, "sharedprotram"), m_igs025(*this,"igs025"), m_igs022(*this,"igs022") { } void pgm_dw3_decrypt(); void pgm_killbld_decrypt(); required_shared_ptr<UINT16> m_sharedprotram; DECLARE_DRIVER_INIT(killbld); DECLARE_DRIVER_INIT(drgw3); DECLARE_MACHINE_RESET(killbld); DECLARE_MACHINE_RESET(dw3); void igs025_to_igs022_callback( void ); required_device<igs025_device> m_igs025; required_device<igs022_device> m_igs022; }; /* for machine/pgmprot5.c type games */ class pgm_012_025_state : public pgm_state { public: pgm_012_025_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_igs025(*this,"igs025") { } required_device<igs025_device> m_igs025; void pgm_drgw2_decrypt(); void drgw2_common_init(); DECLARE_DRIVER_INIT(drgw2); DECLARE_DRIVER_INIT(dw2v100x); DECLARE_DRIVER_INIT(drgw2c); DECLARE_DRIVER_INIT(drgw2j); DECLARE_MACHINE_RESET(drgw2); }; /* for machine/pgmprot6.c type games */ class pgm_028_025_state : public pgm_state { public: pgm_028_025_state(const machine_config &mconfig, device_type type, const char *tag) : pgm_state(mconfig, type, tag), m_sharedprotram(*this, "sharedprotram"), m_igs025(*this,"igs025"), m_igs028(*this,"igs028") { } required_shared_ptr<UINT16> m_sharedprotram; required_device<igs025_device> m_igs025; required_device<igs028_device> m_igs028; void igs025_to_igs028_callback( void ); DECLARE_DRIVER_INIT(olds); DECLARE_MACHINE_RESET(olds); }; /*----------- defined in drivers/pgm.c -----------*/ INPUT_PORTS_EXTERN( pgm ); GFXDECODE_EXTERN( pgm ); MACHINE_CONFIG_EXTERN( pgm ); MACHINE_CONFIG_EXTERN( pgmbase ); ADDRESS_MAP_EXTERN( pgm_z80_mem, 8 ); ADDRESS_MAP_EXTERN( pgm_z80_io, 8 ); void pgm_sound_irq( device_t *device, int level ); ADDRESS_MAP_EXTERN( pgm_mem, 16 ); ADDRESS_MAP_EXTERN( pgm_basic_mem, 16 ); ADDRESS_MAP_EXTERN( pgm_base_mem, 16 ); /*----------- defined in machine/pgmprot.c -----------*/ INPUT_PORTS_EXTERN( orlegend ); INPUT_PORTS_EXTERN( orld105k ); MACHINE_CONFIG_EXTERN( pgm_asic3 ); /*----------- defined in machine/pgmprot1.c -----------*/ /* emulations */ /* simulations */ MACHINE_CONFIG_EXTERN( pgm_arm_type1 ); MACHINE_CONFIG_EXTERN( pgm_arm_type1_sim ); MACHINE_CONFIG_EXTERN( pgm_arm_type1_cave ); INPUT_PORTS_EXTERN( sango ); INPUT_PORTS_EXTERN( sango_ch ); INPUT_PORTS_EXTERN( photoy2k ); INPUT_PORTS_EXTERN( oldsplus ); INPUT_PORTS_EXTERN( pstar ); INPUT_PORTS_EXTERN( py2k2 ); INPUT_PORTS_EXTERN( puzzli2 ); INPUT_PORTS_EXTERN( kovsh ); /*----------- defined in machine/pgmprot2.c -----------*/ /* emulations */ MACHINE_CONFIG_EXTERN( pgm_arm_type2 ); /* simulations (or missing) */ INPUT_PORTS_EXTERN( ddp2 ); INPUT_PORTS_EXTERN( kov2 ); INPUT_PORTS_EXTERN( martmast ); INPUT_PORTS_EXTERN( dw2001 ); /*----------- defined in machine/pgmprot3.c -----------*/ MACHINE_CONFIG_EXTERN( pgm_arm_type3 ); INPUT_PORTS_EXTERN(theglad); INPUT_PORTS_EXTERN(happy6); INPUT_PORTS_EXTERN(svg); /*----------- defined in machine/pgmprot4.c -----------*/ MACHINE_CONFIG_EXTERN(pgm_022_025_dw3); MACHINE_CONFIG_EXTERN(pgm_022_025_killbld); INPUT_PORTS_EXTERN( killbld ); INPUT_PORTS_EXTERN( dw3 ); INPUT_PORTS_EXTERN( dw3j ); /*----------- defined in machine/pgmprot5.c -----------*/ MACHINE_CONFIG_EXTERN( pgm_012_025_drgw2 ); /*----------- defined in machine/pgmprot6.c -----------*/ MACHINE_CONFIG_EXTERN( pgm_028_025_ol ); INPUT_PORTS_EXTERN( olds );
[ "rtype@foo.com" ]
rtype@foo.com
5bee9a1c469e1eea83f2ca5cc2c6ee31aacae667
b84aa8a1745f3346f22b9a0ae1c977a244dfb3cd
/SDK/RC_WBP_SettingsDropdown_classes.hpp
0743db201c0510f843b587e5351acd3e3612b5a5
[]
no_license
frankie-11/Rogue-SDK-11.8
615a9e51f280a504bb60a4cbddb8dfc4de6239d8
20becc4b2fff71cfec160fb7f2ee3a9203031d09
refs/heads/master
2023-01-10T06:00:59.427605
2020-11-08T16:13:01
2020-11-08T16:13:01
311,102,184
1
0
null
null
null
null
UTF-8
C++
false
false
1,280
hpp
#pragma once // RogueCompany (4.24) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // WidgetBlueprintGeneratedClass WBP_SettingsDropdown.WBP_SettingsDropdown_C // 0xAF18700 (0x68AA5580 - 0x5DB8CE80) class UWBP_SettingsDropdown_C : public UKSSettingsWidget { public: unsigned char UnknownData00[0xAF18700]; // 0x5DB8CE80(0xAF18700) MISSED OFFSET static UClass* StaticClass() { static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass WBP_SettingsDropdown.WBP_SettingsDropdown_C"); return ptr; } void NavigateBack(); void NavigateConfirmPressed(); void NavigateConfirm(); void SetDesiredIndex(); void GetDirtyIndex(); void Set_Text_To_Index(); void OnWidgetSettingsInfoSet(); void Selection_Made(); void InitializeWidget(); void GamepadHover(); void InitializeWidgetNavigation(); void FocusGroupNavigateDownFailure(); void FocusGroupNavigateUpFailure(); void OnSettingsInfoValueChanged(); void ExecuteUbergraph_WBP_SettingsDropdown(); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "60810131+frankie-11@users.noreply.github.com" ]
60810131+frankie-11@users.noreply.github.com
49a96e8526d34134f41d4e653e467ec5724a6a21
be34d599008cc0b3b81177fdb9f9e2dcbd7f56ba
/src/mcu/components/platform/Platform.cpp
e981d397e00f173082a63b215a0f7aff9adb97e4
[ "Apache-2.0" ]
permissive
wouterdevinck/lamp
d5c94f98bd8b39fdf5395ae1bc129f0fe1f0e931
5020ba56f68738133934c4014166813790d04df9
refs/heads/master
2023-03-07T03:05:55.753756
2020-08-11T10:15:29
2020-08-11T10:15:29
134,090,004
2
0
Apache-2.0
2023-02-25T04:39:21
2018-05-19T18:58:27
C++
UTF-8
C++
false
false
1,493
cpp
#include "Platform.h" #include "MemMon.h" #include "constants.h" using namespace lamp; Platform::Platform() { MemMon memmon(MEMMON_PERIOD); _spi1 = new Spi(SPI1_ESP_HOST, SPI1_DMA_CH, SPI1_MOSI_PIN, SPI1_MISO_PIN, SPI1_CLK_PIN, SPI1_CS_PIN); _spi2 = new SpiFlash(SPI2_ESP_HOST, SPI2_DMA_CH, SPI2_MOSI_PIN, SPI2_MISO_PIN, SPI2_CLK_PIN, SPI2_CS_PIN); _ir = new IrReceiver(); _led = new RgbLed(PIN_RGB_RED, PIN_RGB_GREEN, PIN_RGB_BLUE); _leds = new LedBoardChain(_spi1, PIN_LED_INT); _storage = new Storage(); _wifi = new WiFiClient(_storage); _lux = new LightSensor(); _updater = new Updater(_spi2, _storage, CHUNK_SIZE); _logger = new Logger(); _httpserver = new HttpServer(); _httpclient = new HttpClient(CHUNK_SIZE); _iot = new AzureIot(_logger); } IIrReceiver* Platform::getIrReceiver() { return _ir; } IRgbLed* Platform::getRgbLed() { return _led; } ILedBoardChain* Platform::getLedBoardChain() { return _leds; } IWiFiClient* Platform::getWiFiClient() { return _wifi; } ILightSensor* Platform::getLightSensor() { return _lux; } IUpdater* Platform::getUpdater() { return _updater; } ILogger* Platform::getLogger() { return _logger; } IHttpServer* Platform::getHttpServer() { return _httpserver; } IHttpClient* Platform::getHttpClient() { return _httpclient; } IIotFramework* Platform::getIotFramework() { return _iot; } INvs* Platform::getStorage() { return _storage; } int Platform::getHttpServerPort() { return HTTP_PORT; }
[ "wouter.devinck@gmail.com" ]
wouter.devinck@gmail.com
e35f3c89b0187d62ff14bc6bca00a194bff59133
fb7efe44f4d9f30d623f880d0eb620f3a81f0fbd
/third_party/WebKit/Source/core/html/custom/CustomElement.cpp
4b2a7e56b202431012d473eff0f3c81716e3e9c5
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
permissive
wzyy2/chromium-browser
2644b0daf58f8b3caee8a6c09a2b448b2dfe059c
eb905f00a0f7e141e8d6c89be8fb26192a88c4b7
refs/heads/master
2022-11-23T20:25:08.120045
2018-01-16T06:41:26
2018-01-16T06:41:26
117,618,467
3
2
BSD-3-Clause
2022-11-20T22:03:57
2018-01-16T02:09:10
null
UTF-8
C++
false
false
10,215
cpp
// 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 "core/html/custom/CustomElement.h" #include "core/dom/Document.h" #include "core/dom/QualifiedName.h" #include "core/frame/LocalDOMWindow.h" #include "core/html/HTMLElement.h" #include "core/html/HTMLUnknownElement.h" #include "core/html/custom/CEReactionsScope.h" #include "core/html/custom/CustomElementDefinition.h" #include "core/html/custom/CustomElementReactionStack.h" #include "core/html/custom/CustomElementRegistry.h" #include "core/html/custom/V0CustomElement.h" #include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html_element_factory.h" #include "core/html_element_type_helpers.h" #include "platform/wtf/text/AtomicStringHash.h" namespace blink { CustomElementRegistry* CustomElement::Registry(const Element& element) { return Registry(element.GetDocument()); } CustomElementRegistry* CustomElement::Registry(const Document& document) { if (LocalDOMWindow* window = document.ExecutingWindow()) return window->customElements(); return nullptr; } static CustomElementDefinition* DefinitionForElementWithoutCheck( const Element& element) { DCHECK_EQ(element.GetCustomElementState(), CustomElementState::kCustom); return element.GetCustomElementDefinition(); } CustomElementDefinition* CustomElement::DefinitionForElement( const Element* element) { if (!element || element->GetCustomElementState() != CustomElementState::kCustom) return nullptr; return DefinitionForElementWithoutCheck(*element); } bool CustomElement::IsHyphenatedSpecElementName(const AtomicString& name) { // Even if Blink does not implement one of the related specs, (for // example annotation-xml is from MathML, which Blink does not // implement) we must prohibit using the name because that is // required by the HTML spec which we *do* implement. Don't remove // names from this list without removing them from the HTML spec // first. DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenated_spec_element_names, ({ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph", })); return hyphenated_spec_element_names.Contains(name); } bool CustomElement::ShouldCreateCustomElement(const AtomicString& name) { return IsValidName(name); } bool CustomElement::ShouldCreateCustomElement(const QualifiedName& tag_name) { return ShouldCreateCustomElement(tag_name.LocalName()) && tag_name.NamespaceURI() == HTMLNames::xhtmlNamespaceURI; } bool CustomElement::ShouldCreateCustomizedBuiltinElement( const AtomicString& local_name) { return htmlElementTypeForTag(local_name) != HTMLElementType::kHTMLUnknownElement && RuntimeEnabledFeatures::CustomElementsBuiltinEnabled(); } bool CustomElement::ShouldCreateCustomizedBuiltinElement( const QualifiedName& tag_name) { return ShouldCreateCustomizedBuiltinElement(tag_name.LocalName()) && tag_name.NamespaceURI() == HTMLNames::xhtmlNamespaceURI; } static CustomElementDefinition* DefinitionFor( const Document& document, const CustomElementDescriptor desc) { if (CustomElementRegistry* registry = CustomElement::Registry(document)) return registry->DefinitionFor(desc); return nullptr; } HTMLElement* CustomElement::CreateCustomElementSync( Document& document, const QualifiedName& tag_name) { CustomElementDefinition* definition = nullptr; CustomElementRegistry* registry = CustomElement::Registry(document); if (registry) { definition = registry->DefinitionFor( CustomElementDescriptor(tag_name.LocalName(), tag_name.LocalName())); } return CreateCustomElementSync(document, tag_name, definition); } HTMLElement* CustomElement::CreateCustomElementSync( Document& document, const AtomicString& local_name, CustomElementDefinition* definition) { return CreateCustomElementSync( document, QualifiedName(g_null_atom, local_name, HTMLNames::xhtmlNamespaceURI), definition); } // https://dom.spec.whatwg.org/#concept-create-element HTMLElement* CustomElement::CreateCustomElementSync( Document& document, const QualifiedName& tag_name, CustomElementDefinition* definition) { DCHECK(ShouldCreateCustomElement(tag_name) || ShouldCreateCustomizedBuiltinElement(tag_name)); HTMLElement* element; if (definition && definition->Descriptor().IsAutonomous()) { // 6. If definition is non-null and we have an autonomous custom element element = definition->CreateElementSync(document, tag_name); } else if (definition) { // 5. If definition is non-null and we have a customized built-in element element = CreateUndefinedElement(document, tag_name); definition->Upgrade(element); } else { // 7. Otherwise element = CreateUndefinedElement(document, tag_name); } return element; } HTMLElement* CustomElement::CreateCustomElementAsync( Document& document, const QualifiedName& tag_name) { DCHECK(ShouldCreateCustomElement(tag_name)); // To create an element: // https://dom.spec.whatwg.org/#concept-create-element // 6. If definition is non-null, then: // 6.2. If the synchronous custom elements flag is not set: if (CustomElementDefinition* definition = DefinitionFor( document, CustomElementDescriptor(tag_name.LocalName(), tag_name.LocalName()))) return definition->CreateElementAsync(document, tag_name); return CreateUndefinedElement(document, tag_name); } // Create a HTMLElement HTMLElement* CustomElement::CreateUndefinedElement( Document& document, const QualifiedName& tag_name) { bool should_create_builtin = ShouldCreateCustomizedBuiltinElement(tag_name); DCHECK(ShouldCreateCustomElement(tag_name) || should_create_builtin); HTMLElement* element; if (V0CustomElement::IsValidName(tag_name.LocalName()) && document.RegistrationContext()) { Element* v0element = document.RegistrationContext()->CreateCustomTagElement( document, tag_name); SECURITY_DCHECK(v0element->IsHTMLElement()); element = ToHTMLElement(v0element); } else if (should_create_builtin) { element = HTMLElementFactory::createHTMLElement( tag_name.LocalName(), document, kCreatedByCreateElement); } else { element = HTMLElement::Create(tag_name, document); } element->SetCustomElementState(CustomElementState::kUndefined); return element; } HTMLElement* CustomElement::CreateFailedElement(Document& document, const QualifiedName& tag_name) { DCHECK(ShouldCreateCustomElement(tag_name)); // "create an element for a token": // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token // 7. If this step throws an exception, let element be instead a new element // that implements HTMLUnknownElement, with no attributes, namespace set to // given namespace, namespace prefix set to null, custom element state set // to "failed", and node document set to document. HTMLElement* element = HTMLUnknownElement::Create(tag_name, document); element->SetCustomElementState(CustomElementState::kFailed); return element; } void CustomElement::Enqueue(Element* element, CustomElementReaction* reaction) { // To enqueue an element on the appropriate element queue // https://html.spec.whatwg.org/multipage/scripting.html#enqueue-an-element-on-the-appropriate-element-queue // If the custom element reactions stack is not empty, then // Add element to the current element queue. if (CEReactionsScope* current = CEReactionsScope::Current()) { current->EnqueueToCurrentQueue(element, reaction); return; } // If the custom element reactions stack is empty, then // Add element to the backup element queue. CustomElementReactionStack::Current().EnqueueToBackupQueue(element, reaction); } void CustomElement::EnqueueConnectedCallback(Element* element) { CustomElementDefinition* definition = DefinitionForElementWithoutCheck(*element); if (definition->HasConnectedCallback()) definition->EnqueueConnectedCallback(element); } void CustomElement::EnqueueDisconnectedCallback(Element* element) { CustomElementDefinition* definition = DefinitionForElementWithoutCheck(*element); if (definition->HasDisconnectedCallback()) definition->EnqueueDisconnectedCallback(element); } void CustomElement::EnqueueAdoptedCallback(Element* element, Document* old_owner, Document* new_owner) { DCHECK_EQ(element->GetCustomElementState(), CustomElementState::kCustom); CustomElementDefinition* definition = DefinitionForElementWithoutCheck(*element); if (definition->HasAdoptedCallback()) definition->EnqueueAdoptedCallback(element, old_owner, new_owner); } void CustomElement::EnqueueAttributeChangedCallback( Element* element, const QualifiedName& name, const AtomicString& old_value, const AtomicString& new_value) { CustomElementDefinition* definition = DefinitionForElementWithoutCheck(*element); if (definition->HasAttributeChangedCallback(name)) definition->EnqueueAttributeChangedCallback(element, name, old_value, new_value); } void CustomElement::TryToUpgrade(Element* element) { // Try to upgrade an element // https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade DCHECK_EQ(element->GetCustomElementState(), CustomElementState::kUndefined); CustomElementRegistry* registry = CustomElement::Registry(*element); if (!registry) return; if (CustomElementDefinition* definition = registry->DefinitionFor( CustomElementDescriptor(element->localName(), element->localName()))) definition->EnqueueUpgradeReaction(element); else registry->AddCandidate(element); } } // namespace blink
[ "jacob-chen@iotwrt.com" ]
jacob-chen@iotwrt.com
982dd9a2b635ef3eb61d41c0f36b93365c75db2b
9c6b8082931c4e630503788d0641210298a507bc
/F800W/main.cpp
ce1e05d78300fc7761140315f25b2558da8acb9c
[]
no_license
hucheng-yyds/device_app_qt_v2
5b2e803bc0e0fd0ed6e8a62b10d3e573d45c9c42
2f805a2c9a7c32d8444704bbdef1fe9307375452
refs/heads/master
2023-07-08T06:52:34.634044
2020-12-23T10:08:33
2020-12-23T10:08:33
390,967,629
0
0
null
null
null
null
UTF-8
C++
false
false
1,398
cpp
#include <QGuiApplication> #include <QTranslator> #include <QQmlApplicationEngine> #include <QQmlContext> #include "prostorage.h" int main(int argc, char *argv[]) { IF_VIO_VPSS_VO_MIPI_TX(switchCtl->m_camera, switchCtl->m_screen, switchCtl->m_angle); while (!IF_CheckYUVDataReady(0)) { QThread::msleep(1000); } QGuiApplication app(argc, argv); QTranslator *m_translator = new QTranslator(); switch (switchCtl->m_language) { case 0: m_translator->load("./language/OF_CH.qm"); break; case 1: m_translator->load("./language/OF_EN.qm"); break; case 2: m_translator->load("./language/OF_JA.qm"); break; case 3: m_translator->load("./language/OF_KOR.qm"); break; case 4: m_translator->load("./language/OF_RU.qm"); break; case 5: m_translator->load("./language/OF_IN.qm"); break; default: break; } app.installTranslator(m_translator); QQmlApplicationEngine engine; ProStorage *programs = new ProStorage; programs->start(); engine.rootContext()->setContextProperty("programs", programs); engine.load(QUrl(QStringLiteral("./qml/main.qml"))); system("himm 0x111F0028 0x0500"); system("himm 0x120D6400 0xB0"); system("himm 0x120D6200 0x80"); system("himm 0x120D6200 0xff"); return app.exec(); }
[ "zgf@officelinking.com" ]
zgf@officelinking.com
9862978843588397286bd656aa76aa761ea392ba
0d1c82ab85d11f7476e6c539baaa50143ebd3084
/SII-2020/SII-2020/FST.cpp
6af0ade63d8bdea531b65f94627eeb99091c8950
[]
no_license
Selevn/SII-2020
4f7a047a83afee4463d84a8220d661306b3d562b
e7a5df5d3131117ce0d8a05fba16e6a383205165
refs/heads/master
2023-02-07T21:08:43.665487
2020-12-14T18:17:45
2020-12-14T18:17:45
314,994,906
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
41,003
cpp
#include "FST.h" #include "Error.h" #include <cstdlib> #include <iomanip> #include <vector> #include "LT.h" #include "IT.h" #include <stack> struct libfuncs { std::string name; IT::IDDATATYPE params[255]; int parcount = 0; IT::IDDATATYPE retval; }; FST::RELATION::RELATION(char c, short ns) { symbol = c; nnode = ns; } FST::NODE::NODE() //по умолчанию { n_relation = 0; RELATION* relations = NULL; }; FST::NODE::NODE(short n, RELATION rel, ...) //с параметрами { n_relation = n; RELATION* p = &rel; relations = new RELATION[n]; for (short i = 0; i < n; i++) relations[i] = p[i]; }; FST::FST::FST(char* s, short ns, NODE n, ...) { string = s; nstates = ns; nodes = new NODE[ns]; NODE* p = &n; for (int k = 0; k < ns; k++) nodes[k] = p[k]; rstates = new short[nstates]; rstates[0] = 0; position = -1; }; bool step(FST::FST& fst, short*& rstates, int length) //один шаг автомата { bool rc = false; bool contFlag = false; std::swap(rstates, fst.rstates); // смена массивов for (short i = 0; i < fst.nstates; i++) //цикл по всем состояниям { if (rstates[i] == fst.position) //если возможная позиция текущая равна текущей позиции for (short j = 0; j < fst.nodes[i].n_relation; j++) //до количеста инцендентных ребер { if (fst.nodes[i].relations[j].symbol == fst.string[fst.position]) //если нашли такой символ { if (fst.position == length)//если последний символ в строке, то ищем есть ли второй узел(второй узел для выхода) { contFlag = true; continue; } else { fst.rstates[fst.nodes[i].relations[j].nnode] = fst.position + 1; rc = true; } }; }; if ((rc == false) && contFlag) //если не нашли второй узел то возвращаемся к первому { for (short j = 0; j < fst.nodes[i].n_relation; j++) //до количеста инцендентных ребер { if (fst.nodes[i].relations[j].symbol == fst.string[fst.position]) //если нашли такой символ { fst.rstates[fst.nodes[i].relations[j].nnode] = fst.position + 1; rc = true; }; }; } }; return rc; } struct col { public: col(void) { column = 1; } void reset_col() { column = 1; } void set_col(int a) { column = a; } int get_col() { return column; } private: int column; } colum; bool FST::execute(FST& fst) //выполнить распознование цепочки { fst.rstates[0] = 0; fst.position = -1; colum.reset_col(); short* rstates = new short[fst.nstates];//выделяем память по размеру memset(rstates, 0xff, sizeof(short) * fst.nstates); //инициализируем пустотой (ff) short lstring = strlen(fst.string); //длина цепочки bool rc = true; for (short i = 0; i < lstring && rc; i++) //по длине цепочки { fst.position++; //продвинули позицию rc = step(fst, rstates, lstring); //один шаг автомата colum.set_col(i); } delete[] rstates; return (rc ? (fst.rstates[fst.nstates - 1] == lstring) : rc); } void FST::LexAnalyzer(In::IN in, Out::OUT out, Log::LOG log, LT::LexTable& lextable, IT::IdTable& idtable) //выполнить распознование цепочки { libfuncs libs[4]; int libslen = 3; libs[0].name = "random"; libs[0].params[0] = IT::INT; libs[0].parcount = 1; libs[0].retval = IT::INT; libs[1].name = "ord"; libs[1].params[0] = IT::CHR; libs[1].parcount = 1; libs[1].retval = IT::INT; libs[2].name = "chr"; libs[2].params[0] = IT::INT; libs[2].parcount = 1; libs[2].retval = IT::CHR; char* str = new char[255]; #pragma region "FSTS" FST l_integer( str, 5, //количество состояний NODE(1, RELATION('u', 1)), NODE(1, RELATION('i', 2)), NODE(1, RELATION('n', 3)), NODE(1, RELATION('t', 4)), NODE() ); FST l_until( str, 6, //количество состояний NODE(1, RELATION('w', 1)), NODE(1, RELATION('h', 2)), NODE(1, RELATION('i', 3)), NODE(1, RELATION('l', 4)), NODE(1, RELATION('e', 5)), NODE() ); FST l_if( str, 3, //количество состояний NODE(1, RELATION('o', 1)), NODE(1, RELATION('n', 2)), NODE() ); FST l_export( str, 7, //количество состояний NODE(1, RELATION('e', 1)), NODE(1, RELATION('x', 2)), NODE(1, RELATION('t', 3)), NODE(1, RELATION('e', 4)), NODE(1, RELATION('r', 5)), NODE(1, RELATION('n', 6)), NODE() ); FST l_str( str, 4, //количество состояний NODE(1, RELATION('s', 1)), NODE(1, RELATION('t', 2)), NODE(1, RELATION('r', 3)), NODE() ); FST l_numberLiteral( str, 2, //количество состояний NODE(20, RELATION('0', 0), RELATION('1', 0), RELATION('2', 0), RELATION('3', 0), RELATION('4', 0), RELATION('5', 0), RELATION('6', 0), RELATION('7', 0), RELATION('8', 0), RELATION('9', 0), RELATION('0', 1), RELATION('1', 1), RELATION('2', 1), RELATION('3', 1), RELATION('4', 1), RELATION('5', 1), RELATION('6', 1), RELATION('7', 1), RELATION('8', 1), RELATION('9', 1) ), NODE() ); FST l_charLiteral( str, 4, NODE(1, RELATION('\'', 1)), NODE(256, RELATION((char)39, 2), RELATION((char)0, 2), RELATION((char)1, 2), RELATION((char)2, 2), RELATION((char)3, 2), RELATION((char)4, 2), RELATION((char)5, 2), RELATION((char)6, 2), RELATION((char)7, 2), RELATION((char)8, 2), RELATION((char)9, 2), RELATION((char)10, 2), RELATION((char)11, 2), RELATION((char)12, 2), RELATION((char)13, 2), RELATION((char)14, 2), RELATION((char)15, 2), RELATION((char)16, 2), RELATION((char)17, 2), RELATION((char)18, 2), RELATION((char)19, 2), RELATION((char)20, 2), RELATION((char)21, 2), RELATION((char)22, 2), RELATION((char)23, 2), RELATION((char)24, 2), RELATION((char)25, 2), RELATION((char)26, 2), RELATION((char)27, 2), RELATION((char)28, 2), RELATION((char)29, 2), RELATION((char)30, 2), RELATION((char)31, 2), RELATION((char)32, 2), RELATION((char)33, 2), RELATION((char)34, 2), RELATION((char)35, 2), RELATION((char)36, 2), RELATION((char)37, 2), RELATION((char)38, 2), RELATION((char)40, 2), RELATION((char)41, 2), RELATION((char)42, 2), RELATION((char)43, 2), RELATION((char)44, 2), RELATION((char)45, 2), RELATION((char)46, 2), RELATION((char)47, 2), RELATION((char)48, 2), RELATION((char)49, 2), RELATION((char)50, 2), RELATION((char)51, 2), RELATION((char)52, 2), RELATION((char)53, 2), RELATION((char)54, 2), RELATION((char)55, 2), RELATION((char)56, 2), RELATION((char)57, 2), RELATION((char)58, 2), RELATION((char)59, 2), RELATION((char)60, 2), RELATION((char)61, 2), RELATION((char)62, 2), RELATION((char)63, 2), RELATION((char)64, 2), RELATION((char)65, 2), RELATION((char)66, 2), RELATION((char)67, 2), RELATION((char)68, 2), RELATION((char)69, 2), RELATION((char)70, 2), RELATION((char)71, 2), RELATION((char)72, 2), RELATION((char)73, 2), RELATION((char)74, 2), RELATION((char)75, 2), RELATION((char)76, 2), RELATION((char)77, 2), RELATION((char)78, 2), RELATION((char)79, 2), RELATION((char)80, 2), RELATION((char)81, 2), RELATION((char)82, 2), RELATION((char)83, 2), RELATION((char)84, 2), RELATION((char)85, 2), RELATION((char)86, 2), RELATION((char)87, 2), RELATION((char)88, 2), RELATION((char)89, 2), RELATION((char)90, 2), RELATION((char)91, 2), RELATION((char)92, 2), RELATION((char)93, 2), RELATION((char)94, 2), RELATION((char)95, 2), RELATION((char)96, 2), RELATION((char)97, 2), RELATION((char)98, 2), RELATION((char)99, 2), RELATION((char)100, 2), RELATION((char)101, 2), RELATION((char)102, 2), RELATION((char)103, 2), RELATION((char)104, 2), RELATION((char)105, 2), RELATION((char)106, 2), RELATION((char)107, 2), RELATION((char)108, 2), RELATION((char)109, 2), RELATION((char)110, 2), RELATION((char)111, 2), RELATION((char)112, 2), RELATION((char)113, 2), RELATION((char)114, 2), RELATION((char)115, 2), RELATION((char)116, 2), RELATION((char)117, 2), RELATION((char)118, 2), RELATION((char)119, 2), RELATION((char)120, 2), RELATION((char)121, 2), RELATION((char)122, 2), RELATION((char)123, 2), RELATION((char)124, 2), RELATION((char)125, 2), RELATION((char)126, 2), RELATION((char)127, 2), RELATION((char)128, 2), RELATION((char)129, 2), RELATION((char)130, 2), RELATION((char)131, 2), RELATION((char)132, 2), RELATION((char)133, 2), RELATION((char)134, 2), RELATION((char)135, 2), RELATION((char)136, 2), RELATION((char)137, 2), RELATION((char)138, 2), RELATION((char)139, 2), RELATION((char)140, 2), RELATION((char)141, 2), RELATION((char)142, 2), RELATION((char)143, 2), RELATION((char)144, 2), RELATION((char)145, 2), RELATION((char)146, 2), RELATION((char)147, 2), RELATION((char)148, 2), RELATION((char)149, 2), RELATION((char)150, 2), RELATION((char)151, 2), RELATION((char)152, 2), RELATION((char)153, 2), RELATION((char)154, 2), RELATION((char)155, 2), RELATION((char)156, 2), RELATION((char)157, 2), RELATION((char)158, 2), RELATION((char)159, 2), RELATION((char)160, 2), RELATION((char)161, 2), RELATION((char)162, 2), RELATION((char)163, 2), RELATION((char)164, 2), RELATION((char)165, 2), RELATION((char)166, 2), RELATION((char)167, 2), RELATION((char)168, 2), RELATION((char)169, 2), RELATION((char)170, 2), RELATION((char)171, 2), RELATION((char)172, 2), RELATION((char)173, 2), RELATION((char)174, 2), RELATION((char)175, 2), RELATION((char)176, 2), RELATION((char)177, 2), RELATION((char)178, 2), RELATION((char)179, 2), RELATION((char)180, 2), RELATION((char)181, 2), RELATION((char)182, 2), RELATION((char)183, 2), RELATION((char)184, 2), RELATION((char)185, 2), RELATION((char)186, 2), RELATION((char)187, 2), RELATION((char)188, 2), RELATION((char)189, 2), RELATION((char)190, 2), RELATION((char)191, 2), RELATION((char)192, 2), RELATION((char)193, 2), RELATION((char)194, 2), RELATION((char)195, 2), RELATION((char)196, 2), RELATION((char)197, 2), RELATION((char)198, 2), RELATION((char)199, 2), RELATION((char)200, 2), RELATION((char)201, 2), RELATION((char)202, 2), RELATION((char)203, 2), RELATION((char)204, 2), RELATION((char)205, 2), RELATION((char)206, 2), RELATION((char)207, 2), RELATION((char)208, 2), RELATION((char)209, 2), RELATION((char)210, 2), RELATION((char)211, 2), RELATION((char)212, 2), RELATION((char)213, 2), RELATION((char)214, 2), RELATION((char)215, 2), RELATION((char)216, 2), RELATION((char)217, 2), RELATION((char)218, 2), RELATION((char)219, 2), RELATION((char)220, 2), RELATION((char)221, 2), RELATION((char)222, 2), RELATION((char)223, 2), RELATION((char)224, 2), RELATION((char)225, 2), RELATION((char)226, 2), RELATION((char)227, 2), RELATION((char)228, 2), RELATION((char)229, 2), RELATION((char)230, 2), RELATION((char)231, 2), RELATION((char)232, 2), RELATION((char)233, 2), RELATION((char)234, 2), RELATION((char)235, 2), RELATION((char)236, 2), RELATION((char)237, 2), RELATION((char)238, 2), RELATION((char)239, 2), RELATION((char)240, 2), RELATION((char)241, 2), RELATION((char)242, 2), RELATION((char)243, 2), RELATION((char)244, 2), RELATION((char)245, 2), RELATION((char)246, 2), RELATION((char)247, 2), RELATION((char)248, 2), RELATION((char)249, 2), RELATION((char)250, 2), RELATION((char)251, 2), RELATION((char)252, 2), RELATION((char)253, 2), RELATION((char)254, 2), RELATION((char)255, 2)), NODE(1, RELATION('\'', 3)), NODE()); FST l_stringLiteral( str, 3, //количество состояний NODE(1, RELATION('\"', 1)), NODE(256, RELATION('\"', 2), RELATION((char)0, 1), RELATION((char)1, 1), RELATION((char)2, 1), RELATION((char)3, 1), RELATION((char)4, 1), RELATION((char)5, 1), RELATION((char)6, 1), RELATION((char)7, 1), RELATION((char)8, 1), RELATION((char)9, 1), RELATION((char)10, 1), RELATION((char)11, 1), RELATION((char)12, 1), RELATION((char)13, 1), RELATION((char)14, 1), RELATION((char)15, 1), RELATION((char)16, 1), RELATION((char)17, 1), RELATION((char)18, 1), RELATION((char)19, 1), RELATION((char)20, 1), RELATION((char)21, 1), RELATION((char)22, 1), RELATION((char)23, 1), RELATION((char)24, 1), RELATION((char)25, 1), RELATION((char)26, 1), RELATION((char)27, 1), RELATION((char)28, 1), RELATION((char)29, 1), RELATION((char)30, 1), RELATION((char)31, 1), RELATION((char)32, 1), RELATION((char)33, 1), RELATION((char)35, 1), RELATION((char)36, 1), RELATION((char)37, 1), RELATION((char)38, 1), RELATION((char)39, 1), RELATION((char)40, 1), RELATION((char)41, 1), RELATION((char)42, 1), RELATION((char)43, 1), RELATION((char)44, 1), RELATION((char)45, 1), RELATION((char)46, 1), RELATION((char)47, 1), RELATION((char)48, 1), RELATION((char)49, 1), RELATION((char)50, 1), RELATION((char)51, 1), RELATION((char)52, 1), RELATION((char)53, 1), RELATION((char)54, 1), RELATION((char)55, 1), RELATION((char)56, 1), RELATION((char)57, 1), RELATION((char)58, 1), RELATION((char)59, 1), RELATION((char)60, 1), RELATION((char)61, 1), RELATION((char)62, 1), RELATION((char)63, 1), RELATION((char)64, 1), RELATION((char)65, 1), RELATION((char)66, 1), RELATION((char)67, 1), RELATION((char)68, 1), RELATION((char)69, 1), RELATION((char)70, 1), RELATION((char)71, 1), RELATION((char)72, 1), RELATION((char)73, 1), RELATION((char)74, 1), RELATION((char)75, 1), RELATION((char)76, 1), RELATION((char)77, 1), RELATION((char)78, 1), RELATION((char)79, 1), RELATION((char)80, 1), RELATION((char)81, 1), RELATION((char)82, 1), RELATION((char)83, 1), RELATION((char)84, 1), RELATION((char)85, 1), RELATION((char)86, 1), RELATION((char)87, 1), RELATION((char)88, 1), RELATION((char)89, 1), RELATION((char)90, 1), RELATION((char)91, 1), RELATION((char)92, 1), RELATION((char)93, 1), RELATION((char)94, 1), RELATION((char)95, 1), RELATION((char)96, 1), RELATION((char)97, 1), RELATION((char)98, 1), RELATION((char)99, 1), RELATION((char)100, 1), RELATION((char)101, 1), RELATION((char)102, 1), RELATION((char)103, 1), RELATION((char)104, 1), RELATION((char)105, 1), RELATION((char)106, 1), RELATION((char)107, 1), RELATION((char)108, 1), RELATION((char)109, 1), RELATION((char)110, 1), RELATION((char)111, 1), RELATION((char)112, 1), RELATION((char)113, 1), RELATION((char)114, 1), RELATION((char)115, 1), RELATION((char)116, 1), RELATION((char)117, 1), RELATION((char)118, 1), RELATION((char)119, 1), RELATION((char)120, 1), RELATION((char)121, 1), RELATION((char)122, 1), RELATION((char)123, 1), RELATION((char)124, 1), RELATION((char)125, 1), RELATION((char)126, 1), RELATION((char)127, 1), RELATION((char)128, 1), RELATION((char)129, 1), RELATION((char)130, 1), RELATION((char)131, 1), RELATION((char)132, 1), RELATION((char)133, 1), RELATION((char)134, 1), RELATION((char)135, 1), RELATION((char)136, 1), RELATION((char)137, 1), RELATION((char)138, 1), RELATION((char)139, 1), RELATION((char)140, 1), RELATION((char)141, 1), RELATION((char)142, 1), RELATION((char)143, 1), RELATION((char)144, 1), RELATION((char)145, 1), RELATION((char)146, 1), RELATION((char)147, 1), RELATION((char)148, 1), RELATION((char)149, 1), RELATION((char)150, 1), RELATION((char)151, 1), RELATION((char)152, 1), RELATION((char)153, 1), RELATION((char)154, 1), RELATION((char)155, 1), RELATION((char)156, 1), RELATION((char)157, 1), RELATION((char)158, 1), RELATION((char)159, 1), RELATION((char)160, 1), RELATION((char)161, 1), RELATION((char)162, 1), RELATION((char)163, 1), RELATION((char)164, 1), RELATION((char)165, 1), RELATION((char)166, 1), RELATION((char)167, 1), RELATION((char)168, 1), RELATION((char)169, 1), RELATION((char)170, 1), RELATION((char)171, 1), RELATION((char)172, 1), RELATION((char)173, 1), RELATION((char)174, 1), RELATION((char)175, 1), RELATION((char)176, 1), RELATION((char)177, 1), RELATION((char)178, 1), RELATION((char)179, 1), RELATION((char)180, 1), RELATION((char)181, 1), RELATION((char)182, 1), RELATION((char)183, 1), RELATION((char)184, 1), RELATION((char)185, 1), RELATION((char)186, 1), RELATION((char)187, 1), RELATION((char)188, 1), RELATION((char)189, 1), RELATION((char)190, 1), RELATION((char)191, 1), RELATION((char)192, 1), RELATION((char)193, 1), RELATION((char)194, 1), RELATION((char)195, 1), RELATION((char)196, 1), RELATION((char)197, 1), RELATION((char)198, 1), RELATION((char)199, 1), RELATION((char)200, 1), RELATION((char)201, 1), RELATION((char)202, 1), RELATION((char)203, 1), RELATION((char)204, 1), RELATION((char)205, 1), RELATION((char)206, 1), RELATION((char)207, 1), RELATION((char)208, 1), RELATION((char)209, 1), RELATION((char)210, 1), RELATION((char)211, 1), RELATION((char)212, 1), RELATION((char)213, 1), RELATION((char)214, 1), RELATION((char)215, 1), RELATION((char)216, 1), RELATION((char)217, 1), RELATION((char)218, 1), RELATION((char)219, 1), RELATION((char)220, 1), RELATION((char)221, 1), RELATION((char)222, 1), RELATION((char)223, 1), RELATION((char)224, 1), RELATION((char)225, 1), RELATION((char)226, 1), RELATION((char)227, 1), RELATION((char)228, 1), RELATION((char)229, 1), RELATION((char)230, 1), RELATION((char)231, 1), RELATION((char)232, 1), RELATION((char)233, 1), RELATION((char)234, 1), RELATION((char)235, 1), RELATION((char)236, 1), RELATION((char)237, 1), RELATION((char)238, 1), RELATION((char)239, 1), RELATION((char)240, 1), RELATION((char)241, 1), RELATION((char)242, 1), RELATION((char)243, 1), RELATION((char)244, 1), RELATION((char)245, 1), RELATION((char)246, 1), RELATION((char)247, 1), RELATION((char)248, 1), RELATION((char)249, 1), RELATION((char)250, 1), RELATION((char)251, 1), RELATION((char)252, 1), RELATION((char)253, 1), RELATION((char)254, 1), RELATION((char)255, 1) ), NODE() ); FST l_itendificator( str, 3, //количество состояний NODE(106, RELATION('a', 1), RELATION('b', 1), RELATION('c', 1), RELATION('d', 1), RELATION('e', 1), RELATION('f', 1), RELATION('g', 1), RELATION('h', 1), RELATION('i', 1), RELATION('j', 1), RELATION('k', 1), RELATION('l', 1), RELATION('m', 1), RELATION('n', 1), RELATION('o', 1), RELATION('p', 1), RELATION('q', 1), RELATION('r', 1), RELATION('s', 1), RELATION('t', 1), RELATION('u', 1), RELATION('v', 1), RELATION('w', 1), RELATION('x', 1), RELATION('y', 1), RELATION('z', 1), RELATION('A', 1), RELATION('B', 1), RELATION('C', 1), RELATION('D', 1), RELATION('E', 1), RELATION('F', 1), RELATION('G', 1), RELATION('H', 1), RELATION('I', 1), RELATION('J', 1), RELATION('K', 1), RELATION('L', 1), RELATION('M', 1), RELATION('N', 1), RELATION('O', 1), RELATION('P', 1), RELATION('Q', 1), RELATION('R', 1), RELATION('S', 1), RELATION('T', 1), RELATION('U', 1), RELATION('V', 1), RELATION('W', 1), RELATION('X', 1), RELATION('Y', 1), RELATION('Z', 1), RELATION('_', 1), RELATION('a', 2), RELATION('b', 2), RELATION('c', 2), RELATION('d', 2), RELATION('e', 2), RELATION('f', 2), RELATION('g', 2), RELATION('h', 2), RELATION('i', 2), RELATION('j', 2), RELATION('k', 2), RELATION('l', 2), RELATION('m', 2), RELATION('n', 2), RELATION('o', 2), RELATION('p', 2), RELATION('q', 2), RELATION('r', 2), RELATION('s', 2), RELATION('t', 2), RELATION('u', 2), RELATION('v', 2), RELATION('w', 2), RELATION('x', 2), RELATION('y', 2), RELATION('z', 2), RELATION('A', 2), RELATION('B', 2), RELATION('C', 2), RELATION('D', 2), RELATION('E', 2), RELATION('F', 2), RELATION('G', 2), RELATION('H', 2), RELATION('I', 2), RELATION('J', 2), RELATION('K', 2), RELATION('L', 2), RELATION('M', 2), RELATION('N', 2), RELATION('O', 2), RELATION('P', 2), RELATION('Q', 2), RELATION('R', 2), RELATION('S', 2), RELATION('T', 2), RELATION('U', 2), RELATION('V', 2), RELATION('W', 2), RELATION('X', 2), RELATION('Y', 2), RELATION('Z', 2), RELATION('_', 2) ), NODE(126, RELATION('a', 1), RELATION('b', 1), RELATION('c', 1), RELATION('d', 1), RELATION('e', 1), RELATION('f', 1), RELATION('g', 1), RELATION('h', 1), RELATION('i', 1), RELATION('j', 1), RELATION('k', 1), RELATION('l', 1), RELATION('m', 1), RELATION('n', 1), RELATION('o', 1), RELATION('p', 1), RELATION('q', 1), RELATION('r', 1), RELATION('s', 1), RELATION('t', 1), RELATION('u', 1), RELATION('v', 1), RELATION('w', 1), RELATION('x', 1), RELATION('y', 1), RELATION('z', 1), RELATION('A', 1), RELATION('B', 1), RELATION('C', 1), RELATION('D', 1), RELATION('E', 1), RELATION('F', 1), RELATION('G', 1), RELATION('H', 1), RELATION('I', 1), RELATION('J', 1), RELATION('K', 1), RELATION('L', 1), RELATION('M', 1), RELATION('N', 1), RELATION('O', 1), RELATION('P', 1), RELATION('Q', 1), RELATION('R', 1), RELATION('S', 1), RELATION('T', 1), RELATION('U', 1), RELATION('V', 1), RELATION('W', 1), RELATION('X', 1), RELATION('Y', 1), RELATION('Z', 1), RELATION('_', 1), RELATION('0', 1), RELATION('1', 1), RELATION('2', 1), RELATION('3', 1), RELATION('4', 1), RELATION('5', 1), RELATION('6', 1), RELATION('7', 1), RELATION('8', 1), RELATION('9', 1), RELATION('a', 2), RELATION('b', 2), RELATION('c', 2), RELATION('d', 2), RELATION('e', 2), RELATION('f', 2), RELATION('g', 2), RELATION('h', 2), RELATION('i', 2), RELATION('j', 2), RELATION('k', 2), RELATION('l', 2), RELATION('m', 2), RELATION('n', 2), RELATION('o', 2), RELATION('p', 2), RELATION('q', 2), RELATION('r', 2), RELATION('s', 2), RELATION('t', 2), RELATION('u', 2), RELATION('v', 2), RELATION('w', 2), RELATION('x', 2), RELATION('y', 2), RELATION('z', 2), RELATION('A', 2), RELATION('B', 2), RELATION('C', 2), RELATION('D', 2), RELATION('E', 2), RELATION('F', 2), RELATION('G', 2), RELATION('H', 2), RELATION('I', 2), RELATION('J', 2), RELATION('K', 2), RELATION('L', 2), RELATION('M', 2), RELATION('N', 2), RELATION('O', 2), RELATION('P', 2), RELATION('Q', 2), RELATION('R', 2), RELATION('S', 2), RELATION('T', 2), RELATION('U', 2), RELATION('V', 2), RELATION('W', 2), RELATION('X', 2), RELATION('Y', 2), RELATION('Z', 2), RELATION('_', 2), RELATION('0', 2), RELATION('1', 2), RELATION('2', 2), RELATION('3', 2), RELATION('4', 2), RELATION('5', 2), RELATION('6', 2), RELATION('7', 2), RELATION('8', 2), RELATION('9', 2) ), NODE() ); FST l_string( str, 5, //количество состояний NODE(1, RELATION('c', 1)), NODE(1, RELATION('h', 2)), NODE(1, RELATION('a', 3)), NODE(1, RELATION('r', 4)), NODE() ); FST l_function( str, 5, //количество состояний NODE(1, RELATION('f', 1)), NODE(1, RELATION('u', 2)), NODE(1, RELATION('n', 3)), NODE(1, RELATION('c', 4)), NODE() ); FST l_declare( str, 5, //количество состояний NODE(1, RELATION('b', 1)), NODE(1, RELATION('i', 2)), NODE(1, RELATION('n', 3)), NODE(1, RELATION('d', 4)), NODE() ); FST l_return( str, 5, //количество состояний NODE(1, RELATION('s', 1)), NODE(1, RELATION('t', 2)), NODE(1, RELATION('o', 3)), NODE(1, RELATION('p', 4)), NODE() ); FST l_printi( str, 7, //количество состояний NODE(1, RELATION('o', 1)), NODE(1, RELATION('u', 2)), NODE(1, RELATION('t', 3)), NODE(1, RELATION('p', 4)), NODE(1, RELATION('u', 5)), NODE(1, RELATION('t', 6)), NODE() ); FST l_prints( str, 5, //количество состояний NODE(1, RELATION('s', 1)), NODE(1, RELATION('a', 2)), NODE(1, RELATION('y', 3)), NODE(1, RELATION('s', 4)), NODE() ); FST l_main( str, 3, //количество состояний NODE(1, RELATION('g', 1)), NODE(1, RELATION('o', 2)), NODE() ); FST l_semicolon( str, 2, //количество состояний NODE(1, RELATION(';', 1)), NODE() ); FST l_comma( str, 2, //количество состояний NODE(1, RELATION(',', 1)), NODE() ); FST l_braceleft( str, 2, //количество состояний NODE(1, RELATION('{', 1)), NODE() ); FST l_braceright( str, 2, //количество состояний NODE(1, RELATION('}', 1)), NODE() ); FST l_lefthesis( str, 2, //количество состояний NODE(1, RELATION('(', 1)), NODE() ); FST l_cycleStart( str, 2, //количество состояний NODE(1, RELATION('[', 1)), NODE() ); FST l_cycleEnd( str, 2, //количество состояний NODE(1, RELATION(']', 1)), NODE() ); FST l_righthesis( str, 2, //количество состояний NODE(1, RELATION(')', 1)), NODE() ); FST l_verb( str, 2, //количество состояний NODE(8, RELATION('+', 1), RELATION('-', 1), RELATION('*', 1), RELATION('/', 1),RELATION(':', 1),RELATION('\\', 1), RELATION('%', 1),RELATION('=', 1)), NODE() ); FST l_boolVerb( str, 2, //количество состояний NODE(4, RELATION('^',1), RELATION('<',1), RELATION('>',1), RELATION('&',1)), NODE() ); #pragma endregion #pragma region "Структура checker и её массив автоматов" struct Checker { FST* chain; IT::IDDATATYPE iddatatype; char lexName; Checker(FST* f, char c, IT::IDDATATYPE t) { chain = f; lexName = c; iddatatype = t; } }; Checker checkArr[] = { Checker(&l_integer,LEX_INTEGER,IT::INT), Checker(&l_string,LEX_STRING,IT::CHR), Checker(&l_str,LEX_CHAR,IT::STR), Checker(&l_function,LEX_FUNCTION,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_declare,LEX_DECLARE,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_until,LEX_UNTIL,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_if,LEX_IF,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_return,LEX_RETURN,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_export,LEX_EXPORT,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_main,LEX_MAIN,(IT::IDDATATYPE)FALSYNUMBER), // Checker(&l_printi,LEX_PRINT,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_braceleft,LEX_LEFTBRACE,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_braceright,LEX_RIGHTBRACE,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_lefthesis,LEX_LEFTHESIS,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_righthesis,LEX_RIGHTHESIS,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_cycleStart,LEX_LEFT_SQUAREBRACE,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_cycleEnd,LEX_RIGHT_SQUAREBRACE,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_comma,LEX_COMMA,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_semicolon,LEX_SEMICOLON,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_verb,LEX_PLUS,(IT::IDDATATYPE)FALSYNUMBER), // Checker(&l_boolVerb,LEX_BOOL_OPERATOR,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_itendificator,LEX_ID,(IT::IDDATATYPE)FALSYNUMBER), Checker(&l_numberLiteral,LEX_LITERAL,IT::INT), Checker(&l_stringLiteral,LEX_LITERAL,IT::STR), Checker(&l_charLiteral,LEX_LITERAL,IT::CHR), //len = 22 }; const int checkArrLen = 25; #pragma endregion #pragma region "Флаги" std::string scopeName; std::vector <std::string> scopeStack; int literalCount = 0; scopeStack.push_back("\0"); int scopeCount = 0; int scopeNumber = 0; // aka currentScope int openedBrace = 0; bool isDeclare = false; bool isExported = false; bool isRequireBodyFunc = false; bool isMain = false; bool isFunction = false; bool isFunctionName = false; bool isFunctionParam = false; bool isParametr = false; bool isLiteral = false; bool wasMain = false; bool isBoleanExpression = false; int hesisCounter = 0; IT::IDDATATYPE dataType = (IT::IDDATATYPE)FALSYNUMBER; IT::IDTYPE type = (IT::IDTYPE)FALSYNUMBER; #pragma endregion int libPos = 0; std::stack<IT::IDDATATYPE> params; bool parmStackShouldWrite = false; int sizze = in.lexems.size(); #pragma region "перебор" for (int i = 0; i < sizze; i++) { In::lexem lex = in.lexems.front(); in.lexems.pop_front(); int len = strlen((const char*)(lex.lexem)); //длина строки ktrctvs #pragma region "запись лексемы в str" for (int k = 0; k < len; k++) { str[k] = lex.lexem[k]; } str[len] = '\0'; #pragma endregion bool executedFlag = false; // флаг окончания перебора цепочек for (int j = 0; j < checkArrLen; j++) { if (execute(*checkArr[j].chain)) { executedFlag = true; #pragma region "Установка флага" LT::Entry lexTableObject(checkArr[j].lexName, lex.line,lex.col, 0xffffffff); //нет until (уже есть) //проверяем что за лексема switch (checkArr[j].lexName) { //если встретили declare case LEX_DECLARE: { isDeclare = true; type = IT::V; break; } case LEX_UNTIL: { isBoleanExpression = true; break; } case LEX_BOOL_OPERATOR: { lexTableObject.lexema = LEX_BOOL_OPERATOR; break; } //если встретили uint/symbol case LEX_TYPE: { if (checkArr[j].iddatatype == IT::INT) { dataType = IT::INT; } else if (checkArr[j].iddatatype == IT::STR) { dataType = IT::STR; } else if (checkArr[j].iddatatype == IT::CHR) { dataType = IT::CHR; } else { //дропай ошибку dataType = (IT::IDDATATYPE)FALSYNUMBER; } break; } //функция case LEX_FUNCTION: { type = IT::F; break; } //вывод case LEX_PRINT: { break; } //итендификатор case LEX_ID: { //область видимости if (strlen(str) > ID_CURRENT_MAXSIZE) { str[ID_CURRENT_MAXSIZE] = '\0'; } std::string scope; //если функция, то не учитываем скоуп if (IT::IsId(idtable, str) != TI_NULLIDX && IT::GetEntry(idtable, IT::IsId(idtable, str)).idtype == (IT::IDTYPE::F)) { scope+= str; } else { if (!isExported) { for (int j = 0; j < scopeStack.size(); j++) { scope = scope + scopeStack.at(j); } } scope += str; } //если нет такого итендфикатора if (IT::IsId(idtable, (char*)scope.c_str()) == TI_NULLIDX) { if (isExported) { bool isOk = false; libPos = 0; for (; libPos < libslen; libPos++) { if (libs[libPos].name == str) { isOk = true; break; } } if (!isOk) throw ERROR_THROW_IN(705, lex.line, lex.col) else { if (dataType != libs[libPos].retval) throw ERROR_THROW_IN(707, lex.line, lex.col) parmStackShouldWrite = true; } } //если не параметр и не объявлен if (type != (IT::IDTYPE::P) && !isDeclare && !isExported) { //то мы пытаемся работать с необъявленным итендификатором throw ERROR_THROW_IN(121, lex.line, lex.col) } if (dataType != (IT::IDDATATYPE)FALSYNUMBER && type != (IT::IDTYPE)FALSYNUMBER) { if (type == IT::F) { scopeName = str; } //добавляем в таблицу IT::Entry idTableObject(lextable.size, scope.c_str(), dataType, type, isExported); IT::Add(idtable, idTableObject); lexTableObject.idxTI = idtable.size - 1; //снимаем флаг объявлённости и экспорта isDeclare = false; isExported = false; //записываем в стек параметры импортируемой функции if (parmStackShouldWrite && type == IT::P) { params.push(dataType); //проверка параметров экспортируемой функции } //зануляем тип и вид if (!isFunctionParam) type = (IT::IDTYPE)FALSYNUMBER; dataType = (IT::IDDATATYPE)FALSYNUMBER; } else //дропаем ошибку если тип или вид не определён throw ERROR_THROW_IN(122, lex.line, lex.col); } else { if(isDeclare || isExported) throw ERROR_THROW_IN(700, lex.line, lex.col); //если в таблице итендификаторов есть запись - ссылаемся на неё lexTableObject.idxTI = IT::IsId(idtable, (char*)scope.c_str()); } break; } //экспорт case LEX_EXPORT: { isExported = true; break; } //левая скобка case LEX_LEFTHESIS: { //если предыдущий - имя функции if (lextable.size != 0 && lextable.table[lextable.size - 1].idxTI != LT_TI_NULLIDX && idtable.table[lextable.table[lextable.size - 1].idxTI].idtype == IT::F) { //если функцию только объявили if (lextable.table[lextable.size - 4].lexema == LEX_EXPORT || lextable.table[lextable.size - 4].lexema == LEX_DECLARE) { isFunctionParam = true; type = IT::P; scopeStack.push_back(scopeName); } //если функцию вызвали else { isFunctionParam = false; } } if (lextable.size != 0 && lextable.table[lextable.size - 1].idxTI != LT_TI_NULLIDX && idtable.table[lextable.table[lextable.size - 1].idxTI].idtype != IT::F) throw ERROR_THROW_IN(602, lex.line, lex.col) break; } //правая скобочка case LEX_RIGHTHESIS: { if (isBoleanExpression) { isBoleanExpression = false; } if (parmStackShouldWrite) { for (int q = libs[libPos].parcount-1; q > -1; --q) { if (params.size() != libs[libPos].parcount) throw ERROR_THROW_IN(706, lex.line, lex.col) if (params.top() != libs[libPos].params[q]) throw ERROR_THROW_IN(706, lex.line, lex.col) params.pop(); } parmStackShouldWrite = false; } //если параметры функции шли if (isFunctionParam) { //убираем область видимости scopeStack.pop_back(); //больше не параметры функции isFunctionParam = false; //закончили смотреть параметры, сейчас ожидаем тело функции isRequireBodyFunc = true; //тип больше не параметр type = (IT::IDTYPE)FALSYNUMBER; } //аргументы функции, то что передаётся в объявленную else type = (IT::IDTYPE)FALSYNUMBER; break; } //левая фигурная case LEX_LEFTBRACE: { hesisCounter++; //если предыдущая лексема закрытсая скобочка и ожидаем тело функции if (lextable.table[lextable.size - 1].lexema == LEX_RIGHTHESIS && isRequireBodyFunc) scopeStack.push_back(scopeName.c_str()); //если main else if (lextable.table[lextable.size - 1].lexema == LEX_MAIN) scopeStack.push_back("main"); //не будет тела функции else isRequireBodyFunc = false; break; } //правая фигурная case LEX_RIGHTBRACE: { hesisCounter--; if (isRequireBodyFunc) { scopeStack.pop_back(); isRequireBodyFunc = false; } //else //throw ERROR_THROW_IN(127, lex.line, lex.col); break; } //main case LEX_MAIN: { if (!wasMain) { //ожидеам тело функции isRequireBodyFunc = true; //встречался ли main wasMain = true; break; } else throw ERROR_THROW_IN(125, lex.line, lex.col); } //литерал case LEX_LITERAL: { //количество литералов literalCount++; lexTableObject.idxTI = idtable.size; bool continueFlag = true; if (checkArr[j].iddatatype == IT::INT) { unsigned int out = strtoul(str, NULL, 10); int positionInTable = IT::IsLX(idtable, checkArr[j].iddatatype, out); if (positionInTable != TI_NULLIDX) { continueFlag = false; lexTableObject.idxTI = positionInTable; } } if (checkArr[j].iddatatype == IT::CHR) { int positionInTable = IT::IsLX(idtable, checkArr[j].iddatatype, str[1]); if (positionInTable != TI_NULLIDX) { continueFlag = false; lexTableObject.idxTI = positionInTable; } } if (checkArr[j].iddatatype == IT::STR) { int positionInTable = IT::IsLX(idtable, IT::STR, str); if (positionInTable != TI_NULLIDX) { continueFlag = false; lexTableObject.idxTI = positionInTable; } } //если ретурним значит определили if (lextable.table[lextable.size - 1].lexema == LEX_RETURN) { continueFlag = true; lexTableObject.idxTI = idtable.size; } //если такого литерала нет if (continueFlag) { //формируем имя литерала std::string scope; for (int j = scopeStack.size() - 1; j >= 0; j--) { scope = scope + scopeStack.at(j); } scope += "$LEX"; char* t = new char[6]; _itoa_s(literalCount, t, 6, 10); scope += t; if (checkArr[j].iddatatype == IT::INT) { unsigned int out = strtoul(str, NULL, 10); IT::Entry ttmp(lextable.size - 1, scope.c_str(), checkArr[j].iddatatype, IT::L, out); IT::Add(idtable, ttmp); } else if (checkArr[j].iddatatype == IT::STR) { IT::Entry ttmp(lextable.size - 1, scope.c_str(), checkArr[j].iddatatype, IT::L, str); IT::Add(idtable, ttmp); } else if (checkArr[j].iddatatype == IT::CHR) { IT::Entry ttmp(lextable.size - 1, scope.c_str(), checkArr[j].iddatatype, IT::L, (char)str[1]); IT::Add(idtable, ttmp); } else ERROR_THROW_IN(122, lex.line, lex.col); } break; } } #pragma region "Если знаковая лексема" if (lexTableObject.lexema == LEX_MINUS || lexTableObject.lexema == LEX_LEFTBRACE || lexTableObject.lexema == LEX_RIGHTBRACE || lexTableObject.lexema == LEX_LEFTHESIS || lexTableObject.lexema == LEX_RIGHTHESIS) lexTableObject.data = str[0]; #pragma endregion #pragma region "Если булевая лексема" if (lexTableObject.lexema == LEX_BOOL_OPERATOR) lexTableObject.data = str[0]; #pragma endregion #pragma endregion LT::Add(lextable, lexTableObject); break; } } //если не распознали цепочку if (!executedFlag) throw ERROR_THROW_IN(120, lex.line, lex.col); } //если не было main if (!wasMain) throw ERROR_THROW(124); if(hesisCounter!=0) throw ERROR_THROW(116); #pragma endregion }
[ "53996471+Selevn@users.noreply.github.com" ]
53996471+Selevn@users.noreply.github.com
a5438c232377e460ef837c0e27725552c855efef
a81c07a5663d967c432a61d0b4a09de5187be87b
/third_party/blink/renderer/core/layout/ng/ng_length_utils.h
a652cb602b1e78f16810a22edb9d18e12b90e22a
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause" ]
permissive
junxuezheng/chromium
c401dec07f19878501801c9e9205a703e8643031
381ce9d478b684e0df5d149f59350e3bc634dad3
refs/heads/master
2023-02-28T17:07:31.342118
2019-09-03T01:42:42
2019-09-03T01:42:42
205,967,014
2
0
BSD-3-Clause
2019-09-03T01:48:23
2019-09-03T01:48:23
null
UTF-8
C++
false
false
21,527
h
// 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. #ifndef NGLengthUtils_h #define NGLengthUtils_h #include "base/optional.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/geometry/logical_size.h" #include "third_party/blink/renderer/core/layout/geometry/physical_size.h" #include "third_party/blink/renderer/core/layout/min_max_size.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_box_strut.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_fragment_geometry.h" #include "third_party/blink/renderer/core/layout/ng/ng_constraint_space.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" #include "third_party/blink/renderer/platform/text/text_direction.h" #include "third_party/blink/renderer/platform/text/writing_mode.h" namespace blink { class ComputedStyle; class Length; struct MinMaxSizeInput; class NGConstraintSpace; class NGBlockNode; class NGLayoutInputNode; // LengthResolvePhase indicates what type of layout pass we are currently in. // This changes how lengths are resolved. kIntrinsic must be used during the // intrinsic sizes pass, and kLayout must be used during the layout pass. enum class LengthResolvePhase { kIntrinsic, kLayout }; inline bool NeedMinMaxSize(const ComputedStyle& style) { // This check is technically too broad (fill-available does not need intrinsic // size computation) but that's a rare case and only affects performance, not // correctness. return style.LogicalWidth().IsIntrinsic() || style.LogicalMinWidth().IsIntrinsic() || style.LogicalMaxWidth().IsIntrinsic(); } // Whether the caller needs to compute min-content and max-content sizes to // pass them to ResolveMainInlineLength / ComputeInlineSizeForFragment. // If this function returns false, it is safe to pass an empty // MinMaxSize struct to those functions. inline bool NeedMinMaxSize(const NGConstraintSpace& constraint_space, const ComputedStyle& style) { return constraint_space.IsShrinkToFit() || NeedMinMaxSize(style); } // Like NeedMinMaxSize, but for use when calling // ComputeMinAndMaxContentContribution. // Because content contributions are commonly needed by a block's parent, // we also take a writing mode here so we can check this in the parent's // coordinate system. CORE_EXPORT bool NeedMinMaxSizeForContentContribution(WritingMode mode, const ComputedStyle&); // Returns if the given |Length| is unresolvable, e.g. the length is %-based // during the intrinsic phase. Considers 'auto' as resolvable. CORE_EXPORT bool InlineLengthUnresolvable(const Length&, LengthResolvePhase); CORE_EXPORT bool BlockLengthUnresolvable( const NGConstraintSpace&, const Length&, LengthResolvePhase, const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = nullptr); // Resolve means translate a Length to a LayoutUnit. // - |NGConstraintSpace| the information given by the parent, e.g. the // available-size. // - |ComputedStyle| the style of the node. // - |border_padding| the resolved border, and padding of the node. // - |MinMaxSize| is only used when the length is intrinsic (fit-content). // - |Length| is the length to resolve. CORE_EXPORT LayoutUnit ResolveInlineLengthInternal(const NGConstraintSpace&, const ComputedStyle&, const NGBoxStrut& border_padding, const base::Optional<MinMaxSize>&, const Length&); // Same as ResolveInlineLengthInternal, except here |content_size| roughly plays // the part of |MinMaxSize|. CORE_EXPORT LayoutUnit ResolveBlockLengthInternal( const NGConstraintSpace&, const ComputedStyle&, const NGBoxStrut& border_padding, const Length&, LayoutUnit content_size, LengthResolvePhase, const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = nullptr); // Used for resolving min inline lengths, (|ComputedStyle::MinLogicalWidth|). inline LayoutUnit ResolveMinInlineLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const base::Optional<MinMaxSize>& min_and_max, const Length& length, LengthResolvePhase phase) { if (LIKELY(length.IsAuto() || InlineLengthUnresolvable(length, phase))) return border_padding.InlineSum(); return ResolveInlineLengthInternal(constraint_space, style, border_padding, min_and_max, length); } // Used for resolving max inline lengths, (|ComputedStyle::MaxLogicalWidth|). inline LayoutUnit ResolveMaxInlineLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const base::Optional<MinMaxSize>& min_and_max, const Length& length, LengthResolvePhase phase) { if (LIKELY(length.IsMaxSizeNone() || InlineLengthUnresolvable(length, phase))) return LayoutUnit::Max(); return ResolveInlineLengthInternal(constraint_space, style, border_padding, min_and_max, length); } // Used for resolving main inline lengths, (|ComputedStyle::LogicalWidth|). inline LayoutUnit ResolveMainInlineLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const base::Optional<MinMaxSize>& min_and_max, const Length& length) { return ResolveInlineLengthInternal(constraint_space, style, border_padding, min_and_max, length); } // Used for resolving min block lengths, (|ComputedStyle::MinLogicalHeight|). inline LayoutUnit ResolveMinBlockLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const Length& length, LayoutUnit content_size, LengthResolvePhase phase, const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = nullptr) { if (LIKELY(length.IsAuto() || length.IsMinContent() || length.IsMaxContent() || length.IsFitContent() || BlockLengthUnresolvable( constraint_space, length, phase, opt_percentage_resolution_block_size_for_min_max))) return border_padding.BlockSum(); return ResolveBlockLengthInternal( constraint_space, style, border_padding, length, content_size, phase, opt_percentage_resolution_block_size_for_min_max); } // Used for resolving max block lengths, (|ComputedStyle::MaxLogicalHeight|). inline LayoutUnit ResolveMaxBlockLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const Length& length, LayoutUnit content_size, LengthResolvePhase phase, const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = nullptr) { if (LIKELY(length.IsMaxSizeNone() || length.IsMinContent() || length.IsMaxContent() || length.IsFitContent() || BlockLengthUnresolvable( constraint_space, length, phase, opt_percentage_resolution_block_size_for_min_max))) return LayoutUnit::Max(); return ResolveBlockLengthInternal( constraint_space, style, border_padding, length, content_size, phase, opt_percentage_resolution_block_size_for_min_max); } // Used for resolving main block lengths, (|ComputedStyle::LogicalHeight|). inline LayoutUnit ResolveMainBlockLength( const NGConstraintSpace& constraint_space, const ComputedStyle& style, const NGBoxStrut& border_padding, const Length& length, LayoutUnit content_size, LengthResolvePhase phase, const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = nullptr) { if (UNLIKELY((length.IsPercentOrCalc() || length.IsFillAvailable()) && BlockLengthUnresolvable( constraint_space, length, phase, opt_percentage_resolution_block_size_for_min_max))) return content_size; return ResolveBlockLengthInternal( constraint_space, style, border_padding, length, content_size, phase, opt_percentage_resolution_block_size_for_min_max); } // For the given style and min/max content sizes, computes the min and max // content contribution (https://drafts.csswg.org/css-sizing/#contributions). // This is similar to ComputeInlineSizeForFragment except that it does not // require a constraint space (percentage sizes as well as auto margins compute // to zero) and that an auto inline size resolves to the respective min/max // content size. // Also, the min/max contribution does include the inline margins as well. // Because content contributions are commonly needed by a block's parent, // we also take a writing mode here so we can compute this in the parent's // coordinate system. CORE_EXPORT MinMaxSize ComputeMinAndMaxContentContribution(WritingMode writing_mode, const ComputedStyle&, const NGBoxStrut& border_padding, const base::Optional<MinMaxSize>&); // A version of ComputeMinAndMaxContentContribution that does not require you // to compute the min/max content size of the child. Instead, this function // will compute it if necessary. // |child| is the node of which to compute the min/max content contribution. // Note that if the writing mode of the child is orthogonal to that of the // parent, we'll still return the inline min/max contribution in the writing // mode of the parent (i.e. typically something based on the preferred *block* // size of the child). MinMaxSize ComputeMinAndMaxContentContribution( const ComputedStyle& parent_style, NGLayoutInputNode child, const MinMaxSizeInput&); // Computes the min/max-content size for an out-of-flow positioned node and // returns it, using the cache where possible. ALways computes it in the writing // mode of the node itself. MinMaxSize ComputeMinAndMaxContentSizeForOutOfFlow( const NGConstraintSpace&, NGLayoutInputNode, const NGBoxStrut& border_padding, const MinMaxSizeInput&); // Returns inline size of the node's border box by resolving the computed value // in style.logicalWidth (Length) to a layout unit, adding border and padding, // then constraining the result by the resolved min logical width and max // logical width from the ComputedStyle object. Calls Node::ComputeMinMaxSize // if needed. // |override_minmax_for_test| is provided *solely* for use by unit tests. CORE_EXPORT LayoutUnit ComputeInlineSizeForFragment( const NGConstraintSpace&, NGLayoutInputNode, const NGBoxStrut& border_padding, const MinMaxSize* override_minmax_for_test = nullptr); // Same as ComputeInlineSizeForFragment, but uses height instead of width. CORE_EXPORT LayoutUnit ComputeBlockSizeForFragment(const NGConstraintSpace&, const ComputedStyle&, const NGBoxStrut& border_padding, LayoutUnit content_size); // Computes intrinsic size for replaced elements. CORE_EXPORT LogicalSize ComputeReplacedSize(const NGLayoutInputNode&, const NGConstraintSpace&, const base::Optional<MinMaxSize>&); // Based on available inline size, CSS computed column-width, CSS computed // column-count and CSS used column-gap, return CSS used column-count. CORE_EXPORT int ResolveUsedColumnCount(int computed_count, LayoutUnit computed_size, LayoutUnit used_gap, LayoutUnit available_size); CORE_EXPORT int ResolveUsedColumnCount(LayoutUnit available_size, const ComputedStyle&); // Based on available inline size, CSS computed column-width, CSS computed // column-count and CSS used column-gap, return CSS used column-width. CORE_EXPORT LayoutUnit ResolveUsedColumnInlineSize(int computed_count, LayoutUnit computed_size, LayoutUnit used_gap, LayoutUnit available_size); CORE_EXPORT LayoutUnit ResolveUsedColumnInlineSize(LayoutUnit available_size, const ComputedStyle&); CORE_EXPORT LayoutUnit ResolveUsedColumnGap(LayoutUnit available_size, const ComputedStyle&); // Compute physical margins. CORE_EXPORT NGPhysicalBoxStrut ComputePhysicalMargins(const ComputedStyle&, LayoutUnit percentage_resolution_size); inline NGPhysicalBoxStrut ComputePhysicalMargins( const NGConstraintSpace& constraint_space, const ComputedStyle& style) { LayoutUnit percentage_resolution_size = constraint_space.PercentageResolutionInlineSizeForParentWritingMode(); return ComputePhysicalMargins(style, percentage_resolution_size); } // Compute margins for the specified NGConstraintSpace. CORE_EXPORT NGBoxStrut ComputeMarginsFor(const NGConstraintSpace&, const ComputedStyle&, const NGConstraintSpace& compute_for); inline NGBoxStrut ComputeMarginsFor(const ComputedStyle& child_style, LayoutUnit percentage_resolution_size, WritingMode container_writing_mode, TextDirection container_direction) { return ComputePhysicalMargins(child_style, percentage_resolution_size) .ConvertToLogical(container_writing_mode, container_direction); } // Compute margins for the style owner. inline NGBoxStrut ComputeMarginsForSelf( const NGConstraintSpace& constraint_space, const ComputedStyle& style) { if (!style.MayHaveMargin() || constraint_space.IsAnonymous()) return NGBoxStrut(); LayoutUnit percentage_resolution_size = constraint_space.PercentageResolutionInlineSizeForParentWritingMode(); return ComputePhysicalMargins(style, percentage_resolution_size) .ConvertToLogical(style.GetWritingMode(), style.Direction()); } // Compute line logical margins for the style owner. // // The "line" versions compute line-relative logical values. See NGLineBoxStrut // for more details. inline NGLineBoxStrut ComputeLineMarginsForSelf( const NGConstraintSpace& constraint_space, const ComputedStyle& style) { if (!style.MayHaveMargin() || constraint_space.IsAnonymous()) return NGLineBoxStrut(); LayoutUnit percentage_resolution_size = constraint_space.PercentageResolutionInlineSizeForParentWritingMode(); return ComputePhysicalMargins(style, percentage_resolution_size) .ConvertToLineLogical(style.GetWritingMode(), style.Direction()); } // Compute line logical margins for the constraint space, in the visual order // (always assumes LTR, ignoring the direction) for inline layout algorithm. inline NGLineBoxStrut ComputeLineMarginsForVisualContainer( const NGConstraintSpace& constraint_space, const ComputedStyle& style) { if (!style.MayHaveMargin() || constraint_space.IsAnonymous()) return NGLineBoxStrut(); LayoutUnit percentage_resolution_size = constraint_space.PercentageResolutionInlineSizeForParentWritingMode(); return ComputePhysicalMargins(style, percentage_resolution_size) .ConvertToLineLogical(constraint_space.GetWritingMode(), TextDirection::kLtr); } // Compute margins for a child during the min-max size calculation. CORE_EXPORT NGBoxStrut ComputeMinMaxMargins(const ComputedStyle& parent_style, NGLayoutInputNode child); CORE_EXPORT NGBoxStrut ComputeBorders(const NGConstraintSpace&, const NGLayoutInputNode); CORE_EXPORT NGBoxStrut ComputeBordersForInline(const ComputedStyle& style); inline NGLineBoxStrut ComputeLineBorders( const ComputedStyle& style) { return NGLineBoxStrut(ComputeBordersForInline(style), style.IsFlippedLinesWritingMode()); } CORE_EXPORT NGBoxStrut ComputeBordersForTest(const ComputedStyle& style); CORE_EXPORT NGBoxStrut ComputeIntrinsicPadding(const NGConstraintSpace&, const ComputedStyle&, const NGBoxStrut& scrollbar); CORE_EXPORT NGBoxStrut ComputePadding(const NGConstraintSpace&, const ComputedStyle&); inline NGLineBoxStrut ComputeLinePadding( const NGConstraintSpace& constraint_space, const ComputedStyle& style) { return NGLineBoxStrut(ComputePadding(constraint_space, style), style.IsFlippedLinesWritingMode()); } CORE_EXPORT NGBoxStrut ComputeScrollbars(const NGConstraintSpace&, const NGLayoutInputNode); // Return true if we need to know the inline size of the fragment in order to // calculate its line-left offset. This is the case when we have auto margins, // or when block alignment isn't line-left (e.g. with align!=left, and always in // RTL mode). bool NeedsInlineSizeToResolveLineLeft( const ComputedStyle& style, const ComputedStyle& containing_block_style); // Convert inline margins from computed to used values. This will resolve 'auto' // values and over-constrainedness. This uses the available size from the // constraint space and inline size to compute the margins that are auto, if // any, and adjusts the given NGBoxStrut accordingly. // available_inline_size, inline_size, and margins are all in the // containing_block's writing mode. CORE_EXPORT void ResolveInlineMargins( const ComputedStyle& child_style, const ComputedStyle& containing_block_style, LayoutUnit available_inline_size, LayoutUnit inline_size, NGBoxStrut* margins); // Calculate the adjustment needed for the line's left position, based on // text-align, direction and amount of unused space. CORE_EXPORT LayoutUnit LineOffsetForTextAlign(ETextAlign, TextDirection, LayoutUnit space_left); inline LayoutUnit ConstrainByMinMax(LayoutUnit length, LayoutUnit min, LayoutUnit max) { return std::max(min, std::min(length, max)); } // Calculates the initial (pre-layout) fragment geometry given a node, and a // constraint space. // The "pre-layout" block-size may be indefinite, as we'll only have enough // information to determine this post-layout. CORE_EXPORT NGFragmentGeometry CalculateInitialFragmentGeometry(const NGConstraintSpace&, const NGBlockNode&); // Similar to |CalculateInitialFragmentGeometry| however will only calculate // the border, scrollbar, and padding (resolving percentages to zero). CORE_EXPORT NGFragmentGeometry CalculateInitialMinMaxFragmentGeometry(const NGConstraintSpace&, const NGBlockNode&); // Shrink and return the available size by an inset. This may e.g. be used to // convert from border-box to content-box size. Indefinite block size is // allowed, in which case the inset will be ignored for block size. LogicalSize ShrinkAvailableSize(LogicalSize size, const NGBoxStrut& inset); // Calculates the percentage resolution size that children of the node should // use. LogicalSize CalculateChildPercentageSize( const NGConstraintSpace&, const NGBlockNode node, const LogicalSize& child_available_size); // Calculates the percentage resolution size that replaced children of the node // should use. LogicalSize CalculateReplacedChildPercentageSize( const NGConstraintSpace&, const NGBlockNode node, LogicalSize border_box_size, const NGBoxStrut& border_scrollbar_padding, const NGBoxStrut& border_padding); LayoutUnit CalculateChildPercentageBlockSizeForMinMax( const NGConstraintSpace& constraint_space, const NGBlockNode node, const NGBoxStrut& border_padding, LayoutUnit parent_percentage_block_size); // The following function clamps the calculated size based on the node // requirements. Specifically, this adjusts the size based on size containment // and display locking status. LayoutUnit ClampIntrinsicBlockSize(const NGBlockNode&, const NGBoxStrut& border_scrollbar_padding, LayoutUnit current_intrinsic_block_size); // This function checks if the inline size of this node has to be calculated // without considering children. If so, it returns the calculated size. // Otherwise, it returns base::nullopt and the caller has to compute the size // itself. base::Optional<MinMaxSize> CalculateMinMaxSizesIgnoringChildren( const NGBlockNode&, const NGBoxStrut& border_scrollbar_padding, NGMinMaxSizeType); } // namespace blink #endif // NGLengthUtils_h
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
8614ee9feff99902c965061d6f458799fd4656fe
988d2a132be3d3f36a985d848f6d4cc54748d5e7
/experimental/Pomdog.Experimental/Utility/UserPreferences.cpp
8bc0e49b96564c4e1d006d792dfb84b8ea7c30fc
[ "MIT" ]
permissive
ValtoForks/pomdog
24336f3342c51a25a0260144bdc72f6bf0bb4a35
73798ae5f4a4c3b9b1e1e96239187c4b842c93b2
refs/heads/master
2021-05-03T15:47:12.979889
2019-01-04T15:42:05
2019-01-04T15:42:05
120,486,114
0
0
NOASSERTION
2019-01-04T15:42:06
2018-02-06T16:15:53
C++
UTF-8
C++
false
false
6,384
cpp
// Copyright (c) 2013-2018 mogemimi. Distributed under the MIT license. #include "UserPreferences.hpp" #include "Pomdog/Content/Utility/BinaryFileStream.hpp" #include "Pomdog/Content/Utility/BinaryReader.hpp" #include "Pomdog/Utility/Assert.hpp" #include "Pomdog/Utility/Exception.hpp" #include "Pomdog/Utility/FileSystem.hpp" #include "Pomdog/Utility/PathHelper.hpp" #include "Pomdog/Logging/Log.hpp" #include <rapidjson/document.h> #include <rapidjson/writer.h> #include <fstream> namespace Pomdog { namespace { template <typename T> rapidjson::Value ToJsonValue(T const& v) { auto value = rapidjson::Value(v); return value; } rapidjson::Value ToJsonValue(std::string const& s) { auto value = rapidjson::Value( s.c_str(), static_cast<rapidjson::SizeType>(s.size())); return value; } template <typename T, typename Func> std::optional<T> GetJsonValue(const std::string& jsonData, const std::string& key, Func func) { POMDOG_ASSERT(!key.empty()); if (jsonData.empty()) { return std::nullopt; } rapidjson::Document doc; doc.Parse(jsonData.data()); POMDOG_ASSERT(!doc.HasParseError()); POMDOG_ASSERT(doc.IsObject()); if (!doc.HasMember(key.c_str())) { return std::nullopt; } auto & v = doc[key.c_str()]; return func(v); } template <typename T> void SetJsonValue(std::string& jsonData, const std::string& key, const T& value) { POMDOG_ASSERT(!key.empty()); rapidjson::Document doc; if (!jsonData.empty()) { doc.Parse(jsonData.data()); POMDOG_ASSERT(!doc.HasParseError()); POMDOG_ASSERT(doc.IsObject()); } if (!doc.HasMember(key.c_str())) { doc.AddMember(ToJsonValue(key), ToJsonValue(value), doc.GetAllocator()); } else { doc[key.c_str()] = ToJsonValue(value); } rapidjson::StringBuffer buf; rapidjson::Writer<rapidjson::StringBuffer> writer(buf); doc.Accept(writer); jsonData.clear(); jsonData.assign(buf.GetString(), buf.GetSize()); } } // unnamed namespace UserPreferences::UserPreferences() : needToSave(false) { using Detail::BinaryReader; const auto directory = FileSystem::GetLocalAppDataDirectoryPath(); filePath = PathHelper::Join(directory, "UserPreferences.json"); if (!FileSystem::IsDirectory(directory)) { if (!FileSystem::CreateDirectory(directory)) { POMDOG_THROW_EXCEPTION(std::runtime_error, "Failed to create directory: " + directory); } } if (FileSystem::Exists(filePath)) { auto binaryFile = PathHelper::OpenStream(filePath); if (!binaryFile.Stream) { POMDOG_THROW_EXCEPTION(std::runtime_error, "Failed to open file"); } if (binaryFile.SizeInBytes > 0) { auto data = BinaryReader::ReadString<char>( binaryFile.Stream, binaryFile.SizeInBytes); jsonData.assign(data.data(), data.size()); POMDOG_ASSERT(!jsonData.empty()); } } if (!jsonData.empty()) { rapidjson::Document doc; doc.Parse(jsonData.data()); if (doc.HasParseError() || !doc.IsObject()) { // FUS RO DAH POMDOG_THROW_EXCEPTION(std::runtime_error, "Failed to parse JSON"); } } else { jsonData = "{}"; } Log::Internal("UserPreferences path: " + filePath); } std::optional<bool> UserPreferences::GetBool(const std::string& key) const { POMDOG_ASSERT(!key.empty()); return GetJsonValue<bool>(jsonData, key, [](const rapidjson::Value& v) -> std::optional<bool> { if (v.IsBool()) { return v.GetBool(); } return std::nullopt; }); } std::optional<float> UserPreferences::GetFloat(const std::string& key) const { POMDOG_ASSERT(!key.empty()); return GetJsonValue<float>(jsonData, key, [](const rapidjson::Value& v) -> std::optional<float> { if (v.IsNumber()) { return static_cast<float>(v.GetDouble()); } return std::nullopt; }); } std::optional<int> UserPreferences::GetInt(const std::string& key) const { return GetJsonValue<int>(jsonData, key, [](const rapidjson::Value& v) -> std::optional<int> { if (v.IsInt()) { return v.GetInt(); } if (v.IsUint()) { return v.GetUint(); } return std::nullopt; }); } std::optional<std::string> UserPreferences::GetString(const std::string& key) const { return GetJsonValue<std::string>(jsonData, key, [](const rapidjson::Value& v) -> std::optional<std::string> { if (v.IsString()) { std::string value = v.GetString(); return std::move(value); } return std::nullopt; }); } bool UserPreferences::HasKey(std::string const& key) { POMDOG_ASSERT(!key.empty()); if (jsonData.empty()) { return false; } rapidjson::Document doc; doc.Parse(jsonData.data()); POMDOG_ASSERT(!doc.HasParseError()); POMDOG_ASSERT(doc.IsObject()); return doc.HasMember(key.c_str()); } void UserPreferences::SetBool(std::string const& key, bool value) { POMDOG_ASSERT(!key.empty()); SetJsonValue(jsonData, key, value); needToSave = true; } void UserPreferences::SetFloat(std::string const& key, float value) { POMDOG_ASSERT(!key.empty()); SetJsonValue(jsonData, key, value); needToSave = true; } void UserPreferences::SetInt(std::string const& key, int value) { POMDOG_ASSERT(!key.empty()); SetJsonValue(jsonData, key, value); needToSave = true; } void UserPreferences::SetString(std::string const& key, std::string const& value) { POMDOG_ASSERT(!key.empty()); SetJsonValue(jsonData, key, value); needToSave = true; } void UserPreferences::Save() { POMDOG_ASSERT(!filePath.empty()); if (!needToSave) { return; } if (jsonData.empty()) { return; } std::ofstream stream(filePath, std::ios_base::out | std::ios_base::binary); if (!stream) { // FUS RO DAH POMDOG_THROW_EXCEPTION(std::runtime_error, "Cannot open file: " + filePath); } stream << jsonData; needToSave = false; } } // namespace Pomdog
[ "mogemimi@enginetrouble.net" ]
mogemimi@enginetrouble.net
52824be25c717eb676070d3bdc2d3ae07dcbeb06
225e82d7a70bfeb544d758c4a01321701ff06a61
/root/root_v4.04.02g/tree/inc/TLeafD.h
ec15312d2330d41b6fbfb80ef312300b68e4650f
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
govoni/learn
9760494d592ba09a98e08939818415857d015371
cb02b6621af73efdbf1e64e5fc39ecd9e72516af
refs/heads/master
2021-01-19T18:51:14.476573
2019-07-22T09:05:26
2019-07-22T09:05:26
101,170,943
0
0
null
null
null
null
UTF-8
C++
false
false
2,557
h
// @(#)root/tree:$Name: v4-04-02g $:$Id: TLeafD.h,v 1.7 2004/10/18 12:32:12 brun Exp $ // Author: Rene Brun 12/01/96 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TLeafD #define ROOT_TLeafD ////////////////////////////////////////////////////////////////////////// // // // TLeafD // // // // A TLeaf for a 64 bit floating point data type. // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TLeaf #include "TLeaf.h" #endif class TLeafD : public TLeaf { protected: Double_t fMinimum; //Minimum value if leaf range is specified Double_t fMaximum; //Maximum value if leaf range is specified Double_t *fValue; //!Pointer to data buffer Double_t **fPointer; //!Address of pointer to data buffer public: TLeafD(); TLeafD(const char *name, const char *type); virtual ~TLeafD(); virtual void Export(TClonesArray *list, Int_t n); virtual void FillBasket(TBuffer &b); const char *GetTypeName() const {return "Double_t";} Double_t GetValue(Int_t i=0) const; virtual void *GetValuePointer() const {return fValue;} virtual void Import(TClonesArray *list, Int_t n); virtual void PrintValue(Int_t i=0) const; virtual void ReadBasket(TBuffer &b); virtual void ReadBasketExport(TBuffer &b, TClonesArray *list, Int_t n); virtual void ReadValue(ifstream & s); virtual void SetAddress(void *add=0); ClassDef(TLeafD,1) //A TLeaf for a 64 bit floating point data type. }; // if leaf is a simple type, i must be set to 0 // if leaf is an array, i is the array element number to be returned inline Double_t TLeafD::GetValue(Int_t i) const { return fValue[i]; } #endif
[ "pietro.govoni@gmail.com" ]
pietro.govoni@gmail.com
1a99f06eb847e42f1e3ba4a361bb0579dacc6795
326828efd246514a09c2891ca9770fab765ebe57
/include/uwsim_netsim_scripts/HILNetSimTracing.h
b82b33d78d3987b186da248edbf3ac303556baf7
[]
no_license
dcentelles/uwsim_netsim_scripts
c6e264a4b15ce10ee83da164b48683f7fccdb96b
9a9cd955ceab700ac92717f6737e6afcb50205f5
refs/heads/master
2020-03-08T05:57:31.062718
2020-02-15T21:20:13
2020-02-15T21:20:13
127,960,102
0
0
null
null
null
null
UTF-8
C++
false
false
2,562
h
#include <nav_msgs/Odometry.h> #include <ros/publisher.h> #include <ros/subscriber.h> #include <underwater_sensor_msgs/LedLight.h> #include <uwsim/NetSim.h> namespace uwsim_netstim { using namespace uwsim; class HILNetSimTracing : public NetSimTracing { public: HILNetSimTracing(); void PacketTransmitting(std::string path, ROSCommsDevicePtr dev, ns3ConstPacketPtr pkt); void PacketError(std::string path, ROSCommsDevicePtr dev, ns3ConstPacketPtr pkt, bool propError, bool colError); void PacketReceived(std::string path, ROSCommsDevicePtr dev, ns3ConstPacketPtr pkt); void TxFifoUpdated(std::string path, uint32_t oldValue, uint32_t newValue); void PacketDropsUpdated(std::string path, uint32_t oldValue, uint32_t newValue); void MacTxFifoUpdated(std::string path, uint32_t oldValue, uint32_t newValue); void MacPacketDropsUpdated(std::string path, uint32_t oldValue, uint32_t newValue); void MacRx(std::string path, ROSCommsDevicePtr dev, ns3ConstPacketPtr pkt); void MacTx(std::string path, ROSCommsDevicePtr dev, ns3ConstPacketPtr pkt); void LeaderOdomCb(const nav_msgs::Odometry::ConstPtr &msg); void FollowerOdomCb(const nav_msgs::Odometry::ConstPtr &msg); void SupportOdomCb(const nav_msgs::Odometry::ConstPtr &msg); void Configure(); void DoRun(); void ShowPosition(string path, ROSCommsDevicePtr dev, const tf::Vector3 &pos); ros::NodeHandle node; underwater_sensor_msgs::LedLight ledmsg; ros::Publisher leader_pub, follower_pub, support_pub, e0_pub, e1_pub, e2_pub, e3_pub; ros::Publisher leader_joint_pub, follower_joint_pub; ros::Publisher leader_gled_pub, leader_rled_pub, follower_gled_pub, follower_rled_pub, support_gled_pub, support_rled_pub; // ros::Subscriber leader_sub, follower_sub, support_sub; // nav_msgs::Odometry leader_odom, follower_odom, support_odom; struct PIDStatus {}; PIDStatus leader_pid, follower_pid, support_pid; int freq; void GetLinearVel(const double &diffx, const double &diffy, const double &diffz, double &vx, double &vy, double &vz); void GetExplorerLinearVel(const double &diffx, const double &diffy, const double &diffz, double &vx, double &vy, double &vz); double GetAngularVel(const double &diff); double GetExplorerAngularVel(const double &diff); double AngleToRadians(const double &angle); }; } // namespace uwsim_netstim
[ "centelld@uji.es" ]
centelld@uji.es
65b7d4217ba59819cee93ea558b5d18308a3368f
38c10c01007624cd2056884f25e0d6ab85442194
/media/filters/decrypting_video_decoder.h
80b3b814bf5a4f904897c635879ecf5030dcbccf
[ "BSD-3-Clause" ]
permissive
zenoalbisser/chromium
6ecf37b6c030c84f1b26282bc4ef95769c62a9b2
e71f21b9b4b9b839f5093301974a45545dad2691
refs/heads/master
2022-12-25T14:23:18.568575
2016-07-14T21:49:52
2016-07-23T08:02:51
63,980,627
0
2
BSD-3-Clause
2022-12-12T12:43:41
2016-07-22T20:14:04
null
UTF-8
C++
false
false
4,138
h
// Copyright (c) 2012 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. #ifndef MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "media/base/decryptor.h" #include "media/base/video_decoder.h" #include "media/base/video_decoder_config.h" namespace base { class SingleThreadTaskRunner; } namespace media { class DecoderBuffer; class Decryptor; class MediaLog; // Decryptor-based VideoDecoder implementation that can decrypt and decode // encrypted video buffers and return decrypted and decompressed video frames. // All public APIs and callbacks are trampolined to the |task_runner_| so // that no locks are required for thread safety. class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { public: DecryptingVideoDecoder( const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, const scoped_refptr<MediaLog>& media_log, const SetDecryptorReadyCB& set_decryptor_ready_cb, const base::Closure& waiting_for_decryption_key_cb); ~DecryptingVideoDecoder() override; // VideoDecoder implementation. std::string GetDisplayName() const override; void Initialize(const VideoDecoderConfig& config, bool low_delay, const InitCB& init_cb, const OutputCB& output_cb) override; void Decode(const scoped_refptr<DecoderBuffer>& buffer, const DecodeCB& decode_cb) override; void Reset(const base::Closure& closure) override; static const char kDecoderName[]; private: // For a detailed state diagram please see this link: http://goo.gl/8jAok // TODO(xhwang): Add a ASCII state diagram in this file after this class // stabilizes. enum State { kUninitialized = 0, kDecryptorRequested, kPendingDecoderInit, kIdle, kPendingDecode, kWaitingForKey, kDecodeFinished, kError }; // Callback for DecryptorHost::RequestDecryptor(). |decryptor_attached_cb| is // called when the decryptor has been completely attached to the pipeline. void SetDecryptor(Decryptor* decryptor, const DecryptorAttachedCB& decryptor_attached_cb); // Callback for Decryptor::InitializeVideoDecoder() during initialization. void FinishInitialization(bool success); void DecodePendingBuffer(); // Callback for Decryptor::DecryptAndDecodeVideo(). void DeliverFrame(int buffer_size, Decryptor::Status status, const scoped_refptr<VideoFrame>& frame); // Callback for the |decryptor_| to notify this object that a new key has been // added. void OnKeyAdded(); // Reset decoder and call |reset_cb_|. void DoReset(); scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_refptr<MediaLog> media_log_; State state_; InitCB init_cb_; OutputCB output_cb_; DecodeCB decode_cb_; base::Closure reset_cb_; base::Closure waiting_for_decryption_key_cb_; VideoDecoderConfig config_; // Callback to request/cancel decryptor creation notification. SetDecryptorReadyCB set_decryptor_ready_cb_; Decryptor* decryptor_; // The buffer that needs decrypting/decoding. scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; // Indicates the situation where new key is added during pending decode // (in other words, this variable can only be set in state kPendingDecode). // If this variable is true and kNoKey is returned then we need to try // decrypting/decoding again in case the newly added key is the correct // decryption key. bool key_added_while_decode_pending_; // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the // matching DecryptCB call (in DoDeliverFrame()). uint32 trace_id_; base::WeakPtr<DecryptingVideoDecoder> weak_this_; base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_; DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); }; } // namespace media #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
[ "zeno.albisser@hemispherian.com" ]
zeno.albisser@hemispherian.com
27ccec47b63697c69ed2066c7de9cbf3f91ad744
3ede3a538fa06a2082520016e84499281f3d167a
/Source/MyLevelProject/MyLevelProjectProjectile.cpp
2c821316c56a788ab779ecaa84af628c0c2beda8
[]
no_license
finoriko/MyLevelProject
ab4cb6d717cc61a6673b21e5165d019087f356ad
2190278a2906ceadda065d4b08e2fa375e3b6f41
refs/heads/master
2020-04-13T13:25:37.821881
2018-12-26T14:02:50
2018-12-26T14:02:50
163,230,130
0
0
null
null
null
null
UTF-8
C++
false
false
1,804
cpp
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "MyLevelProjectProjectile.h" #include "GameFramework/ProjectileMovementComponent.h" #include "Components/SphereComponent.h" AMyLevelProjectProjectile::AMyLevelProjectProjectile() { // Use a sphere as a simple collision representation CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp")); CollisionComp->InitSphereRadius(5.0f); CollisionComp->BodyInstance.SetCollisionProfileName("Projectile"); CollisionComp->OnComponentHit.AddDynamic(this, &AMyLevelProjectProjectile::OnHit); // set up a notification for when this component hits something blocking // Players can't walk on it CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f)); CollisionComp->CanCharacterStepUpOn = ECB_No; // Set as root component RootComponent = CollisionComp; // Use a ProjectileMovementComponent to govern this projectile's movement ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp")); ProjectileMovement->UpdatedComponent = CollisionComp; ProjectileMovement->InitialSpeed = 3000.f; ProjectileMovement->MaxSpeed = 3000.f; ProjectileMovement->bRotationFollowsVelocity = true; ProjectileMovement->bShouldBounce = true; // Die after 3 seconds by default InitialLifeSpan = 3.0f; } void AMyLevelProjectProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { // Only add impulse and destroy projectile if we hit a physics if ((OtherActor != NULL) && (OtherActor != this) && (OtherComp != NULL) && OtherComp->IsSimulatingPhysics()) { OtherComp->AddImpulseAtLocation(GetVelocity() * 100.0f, GetActorLocation()); Destroy(); } }
[ "finoriko@Hotmail.com" ]
finoriko@Hotmail.com
901145852e31212055c4df74088b6b7c267e9c25
d8baa1ead20a5338cae542281838c83a64863919
/arrays/mergeSorted.cpp
ab59fcd68b8316d92a8b4bd1478d35f7c0a1a06e
[]
no_license
ktekchan/Summer
c2732f85ce3328dca8d4fd686398044a82f6c792
b51997d3d82251dce461640ae3bf6263ab1237c1
refs/heads/master
2020-05-21T10:14:23.649257
2017-03-01T17:51:01
2017-03-01T17:51:01
42,786,975
0
0
null
null
null
null
UTF-8
C++
false
false
1,195
cpp
/* * Khushboo Tekchandani * Merge an array of size m+n containing m elements with an array of size n * Both of these are sorted arrays * Idea: Move all elements of m+n to the end * Merge */ #include <iostream> using namespace std; void moveToEnd(int arr[], int size){ int i, j; j = size-1; for(i=size-1; i>=0; i--){ if(arr[i]!=-1){ arr[j] = arr[i]; j--; } } } void mergeArr(int arrMN[], int arrN[], int m, int n){ int i,j,k; i = n; // where elements in arr m+n starts from j = 0; // starting of arrn k = 0; // starting of newly merged m+n while(k < (m+n)){ if((j==n)||(i < m+n && arrMN[i]<=arrN[j])){ arrMN[k] = arrMN[i]; k++; i++; } else{ arrMN[k] = arrN[j]; k++; j++; } } for(i=0; i<(m+n-1); i++){ cout << arrMN[i] << " "; } cout << endl; } int main(){ int arrMN[] = {2,8,-1,-1,-1,13,-1,15,20}; int arrN[] = {5,7,9,25}; int size = sizeof(arrMN)/sizeof(arrMN[0]); int n = sizeof(arrN)/sizeof(arrN[0]); int m = size - n; moveToEnd(arrMN,size); mergeArr(arrMN,arrN,m,n); return 0; }
[ "ktekchan@buffalo.edu" ]
ktekchan@buffalo.edu
1e696ebb317e5a78fa18bc38d23ccb2d0bcb83da
5d841efa1c0e0186a726228ac15abeba05a5920f
/plotTurnOn.h
c4b7fb9bb56d6ca63ba27e40dabd9aeb40bf13b8
[]
no_license
vince502/HLTGPU
52225ed5b1a5a8577b2912d22fece850654241ff
8a7c2d0efa805b9c0288fc1f130e97973bf0cf18
refs/heads/main
2023-04-02T03:54:26.226833
2020-12-05T17:27:18
2020-12-05T17:27:18
308,573,995
0
0
null
null
null
null
UTF-8
C++
false
false
24,696
h
#ifndef plotTurnOn_h #define plotTurnOn_h #include <TROOT.h> #include <TSystem.h> #include <TFile.h> #include <TH1.h> #include <TEfficiency.h> #include <TTreeReader.h> #include <TTreeReaderValue.h> #include <TTreeReaderArray.h> #include <TLorentzVector.h> #include <TGraphAsymmErrors.h> #include <TCanvas.h> #include <TPad.h> #include <TAxis.h> #include <TLine.h> #include <TLegend.h> #include <TLegendEntry.h> #include <ROOT/TProcessExecutor.hxx> #include <ROOT/TSeq.hxx> #include <iostream> #include <map> #include <set> #include <vector> #include <string> #include <dirent.h> #include <memory> #include "tdrstyle.C" #include "CMS_lumi.C" class TreeReaderBase { public: TreeReaderBase(){}; TreeReaderBase(const std::string& path) { setFile(path); }; ~TreeReaderBase() { if (file_ && file_->IsOpen()) file_->Close(); }; // getters Long64_t getEntries() const { if (reader_.empty()) { return 0; } return reader_.begin()->second->GetEntries(false); }; // setters void setFile(const std::string& path) { file_.reset(TFile::Open(path.c_str(), "READ")); if (!file_->IsOpen() || file_->IsZombie()) { throw std::runtime_error("[ERROR] File "+path+" failed to open!"); } }; void setEntry(const Long64_t& i, const bool& checkValue, const bool& onDemand) { if (i<0) { throw std::runtime_error(Form("[ERROR] Invalid index: %lld", i)); } onDemand_ = onDemand; index_ = i; checkValue_ = checkValue; if (!onDemand_) { for (const auto& r : reader_) { loadEntry(r.first); } } }; protected: void checkValue(ROOT::Internal::TTreeReaderValueBase* value) const { if (value==NULL) { throw std::runtime_error("[ERROR] Value pointer is null"); } else if (value->GetSetupStatus() < 0) { throw std::runtime_error(Form("[ERROR] Status %d when setting up reader for %s", value->GetSetupStatus(), value->GetBranchName())); } }; virtual void checkValues(const std::string& tree) const { }; void setTreeReader(const std::string& name, const std::string& dir) { if (reader_.find(name)!=reader_.end() || !file_) return; reader_[name].reset(new TTreeReader(dir.c_str(), file_.get())); if (!reader_.at(name)->GetTree()) { throw std::runtime_error("[ERROR] Failed to open "+dir+" !"); } currentEntry_[name] = -1; }; void loadTreeEntry(TTreeReader* r) const { if (!r) return; const auto status = r->SetEntry(index_); if (status!=TTreeReader::kEntryValid) { std::string msg = ""; if (status==TTreeReader::kEntryNotLoaded) { msg = "no entry has been loaded yet"; } else if (status==TTreeReader::kEntryNoTree) { msg = "the tree does not exist"; } else if (status==TTreeReader::kEntryNotFound) { msg = "the tree entry number does not exist"; } else if (status==TTreeReader::kEntryChainSetupError) { msg = "problem in accessing a chain element, e.g. file without the tree"; } else if (status==TTreeReader::kEntryChainFileError) { msg = "problem in opening a chain's file"; } else if (status==TTreeReader::kEntryDictionaryError) { msg = "problem reading dictionary info from tree"; } //else if (status==TTreeReader::kEntryLast) { msg = "last entry was reached"; } throw std::runtime_error("[ERROR] Invalid entry: "+msg); } }; void loadEntry(const std::string& tree) const { if (index_!=currentEntry_.at(tree)) { loadTreeEntry(reader_.at(tree).get()); if (checkValue_) { checkValues(tree); } const_cast<std::map<std::string, Long64_t >* >(&currentEntry_)->at(tree) = index_; } }; std::unique_ptr<TFile> file_; std::map<std::string, std::unique_ptr<TTreeReader> > reader_; bool checkValue_, onDemand_; Long64_t index_; std::map<std::string, Long64_t > currentEntry_; }; class TriggerReader : public TreeReaderBase { public: TriggerReader(const std::string& path, const bool& buildIndex=false) { setFile(path); setTreeReader("HltTree", "hltanalysis/HltTree"); if (buildIndex) { std::cout<< "[INFO] Building index in TriggerReader for HltTree" << std::endl; reader_.at("HltTree")->GetTree()->BuildIndex("Run","Event"); if (getEntries()>0) { reader_.at("HltTree")->GetTree()->LoadTree(0); } } evtI_["runN"].reset(new TTreeReaderValue<int>(*reader_.at("HltTree"), "Run")); evtUL_["eventN"].reset(new TTreeReaderValue<ULong64_t>(*reader_.at("HltTree"), "Event")); }; // getters std::pair<Long64_t, Long64_t> getEventNumber() const { if (onDemand_) { loadEntry("HltTree"); } if (evtUL_.find("eventN")==evtUL_.end()) { return {0, 0}; } return {*evtI_.at("runN")->Get(), *evtUL_.at("eventN")->Get()}; }; bool isTriggerMatched(const TLorentzVector& p4, const std::string& path) const { // set entry on demand for HltTree if (onDemand_) { loadEntry("HltTree"); } if (!*evtI_.at(path)->Get()) { return false; } // set entry on demand for TriggerObject if (onDemand_) { loadEntry(path); } // define delta R threshold const auto dR = (path.rfind("HLT_HIL3",0)==0 ? 0.1 : 0.3); const auto dPt = (path.rfind("HLT_HIL1",0)==0 ? 2.0 : 10.0); // check trigger objects bool isMatch = false; for (size_t i=0; i<obj_.at(path).at("eta")->Get()->size(); i++) { // compare object momenta TLorentzVector trigP4; trigP4.SetPtEtaPhiM(obj_.at(path).at("pt")->Get()->at(i), obj_.at(path).at("eta")->Get()->at(i), obj_.at(path).at("phi")->Get()->at(i), p4.M()); isMatch = (path.rfind("HLT_HIL1",0)==0 ? std::abs(trigP4.Eta()-p4.Eta()) < 0.2 : trigP4.DeltaR(p4) < dR) && std::abs(trigP4.Pt()-p4.Pt())/p4.Pt() < dPt; if (isMatch) break; } return isMatch; }; // setters void addTrigger(const std::string& name) { if (name.rfind("HLT_",0)!=0) { throw std::runtime_error("[ERROR] Invalid trigger name "+name+" !"); } if (evtI_.find(name)!=evtI_.end()) return; const auto nm = name.substr(0,name.rfind("_v")+2); setTreeReader(name, "hltobject/"+nm); evtI_[name].reset(new TTreeReaderValue<int>(*reader_.at("HltTree"), name.c_str())); for (const auto& var : {"pt", "eta", "phi"}) { obj_[name][var].reset(new TTreeReaderValue<std::vector<float> >(*reader_.at(name), var)); } }; using TreeReaderBase::setEntry; bool setEntry(const std::pair<Long64_t, Long64_t>& evtN, const bool& checkValue=true, const bool& onDemand=true) { const auto index = reader_.at("HltTree")->GetTree()->GetEntryNumberWithIndex(evtN.first, evtN.second); if (index<0) { return false; } setEntry(index, checkValue, onDemand); return true; }; private: void checkValues(const std::string& tree) const { if (tree=="HltTree") { for (const auto& r : evtI_ ) { checkValue(r.second.get()); } for (const auto& r : evtUL_) { checkValue(r.second.get()); } } else if (obj_.find(tree)!=obj_.end()) { for (const auto& o : obj_.at(tree)) { checkValue(o.second.get()); } } }; std::map<std::string, std::unique_ptr<TTreeReaderValue<int> > > evtI_; std::map<std::string, std::unique_ptr<TTreeReaderValue<ULong64_t> > > evtUL_; std::map<std::string, std::map<std::string, std::unique_ptr<TTreeReaderValue<std::vector<float> > > > > obj_; }; class RecoReader : public TreeReaderBase { public: RecoReader(const std::string& path, const bool& buildIndex=false) { setFile(path); setTreeReader("ggHiNtuplizerGED", "ggHiNtuplizerGED/EventTree"); setTreeReader("skimanalysis", "skimanalysis/HltTree"); setTreeReader("hiEvtAnalyzer", "hiEvtAnalyzer/HiTree"); if (buildIndex) { std::cout<< "[INFO] Building index in RecoReader for hiEvtAnalyzer" << std::endl; reader_.at("hiEvtAnalyzer")->GetTree()->BuildIndex("run","evt"); if (getEntries()>0) { reader_.at("hiEvtAnalyzer")->GetTree()->LoadTree(0); } } initEventInfo(); }; typedef std::vector<std::pair<TLorentzVector, int> > ParticleCollection; // getters std::pair<Long64_t, Long64_t> getEventNumber() const { if (onDemand_) { loadEntry("hiEvtAnalyzer"); } return {*evtUI_.at("runN")->Get(), *evtUL_.at("eventN")->Get()}; }; ParticleCollection getParticles(const std::string& type) const { if (onDemand_) { loadEntry("ggHiNtuplizerGED"); } if (getSize(type)==0) return {}; // loop over muons ParticleCollection particles; for (size_t i=0; i<getSize(type); i++) { if (passParticleCut(type, i)) { particles.push_back({getP4(type, i), getPdgID(type, i)}); } } return particles; }; bool passEventSelection() const { if (onDemand_) { loadEntry("skimanalysis"); } return *skimI_.at("evtSel")->Get(); }; int getCentrality() const { if (onDemand_) { loadEntry("hiEvtAnalyzer"); } return *evtI_.at("hiBin")->Get(); }; // setters void initBranches(const std::string& type) { if (type=="electron") { initElectron(); } else if (type=="photon" ) { initPhoton(); } else if (type=="muon" ) { initMuon(); } }; using TreeReaderBase::setEntry; bool setEntry(const std::pair<Long64_t, Long64_t>& evtN, const bool& checkValue=true, const bool& onDemand=true) { const auto& index = reader_.at("hiEvtAnalyzer")->GetTree()->GetEntryNumberWithIndex(evtN.first, evtN.second); if (index<0) { return false; } setEntry(index, checkValue, onDemand); return true; }; private: void checkValues(const std::string& tree) const { if (tree=="ggHiNtuplizerGED") { for (const auto& o : objI_) { checkValue(o.second.get()); } for (const auto& o : objF_) { checkValue(o.second.get()); } } else if (tree=="hiEvtAnalyzer") { for (const auto& o : evtI_ ) { checkValue(o.second.get()); } for (const auto& o : evtUI_) { checkValue(o.second.get()); } for (const auto& o : evtUL_) { checkValue(o.second.get()); } } else if (tree=="skimanalysis") { for (const auto& o : skimI_ ) { checkValue(o.second.get()); } } }; size_t getSize(const std::string& type) const { if (type=="electron") { return (objF_.find("elePt")!=objF_.end() ? objF_.at("elePt")->Get()->size() : 0); } else if (type=="photon" ) { return (objF_.find("phoEt")!=objF_.end() ? objF_.at("phoEt")->Get()->size() : 0); } else if (type=="muon" ) { return (objF_.find("muPt" )!=objF_.end() ? objF_.at("muPt" )->Get()->size() : 0); } return 0; }; TLorentzVector getP4(const std::string& type, const size_t& i) const { TLorentzVector p4; if (getSize(type)==0) { return p4; } else if (type=="electron") { p4.SetPtEtaPhiM(objF_.at("elePt")->Get()->at(i), objF_.at("eleSCEta")->Get()->at(i), objF_.at("eleSCPhi")->Get()->at(i), 0.000511); } else if (type=="photon" ) { p4.SetPtEtaPhiM(objF_.at("phoEt")->Get()->at(i), objF_.at("phoSCEta")->Get()->at(i), objF_.at("phoSCPhi")->Get()->at(i), 0.0); } else if (type=="muon" ) { p4.SetPtEtaPhiM(objF_.at("muPt" )->Get()->at(i), objF_.at("muEta" )->Get()->at(i), objF_.at("muPhi" )->Get()->at(i), 0.10565837); } return p4; }; int getPdgID(const std::string& type, const size_t& i) const { int pdgID = 0; if (getSize(type)==0) { return pdgID; } else if (type=="electron") { pdgID = -11 * objI_.at("eleCharge")->Get()->at(i); } else if (type=="photon" ) { pdgID = 22; } else if (type=="muon" ) { pdgID = -13 * objI_.at("muCharge")->Get()->at(i); } return pdgID; }; bool passParticleCut(const std::string& type, const size_t& i) const { if (getSize(type)==0) { return false; } else if (type=="electron") { return passElectronCut(i); } else if (type=="photon" ) { return passPhotonCut(i); } else if (type=="muon" ) { return passMuonCut(i); } return false; }; bool passElectronCut(const size_t& i) const { // set entry on demand if (onDemand_) { loadEntry("hiEvtAnalyzer"); } // check kinematics if (objF_.at("elePt")->Get()->at(i) <= 20.) return false; if ((std::abs(objF_.at("eleSCEta")->Get()->at(i)) >= 1.4 && std::abs(objF_.at("eleSCEta")->Get()->at(i)) <= 1.6) || std::abs(objF_.at("eleSCEta")->Get()->at(i)) >= 2.1) return false; // use Loose ID working points for PbPb 2018 float cutSigmaIEtaIEta, cutdEtaSeedAtVtx, cutdPhiAtVtx, cutEoverPInv, cutHoverEBc; if (*evtI_.at("hiBin")->Get() <= 60) { if (std::abs(objF_.at("eleSCEta")->Get()->at(i)) < 1.479) { cutSigmaIEtaIEta = 0.013451; cutdEtaSeedAtVtx = 0.003814; cutdPhiAtVtx = 0.037586; cutEoverPInv = 0.017664; cutHoverEBc = 0.161613; } else { cutSigmaIEtaIEta = 0.046571; cutdEtaSeedAtVtx = 0.006293; cutdPhiAtVtx = 0.118592; cutEoverPInv = 0.020135; cutHoverEBc = 0.131705; } } else { if (std::abs(objF_.at("eleSCEta")->Get()->at(i)) < 1.479) { cutSigmaIEtaIEta = 0.010867; cutdEtaSeedAtVtx = 0.003284; cutdPhiAtVtx = 0.020979; cutEoverPInv = 0.077633; cutHoverEBc = 0.126826; } else { cutSigmaIEtaIEta = 0.033923; cutdEtaSeedAtVtx = 0.006708; cutdPhiAtVtx = 0.083766; cutEoverPInv = 0.019279; cutHoverEBc = 0.097703; } } const bool passID = objF_.at("eleSigmaIEtaIEta_2012")->Get()->at(i) < cutSigmaIEtaIEta && std::abs(objF_.at("eledEtaSeedAtVtx")->Get()->at(i)) < cutdEtaSeedAtVtx && std::abs(objF_.at("eledPhiAtVtx")->Get()->at(i)) < cutdPhiAtVtx && objF_.at("eleEoverPInv")->Get()->at(i) < cutEoverPInv && objF_.at("eleHoverEBc")->Get()->at(i) < cutHoverEBc && std::abs(objF_.at("eleIP3D")->Get()->at(i)) < 0.03 && objI_.at("eleMissHits")->Get()->at(i) <= 1; return passID; }; bool passPhotonCut(const size_t& i) const { // check kinematics if (objF_.at("phoEt")->Get()->at(i) <= 40.) return false; if ((std::abs(objF_.at("phoSCEta")->Get()->at(i)) >= 1.44 && std::abs(objF_.at("phoSCEta")->Get()->at(i)) <= 1.57) || std::abs(objF_.at("phoSCEta")->Get()->at(i)) >= 2.4) return false; // apply pre-selection if(!(objF_.at("phoSigmaIEtaIEta_2012")->Get()->at(i) > 0.002 && objF_.at("pho_swissCrx")->Get()->at(i) < 0.9 && abs(objF_.at("pho_seedTime")->Get()->at(i)) < 3)) return false; if(!(objF_.at("phoSigmaIEtaIEta_2012")->Get()->at(i) < 0.5 && objF_.at("pho_trackIsoR3PtCut20")->Get()->at(i) > -500 && objF_.at("pho_trackIsoR3PtCut20")->Get()->at(i) < 500)) return false; // use Tight ID working points for PbPb 2018 bool passID = false; const auto iso = objF_.at("pho_ecalClusterIsoR3")->Get()->at(i) + objF_.at("pho_hcalRechitIsoR3")->Get()->at(i) + objF_.at("pho_trackIsoR3PtCut20")->Get()->at(i); if (std::abs(objF_.at("phoSCEta")->Get()->at(i)) < 1.5) { passID = iso < 4.1708 && objF_.at("phoSigmaIEtaIEta_2012")->Get()->at(i) < 0.01072 && objF_.at("phoHoverE")->Get()->at(i) < 0.1609; } else { passID = iso < 8.589 && objF_.at("phoSigmaIEtaIEta_2012")->Get()->at(i) < 0.0440 && objF_.at("phoHoverE")->Get()->at(i) < 0.324; } return passID; }; bool passMuonCut(const size_t& i, const bool& useTightID=false) const { // check kinematics const auto& eta = objF_.at("muEta")->Get()->at(i); const auto& pt = objF_.at("muPt")->Get()->at(i); const bool inAcc = ((std::abs(eta)<1.2 && pt>=3.5) || (1.2<=std::abs(eta) && abs(eta)<2.1 && pt>=5.47-1.89*std::abs(eta)) || (2.1<=std::abs(eta) && std::abs(eta)<2.4 && pt>=1.5)); if (!inAcc) return false; // use Tight ID working points for PbPb 2018 (if requested) if (useTightID) return objI_.at("muIDTight")->Get()->at(i); // use Hybrid Soft ID working points for PbPb 2018 const bool passID = objI_.at("muIsGlobal")->Get()->at(i) && objI_.at("muIsTracker")->Get()->at(i) && objI_.at("muTrkLayers")->Get()->at(i) > 5 && objI_.at("muPixelLayers")->Get()->at(i) > 0 && std::abs(objF_.at("muD0")->Get()->at(i)) < 0.3 && std::abs(objF_.at("muDz")->Get()->at(i)) < 20.0; return passID; }; void initEventInfo() { evtUI_["runN"].reset(new TTreeReaderValue<UInt_t>(*reader_.at("hiEvtAnalyzer"), "run")); evtUL_["eventN"].reset(new TTreeReaderValue<ULong64_t>(*reader_.at("hiEvtAnalyzer"), "evt")); evtI_["hiBin"].reset(new TTreeReaderValue<int>(*reader_.at("hiEvtAnalyzer"), "hiBin")); skimI_["evtSel"].reset(new TTreeReaderValue<int>(*reader_.at("skimanalysis"), "collisionEventSelectionAODv2")); }; void initElectron() { for (const auto& var : {"eleCharge", "eleMissHits"}) { objI_[var].reset(new TTreeReaderValue<std::vector<int> >(*reader_.at("ggHiNtuplizerGED"), var)); } for (const auto& var : {"elePt", "eleSCEta", "eleSCPhi", "eleSigmaIEtaIEta_2012", "eledEtaSeedAtVtx", "eledPhiAtVtx", "eleEoverPInv", "eleHoverEBc", "eleIP3D"}) { objF_[var].reset(new TTreeReaderValue<std::vector<float> >(*reader_.at("ggHiNtuplizerGED"), var)); } }; void initPhoton() { for (const auto& var : {"phoEt", "phoSCEta", "phoSCPhi", "pho_ecalClusterIsoR3", "pho_hcalRechitIsoR3", "pho_trackIsoR3PtCut20", "phoSigmaIEtaIEta_2012", "phoHoverE", "pho_swissCrx", "pho_seedTime"}) { objF_[var].reset(new TTreeReaderValue<std::vector<float> >(*reader_.at("ggHiNtuplizerGED"), var)); } }; void initMuon() { for (const auto& var : {"muCharge", "muIsGlobal", "muIsTracker", "muIDTight", "muTrkLayers", "muPixelLayers"}) { objI_[var].reset(new TTreeReaderValue<std::vector<int> >(*reader_.at("ggHiNtuplizerGED"), var)); }; for (const auto& var : {"muPt", "muEta", "muPhi", "muD0", "muDz"}) { objF_[var].reset(new TTreeReaderValue<std::vector<float> >(*reader_.at("ggHiNtuplizerGED"), var)); } }; std::map<std::string, std::unique_ptr<TTreeReaderValue<UInt_t> > > evtUI_; std::map<std::string, std::unique_ptr<TTreeReaderValue<ULong64_t> > > evtUL_; std::map<std::string, std::unique_ptr<TTreeReaderValue<int> > > evtI_, skimI_; std::map<std::string, std::unique_ptr<TTreeReaderValue<std::vector<int> > > > objI_; std::map<std::string, std::unique_ptr<TTreeReaderValue<std::vector<float> > > > objF_; }; void formatEff(TGraphAsymmErrors& graph, const std::string& par, const std::string& var) { // add particle label std::string parLbl; if (par=="SingleMuon") { parLbl = "Muon"; } else if (par=="DoubleMuon") { parLbl = "Dimuon"; } else if (par=="SingleElectron") { parLbl = "Electron"; } else if (par=="DoubleElectron") { parLbl = "Dielectron"; } else if (par=="SinglePhoton") { parLbl = "Photon"; } // X-axis label std::string xLabel = parLbl; if (var=="Pt") { xLabel += " p_{T} [GeV/c]"; } else if (var=="Eta") { xLabel += " #eta"; } else if (var=="Rapidity") { xLabel += " y"; } // Y-axis label const std::string yLabel = "Efficiency"; // General graph.SetMarkerColor(kBlue); graph.SetMarkerStyle(20); graph.SetMarkerSize(1.5); graph.SetFillStyle(1001); // X-axis graph.GetXaxis()->CenterTitle(kTRUE); graph.GetXaxis()->SetTitleOffset(0.90); graph.GetXaxis()->SetTitleSize(0.055); graph.GetXaxis()->SetLabelSize(0.035); // Y-axis graph.GetYaxis()->CenterTitle(kTRUE); graph.GetYaxis()->SetTitleOffset(1.05); graph.GetYaxis()->SetTitleSize(0.055); graph.GetYaxis()->SetLabelSize(0.035); graph.GetYaxis()->SetRangeUser(0.0, 1.4); // Set Axis Titles graph.SetTitle(Form(";%s;%s", xLabel.c_str(), yLabel.c_str())); gPad->Update(); }; bool existDir(const std::string& dir) { bool exist = false; const auto& dirp = gSystem->OpenDirectory(dir.c_str()); if (dirp) { gSystem->FreeDirectory(dirp); exist = true; } return exist; }; void makeDir(const std::string& dir) { if (existDir(dir)==false){ std::cout << "[INFO] DataSet directory: " << dir << " doesn't exist, will create it!" << std::endl; gSystem->mkdir(dir.c_str(), kTRUE); } }; const std::map<std::string, std::map<std::string, std::vector<double> > > BINMAP = { { "SingleMuon" , { { "Pt" , { 0, 1, 2, 3, 4, 5, 6.5, 7, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 25, 30, 35, 40, 50 } }, { "Eta" , { -2.4, -2.0, -1.6, -1.2, -0.8, -0.4, 0.4, 0.8, 1.2, 1.6, 2.0, 2.4 } } } }, { "DoubleMuon" , { { "Pt" , { 0, 1, 2, 3, 4, 5, 6.5, 7, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 25, 30, 35, 40, 50 } }, { "Rapidity" , { -2.4, -2.0, -1.6, -1.2, -0.8, -0.4, 0.4, 0.8, 1.2, 1.6, 2.0, 2.4 } } } }, { "SingleElectron" , { { "Pt" , { 20, 21, 22, 25, 30, 35, 40, 50, 60, 100 } }, { "Eta" , { -2.1, -1.6, -1.2, -0.8, -0.4, 0.4, 0.8, 1.2, 1.6, 2.1 } } } }, { "DoubleElectron" , { { "Pt" , { 0, 1, 2, 3, 4, 5, 6.5, 7, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 25, 30, 35, 40, 50 } }, { "Rapidity" , { -2.1, -1.6, -1.2, -0.8, -0.4, 0.4, 0.8, 1.2, 1.6, 2.1 } } } }, { "SinglePhoton" , { { "Pt" , { 40, 41, 42, 45, 50, 55, 60, 65, 70, 80, 100, 200 } }, { "Eta" , { -2.4, -2.0, -1.6, -1.2, -0.8, -0.4, 0.4, 0.8, 1.2, 1.6, 2.0, 2.4 } } } } }; const std::map< std::string , std::vector<std::string> > TRIGLIST = { { "SingleMuon" , { "HLT_HIL1MuOpen_Centrality_70_100_v1", "HLT_HIL1MuOpen_Centrality_80_100_v1", "HLT_HIL2Mu3_NHitQ15_v1", "HLT_HIL2Mu5_NHitQ15_v1", "HLT_HIL2Mu7_NHitQ15_v1", "HLT_HIL3Mu12_v1", "HLT_HIL3Mu15_v1", "HLT_HIL3Mu20_v1", "HLT_HIL3Mu3_NHitQ10_v1", "HLT_HIL3Mu5_NHitQ10_v1", "HLT_HIL3Mu7_NHitQ10_v1" } }, { "DoubleMuon" , { "HLT_HIL1DoubleMu10_v1", "HLT_HIL1DoubleMuOpen_v1", "HLT_HIL2DoubleMuOpen_v1", "HLT_HIL2_L1DoubleMu10_v1", "HLT_HIL3DoubleMuOpen_M60120_v1", "HLT_HIL3DoubleMuOpen_Upsi_v1", "HLT_HIL3DoubleMuOpen_v1", "HLT_HIL3Mu0_L2Mu0_v1", "HLT_HIL3Mu2p5NHitQ10_L2Mu2_M7toinf_v1", "HLT_HIL3_L1DoubleMu10_v1", "HLT_HIL1DoubleMuOpen_Centrality_50_100_v1", "HLT_HIL1DoubleMuOpen_OS_Centrality_40_100_v1", "HLT_HIL3DoubleMuOpen_JpsiPsi_v1", "HLT_HIL3Mu0NHitQ10_L2Mu0_MAXdR3p5_M1to5_v1" } }, { "SingleElectron" , { "HLT_HIEle10Gsf_v1", "HLT_HIEle15Gsf_v1", "HLT_HIEle20Gsf_v1", "HLT_HIEle30Gsf_v1", "HLT_HIEle40Gsf_v1", "HLT_HIEle50Gsf_v1" } }, { "DoubleElectron" , { "HLT_HIDoubleEle10GsfMass50_v1", "HLT_HIDoubleEle10Gsf_v1", "HLT_HIDoubleEle15GsfMass50_v1", "HLT_HIDoubleEle15Gsf_v1", "HLT_HIEle15Ele10GsfMass50_v1", "HLT_HIEle15Ele10Gsf_v1" } }, { "SinglePhoton" , { "HLT_HIGEDPhoton30_EB_v1", "HLT_HIGEDPhoton30_v1", "HLT_HIGEDPhoton40_EB_v1", "HLT_HIGEDPhoton40_v1", "HLT_HIGEDPhoton50_EB_v1", "HLT_HIGEDPhoton50_v1", "HLT_HIGEDPhoton60_EB_v1", "HLT_HIGEDPhoton60_v1", "HLT_HIGEDPhoton10_EB_v1", "HLT_HIGEDPhoton10_v1", "HLT_HIGEDPhoton20_EB_v1", "HLT_HIGEDPhoton20_v1" } } }; #endif // ifndef plotTurnOn_h
[ "soohwan.lee@cern.ch" ]
soohwan.lee@cern.ch
a86ae42b4e8de2f398ef102456196a76ea31c556
9bf93209b0a9b0bdbf30b9a318b6da5115cc3e69
/src/Lista.cpp
bd7b6c7e19a42c8df18099df4604aec3459afbe0
[]
no_license
LeandroArista/Test
d9317b98a626723fc91dcb78aa868abaec43faf4
b16752d7cea7e175bbb7d188d6637f9f072208a4
refs/heads/master
2020-04-08T01:15:23.514581
2018-11-24T01:47:16
2018-11-24T01:47:16
158,887,218
0
0
null
2018-11-24T00:40:09
2018-11-23T23:46:05
C++
UTF-8
C++
false
false
4,478
cpp
#include "Lista.h" #include <cassert> template <typename t> Lista<t>::Lista(){ lista=NULL; punterofinal=NULL; cursor=NULL; cantidadelementos=0; } template<typename t> Lista<t>::~Lista(){ vaciar(); delete lista; } template<typename t> void Lista<t>::vaciar(){ if (!vacia()){ nodo*cursor; while (!vacia()){ cursor=lista->siguiente; delete lista; lista=cursor; } } } template<typename t> int Lista<t>::longitud() const{ return cantidadelementos; } template<typename t> bool Lista<t>::vacia() const{ return (lista==NULL); } template<typename t> void Lista<t>::agregar(const int & posicion, const t & elemento){ if (posicion>0 && posicion<=longitud()+1){ nodo * nodoagregar=new nodo; nodoagregar->dato=elemento; nodoagregar->siguiente=NULL; if ( vacia() || posicion==1){ nodoagregar->siguiente=lista; lista=nodoagregar; if (lista->siguiente==NULL){ punterofinal=lista; } } else{ if (posicion==longitud()+1){ punterofinal->siguiente=nodoagregar; punterofinal=nodoagregar; } else{ cursor=lista; int posicionactual=1; while(posicionactual<(posicion-1)){ cursor=cursor->siguiente; posicionactual++; } nodoagregar->siguiente=cursor->siguiente; cursor->siguiente=nodoagregar; } } cantidadelementos++; } } template<typename t> void Lista<t>::agregarp( const t & elemento){ agregar(1, elemento); } template<typename t> void Lista<t>::agregarf( const t & elemento){ agregar(cantidadelementos+1, elemento); } template<typename t> bool Lista<t>::pertenece(const t & elemento) const{ nodo * cursor = lista; while (cursor != NULL){ if (cursor->dato==elemento){ return true; } cursor=cursor->siguiente; } return false; } template<typename t> void Lista<t>::eliminarPos(const int & posicion){ if (lista!=NULL){ if (posicion==1){ nodo * aeliminar=lista; lista=lista->siguiente; aeliminar->siguiente=NULL; delete aeliminar; cantidadelementos--; } else{ if (posicion<=longitud()){ nodo * cursor = lista; for (int i=1; i<posicion; i++){ cursor=cursor->siguiente; } nodo * aeliminar=cursor->siguiente; cursor->siguiente=aeliminar->siguiente; aeliminar=NULL; delete aeliminar; cantidadelementos--; } } } } template<typename t> const t & Lista<t>::getElem(const int & posicion) const{ // cout<<"a:"<<posicion<<" b:"<<cantidadelementos<<endl; assert(posicion>0 && posicion<=cantidadelementos); int posicionactual=1; if (posicion == posicionactual){ return lista->dato; } else{ nodo*cursor=lista; if (posicion<cantidadelementos){ while (posicion != posicionactual && cursor->siguiente != NULL){ cursor=cursor->siguiente; posicionactual++; } } else{ cursor=punterofinal; } return cursor->dato; } } template<typename t> void Lista<t>::eliminarElem(const t & elemento){ nodo * cursor = lista; nodo * anterior= cursor; while (cursor != NULL){ if (cursor->dato==elemento){ nodo * aeliminar=cursor; if (lista==cursor){ lista=lista->siguiente; }else{ anterior->siguiente=cursor->siguiente; if (cursor->siguiente==NULL) punterofinal=anterior; } aeliminar->siguiente=NULL; delete aeliminar; cantidadelementos--; }else{ anterior=cursor; } cursor=cursor->siguiente; } anterior= NULL; cursor=NULL; delete cursor; delete anterior; } template class Lista<int>; template class Lista<char>; template class Lista<float>; template class Lista<string>; template class Lista<Figura*>; template class Lista<Punto>; template class Lista<Segmento>;
[ "leandroalbertoarista@gmail.com" ]
leandroalbertoarista@gmail.com
9f8356ce18c2ab0c440ff52084c63b679e76d8da
fffe012158fb8ad26bfb8ea04bebaac9fbf58b48
/BuildingDetectorDemo/stdafx.cpp
dd9b71a3e29328690e31212fc246f1affce517d1
[]
no_license
Huang-Jin/BuildingDetecor
4ef2e5c7ec90451ae5de1d89a5f6ebd852f15129
0d86277b11411127cd1c2aca6e0b8bdaa87ea758
refs/heads/master
2021-05-10T20:48:33.528598
2018-01-23T06:36:21
2018-01-23T06:36:21
118,206,053
1
0
null
null
null
null
GB18030
C++
false
false
273
cpp
// stdafx.cpp : 只包括标准包含文件的源文件 // BuildingDetectorDemo.pch 将作为预编译头 // stdafx.obj 将包含预编译类型信息 #include "stdafx.h" // TODO: 在 STDAFX.H 中 // 引用任何所需的附加头文件,而不是在此文件中引用
[ "1309740625@qq.com" ]
1309740625@qq.com
c08e2f84e0e697b05613ae876a917fce896bb7fb
0a6a43b691996499230276055523eb895da6ffec
/.history/spectrum/spectrum_20190117002614.hpp
03648b98c056dbcd7f27ea8b9329d1c6bd67f133
[]
no_license
SoundRabbit/voice-changer
362890a6e0ef1dda37c1666b946879fc12125370
e5a5d64426fc072504477ae30c96e8e293a07a52
refs/heads/master
2020-03-27T09:49:50.340212
2019-01-16T17:55:04
2019-01-16T17:55:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
174
hpp
#pragma once template<int length> class Spectrum { private: class Intensity { public: operator double(); double operator= (double); }; public: };
[ "neu1neu9neu9neu9neu@gmail.com" ]
neu1neu9neu9neu9neu@gmail.com
207934a2f90ec5ab24a69b87703aa00eeb3b1a58
75bb52c11587ea6c286e5fcd311369850e74dfde
/3-01_a/main.cpp
ae01b1481c8b1c3b163e6364c1183bea4550d11d
[]
no_license
tado/BeyondInteraction_2nd_examples
6d763f889a7014fbf63113b263c0aac58dacf878
b59a333e45ebd7fa2ebd7aa991530dcca426a931
refs/heads/master
2021-01-10T18:55:41.437469
2020-03-11T01:55:22
2020-03-11T01:55:22
7,948,883
26
17
null
2016-03-08T21:53:10
2013-02-01T00:36:41
C++
UTF-8
C++
false
false
699
cpp
#include <iostream> using namespace std; class Dog { // Dogクラスの定義 public: string name; //犬の名前 (状態) void bark(); //犬が吠える (動作) }; //Dogクラスの定義終了 (最後に";"が入るのに注意) void Dog::bark() { //Dogのメソッド bark() の定義 //プログラムのデータ出力に、名前と鳴き声を表示 cout << name << "「ワンワン!」" << endl; } int main (int argc, char * const argv[]) { //メイン関数 Dog hachi; //Dogクラスをインスタンス化して、hachiを生成 hachi.name = "ハチ"; //hachiのプロパティnameに"ハチ"を代入 hachi.bark(); //hachiのメソッドbark()を実行 }
[ "tadokoro@gmail.com" ]
tadokoro@gmail.com
af9861f2ad6bbb3335650efcc59fcdae4847995b
77b54e9b87ee83d3d413009d4d484835d2860179
/src/solvers/solver.hpp
1fcaf04c19910432cb58ba892434c871a0368d55
[]
no_license
zhangchi0605/oppt
fe70a600ad8e8b35074bf1ca76d364dacff11677
461912d0b8a39b2261819cedbdef6ff29864962c
refs/heads/master
2020-04-05T09:06:19.523150
2018-09-29T14:13:14
2018-09-29T14:13:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,734
hpp
/** * Copyright 2017 * * This file is part of On-line POMDP Planning Toolkit (OPPT). * OPPT is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License published by the Free Software Foundation, * either version 2 of the License, or (at your option) any later version. * * OPPT 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along with OPPT. * If not, see http://www.gnu.org/licenses/. */ /** @file solver.hpp * Contains an abstract definition of a POMDP solver */ #ifndef __OPPT_SOLVER_HPP__ #define __OPPT_SOLVER_HPP__ #include <fstream> #include <iostream> #include <memory> #include "global.hpp" #include "oppt/opptCore/core.hpp" #include "oppt/opptCore/resources/resources.hpp" //#include "problems/shared/filesystemUtils.hpp" #include "oppt/problemEnvironment/ProblemEnvironmentOptions.hpp" #include "oppt/plugin/Plugin.hpp" namespace oppt { // Forward declaration class ProblemEnvironment; } using namespace oppt; namespace solvers { typedef std::function<void(RobotEnvironment *const env1, RobotEnvironment *const env2)> RegisterEnvironmentFn; /** * An abstract class which represents a POMDP solver. When designing new POMDP solvers, the user has to inherit * from this class and override all pure virtual methods. */ class Solver { public: friend class oppt::ProblemEnvironment; /** * Default constructor */ Solver() = default; /** * Virtual destructor */ virtual ~Solver() {} /** * @brief Get the name of the solver */ const std::string getName() const { return solverName_; } /** * @brief Performs initial setup operations */ virtual void setup() = 0; /** * @brief Perform reset operations. This method is called after each simulation run */ virtual bool reset() = 0; /** * @brief Improve the POMDP policy starting from the current belief. * @param timeout The maximum time (in milliseconds) the solver should take to improve the policy * * @return true if the policy improvement was successful */ virtual bool improvePolicy(const FloatType &timeout) = 0; /** * @brief Get the next action the robot has to execute according to the calculated * policy. * * @return A shared pointer to the Action that is going to be executed. * If there's no action available, a nullptr should be returned */ virtual ActionSharedPtr getNextAction() = 0; /** * @brief Update the belief, based on the action taken and observation received * * @return true if the belief update was successful */ virtual bool updateBelief(const ActionSharedPtr& action, const ObservationSharedPtr& observation) = 0; /** * @brief Method for handling environment changes. Implementing this method is optional * * @param environmentChanges Vector of oppt::EnvironmentChange pointers. The changes are ordered in sequential order */ virtual void handleEnvironmentChanges(const std::vector<EnvironmentChangeSharedPtr>& environmentChanges) {} /** * @brief This method is called after a step has been performed and allows the user to serialize additional * information specific to a Solver implementation. Implementing this method is optional * * @param os An output stream to the log file */ virtual void serializeStep(std::ofstream& os) {} /** * @brief a method which is being called when a simulation run is finished. * Implementing this method is optional * * @param os The output stream to the log file * @param run The number of the run */ virtual void runFinished(std::ofstream& os, const unsigned int &run) {} /** * @brief Returns a vector consisting of a particle representation of a belief. This method is purely used * for visualization purposes and is optional * * @return A vector representation of belief particles consisting of shared pointers to RobotState objects */ virtual VectorRobotStatePtr getBeliefParticles() { return VectorRobotStatePtr(); } protected: /** * @brief Registers an environment for environment changes that happen in another environment * * When a RobotEnvironment is registered for environment changes, whenever am EnvironmentChange is * applied to this RobotEnvironment, is will automatically be applied to the registered RobotEnvironment * as well. Note that only planning environments can be registered * * @param registeredEnvironment The RobotEnvironment that has to be registered for environment changes * @param environment The RobotEnvironment the registeredEnvironment gets registered to. If this is a nullptr, * the registerdEnvironment is registered to the execution environment */ void registerForEnvironmentChanges(RobotEnvironment *const registeredEnvironment, RobotEnvironment *const environment=nullptr) { registerForEnvironmentChangesFn_(registeredEnvironment, environment); } /** The heuristic plugin needs to be loaded AFTER the robo environment is fully initialized */ void loadHeuristicPlugin() { // Load heuristic plugin if (problemEnvironmentOptions_->heuristicPlugin == "") return; if (!resources::FileExists(problemEnvironmentOptions_->heuristicPlugin)) { ERROR("Heuristic plugin '" + problemEnvironmentOptions_->heuristicPlugin + "' doesn't exist"); } heuristicPlugin_ = HeuristicPlugin::Create(problemEnvironmentOptions_->heuristicPlugin, "heuristicPlugin"); if (!heuristicPlugin_->load(robotPlanningEnvironment_, problemEnvironmentOptions_->configPath)) { ERROR("Heuristic plugin '" + problemEnvironmentOptions_->heuristicPlugin + "' couldn't be loaded"); } } protected: /** @brief The planning environment the solver uses for computing a policy */ oppt::RobotEnvironment* robotPlanningEnvironment_ = nullptr; /** @brief The name of the solver */ std::string solverName_ = "Solver"; /** @brief A std::unique_ptr to the oppt::HeuristicPlugin. If no HeuristicPlugin is provided in the problem configuration file, this will be a nullptr */ HeuristicPlugin::HeuristicPluginUniquePtr heuristicPlugin_; /** @brief A pointer to the ProblemEnvironmentOptions object*/ ProblemEnvironmentOptions* problemEnvironmentOptions_ = nullptr; /** @brief A pointer to the random engine*/ RandomEnginePtr randGen_ = nullptr; RegisterEnvironmentFn registerForEnvironmentChangesFn_; private: void setRobotPlanningEnvironment(oppt::RobotEnvironment* robotPlanningEnvironment) { robotPlanningEnvironment_ = robotPlanningEnvironment; } void setProblemEnvironmentOptions(ProblemEnvironmentOptions* problemEnvironmentOptions) { problemEnvironmentOptions_ = problemEnvironmentOptions; } void setRandomEngine(RandomEnginePtr& randomEngine) { randGen_ = randomEngine; } void setRegisterEnvironmentFn(RegisterEnvironmentFn &registerEnvFn) { registerForEnvironmentChangesFn_ = registerEnvFn; } }; typedef std::unique_ptr<Solver> SolverPtr; } #endif
[ "hoergems@gmail.com" ]
hoergems@gmail.com
a9c71fde2bdc62169a843775145f15587ee488af
8e4a3464a9cfb59466f7ce80b276e7ba87044bc7
/ConsoleFive4/FiveArr.h
b0dea14f20305faf63034a8409b20f0bc4a7b345
[]
no_license
lilingshui/code-refrence
875daf6b69c6a1d0bb908e78cc718ccc967cf8e6
5bf07d09f12133a1fa10d8d3fb086f143f9f7c1e
refs/heads/master
2023-08-16T16:38:43.215233
2023-07-23T09:54:00
2023-07-23T09:54:00
26,759,907
0
1
null
null
null
null
WINDOWS-1252
C++
false
false
295
h
#pragma once #include "FivePos.h" #include "FiveCore.h" //Æå×ÓÐÅÏ¢Àà class CFiveArr { protected: char m_cArr[SIZE][SIZE]; friend class CFiveCore; public: void InitArr(); void PrintArr(); void SetArr(CFivePos& pos, char cPlayer); char GetArr(CFivePos& pos); };
[ "shuiming.peng@ning-hou.com" ]
shuiming.peng@ning-hou.com
10556db8f4104c03cbeb3f86ffa47a4edb976527
f60fbce76f3464fcba29fbd8cf1181b273de1825
/tests/test_ability_remap.cc
7edd69088e71aafaef4fc578106868cf615b2203
[ "MIT" ]
permissive
EvenSharper/s2client-api
0f81230649898e12462d109c13c91bc0b49a9d88
d5419714346500d5659bcaffc6e78f26a8e1241a
refs/heads/master
2021-01-16T00:28:44.507665
2017-08-10T17:59:52
2017-08-10T17:59:52
99,964,204
1
0
null
2017-08-10T20:57:57
2017-08-10T20:57:57
null
UTF-8
C++
false
false
6,458
cc
#include "test_framework.h" #include "test_movement_combat.h" #include "sc2api/sc2_api.h" #include "sc2utils/sc2_manage_process.h" #include <iostream> #include <string> #include <random> #include "feature_layers_shared.h" namespace sc2 { // // TestRemapStart // class TestRemap : public TestSequence { public: Point2DI command_center_pt_; TestRemap() : command_center_pt_(24, 24), TestSequence() { } Unit GetCommandCenter() { const ObservationInterface* obs = agent_->Observation(); Units found_command_centers = obs->GetUnits(Unit::Alliance::Self, IsUnit(UNIT_TYPEID::TERRAN_COMMANDCENTER)); if (found_command_centers.size() != 1) { ReportError("Could not find the command center"); assert(0); return Unit(); } return found_command_centers[0]; } }; class TestRemapStart : public TestRemap { public: void OnTestStart() override { const ObservationInterface* obs = agent_->Observation(); const GameInfo& game_info = agent_->Observation()->GetGameInfo(); Point2D min = game_info.playable_min; Point2D max = game_info.playable_max; Point2D spawn_pt = min + (max - min) / 2.0f; agent_->Debug()->DebugCreateUnit(UNIT_TYPEID::TERRAN_SCV, spawn_pt, agent_->Observation()->GetPlayerID(), 1); agent_->Debug()->DebugMoveCamera(spawn_pt); agent_->Debug()->DebugGiveAllResources(); agent_->Debug()->DebugIgnoreMineral(); agent_->Debug()->SendDebug(); } }; class TestRemapSelectSCV : public TestRemap { public: void OnTestStart() override { ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); Point2DI p0(0, 0); Point2DI p1(63, 63); action->Select(p0, p1); } }; class TestRemapBuildCommandCenter : public TestRemap { public: void OnTestStart() override { ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); action->UnitCommand(ABILITY_ID::BUILD_COMMANDCENTER, command_center_pt_); wait_game_loops_ = 50; } }; class TestRemapBuildCommandCenterHalt : public TestRemap { public: void OnTestStart() override { ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); action->UnitCommand(ABILITY_ID::HALT); wait_game_loops_ = 10; } }; class TestRemapBuildCommandCenterDetectHalt : public TestRemap { public: float current_progress; void OnTestStart() override { Unit command_center = GetCommandCenter(); current_progress = command_center.build_progress; if (current_progress == 0.0f) { ReportError("Command center did not start building"); assert(0); return; } if (current_progress == 1.0f) { ReportError("Command center finished building"); assert(0); return; } wait_game_loops_ = 50; } void OnTestFinish() override { Unit command_center = GetCommandCenter(); if (current_progress != command_center.build_progress) { ReportError("Command center building continued"); assert(0); return; } } }; class TestRemapBuildCommandCenterContinue : public TestRemap { public: float current_progress; void OnTestStart() override { Unit command_center = GetCommandCenter(); current_progress = command_center.build_progress; ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); action->UnitCommand(ABILITY_ID::SMART, command_center_pt_); wait_game_loops_ = 50; } void OnTestFinish() override { Unit command_center = GetCommandCenter(); if (current_progress == command_center.build_progress) { ReportError("Command center building would not continue"); assert(0); return; } // Select the barracks. ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); action->Select(command_center_pt_, PointSelectionType::PtSelect); } }; class TestRemapBuildCommandCenterCancel : public TestRemap { public: void OnTestStart() override { ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); action->UnitCommand(ABILITY_ID::CANCEL); wait_game_loops_ = 10; } void OnTestFinish() override { const ObservationInterface* obs = agent_->Observation(); Units found_command_centers = obs->GetUnits(Unit::Alliance::Self, IsUnit(UNIT_TYPEID::TERRAN_COMMANDCENTER)); if (found_command_centers.size() != 0) { ReportError("Command center was not destroyed!"); assert(0); } } }; class TestRemapFinishTest : public TestRemap { public: void OnTestStart() override { wait_game_loops_ = 5; } }; // // RemapAbilitiesTestBot // class RemapAbilitiesTestBot : public UnitTestBot { public: RemapAbilitiesTestBot(); private: void OnTestsBegin () final; void OnTestsEnd () final; }; RemapAbilitiesTestBot::RemapAbilitiesTestBot() : UnitTestBot() { // Sequences. Add(TestRemapStart()); Add(TestRemapSelectSCV()); Add(TestRemapBuildCommandCenter()); Add(TestRemapBuildCommandCenterHalt()); Add(TestRemapBuildCommandCenterDetectHalt()); Add(TestRemapBuildCommandCenterContinue()); Add(WaitT<5>()); Add(TestRemapBuildCommandCenterHalt()); Add(TestRemapBuildCommandCenterDetectHalt()); Add(TestRemapBuildCommandCenterCancel()); Add(TestRemapFinishTest()); } void RemapAbilitiesTestBot::OnTestsBegin() { Debug()->DebugShowMap(); }; void RemapAbilitiesTestBot::OnTestsEnd () { } // // TestFeatureLayers // bool TestAbilityRemap(int argc, char** argv) { Coordinator coordinator; if (!coordinator.LoadSettings(argc, argv)) { return false; } coordinator.SetFeatureLayers(sc2::FeatureLayerSettings()); // Add the custom bot, it will control the players. RemapAbilitiesTestBot bot; coordinator.SetParticipants({ CreateParticipant(sc2::Race::Terran, &bot), }); // Start the game. coordinator.LaunchStarcraft(); coordinator.StartGame(sc2::kMapEmpty); // Step forward the game simulation. while (!bot.IsFinished()) { sc2::SleepFor(20); coordinator.Update(); } return bot.Success(); } }
[ "abrunasso@blizzard.com" ]
abrunasso@blizzard.com
d3baef387cdb51563d731ce4bf8a8b3e31ea6cf0
eb50a330cb3d2402d17bee9a5f91f2b372c1e1c1
/Codeforces/1398D_ColoredRectangle.cpp
e7343e936efb5b872a400f2ccf20c1abc111a86b
[]
no_license
MaxSally/Competitive_Programming
2190552a8c8a97d13f33d5fdbeb94c5d92fa9038
8c57924224ec0d1bbc5f17078505ef8864f4caa3
refs/heads/master
2023-04-27T22:28:19.276998
2023-04-12T22:47:10
2023-04-12T22:47:10
270,885,835
0
0
null
null
null
null
UTF-8
C++
false
false
2,926
cpp
/* * Author : MaxSally */ /******** All Required Header Files ********/ #include<bits/stdc++.h> using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d",&t) #define SCLD(t) scanf("%ld",&t) #define SCLLD(t) scanf("%lld",&t) #define SCC(t) scanf("%c",&t) #define SCS(t) scanf("%s",t) #define SCF(t) scanf("%f",&t) #define SCLF(t) scanf("%lf",&t) #define mem(a, b) memset(a, (b), sizeof(a)) #define rep(i, j, k) for (int i = j ; i <= k ; ++i) #define rrep(i, j, k) for (int i = j; i >= k; --i) #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define foreach(i, a) for(auto i: a) #define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++) #define in(A, B, C) assert( B <= A && A <= C) #define mp make_pair #define pb push_back #define inf (int) (1e9 + 7) #define epsi 1e-9 #define PI 3.1415926535897932384626433832795 #define mod 1000000007 #define read(type) readInt<type>() #define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define ll long long int #define left tuyiuoi #define right fgjhk #define ss second #define ff first #define debug(a) cout << #a << ": " << a << endl #define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl #define Flag(n) cout << "here " << n << endl const double pi=acos(-1.0); typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<ll, ll> pll; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<pll> vpll; typedef vector<vi> vvi; typedef map<int,int> MPII; typedef set<int> SETI; typedef multiset<int> MSETI; typedef long int int32; typedef unsigned long int uint32; typedef long long int int64; typedef unsigned long long int uint64; const int N = 205; ll r[N], g[N], b[N]; ll dp[N][N][N]; int n, n1, n2; bool compare(int x, int y){ return x > y; } int main(){ io; freopen("input.txt", "r", stdin); cin >> n >> n1 >> n2; rep(i, 0, n - 1){ cin >> r[i]; } rep(i, 0, n1 - 1){ cin >> g[i]; } rep(i, 0, n2 - 1){ cin >> b[i]; } sort(r, r + n, compare); sort(g, g + n1, compare); sort(b, b + n2, compare); ll ans = 0; rep(i, 0, n){ rep(j, 0, n1){ rep(k, 0, n2){ if(i + j + k < 2)continue; ll temp = 0; if(i > 0 && j > 0) { temp = max(temp, dp[i - 1][j - 1][k] + r[i - 1] * g[j - 1]); } if(j > 0 && k > 0){ temp = max(temp, dp[i][j - 1][k - 1] + g[j - 1] * b[k - 1]); } if(i > 0 && k > 0){ temp = max(temp, dp[i - 1][j][k - 1] + r[i - 1] * b[k - 1]); } dp[i][j][k] = temp; ans = max(ans, temp); } } } cout << ans; return 0; }
[ "qnguyen16@huskers.unl.edu" ]
qnguyen16@huskers.unl.edu
d054b4d5a85eea00c22c97ec0522f42901156b0d
c5abcc4ea4d670cbf2322725caa54892ed041d5b
/solving problem/Technique/DFS/Islands in the Data Stream.cpp
6253dda0b77455d68a8887901429137efb649d21
[]
no_license
sngvahmed/Problem
c2682f1b24ca61d090030a5e9fae55346c525b6e
b7dc0a8b94a054ce2e7f4e881c176277c5afda31
refs/heads/master
2020-04-06T04:01:36.419414
2015-03-10T20:29:22
2015-03-10T20:29:22
25,265,073
0
0
null
null
null
null
UTF-8
C++
false
false
1,953
cpp
#include <cstring> #include <string.h> #include <map> #include <deque> #include <queue> #include <stack> #include <sstream> #include <bitset> #include <iostream> #include <iomanip> #include <cstdio> #include <fstream> #include <cmath> #include <cstdlib> #include <ctime> #include <algorithm> #include <vector> #include <set> #include <complex> #include <list> #include <valarray> #include <memory.h> #include <climits> #include <math.h> using namespace std; #define FO(i, a, x) for(int i = a; i < (int)x; i++) #define FOR(i, x) FO(i, 0, x) #define RO(i, a, x) for(int i = a; i >= x; i--) #define ROF(i, x) for(int i = x; i >= 0; i--) #define FORIT(it, x) for(typeof(x.begin()) it = x.begin(); it != x.end(); it++) #define FOUND(s, x) find(all(s), x) != s.end() #define NOTFOUND(s, x) find(all(s), x) == s.end() #define SZ(x) (int)x.size() #define pb push_back #define mp make_pair #define F first #define S second #define pii pair<int, int> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define MMS(x, v) memset(x, v, sizeof(x)) #define SQ(x) (x) * (x) typedef long long ll; typedef unsigned long long ull; typedef unsigned long ul; typedef vector<string> vs; typedef vector<int> vi; int di[] = { 0, 0, 1, -1, 1, -1, 1, -1 }; int dj[] = { 1, -1, 0, 0, 1, -1, -1, 1 }; int ret = 0; int arr[16]; bool validate(string sum) { int i = 1; char I = sum[0], J = sum[SZ(sum) - 1]; while (i < SZ(sum) - 1) { if (sum[i] <= I || sum[i] <= J) return 0; i++; } return 1; } void DFS(int i, string sum, map<string, int> vis) { if (SZ(sum) > 2 && validate(sum) && vis[sum] == 0) { ret++, vis[sum] = 1; } if (i == 16) { return; } DFS(i + 1, sum + char(arr[i] + '0'), vis); } void Generate() { FO(i,1,16) { DFS(i, "", map<string, int>()); } } int main() { int co; scanf("%d", &co); while (co--) { ret = 0; FO(i,0,16) scanf("%d", &arr[i]); Generate(); cout << arr[0] << " " << ret << endl; } return 0; }
[ "ahmednasser1993@gmail.com" ]
ahmednasser1993@gmail.com