blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
32f4610f10428a23a9710f6f60c898f73765e459
0b5783e341734e3c531a67c90c7d43eefaf89b9a
/code/render/coregraphics/memoryvertexbufferpool.cc
850b613fbfb03eed877ed0b1168b1668f9d68a24
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
zhouxs1023/nebula
5f120d6af8fe4052b3216cda4a0da105a3623ada
75168007627d4a1149518a57a9ca94c4e917c02f
refs/heads/master
2020-06-19T14:27:23.832916
2019-07-11T13:57:53
2019-07-11T13:57:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,016
cc
memoryvertexbufferpool.cc
//------------------------------------------------------------------------------ // memoryvertexbufferloader.cc // (C) 2007 Radon Labs GmbH // (C) 2013-2018 Individual contributors, see AUTHORS file //------------------------------------------------------------------------------ #include "render/stdneb.h" #include "coregraphics/memoryvertexbufferpool.h" #if __DX11__ namespace CoreGraphics { __ImplementClass(CoreGraphics::MemoryVertexBufferPool, 'MVBP', Direct3D11::D3D11MemoryVertexBufferPool); } #elif __OGL4__ namespace CoreGraphics { __ImplementClass(CoreGraphics::MemoryVertexBufferPool, 'MVBP', OpenGL4::OGL4MemoryVertexBufferPool); } #elif __VULKAN__ namespace CoreGraphics { __ImplementClass(CoreGraphics::MemoryVertexBufferPool, 'MVBP', Vulkan::VkMemoryVertexBufferPool); } #elif __DX9__ namespace CoreGraphics { __ImplementClass(CoreGraphics::MemoryVertexBufferPool, 'MVBP', Win360::D3D9MemoryVertexBufferPool); } #else #error "MemoryVertexBufferPool class not implemented on this platform!" #endif
4784b92612d0ebed81be0119c0d14c749905cd4c
6c6bb201c0dce86a053dfb9f4e8b2f26d0892fca
/filterdebtshistory.h
d755662aa80c71187df2e9e0eb1821497d00f1a6
[]
no_license
End1-1/FlashCards
076481f5bb263e42beba879be4612c7c279de2be
e8609f440894dd4eab389397c0db91af0abfc896
refs/heads/master
2022-11-07T18:39:02.336469
2022-10-17T21:22:47
2022-10-17T21:22:47
251,817,501
0
0
null
null
null
null
UTF-8
C++
false
false
542
h
filterdebtshistory.h
#ifndef FILTERDEBTSHISTORY_H #define FILTERDEBTSHISTORY_H #include "c5filterwidget.h" namespace Ui { class FilterDebtsHistory; } class FilterDebtsHistory : public C5FilterWidget { Q_OBJECT public: explicit FilterDebtsHistory(QWidget *parent = nullptr); ~FilterDebtsHistory(); virtual QString condition(); virtual QString conditionText(); virtual QString filterString(); void setFilter(const QDate &d1, const QDate &d2, int partner); private: Ui::FilterDebtsHistory *ui; }; #endif // FILTERDEBTSHISTORY_H
b33c63ae4d42b1c51bc4747ce7b742e585561fe7
505fe6355b8442eb7fb62ee103b6f34da26db0c7
/src/Waypoint.cpp
877fa8e85a7bd7f47050a41b63f7d768bf96238e
[ "MIT" ]
permissive
fatihgulakar/TrafficSimulator
7874312cc06c8c0ffd84493067316b5abc0032b3
80166ec5450bd5d7e542c6fc00429a72c12cf5c3
refs/heads/master
2023-01-02T18:55:01.598343
2020-10-08T12:55:17
2020-10-08T12:55:17
296,675,662
3
1
null
null
null
null
UTF-8
C++
false
false
3,899
cpp
Waypoint.cpp
#include "Waypoint.h" Waypoint::Waypoint(tWaypointDir dir, tRoadTileType type, int row, int col, int idx, int next1, int next2, int next3) { std::cout << "Waypoint object is initialized" << std::endl; this->next1 = next1; this->next2 = next2; this->next3 = next3; this->dir = static_cast<int>(dir); // dir is tWaypoint enum class, so casting it to "int" is needed. this->canDrive = true; switch (dir) { case tWaypointDir::down: this->texture.loadFromFile("./images/waypoints/down.png"); this->sprite.setTexture(this->texture); break; case tWaypointDir::up: this->texture.loadFromFile("./images/waypoints/up.png"); this->sprite.setTexture(this->texture); break; case tWaypointDir::left: this->texture.loadFromFile("./images/waypoints/left.png"); this->sprite.setTexture(this->texture); break; case tWaypointDir::right: this->texture.loadFromFile("./images/waypoints/right.png"); this->sprite.setTexture(this->texture); break; default: std::cout << "Invalid type of direction." << std::endl; break; } // x_internal and y_internal are coordinates of a waypoint in regards to Road Tile it belongs to. auto x_internal = 0; auto y_internal = 0; switch (type) { case tRoadTileType::corner_bottomleft: x_internal = (idx == 0 ? 118 : 218); y_internal = (idx == 0 ? 20 : 121); break; case tRoadTileType::corner_bottomright: x_internal = (idx == 0 ? 20 : 118); y_internal = (idx == 0 ? 121 : 20); break; case tRoadTileType::corner_topleft: x_internal = (idx == 0 ? 118 : 218); y_internal = (idx == 0 ? 218 : 121); break; case tRoadTileType::corner_topright: x_internal = (idx == 0 ? 20 : 118); y_internal = (idx == 0 ? 121 : 218); break; case tRoadTileType::cross: x_internal = ((idx == 1 || idx == 3) ? 118 : (idx == 0) ? 20 : 218); y_internal = ((idx == 0 || idx == 2) ? 121 : (idx == 1) ? 20 : 218); break; case tRoadTileType::straight_horizontal: x_internal = (idx == 0 ? 20 : 172); y_internal = 121; break; case tRoadTileType::straight_vertical: x_internal = 118; y_internal = (idx == 0 ? 20 : 172); break; case tRoadTileType::t_bottom: x_internal = (idx == 0 ? 20 : (idx == 1) ? 118 : 218); y_internal = ((idx == 0 || idx == 2) ? 121 : 20); break; case tRoadTileType::t_left: x_internal = ((idx == 0 || idx == 2) ? 118 : 218); y_internal = (idx == 0 ? 20 : (idx == 1) ? 121 : 218); break; case tRoadTileType::t_right: x_internal = ((idx == 0 || idx == 2) ? 118 : 20); y_internal = (idx == 0 ? 20 : (idx == 1) ? 121 : 218); break; case tRoadTileType::t_top: x_internal = (idx == 0 ? 20 : (idx == 1) ? 118 : 218); y_internal = ((idx == 0 || idx == 2) ? 121 : 218); break; default: break; } // Global coordinates of waypoint this->x = static_cast<float>(x_internal + X_MARGIN + col * TILE_SIZE); this->y = static_cast<float>(y_internal + Y_MARGIN + row * TILE_SIZE); this->sprite.setOrigin(sf::Vector2f(this->texture.getSize().x * 0.5, this->texture.getSize().y * 0.5)); } void Waypoint::getPosition(float& x, float& y, float& dir) { x = this->x; y = this->y; dir = static_cast<float>(this->dir); } void Waypoint::draw(sf::RenderWindow& window) { this->sprite.setPosition(this->x, this->y); window.draw(this->sprite); } bool Waypoint::getDrive() { return this->canDrive; } void Waypoint::setDrive(bool status) { this->canDrive = status; } std::vector<int> Waypoint::get_next_indexes() { return {this->next1, this->next2, this->next3}; }
ff7a97c41d9b9caa4daf68cc9afe28536106b65b
ede27af111a24fb36550c4e943e8ca4324ae9a64
/Server/SR/SR_Sender.cpp
9ccc8bb54f2df3d99c35cae7834eea53e9dcbf4a
[ "MIT" ]
permissive
shawnvision7264/tcp-protocol
e959c0d22a55afa1c55cb21706db824b7943d7eb
7011195b529dbcb0761d2b1d0131bdb209c1365d
refs/heads/master
2021-03-17T08:52:43.740455
2019-01-25T06:59:04
2019-01-25T06:59:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,191
cpp
SR_Sender.cpp
// // Created by Amr Hendy on 08/12/2018. // #include "SR_Sender.h" SR_Sender::SR_Sender(int socket_fd, string file_name, double loss_prob, int seed_number, struct sockaddr_in client_socket): sender(client_socket), reader(file_name){ SR_Sender::socket_fd = socket_fd; SR_Sender::file_path = file_name; std::ifstream infile("control.txt"); int a; while(infile >> a){ window_changes.push_back(a); } get_loss_packets(loss_prob, seed_number); cwnd = 1; threshold = 10; additive_increase = 1; multiplicative_decrease = 2; window.clear(); acked.clear(); start_window_packet = 0; end_window_packet = 0; SR_Sender::client_socket = client_socket; } void SR_Sender::sendFile(){ sender_thread = std::thread (&SR_Sender::send_handling, this); receiver_thread = std::thread (&SR_Sender::recev_ack_handling, this); sender_thread.join(); printf("sender thread finished in selective repeat.\n"); receiver_thread.join(); printf("receiver thread finished in selective repeat.\n"); } void SR_Sender::send_handling(){ //mtx.lock(); int total_packets = reader.get_total_packet_number(); int sended = 0; int window_congestion_index = 0; while(start_window_packet < total_packets){ for(int index = start_window_packet; index <= end_window_packet; index++){ mtx.lock(); if(window.find(index) != window.end()){ Packet packet = reader.get_chunk_data(index); // loss if(loss_packets_indices.count(index)){ loss_packets_indices.erase(index); clock_t start_time = clock(); window[index] = {packet, start_time}; } else if(window_congestion_index < window_changes.size() && sended == window_changes[window_congestion_index]){ window.clear(); //acked.clear(); sended = 0; window_congestion_index++; cwnd = max((int)floor(1.0 * cwnd / multiplicative_decrease), 1); start_window_packet = start_window_packet; end_window_packet = min(start_window_packet + cwnd - 1, total_packets - 1); mtx.unlock(); break; } else{ sender.send_packet(packet, socket_fd); clock_t start_time = clock(); window[index] = {packet, start_time}; sended++; } } if(acked.find(index) == acked.end()){ clock_t time_now = clock(); if((time_now - window[index].second)/ CLOCKS_PER_SEC >= SR_TIMEOUT){ // TODO handle timeout window.clear(); acked.clear(); cwnd = 1; start_window_packet = start_window_packet; end_window_packet = start_window_packet; mtx.unlock(); break; } } mtx.unlock(); } } } void SR_Sender::recev_ack_handling(){ //mtx.lock(); int total_packets = reader.get_total_packet_number(); while(start_window_packet < total_packets){ int status; Ack_Packet ack_packet = Receiver::receive_ack_packet(socket_fd, client_socket, status); if(status == 1){ mtx.lock(); if(PacketHandler::compare_ack_packet_checksum(ack_packet) && window.find(ack_packet.ackno) != window.end()){ cout << "packet " << ack_packet.ackno << " ack." << endl; acked[ack_packet.ackno] = ack_packet; while(start_window_packet <= end_window_packet && acked.find(start_window_packet) != acked.end()){ start_window_packet++; } if(cwnd < threshold){ //exp cout << "window size duplicated." << endl; cwnd *= 2; }else if(cwnd < total_packets){ cout << "window size increased by " << additive_increase << endl; cwnd += additive_increase; } end_window_packet = min(start_window_packet + cwnd - 1, total_packets - 1); } else{ // ignore the ack packet } mtx.unlock(); } else{ // not recev for long time } } return; } void SR_Sender::get_loss_packets(double loss_prob, int seed_number){ srand(seed_number); int total_packets = reader.get_total_packet_number(); int total_loss_packets = ceil(loss_prob * total_packets); set<int> loss_packets_indices; for(int i = 0; i < total_loss_packets; i++){ int index = rand() % total_packets; if(loss_packets_indices.count(index) == 0){ loss_packets_indices.insert(index); } else{ // as that index is already exist i--; } } SR_Sender::loss_packets_indices = loss_packets_indices; }
3a1d0245bb045c331d359404fe750e530eab71f4
483255eebf46a12460a9349fdfb78a5e7d1c1048
/developers/PotentialFlow/mastersolution/potentialflow.cc
11f0fba7a1a819ed57402125b27a08bd7f4a9f00
[ "MIT" ]
permissive
erickschulz/NPDECODES
5460331cb4c608ff922658c9beb1e31b4b6c9b2e
47b4fe6d60640a10bfe0ed085d67a3ccdadac831
refs/heads/master
2023-05-03T09:46:22.047387
2023-05-01T07:27:10
2023-05-01T07:27:10
184,058,364
32
64
MIT
2023-04-28T14:58:23
2019-04-29T11:28:34
C++
UTF-8
C++
false
false
3,586
cc
potentialflow.cc
#include <Eigen/Core> #include <Eigen/Sparse> namespace PotentialFlow { /* SAM_LISTING_BEGIN_1 */ Eigen::SparseMatrix<double> initializeA(unsigned int M) { // For the sake of efficiency the use of Eigen's sparse matrix data type is // essential. The matrix is stored in CCS format. Eigen::SparseMatrix<double> A(M * M, M * M); // We already know that the matrix has at most $9$ non-zero entries per row // and column. This information is passed to Eigen via the reserve() member // function. A.reserve(Eigen::VectorXi::Constant(M * M, 9)); // Iterate over all interior nodes of the mesh and apply the stencil and // initialize the matrix in column-wise order, from top to bottom in every // column, which is most efficient for the CCS storage format. for (int i = 0; i < M; ++i) { // "vertical" loop for (int j = 0; j < M; ++j) { // "horizontal" loop // Index of the current node const int k = i * M + j; // Self-interaction weight A.insert(k, k) = 16.0 / 6; // Interaction term with the node below to the left if (i > 0 && j > 0) { A.insert(k - M - 1, k) = -2.0 / 6; } // Interaction term with the node below if (i > 0) { A.insert(k - M, k) = -2.0 / 6; } // Interaction term with the node below to the right if (i > 0 && j < M - 1) { A.insert(k - M + 1, k) = -2.0 / 6; } // Interaction term with the node to the left if (j > 0) { A.insert(k - 1, k) = -2.0 / 6; } // Interaction term with the node to the right if (j < M - 1) { A.insert(k + 1, k) = -2.0 / 6; } // Interaction term with the node above to the left if (i < M - 1 && j > 0) { A.insert(k + M - 1, k) = -2.0 / 6; } // Interaction term with the node above if (i < M - 1) { A.insert(k + M, k) = -2.0 / 6; } // Interaction term with the node above to th right if (i < M - 1 && j < M - 1) { A.insert(k + M + 1, k) = -2.0 / 6; } } } A.makeCompressed(); return A; } /* SAM_LISTING_END_1 */ /* SAM_LISTING_BEGIN_2 */ Eigen::VectorXd initializeRHSVector(const std::function<double(double, double)> &g, unsigned int M) { // Mesh width const double h = 1.0 / (M + 1); // Off-center entry of stencil const double w = 2.0 / 6; Eigen::VectorXd phi = Eigen::VectorXd::Zero(M * M); // Four corner points phi[0] = w * (g(0.0, 0.0) + g(0.0, h) + g(h, 0.0) + g(2 * h, 0.0) + g(0.0, 2 * h)); // Bottom left corner phi[M - 1] = w * (g(1.0, 0.0) + g(1.0 - h, 0.0) + g(1.0, h) + g(1.0 - 2 * h, 0.0) + g(1.0, 2 * h)); // Bottom right corner phi[M * (M - 1)] = w * (g(0.0, 1.0) + g(0.0, 1.0 - h) + g(h, 1.0) + g(2 * h, 1.0) + g(0.0, 1.0 - 2 * h)); // Top left corner phi[M * M - 1] = w * (g(1.0, 1.0) + g(1.0, 1.0 - h) + g(1.0 - h, 1.0) + g(1.0, 1.0 - 2 * h) + g(1.0 - 2 * h, 1.0)); // Top right corner for (unsigned int l = 1; l < M - 1; ++l) { phi[l] = w * (g(h * l, 0.0) + g((l + 1) * h, 0.0) + g((l + 2) * h, 0.0)); // bottom phi[M * l] = w * (g(0.0, l * h) + g(0.0, (l + 1) * h) + g(0.0, (l + 2) * h)); // left phi[M * (l + 1) - 1] = w * (g(1.0, l * h) + g(1.0, (l + 1) * h) + g(1.0, (l + 2) * h)); // right phi[M * (M - 1) + l] = w * (g(h * l, 1.0) + g((l + 1) * h, 1.0) + g((l + 2) * h, 1.0)); // top } return phi; } /* SAM_LISTING_END_2 */ } // namespace PotentialFlow
5fc9caf1e5ec4bd44aa985975c955860278f4117
8778bed3d657bc14278e978a1ab56cbaa02596f3
/codeMonk.cpp
3ee4b601b34e5c33a07585afc2789522ca94c09e
[]
no_license
raysayantan/HackerEarth
69bca41a2334e8aab2ef1501222328d1fa7ef806
ccd097f5efb806c3f06bc98838f7dd01fbef0655
refs/heads/master
2021-04-23T12:03:42.696666
2020-03-25T08:30:03
2020-03-25T08:30:03
249,924,007
0
0
null
null
null
null
UTF-8
C++
false
false
1,701
cpp
codeMonk.cpp
/* Monk loves cycling. He wants to buy his favorite bicycle costing P dollars. But his father won’t give him the money so easily as he wants Monk to understand the importance of money. So they made a deal. Monk starts with Zero dollars in his piggybank. On each day, Monk will go to another city where God of Money lives, and will get as much as dollars he wants from him. At the end of each day, Monk brings the piggybank to his father, who counts the money in the piggybank and deposits as much more money as the amount that is present in the piggybank, which eventually doubles the amount in piggybank. As a result, the money in the piggybank keeps growing. Note that, his father does not deposit any money if the piggybank is empty. Monk wants to ask God of Money for as minimum dollars as possible. Find the minimum dollars that Monk has to ask from God of Money, so that he has exactly P dollars in his piggybank, irrespective of the number of days he takes. Input: The first line consists of integer T. T testcases follow. The first line of each testcase consists of an integer P, denoting the cost of the bicycle. Output: For each testcase, print the answer in a single line. Constraints: 1<=T<=10 1<=P<=10^18 SAMPLE INPUT 2 1 2 SAMPLE OUTPUT 1 1 Explanation In the second testcase, Monk asks for 1 dollar from God of Money on the first day. He takes the piggybank with 1 Dollar to his father who deposits 1 Dollar, making a total of 2 Dollars i.e. cost of the bicycle. */ #include <iostream> using namespace std; int main(){ int t; cin>>t; while(t--) { long long int p; cin>>p; int count=0; while(p) { p=p&(p-1); count++; } cout<<count<<endl; } }
03ded94530f07a44db6a909b7cf52ed60cb871b7
5e3154c2629d87442f5b5038596c4ab627b6708c
/ext/ogremovableobjectlistener.cpp
1ae85f3ef501ac2dba5ce6fc6d33caddff2bd76b
[]
no_license
RavensKrag/libogre-ruby
ac762d168d8375f6491853ac3ae62ca45fe8fc8b
5259348f58e046fa8f7e82e4bfcc65fc31945923
refs/heads/master
2021-01-17T08:46:30.192069
2012-09-20T21:32:56
2012-09-20T21:32:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,258
cpp
ogremovableobjectlistener.cpp
#include "ogremovableobjectlistener.hpp" #include "ogremovableobject.hpp" VALUE rb_mOgreMovableObjectListener; std::map<VALUE,RubyMovableObjectListener*> movableObjectListenerHolder; template <> VALUE wrap< RubyMovableObjectListener >(RubyMovableObjectListener *obj ) { return obj->mRuby; } template <> VALUE wrap< Ogre::MovableObject::Listener >(Ogre::MovableObject::Listener *obj ) { return wrap<RubyMovableObjectListener>(reinterpret_cast<RubyMovableObjectListener*>(obj)); } //*/ template <> Ogre::MovableObject::Listener* wrap< Ogre::MovableObject::Listener* >(const VALUE &vmovable) { std::map<VALUE,RubyMovableObjectListener*>::iterator it = movableObjectListenerHolder.find(vmovable); if(it != movableObjectListenerHolder.end()) return it->second; return new RubyMovableObjectListener(vmovable); } RubyMovableObjectListener::RubyMovableObjectListener(VALUE val) : mRuby(val) { movableObjectListenerHolder.insert(std::make_pair(val,this)); } void RubyMovableObjectListener::objectDestroyed(Ogre::MovableObject* obj) { rb_funcall(this->mRuby,rb_intern("object_destroyed"),1,wrap(obj)); } void RubyMovableObjectListener::objectAttached(Ogre::MovableObject* obj) { rb_funcall(this->mRuby,rb_intern("object_attached"),1,wrap(obj)); } void RubyMovableObjectListener::objectDetached(Ogre::MovableObject* obj) { rb_funcall(this->mRuby,rb_intern("object_detached"),1,wrap(obj)); } void RubyMovableObjectListener::objectMoved(Ogre::MovableObject* obj) { rb_funcall(this->mRuby,rb_intern("object_moved"),1,wrap(obj)); } void Init_OgreMovableObjectListener(VALUE rb_mOgre) { #if 0 rb_mOgre = rb_define_module("Ogre"); rb_mOgreMovableObject = rb_define_module_under(rb_mOgre,"MovableObject"); #endif rb_mOgreMovableObjectListener = rb_define_module_under(rb_mOgreMovableObject,"Listener"); rb_define_method(rb_mOgreMovableObjectListener,"object_destroyed",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_attached",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_detached",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_moved",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y }
ec65c71e6657a4ef9af4cea16c0b70bfab150714
0cfea5cdfcd12f6fddb3b2dcb86229b1a8889c93
/1D.cpp
d88b22ee41850160c351a17c7c2bc0c6e4fb025b
[]
no_license
joeyuan19/Traffic
b1e2e52561f96acdfdc0ffe0bbf678a02e67bd9a
3b1919567dd3420811fad80788c07b67a66ef736
refs/heads/master
2020-04-04T22:48:26.317183
2018-11-06T06:28:40
2018-11-06T06:28:40
156,336,620
0
0
null
null
null
null
UTF-8
C++
false
false
12,523
cpp
1D.cpp
#include <iostream> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <random> #include <SDL2/SDL.h> #define PI 3.141592653589793238 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1D traffic simulator * To Do: * [+] Lane Changes * [ ] Car AI * [ ] Merging * [+] Look for merge when slowed to less than 90% max speed * [ ] Merge when at least two cars away from any cars in the lane * [ ] Wait time after merge, list of refresh frames to wait, subtract on each pass, only merge if = 0 * [+] Fancy cars * [+] Headlights * [+] Taillights * [+] Flat 2D look * [+] wheels * [+] windows * [+] Roof Shape * [+] Spinning wheels * [ ] Acceleration/Braking * [ ] Two Way Traffic * [ ] Merging allowed in other lane * [ ] Lane Block: Construction * [ ] Traffic light, Stop sign * [ ] Curved Road * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ using namespace std; const int DELAY_WAIT = 0; const int SCREEN_WIDTH = 1000; const int SCREEN_HEIGHT = 300; const int LANES = 3; const int DASH_LENGTH = 20; const int DASH_WIDTH = 1; const int DASH_SPACE = 40; const int ROAD_UNIT = DASH_LENGTH+DASH_SPACE; const int LANE_WIDTH = SCREEN_HEIGHT/LANES; const int CARS = LANES*2; const int TRACK_UNIT = SCREEN_WIDTH/CARS; const int CAR_HEIGHT = LANE_WIDTH/2; const int CAR_LENGTH = CAR_HEIGHT*2; const int LIGHT_SIZE = CAR_HEIGHT/4; const int CAR_WHEEL_RADIUS = CAR_HEIGHT/4; const int CAR_WHEEL_RIM_DIVS = 5; const float CAR_WHEEL_RIM_DIVS_ANGLE = 360./CAR_WHEEL_RIM_DIVS; float carPosition[CARS]; float carLane[CARS]; float carVelocity[CARS]; float carMaxVelocity[CARS]; float carWheelAngle[CARS]; float carMergeWait[CARS]; const float DT = 0.1; const float MAX_VELOCITY = 50; const float MIN_VELOCITY = 10; /* SDL Overhead */ bool init(); bool loadMedia(); bool close(); SDL_Window * window = NULL; SDL_Renderer * renderer = NULL; bool initSDL() { bool success = true; if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); success = false; } else { if ( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1") ) { printf("Warning: Linear texture filtering not enabled!"); } window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); if ( window == NULL ) { printf("Window could not be created! SDL_Error: %s\n", SDL_GetError()); success = false; } else { renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0xFF,0xFF); SDL_RenderClear(renderer); } } return success; } bool loadMedia() { bool success = true; return success; } bool close() { SDL_DestroyRenderer(renderer); renderer = NULL; SDL_DestroyWindow(window); window = NULL; SDL_Quit(); return true; } /* Helper Method */ int radToDeg(float r) { return 180*r/PI; } float degToRad(int d) { return PI*d/180.; } int directionCrossProduct(int x1, int y1, int x2, int y2) { return 0 <= (x1*y2 - y1*x2); } bool sameSide(int x1, int y1, int x2, int y2, int lx1, int ly1, int lx2, int ly2) { return directionCrossProduct(lx2-lx1,ly2-ly1,x1-lx1,y1-ly1) && directionCrossProduct(lx2-lx1,ly2-ly1,x2-lx1,y2-ly1); } bool inTriangle(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { return sameSide(x,y,x3,y3,x1,y1,x2,y2) && sameSide(x,y,x2,y2,x3,y3,x1,y1) && sameSide(x,y,x1,y1,x2,y2,x3,y3); } double angleDegPoint(float y, float x) { double a = atan2(y,x); if (a < 0) { a = 2*PI + a; } return radToDeg(a); } float wrapDeg(float a) { if (a > 360) { return a - 360; } else { return a; } } bool angleBetween(double a, int lower_a, int upper_a) { if (lower_a < upper_a) { return lower_a <= a && a <= upper_a; } else { return (lower_a <= a && a <= 360+upper_a) || (lower_a-360 <= a && a <= upper_a); } } /* Drawing funcitons */ void fillCircle(int x, int y, int r) { int i, j; for (i = -r; i <= r; i++) { for (j = -r; j <= r; j++) { if (i*i + j*j <= r*r) { SDL_RenderDrawPoint(renderer,x+i,y+j); } } } } void fillCircleSlice(int x, int y, int r, int a1, int a2) { int i, j; double a; for (i = -r; i <= r; i++) { for (j = -r; j <= r; j++) { a = angleDegPoint(j,i); if (i*i + j*j <= r*r && angleBetween(a,a1,a2)) { SDL_RenderDrawPoint(renderer,x+i,y+j); } } } } void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) { int max_x = max(x1,max(x2,x3)), min_x = min(x1,min(x2,x3)), max_y = max(y1,max(y2,y3)), min_y = min(y1,min(y2,y3)); int x, y; for (x = min_x; x <= max_x; x++) { for (y = min_y; y <= max_y; y++) { if (inTriangle(x,y,x1,y1,x2,y2,x3,y3)) { SDL_RenderDrawPoint(renderer,x,y); } } } } void drawRoad(int lanes) { SDL_SetRenderDrawColor(renderer,0x00,0x00,0x00,0xFF); SDL_RenderClear(renderer); SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0x00,0xFF); int lane, dash; for (lane = 1; lane < lanes; lane++) { for (dash = 0; dash < SCREEN_WIDTH; dash += ROAD_UNIT) { const SDL_Rect rect = {dash, LANE_WIDTH*lane - DASH_WIDTH/2, DASH_LENGTH, DASH_WIDTH}; SDL_RenderFillRect(renderer, &rect); } } } void drawWheel(int x, int y, int r, int a) { // Tire color SDL_SetRenderDrawColor(renderer,0x36,0x45,0x4F,0xFF); fillCircle(x,y,r); // Rim color SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0xFF,0xFF); fillCircle(x,y,r/2.); SDL_SetRenderDrawColor(renderer,0x00,0x00,0x00,0xFF); for (int n = 0; n < CAR_WHEEL_RIM_DIVS; n++) { fillCircleSlice(x,y,r/2.,wrapDeg(a+n*CAR_WHEEL_RIM_DIVS_ANGLE),wrapDeg(a+(n+.5)*CAR_WHEEL_RIM_DIVS_ANGLE)); } SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0xFF,0xFF); fillCircle(x,y,r/8.); } void drawCar(int n) { int X = carPosition[n]-CAR_LENGTH/2; int Y = LANE_WIDTH/2 + (carLane[n]-1)*LANE_WIDTH - CAR_HEIGHT/2; SDL_SetRenderDrawColor(renderer,0x00,0xFF*(1.0 - 1.0*n/CARS),0x55,0xFF); // Roof const SDL_Rect roof = {X + 3*CAR_LENGTH/8, Y, CAR_LENGTH/4, CAR_HEIGHT/2}; SDL_SetRenderDrawColor(renderer,0x00,0xFF*(1.0 - 1.0*n/CARS),0x55,0xFF); SDL_RenderFillRect(renderer, &roof); fillTriangle(X,Y+CAR_HEIGHT/2,X+3.*CAR_LENGTH/8,Y,X+3.*CAR_LENGTH/8,Y+CAR_HEIGHT/2); fillTriangle(X+5.*CAR_LENGTH/8,Y+CAR_HEIGHT/2,X+5*CAR_LENGTH/8,Y,X+CAR_LENGTH,Y+CAR_HEIGHT/2); // Windows SDL_SetRenderDrawColor(renderer,0xCC,0xCC,0xCC,0xFF); // Windshield int offset = 2; // offset from roof fillTriangle(X+5*CAR_LENGTH/8+offset,Y+CAR_HEIGHT/2+offset, X+5*CAR_LENGTH/8+offset,Y, X+CAR_LENGTH,Y+CAR_HEIGHT/2); // backseat window const SDL_Rect bw = {X + 3*CAR_LENGTH/8, Y+offset, CAR_LENGTH/8 - 1, CAR_HEIGHT/2}; SDL_RenderFillRect(renderer, &bw); // frontseat window const SDL_Rect fw = {X + CAR_LENGTH/2 + 1, Y+offset, CAR_LENGTH/8 - 2, CAR_HEIGHT/2}; SDL_RenderFillRect(renderer, &fw); // Body const SDL_Rect body = {X, Y + CAR_HEIGHT/4, CAR_LENGTH, CAR_HEIGHT/2}; SDL_SetRenderDrawColor(renderer,0x00,0xFF*(1.0 - 1.0*n/CARS),0x55,0xFF); SDL_RenderFillRect(renderer, &body); // Blinker const SDL_Rect bl = {X, Y + CAR_HEIGHT/4, LIGHT_SIZE, LIGHT_SIZE}; SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0x00,0xFF); SDL_RenderFillRect(renderer, &bl); // Taillight const SDL_Rect tl = {X, Y + CAR_HEIGHT/4, LIGHT_SIZE, LIGHT_SIZE/2}; SDL_SetRenderDrawColor(renderer,0xFF,0x00,0x00,0xFF); SDL_RenderFillRect(renderer, &tl); // Headlight const SDL_Rect hl = {X+CAR_LENGTH-LIGHT_SIZE, Y + CAR_HEIGHT/4, LIGHT_SIZE, LIGHT_SIZE}; SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0xFF,0xFF); SDL_RenderFillRect(renderer, &hl); drawWheel(X+3*CAR_LENGTH/4,Y+3*CAR_HEIGHT/4,CAR_WHEEL_RADIUS,carWheelAngle[n]); drawWheel(X+CAR_LENGTH/4,Y+3*CAR_HEIGHT/4,CAR_WHEEL_RADIUS,carWheelAngle[n]); } void drawCars() { for (int n = 0; n < CARS; n++) { drawCar(n); } } void draw() { drawRoad(LANES); drawCars(); } /* Random numbers */ float R(int min, int max) { float r = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); return min + r*(max-min); } /* Bumper to bumper distance + small padding */ float b2b(int carA, int carB) { float x1 = carPosition[carA], x2 = carPosition[carB]; if (x1 > x2) { x2 = x2 + SCREEN_WIDTH; } return x2 - x1 - (CAR_LENGTH + 2); } /* Driving AI */ int nextCar(int n) { int min_i = n, min = SCREEN_WIDTH*2; float dx; for (int c = 0; c < CARS; c++) { if (c != n && carLane[n] == carLane[c]) { if ((dx = b2b(n,c)) < min) { min_i = c; min = dx; } } } return min_i; } bool checkLaneClear(int n, int lane) { if (lane > LANES || lane < 1) {return false;} // No merging off road float x = carPosition[n]; float xmin = x - 2*CAR_LENGTH; float xmax = x + 2*CAR_LENGTH; float x2, x2min, x2max; for (int c = 0; c < CARS; c++) { if (carLane[c] == lane) { x2 = carPosition[c]; x2min = x2 - CAR_LENGTH/2; x2max = x2 + CAR_LENGTH/2; if (x2min < xmax && x2min > xmin) { return false; } else if (x2max < xmax && x2max > xmin) { return false; } } } return true; } /* Rendering */ bool init() { bool success = true; R(MIN_VELOCITY,MAX_VELOCITY); for (int n = 0; n < CARS; n++) { carPosition[n] = 5*n*CAR_LENGTH; carVelocity[n] = 0; carLane[n] = 1 + (n%LANES); carMaxVelocity[n] = R(MIN_VELOCITY,MAX_VELOCITY); carMergeWait[n] = 0; } draw(); return success; } float wrap(float pos) { if (pos >= SCREEN_WIDTH) { return pos-SCREEN_WIDTH; } else { return pos; } } void update(int n) { float x1 = carPosition[n], x2 = carPosition[(n+1)%CARS]; carPosition[n] = wrap(x1 + DT*carVelocity[n]); int nc = nextCar(n); float dx; if (nc == n) { dx = 1.0; } else { dx = b2b(n,nc); if (dx > 2*CAR_LENGTH) { dx = 1.0; } else { dx = dx/(2*CAR_LENGTH); } } carMergeWait[n] = carMergeWait[n] == 0 ? 0 : carMergeWait[n] - 1; carWheelAngle[n] = wrapDeg(carWheelAngle[n]+carVelocity[n]/CAR_WHEEL_RADIUS); if (carMergeWait[n] == 0 && carMaxVelocity[n]*.9 > carVelocity[n]) { if (checkLaneClear(n,carLane[n] + 1)) { carLane[n] = carLane[n] + 1; carMergeWait[n] = 50; } else if (checkLaneClear(n,carLane[n] - 1)) { carLane[n] = carLane[n] - 1; carMergeWait[n] = 50; } } carVelocity[n] = carMaxVelocity[n]*dx; } bool render() { bool success = true; for (int c = 0; c < CARS; c++) { update(c); } draw(); SDL_Delay(DELAY_WAIT); SDL_RenderPresent(renderer); return success; } int main(int argc, char *argv[ ] ) { if ( !initSDL() || !init() ) { printf("Failed to initialize!\n"); } else { if ( !loadMedia() ) { printf("Failed to load media!\n"); } else { bool quit = false; SDL_Event e; while ( !quit ) { while ( SDL_PollEvent( &e ) != 0 ) { if ( e.type == SDL_QUIT ) { quit = true; } } if (!render()){ quit = true; } } } } close(); return 0; }
cc0ad04fa90e1c1d38dadfd1ea6dc7e691b4a607
bc952d7c5dcf39876d5b1b1ad46a9ede8c84e1df
/mindspore/lite/src/runtime/kernel/arm/nnacl/winograd_utils.cc
3ee722d4ec356097e126afc2d5eefad1773591a6
[ "Apache-2.0", "Libpng", "LGPL-2.1-only", "MIT", "IJG", "Zlib", "BSD-3-Clause-Open-MPI", "AGPL-3.0-only", "MPL-2.0-no-copyleft-exception", "MPL-1.0", "MPL-1.1", "MPL-2.0", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Unlicense", "LicenseRef-scancode-proprietary-license", "BSL-1.0", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
dilingsong/mindspore
f69c88ebc773bb6eaf88162bd038e807f84633bc
4276050f2494cfbf8682560a1647576f859991e8
refs/heads/master
2022-12-01T12:23:13.490558
2020-08-10T09:16:27
2020-08-10T09:16:27
286,463,866
1
0
Apache-2.0
2020-08-10T12:06:08
2020-08-10T12:06:07
null
UTF-8
C++
false
false
263,581
cc
winograd_utils.cc
/** * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "src/runtime/kernel/arm/nnacl/winograd_utils.h" #include <cstdio> #define MIN_UNIT 2 #define MAX_UNIT 8 static OutputTransformUnitFunc outputTransformUnit[] = { nullptr, // 0 nullptr, // 1 OutputTransform8x2Unit, OutputTransform8x3Unit, OutputTransform8x4Unit, OutputTransform8x5Unit, OutputTransform8x6Unit, OutputTransform8x7Unit, }; void InputTransform4x4Unit(const float *src_data, float *dst_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 15 * src_step); float32x4_t t00 = vsubq_f32(src_data_00, vmulq_n_f32(src_data_20, 4)); float32x4_t t01 = vsubq_f32(src_data_01, vmulq_n_f32(src_data_21, 4)); float32x4_t t02 = vsubq_f32(src_data_02, vmulq_n_f32(src_data_22, 4)); float32x4_t t03 = vsubq_f32(src_data_03, vmulq_n_f32(src_data_23, 4)); float32x4_t t10 = vaddq_f32(src_data_10, vmulq_n_f32(src_data_20, 2)); float32x4_t t11 = vaddq_f32(src_data_11, vmulq_n_f32(src_data_21, 2)); float32x4_t t12 = vaddq_f32(src_data_12, vmulq_n_f32(src_data_22, 2)); float32x4_t t13 = vaddq_f32(src_data_13, vmulq_n_f32(src_data_23, 2)); float32x4_t t20 = vsubq_f32(vmulq_n_f32(src_data_20, 2), src_data_10); float32x4_t t21 = vsubq_f32(vmulq_n_f32(src_data_21, 2), src_data_11); float32x4_t t22 = vsubq_f32(vmulq_n_f32(src_data_22, 2), src_data_12); float32x4_t t23 = vsubq_f32(vmulq_n_f32(src_data_23, 2), src_data_13); float32x4_t t30 = vsubq_f32(src_data_30, vmulq_n_f32(src_data_10, 0.25)); float32x4_t t31 = vsubq_f32(src_data_31, vmulq_n_f32(src_data_11, 0.25)); float32x4_t t32 = vsubq_f32(src_data_32, vmulq_n_f32(src_data_12, 0.25)); float32x4_t t33 = vsubq_f32(src_data_33, vmulq_n_f32(src_data_13, 0.25)); float32x4_t m00 = vsubq_f32(t00, vmulq_n_f32(t02, 4)); float32x4_t m01 = vaddq_f32(t01, vmulq_n_f32(t02, 2)); float32x4_t m02 = vsubq_f32(vmulq_n_f32(t02, 2), t01); float32x4_t m03 = vsubq_f32(t03, vmulq_n_f32(t01, 0.25)); float32x4_t m10 = vsubq_f32(t10, vmulq_n_f32(t12, 4)); float32x4_t m11 = vaddq_f32(t11, vmulq_n_f32(t12, 2)); float32x4_t m12 = vsubq_f32(vmulq_n_f32(t12, 2), t11); float32x4_t m13 = vsubq_f32(t13, vmulq_n_f32(t11, 0.25)); float32x4_t m20 = vsubq_f32(t20, vmulq_n_f32(t22, 4)); float32x4_t m21 = vaddq_f32(t21, vmulq_n_f32(t22, 2)); float32x4_t m22 = vsubq_f32(vmulq_n_f32(t22, 2), t21); float32x4_t m23 = vsubq_f32(t23, vmulq_n_f32(t21, 0.25)); float32x4_t m30 = vsubq_f32(t30, vmulq_n_f32(t32, 4)); float32x4_t m31 = vaddq_f32(t31, vmulq_n_f32(t32, 2)); float32x4_t m32 = vsubq_f32(vmulq_n_f32(t32, 2), t31); float32x4_t m33 = vsubq_f32(t33, vmulq_n_f32(t31, 0.25)); vst1q_f32(dst_data + 0 * dst_step, m00); vst1q_f32(dst_data + 1 * dst_step, m01); vst1q_f32(dst_data + 2 * dst_step, m02); vst1q_f32(dst_data + 3 * dst_step, m03); vst1q_f32(dst_data + 4 * dst_step, m10); vst1q_f32(dst_data + 5 * dst_step, m11); vst1q_f32(dst_data + 6 * dst_step, m12); vst1q_f32(dst_data + 7 * dst_step, m13); vst1q_f32(dst_data + 8 * dst_step, m20); vst1q_f32(dst_data + 9 * dst_step, m21); vst1q_f32(dst_data + 10 * dst_step, m22); vst1q_f32(dst_data + 11 * dst_step, m23); vst1q_f32(dst_data + 12 * dst_step, m30); vst1q_f32(dst_data + 13 * dst_step, m31); vst1q_f32(dst_data + 14 * dst_step, m32); vst1q_f32(dst_data + 15 * dst_step, m33); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_10 = src_data[i + 4 * src_step]; float src_data_11 = src_data[i + 5 * src_step]; float src_data_12 = src_data[i + 6 * src_step]; float src_data_13 = src_data[i + 7 * src_step]; float src_data_20 = src_data[i + 8 * src_step]; float src_data_21 = src_data[i + 9 * src_step]; float src_data_22 = src_data[i + 10 * src_step]; float src_data_23 = src_data[i + 11 * src_step]; float src_data_30 = src_data[i + 12 * src_step]; float src_data_31 = src_data[i + 13 * src_step]; float src_data_32 = src_data[i + 14 * src_step]; float src_data_33 = src_data[i + 15 * src_step]; float t00 = src_data_00 - 4 * src_data_20; float t01 = src_data_01 - 4 * src_data_21; float t02 = src_data_02 - 4 * src_data_22; float t03 = src_data_03 - 4 * src_data_23; float t10 = src_data_10 + 2 * src_data_20; float t11 = src_data_11 + 2 * src_data_21; float t12 = src_data_12 + 2 * src_data_22; float t13 = src_data_13 + 2 * src_data_23; float t20 = 2 * src_data_20 - src_data_10; float t21 = 2 * src_data_21 - src_data_11; float t22 = 2 * src_data_22 - src_data_12; float t23 = 2 * src_data_23 - src_data_13; float t30 = src_data_30 - 0.25f * src_data_10; float t31 = src_data_31 - 0.25f * src_data_11; float t32 = src_data_32 - 0.25f * src_data_12; float t33 = src_data_33 - 0.25f * src_data_13; float m00 = t00 - 4 * t02; float m01 = t01 + 2 * t02; float m02 = 2 * t02 - t01; float m03 = t03 - 0.25f * t01; float m10 = t10 - 4 * t12; float m11 = t11 + 2 * t12; float m12 = 2 * t12 - t11; float m13 = t13 - 0.25f * t11; float m20 = t20 - 4 * t22; float m21 = t21 + 2 * t22; float m22 = 2 * t22 - t21; float m23 = t23 - 0.25f * t21; float m30 = t30 - 4 * t32; float m31 = t31 + 2 * t32; float m32 = 2 * t32 - t31; float m33 = t33 - 0.25f * t31; (dst_data + i)[0] = m00; (dst_data + i + dst_step)[0] = m01; (dst_data + i + 2 * dst_step)[0] = m02; (dst_data + i + 3 * dst_step)[0] = m03; (dst_data + i + 4 * dst_step)[0] = m10; (dst_data + i + 5 * dst_step)[0] = m11; (dst_data + i + 6 * dst_step)[0] = m12; (dst_data + i + 7 * dst_step)[0] = m13; (dst_data + i + 8 * dst_step)[0] = m20; (dst_data + i + 9 * dst_step)[0] = m21; (dst_data + i + 10 * dst_step)[0] = m22; (dst_data + i + 11 * dst_step)[0] = m23; (dst_data + i + 12 * dst_step)[0] = m30; (dst_data + i + 13 * dst_step)[0] = m31; (dst_data + i + 14 * dst_step)[0] = m32; (dst_data + i + 15 * dst_step)[0] = m33; } #endif } void InputTransform8x8Unit(const float *src_data, float *dst_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t t00 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_00, vmulq_n_f32(src_data_20, 5.44444444444444444444444445)), vmulq_n_f32(src_data_40, 6.222222222222)), vmulq_n_f32(src_data_60, 1.7777777777777)); float32x4_t t01 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_01, vmulq_n_f32(src_data_21, 5.44444444444444444444444445)), vmulq_n_f32(src_data_41, 6.222222222222)), vmulq_n_f32(src_data_61, 1.7777777777777)); float32x4_t t02 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_02, vmulq_n_f32(src_data_22, 5.44444444444444444444444445)), vmulq_n_f32(src_data_42, 6.222222222222)), vmulq_n_f32(src_data_62, 1.7777777777777)); float32x4_t t03 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_03, vmulq_n_f32(src_data_23, 5.44444444444444444444444445)), vmulq_n_f32(src_data_43, 6.222222222222)), vmulq_n_f32(src_data_63, 1.7777777777777)); float32x4_t t04 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_04, vmulq_n_f32(src_data_24, 5.44444444444444444444444445)), vmulq_n_f32(src_data_44, 6.222222222222)), vmulq_n_f32(src_data_64, 1.7777777777777)); float32x4_t t05 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_05, vmulq_n_f32(src_data_25, 5.44444444444444444444444445)), vmulq_n_f32(src_data_45, 6.222222222222)), vmulq_n_f32(src_data_65, 1.7777777777777)); float32x4_t t06 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_06, vmulq_n_f32(src_data_26, 5.44444444444444444444444445)), vmulq_n_f32(src_data_46, 6.222222222222)), vmulq_n_f32(src_data_66, 1.7777777777777)); float32x4_t t07 = vsubq_f32(vaddq_f32(vsubq_f32(src_data_07, vmulq_n_f32(src_data_27, 5.44444444444444444444444445)), vmulq_n_f32(src_data_47, 6.222222222222)), vmulq_n_f32(src_data_67, 1.7777777777777)); float32x4_t t10 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_10, 1.5), vmulq_n_f32(src_data_20, 3)), vmulq_n_f32(src_data_30, 2.166666666666666667)), vmulq_n_f32(src_data_40, 4.333333333333)), vmulq_n_f32(src_data_50, 0.66666666666)), vmulq_n_f32(src_data_60, 1.333333333333)); float32x4_t t11 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_11, 1.5), vmulq_n_f32(src_data_21, 3)), vmulq_n_f32(src_data_31, 2.166666666666666667)), vmulq_n_f32(src_data_41, 4.333333333333)), vmulq_n_f32(src_data_51, 0.66666666666)), vmulq_n_f32(src_data_61, 1.333333333333)); float32x4_t t12 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_12, 1.5), vmulq_n_f32(src_data_22, 3)), vmulq_n_f32(src_data_32, 2.166666666666666667)), vmulq_n_f32(src_data_42, 4.333333333333)), vmulq_n_f32(src_data_52, 0.66666666666)), vmulq_n_f32(src_data_62, 1.333333333333)); float32x4_t t13 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_13, 1.5), vmulq_n_f32(src_data_23, 3)), vmulq_n_f32(src_data_33, 2.166666666666666667)), vmulq_n_f32(src_data_43, 4.333333333333)), vmulq_n_f32(src_data_53, 0.66666666666)), vmulq_n_f32(src_data_63, 1.333333333333)); float32x4_t t14 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_14, 1.5), vmulq_n_f32(src_data_24, 3)), vmulq_n_f32(src_data_34, 2.166666666666666667)), vmulq_n_f32(src_data_44, 4.333333333333)), vmulq_n_f32(src_data_54, 0.66666666666)), vmulq_n_f32(src_data_64, 1.333333333333)); float32x4_t t15 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_15, 1.5), vmulq_n_f32(src_data_25, 3)), vmulq_n_f32(src_data_35, 2.166666666666666667)), vmulq_n_f32(src_data_45, 4.333333333333)), vmulq_n_f32(src_data_55, 0.66666666666)), vmulq_n_f32(src_data_65, 1.333333333333)); float32x4_t t16 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_16, 1.5), vmulq_n_f32(src_data_26, 3)), vmulq_n_f32(src_data_36, 2.166666666666666667)), vmulq_n_f32(src_data_46, 4.333333333333)), vmulq_n_f32(src_data_56, 0.66666666666)), vmulq_n_f32(src_data_66, 1.333333333333)); float32x4_t t17 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_17, 1.5), vmulq_n_f32(src_data_27, 3)), vmulq_n_f32(src_data_37, 2.166666666666666667)), vmulq_n_f32(src_data_47, 4.333333333333)), vmulq_n_f32(src_data_57, 0.66666666666)), vmulq_n_f32(src_data_67, 1.333333333333)); float32x4_t t20 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_10, -1.5), vmulq_n_f32(src_data_20, 3)), vmulq_n_f32(src_data_30, 2.166666666666666667)), vmulq_n_f32(src_data_40, 4.333333333333)), vmulq_n_f32(src_data_50, 0.66666666666)), vmulq_n_f32(src_data_60, 1.333333333333)); float32x4_t t21 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_11, -1.5), vmulq_n_f32(src_data_21, 3)), vmulq_n_f32(src_data_31, 2.166666666666666667)), vmulq_n_f32(src_data_41, 4.333333333333)), vmulq_n_f32(src_data_51, 0.66666666666)), vmulq_n_f32(src_data_61, 1.333333333333)); float32x4_t t22 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_12, -1.5), vmulq_n_f32(src_data_22, 3)), vmulq_n_f32(src_data_32, 2.166666666666666667)), vmulq_n_f32(src_data_42, 4.333333333333)), vmulq_n_f32(src_data_52, 0.66666666666)), vmulq_n_f32(src_data_62, 1.333333333333)); float32x4_t t23 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_13, -1.5), vmulq_n_f32(src_data_23, 3)), vmulq_n_f32(src_data_33, 2.166666666666666667)), vmulq_n_f32(src_data_43, 4.333333333333)), vmulq_n_f32(src_data_53, 0.66666666666)), vmulq_n_f32(src_data_63, 1.333333333333)); float32x4_t t24 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_14, -1.5), vmulq_n_f32(src_data_24, 3)), vmulq_n_f32(src_data_34, 2.166666666666666667)), vmulq_n_f32(src_data_44, 4.333333333333)), vmulq_n_f32(src_data_54, 0.66666666666)), vmulq_n_f32(src_data_64, 1.333333333333)); float32x4_t t25 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_15, -1.5), vmulq_n_f32(src_data_25, 3)), vmulq_n_f32(src_data_35, 2.166666666666666667)), vmulq_n_f32(src_data_45, 4.333333333333)), vmulq_n_f32(src_data_55, 0.66666666666)), vmulq_n_f32(src_data_65, 1.333333333333)); float32x4_t t26 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_16, -1.5), vmulq_n_f32(src_data_26, 3)), vmulq_n_f32(src_data_36, 2.166666666666666667)), vmulq_n_f32(src_data_46, 4.333333333333)), vmulq_n_f32(src_data_56, 0.66666666666)), vmulq_n_f32(src_data_66, 1.333333333333)); float32x4_t t27 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_17, -1.5), vmulq_n_f32(src_data_27, 3)), vmulq_n_f32(src_data_37, 2.166666666666666667)), vmulq_n_f32(src_data_47, 4.333333333333)), vmulq_n_f32(src_data_57, 0.66666666666)), vmulq_n_f32(src_data_67, 1.333333333333)); float32x4_t t30 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_30, src_data_40), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_10, src_data_20), -0.3)), vmulq_n_f32(vaddq_f32(src_data_50, src_data_60), 0.53333333333)); float32x4_t t31 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_31, src_data_41), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_11, src_data_21), -0.3)), vmulq_n_f32(vaddq_f32(src_data_51, src_data_61), 0.53333333333)); float32x4_t t32 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_32, src_data_42), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_12, src_data_22), -0.3)), vmulq_n_f32(vaddq_f32(src_data_52, src_data_62), 0.53333333333)); float32x4_t t33 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_33, src_data_43), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_13, src_data_23), -0.3)), vmulq_n_f32(vaddq_f32(src_data_53, src_data_63), 0.53333333333)); float32x4_t t34 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_34, src_data_44), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_14, src_data_24), -0.3)), vmulq_n_f32(vaddq_f32(src_data_54, src_data_64), 0.53333333333)); float32x4_t t35 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_35, src_data_45), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_15, src_data_25), -0.3)), vmulq_n_f32(vaddq_f32(src_data_55, src_data_65), 0.53333333333)); float32x4_t t36 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_36, src_data_46), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_16, src_data_26), -0.3)), vmulq_n_f32(vaddq_f32(src_data_56, src_data_66), 0.53333333333)); float32x4_t t37 = vsubq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(src_data_37, src_data_47), 1.3333333333333), vmulq_n_f32(vaddq_f32(src_data_17, src_data_27), -0.3)), vmulq_n_f32(vaddq_f32(src_data_57, src_data_67), 0.53333333333)); float32x4_t t40 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_40, src_data_30), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_10, src_data_20), 0.3)), vmulq_n_f32(vsubq_f32(src_data_50, src_data_60), 0.53333333333)); float32x4_t t41 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_41, src_data_31), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_11, src_data_21), 0.3)), vmulq_n_f32(vsubq_f32(src_data_51, src_data_61), 0.53333333333)); float32x4_t t42 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_42, src_data_32), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_12, src_data_22), 0.3)), vmulq_n_f32(vsubq_f32(src_data_52, src_data_62), 0.53333333333)); float32x4_t t43 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_43, src_data_33), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_13, src_data_23), 0.3)), vmulq_n_f32(vsubq_f32(src_data_53, src_data_63), 0.53333333333)); float32x4_t t44 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_44, src_data_34), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_14, src_data_24), 0.3)), vmulq_n_f32(vsubq_f32(src_data_54, src_data_64), 0.53333333333)); float32x4_t t45 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_45, src_data_35), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_15, src_data_25), 0.3)), vmulq_n_f32(vsubq_f32(src_data_55, src_data_65), 0.53333333333)); float32x4_t t46 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_46, src_data_36), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_16, src_data_26), 0.3)), vmulq_n_f32(vsubq_f32(src_data_56, src_data_66), 0.53333333333)); float32x4_t t47 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(src_data_47, src_data_37), 1.3333333333333), vmulq_n_f32(vsubq_f32(src_data_17, src_data_27), 0.3)), vmulq_n_f32(vsubq_f32(src_data_57, src_data_67), 0.53333333333)); float32x4_t t50 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_10, 0.03333333), vmulq_n_f32(src_data_20, 0.022222222)), vmulq_n_f32(src_data_30, 0.1666666666)), vmulq_n_f32(src_data_40, 0.11111111111)), vmulq_n_f32(src_data_50, 0.133333333)), vmulq_n_f32(src_data_60, 0.088888888)); float32x4_t t51 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_11, 0.03333333), vmulq_n_f32(src_data_21, 0.022222222)), vmulq_n_f32(src_data_31, 0.1666666666)), vmulq_n_f32(src_data_41, 0.11111111111)), vmulq_n_f32(src_data_51, 0.133333333)), vmulq_n_f32(src_data_61, 0.088888888)); float32x4_t t52 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_12, 0.03333333), vmulq_n_f32(src_data_22, 0.022222222)), vmulq_n_f32(src_data_32, 0.1666666666)), vmulq_n_f32(src_data_42, 0.11111111111)), vmulq_n_f32(src_data_52, 0.133333333)), vmulq_n_f32(src_data_62, 0.088888888)); float32x4_t t53 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_13, 0.03333333), vmulq_n_f32(src_data_23, 0.022222222)), vmulq_n_f32(src_data_33, 0.1666666666)), vmulq_n_f32(src_data_43, 0.11111111111)), vmulq_n_f32(src_data_53, 0.133333333)), vmulq_n_f32(src_data_63, 0.088888888)); float32x4_t t54 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_14, 0.03333333), vmulq_n_f32(src_data_24, 0.022222222)), vmulq_n_f32(src_data_34, 0.1666666666)), vmulq_n_f32(src_data_44, 0.11111111111)), vmulq_n_f32(src_data_54, 0.133333333)), vmulq_n_f32(src_data_64, 0.088888888)); float32x4_t t55 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_15, 0.03333333), vmulq_n_f32(src_data_25, 0.022222222)), vmulq_n_f32(src_data_35, 0.1666666666)), vmulq_n_f32(src_data_45, 0.11111111111)), vmulq_n_f32(src_data_55, 0.133333333)), vmulq_n_f32(src_data_65, 0.088888888)); float32x4_t t56 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_16, 0.03333333), vmulq_n_f32(src_data_26, 0.022222222)), vmulq_n_f32(src_data_36, 0.1666666666)), vmulq_n_f32(src_data_46, 0.11111111111)), vmulq_n_f32(src_data_56, 0.133333333)), vmulq_n_f32(src_data_66, 0.088888888)); float32x4_t t57 = vaddq_f32( vaddq_f32( vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_17, 0.03333333), vmulq_n_f32(src_data_27, 0.022222222)), vmulq_n_f32(src_data_37, 0.1666666666)), vmulq_n_f32(src_data_47, 0.11111111111)), vmulq_n_f32(src_data_57, 0.133333333)), vmulq_n_f32(src_data_67, 0.088888888)); float32x4_t t60 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_10, -0.03333333), vmulq_n_f32(src_data_20, 0.022222222)), vmulq_n_f32(src_data_30, 0.1666666666)), vmulq_n_f32(src_data_40, 0.11111111111)), vmulq_n_f32(src_data_50, -0.133333333)), vmulq_n_f32(src_data_60, 0.088888888)); float32x4_t t61 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_11, -0.03333333), vmulq_n_f32(src_data_21, 0.022222222)), vmulq_n_f32(src_data_31, 0.1666666666)), vmulq_n_f32(src_data_41, 0.11111111111)), vmulq_n_f32(src_data_51, -0.133333333)), vmulq_n_f32(src_data_61, 0.088888888)); float32x4_t t62 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_12, -0.03333333), vmulq_n_f32(src_data_22, 0.022222222)), vmulq_n_f32(src_data_32, 0.1666666666)), vmulq_n_f32(src_data_42, 0.11111111111)), vmulq_n_f32(src_data_52, -0.133333333)), vmulq_n_f32(src_data_62, 0.088888888)); float32x4_t t63 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_13, -0.03333333), vmulq_n_f32(src_data_23, 0.022222222)), vmulq_n_f32(src_data_33, 0.1666666666)), vmulq_n_f32(src_data_43, 0.11111111111)), vmulq_n_f32(src_data_53, -0.133333333)), vmulq_n_f32(src_data_63, 0.088888888)); float32x4_t t64 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_14, -0.03333333), vmulq_n_f32(src_data_24, 0.022222222)), vmulq_n_f32(src_data_34, 0.1666666666)), vmulq_n_f32(src_data_44, 0.11111111111)), vmulq_n_f32(src_data_54, -0.133333333)), vmulq_n_f32(src_data_64, 0.088888888)); float32x4_t t65 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_15, -0.03333333), vmulq_n_f32(src_data_25, 0.022222222)), vmulq_n_f32(src_data_35, 0.1666666666)), vmulq_n_f32(src_data_45, 0.11111111111)), vmulq_n_f32(src_data_55, -0.133333333)), vmulq_n_f32(src_data_65, 0.088888888)); float32x4_t t66 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_16, -0.03333333), vmulq_n_f32(src_data_26, 0.022222222)), vmulq_n_f32(src_data_36, 0.1666666666)), vmulq_n_f32(src_data_46, 0.11111111111)), vmulq_n_f32(src_data_56, -0.133333333)), vmulq_n_f32(src_data_66, 0.088888888)); float32x4_t t67 = vaddq_f32( vaddq_f32( vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(src_data_17, -0.03333333), vmulq_n_f32(src_data_27, 0.022222222)), vmulq_n_f32(src_data_37, 0.1666666666)), vmulq_n_f32(src_data_47, 0.11111111111)), vmulq_n_f32(src_data_57, -0.133333333)), vmulq_n_f32(src_data_67, 0.088888888)); float32x4_t t70 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_30, 3.0625), vmulq_n_f32(src_data_10, -0.5625)), vmulq_n_f32(src_data_50, 3.5)), src_data_70); float32x4_t t71 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_31, 3.0625), vmulq_n_f32(src_data_11, -0.5625)), vmulq_n_f32(src_data_51, 3.5)), src_data_71); float32x4_t t72 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_32, 3.0625), vmulq_n_f32(src_data_12, -0.5625)), vmulq_n_f32(src_data_52, 3.5)), src_data_72); float32x4_t t73 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_33, 3.0625), vmulq_n_f32(src_data_13, -0.5625)), vmulq_n_f32(src_data_53, 3.5)), src_data_73); float32x4_t t74 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_34, 3.0625), vmulq_n_f32(src_data_14, -0.5625)), vmulq_n_f32(src_data_54, 3.5)), src_data_74); float32x4_t t75 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_35, 3.0625), vmulq_n_f32(src_data_15, -0.5625)), vmulq_n_f32(src_data_55, 3.5)), src_data_75); float32x4_t t76 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_36, 3.0625), vmulq_n_f32(src_data_16, -0.5625)), vmulq_n_f32(src_data_56, 3.5)), src_data_76); float32x4_t t77 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(src_data_37, 3.0625), vmulq_n_f32(src_data_17, -0.5625)), vmulq_n_f32(src_data_57, 3.5)), src_data_77); float32x4_t m00 = vsubq_f32(vaddq_f32(vsubq_f32(t00, vmulq_n_f32(t02, 5.444444444444444)), vmulq_n_f32(t04, 6.22222222222)), vmulq_n_f32(t06, 1.77777777777777777778)); float32x4_t m01 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t01, 1.5), vmulq_n_f32(t02, 3)), vmulq_n_f32(t03, 2.16666666666666667)), vmulq_n_f32(t04, 4.3333333333)), vmulq_n_f32(t05, 0.66666666667)), vmulq_n_f32(t06, 1.333333333333)); float32x4_t m02 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t01, -1.5), vmulq_n_f32(t02, 3)), vmulq_n_f32(t03, 2.16666666666666667)), vmulq_n_f32(t04, 4.3333333333)), vmulq_n_f32(t05, 0.66666666667)), vmulq_n_f32(t06, 1.333333333333)); float32x4_t m03 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t01, t02), -0.3), vmulq_n_f32(vaddq_f32(t03, t04), 1.33333333333)), vmulq_n_f32(vaddq_f32(t05, t06), -0.533333333333)); float32x4_t m04 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t01, t02), 0.3), vmulq_n_f32(vsubq_f32(t04, t03), 1.33333333333)), vmulq_n_f32(vsubq_f32(t05, t06), 0.533333333333)); float32x4_t m05 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t01, 0.03333333), vmulq_n_f32(t02, 0.0222222)), vmulq_n_f32(t03, 0.16666666666666667)), vmulq_n_f32(t04, 0.11111111111)), vmulq_n_f32(t05, 0.1333333333)), vmulq_n_f32(t06, 0.08888888888)); float32x4_t m06 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t01, -0.03333333), vmulq_n_f32(t02, 0.0222222)), vmulq_n_f32(t03, 0.16666666666666667)), vmulq_n_f32(t04, 0.11111111111)), vmulq_n_f32(t05, 0.1333333333)), vmulq_n_f32(t06, 0.08888888888)); float32x4_t m07 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t01, -0.5625), vmulq_n_f32(t03, 3.0625)), vmulq_n_f32(t05, 3.5)), t07); float32x4_t m10 = vsubq_f32(vaddq_f32(vsubq_f32(t10, vmulq_n_f32(t12, 5.444444444444444)), vmulq_n_f32(t14, 6.22222222222)), vmulq_n_f32(t16, 1.77777777777777777778)); float32x4_t m11 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t11, 1.5), vmulq_n_f32(t12, 3)), vmulq_n_f32(t13, 2.16666666666666667)), vmulq_n_f32(t14, 4.3333333333)), vmulq_n_f32(t15, 0.66666666667)), vmulq_n_f32(t16, 1.333333333333)); float32x4_t m12 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t11, -1.5), vmulq_n_f32(t12, 3)), vmulq_n_f32(t13, 2.16666666666666667)), vmulq_n_f32(t14, 4.3333333333)), vmulq_n_f32(t15, 0.66666666667)), vmulq_n_f32(t16, 1.333333333333)); float32x4_t m13 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t11, t12), -0.3), vmulq_n_f32(vaddq_f32(t13, t14), 1.33333333333)), vmulq_n_f32(vaddq_f32(t15, t16), -0.533333333333)); float32x4_t m14 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t11, t12), 0.3), vmulq_n_f32(vsubq_f32(t14, t13), 1.33333333333)), vmulq_n_f32(vsubq_f32(t15, t16), 0.533333333333)); float32x4_t m15 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t11, 0.03333333), vmulq_n_f32(t12, 0.0222222)), vmulq_n_f32(t13, 0.16666666666666667)), vmulq_n_f32(t14, 0.11111111111)), vmulq_n_f32(t15, 0.1333333333)), vmulq_n_f32(t16, 0.08888888888)); float32x4_t m16 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t11, -0.03333333), vmulq_n_f32(t12, 0.0222222)), vmulq_n_f32(t13, 0.16666666666666667)), vmulq_n_f32(t14, 0.11111111111)), vmulq_n_f32(t15, 0.1333333333)), vmulq_n_f32(t16, 0.08888888888)); float32x4_t m17 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t11, -0.5625), vmulq_n_f32(t13, 3.0625)), vmulq_n_f32(t15, 3.5)), t17); float32x4_t m20 = vsubq_f32(vaddq_f32(vsubq_f32(t20, vmulq_n_f32(t22, 5.444444444444444)), vmulq_n_f32(t24, 6.22222222222)), vmulq_n_f32(t26, 1.77777777777777777778)); float32x4_t m21 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t21, 1.5), vmulq_n_f32(t22, 3)), vmulq_n_f32(t23, 2.16666666666666667)), vmulq_n_f32(t24, 4.3333333333)), vmulq_n_f32(t25, 0.66666666667)), vmulq_n_f32(t26, 1.333333333333)); float32x4_t m22 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t21, -1.5), vmulq_n_f32(t22, 3)), vmulq_n_f32(t23, 2.16666666666666667)), vmulq_n_f32(t24, 4.3333333333)), vmulq_n_f32(t25, 0.66666666667)), vmulq_n_f32(t26, 1.333333333333)); float32x4_t m23 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t21, t22), -0.3), vmulq_n_f32(vaddq_f32(t23, t24), 1.33333333333)), vmulq_n_f32(vaddq_f32(t25, t26), -0.533333333333)); float32x4_t m24 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t21, t22), 0.3), vmulq_n_f32(vsubq_f32(t24, t23), 1.33333333333)), vmulq_n_f32(vsubq_f32(t25, t26), 0.533333333333)); float32x4_t m25 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t21, 0.03333333), vmulq_n_f32(t22, 0.0222222)), vmulq_n_f32(t23, 0.16666666666666667)), vmulq_n_f32(t24, 0.11111111111)), vmulq_n_f32(t25, 0.1333333333)), vmulq_n_f32(t26, 0.08888888888)); float32x4_t m26 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t21, -0.03333333), vmulq_n_f32(t22, 0.0222222)), vmulq_n_f32(t23, 0.16666666666666667)), vmulq_n_f32(t24, 0.11111111111)), vmulq_n_f32(t25, 0.1333333333)), vmulq_n_f32(t26, 0.08888888888)); float32x4_t m27 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t21, -0.5625), vmulq_n_f32(t23, 3.0625)), vmulq_n_f32(t25, 3.5)), t27); float32x4_t m30 = vsubq_f32(vaddq_f32(vsubq_f32(t30, vmulq_n_f32(t32, 5.444444444444444)), vmulq_n_f32(t34, 6.22222222222)), vmulq_n_f32(t36, 1.77777777777777777778)); float32x4_t m31 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t31, 1.5), vmulq_n_f32(t32, 3)), vmulq_n_f32(t33, 2.16666666666666667)), vmulq_n_f32(t34, 4.3333333333)), vmulq_n_f32(t35, 0.66666666667)), vmulq_n_f32(t36, 1.333333333333)); float32x4_t m32 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t31, -1.5), vmulq_n_f32(t32, 3)), vmulq_n_f32(t33, 2.16666666666666667)), vmulq_n_f32(t34, 4.3333333333)), vmulq_n_f32(t35, 0.66666666667)), vmulq_n_f32(t36, 1.333333333333)); float32x4_t m33 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t31, t32), -0.3), vmulq_n_f32(vaddq_f32(t33, t34), 1.33333333333)), vmulq_n_f32(vaddq_f32(t35, t36), -0.533333333333)); float32x4_t m34 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t31, t32), 0.3), vmulq_n_f32(vsubq_f32(t34, t33), 1.33333333333)), vmulq_n_f32(vsubq_f32(t35, t36), 0.533333333333)); float32x4_t m35 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t31, 0.03333333), vmulq_n_f32(t32, 0.0222222)), vmulq_n_f32(t33, 0.16666666666666667)), vmulq_n_f32(t34, 0.11111111111)), vmulq_n_f32(t35, 0.1333333333)), vmulq_n_f32(t36, 0.08888888888)); float32x4_t m36 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t31, -0.03333333), vmulq_n_f32(t32, 0.0222222)), vmulq_n_f32(t33, 0.16666666666666667)), vmulq_n_f32(t34, 0.11111111111)), vmulq_n_f32(t35, 0.1333333333)), vmulq_n_f32(t36, 0.08888888888)); float32x4_t m37 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t31, -0.5625), vmulq_n_f32(t33, 3.0625)), vmulq_n_f32(t35, 3.5)), t37); float32x4_t m40 = vsubq_f32(vaddq_f32(vsubq_f32(t40, vmulq_n_f32(t42, 5.444444444444444)), vmulq_n_f32(t44, 6.22222222222)), vmulq_n_f32(t46, 1.77777777777777777778)); float32x4_t m41 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t41, 1.5), vmulq_n_f32(t42, 3)), vmulq_n_f32(t43, 2.16666666666666667)), vmulq_n_f32(t44, 4.3333333333)), vmulq_n_f32(t45, 0.66666666667)), vmulq_n_f32(t46, 1.333333333333)); float32x4_t m42 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t41, -1.5), vmulq_n_f32(t42, 3)), vmulq_n_f32(t43, 2.16666666666666667)), vmulq_n_f32(t44, 4.3333333333)), vmulq_n_f32(t45, 0.66666666667)), vmulq_n_f32(t46, 1.333333333333)); float32x4_t m43 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t41, t42), -0.3), vmulq_n_f32(vaddq_f32(t43, t44), 1.33333333333)), vmulq_n_f32(vaddq_f32(t45, t46), -0.533333333333)); float32x4_t m44 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t41, t42), 0.3), vmulq_n_f32(vsubq_f32(t44, t43), 1.33333333333)), vmulq_n_f32(vsubq_f32(t45, t46), 0.533333333333)); float32x4_t m45 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t41, 0.03333333), vmulq_n_f32(t42, 0.0222222)), vmulq_n_f32(t43, 0.16666666666666667)), vmulq_n_f32(t44, 0.11111111111)), vmulq_n_f32(t45, 0.1333333333)), vmulq_n_f32(t46, 0.08888888888)); float32x4_t m46 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t41, -0.03333333), vmulq_n_f32(t42, 0.0222222)), vmulq_n_f32(t43, 0.16666666666666667)), vmulq_n_f32(t44, 0.11111111111)), vmulq_n_f32(t45, 0.1333333333)), vmulq_n_f32(t46, 0.08888888888)); float32x4_t m47 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t41, -0.5625), vmulq_n_f32(t43, 3.0625)), vmulq_n_f32(t45, 3.5)), t47); float32x4_t m50 = vsubq_f32(vaddq_f32(vsubq_f32(t50, vmulq_n_f32(t52, 5.444444444444444)), vmulq_n_f32(t54, 6.22222222222)), vmulq_n_f32(t56, 1.77777777777777777778)); float32x4_t m51 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t51, 1.5), vmulq_n_f32(t52, 3)), vmulq_n_f32(t53, 2.16666666666666667)), vmulq_n_f32(t54, 4.3333333333)), vmulq_n_f32(t55, 0.66666666667)), vmulq_n_f32(t56, 1.333333333333)); float32x4_t m52 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t51, -1.5), vmulq_n_f32(t52, 3)), vmulq_n_f32(t53, 2.16666666666666667)), vmulq_n_f32(t54, 4.3333333333)), vmulq_n_f32(t55, 0.66666666667)), vmulq_n_f32(t56, 1.333333333333)); float32x4_t m53 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t51, t52), -0.3), vmulq_n_f32(vaddq_f32(t53, t54), 1.33333333333)), vmulq_n_f32(vaddq_f32(t55, t56), -0.533333333333)); float32x4_t m54 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t51, t52), 0.3), vmulq_n_f32(vsubq_f32(t54, t53), 1.33333333333)), vmulq_n_f32(vsubq_f32(t55, t56), 0.533333333333)); float32x4_t m55 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t51, 0.03333333), vmulq_n_f32(t52, 0.0222222)), vmulq_n_f32(t53, 0.16666666666666667)), vmulq_n_f32(t54, 0.11111111111)), vmulq_n_f32(t55, 0.1333333333)), vmulq_n_f32(t56, 0.08888888888)); float32x4_t m56 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t51, -0.03333333), vmulq_n_f32(t52, 0.0222222)), vmulq_n_f32(t53, 0.16666666666666667)), vmulq_n_f32(t54, 0.11111111111)), vmulq_n_f32(t55, 0.1333333333)), vmulq_n_f32(t56, 0.08888888888)); float32x4_t m57 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t51, -0.5625), vmulq_n_f32(t53, 3.0625)), vmulq_n_f32(t55, 3.5)), t57); float32x4_t m60 = vsubq_f32(vaddq_f32(vsubq_f32(t60, vmulq_n_f32(t62, 5.444444444444444)), vmulq_n_f32(t64, 6.22222222222)), vmulq_n_f32(t66, 1.77777777777777777778)); float32x4_t m61 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t61, 1.5), vmulq_n_f32(t62, 3)), vmulq_n_f32(t63, 2.16666666666666667)), vmulq_n_f32(t64, 4.3333333333)), vmulq_n_f32(t65, 0.66666666667)), vmulq_n_f32(t66, 1.333333333333)); float32x4_t m62 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t61, -1.5), vmulq_n_f32(t62, 3)), vmulq_n_f32(t63, 2.16666666666666667)), vmulq_n_f32(t64, 4.3333333333)), vmulq_n_f32(t65, 0.66666666667)), vmulq_n_f32(t66, 1.333333333333)); float32x4_t m63 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t61, t62), -0.3), vmulq_n_f32(vaddq_f32(t63, t64), 1.33333333333)), vmulq_n_f32(vaddq_f32(t65, t66), -0.533333333333)); float32x4_t m64 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t61, t62), 0.3), vmulq_n_f32(vsubq_f32(t64, t63), 1.33333333333)), vmulq_n_f32(vsubq_f32(t65, t66), 0.533333333333)); float32x4_t m65 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t61, 0.03333333), vmulq_n_f32(t62, 0.0222222)), vmulq_n_f32(t63, 0.16666666666666667)), vmulq_n_f32(t64, 0.11111111111)), vmulq_n_f32(t65, 0.1333333333)), vmulq_n_f32(t66, 0.08888888888)); float32x4_t m66 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t61, -0.03333333), vmulq_n_f32(t62, 0.0222222)), vmulq_n_f32(t63, 0.16666666666666667)), vmulq_n_f32(t64, 0.11111111111)), vmulq_n_f32(t65, 0.1333333333)), vmulq_n_f32(t66, 0.08888888888)); float32x4_t m67 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t61, -0.5625), vmulq_n_f32(t63, 3.0625)), vmulq_n_f32(t65, 3.5)), t67); float32x4_t m70 = vsubq_f32(vaddq_f32(vsubq_f32(t70, vmulq_n_f32(t72, 5.444444444444444)), vmulq_n_f32(t74, 6.22222222222)), vmulq_n_f32(t76, 1.77777777777777777778)); float32x4_t m71 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t71, 1.5), vmulq_n_f32(t72, 3)), vmulq_n_f32(t73, 2.16666666666666667)), vmulq_n_f32(t74, 4.3333333333)), vmulq_n_f32(t75, 0.66666666667)), vmulq_n_f32(t76, 1.333333333333)); float32x4_t m72 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t71, -1.5), vmulq_n_f32(t72, 3)), vmulq_n_f32(t73, 2.16666666666666667)), vmulq_n_f32(t74, 4.3333333333)), vmulq_n_f32(t75, 0.66666666667)), vmulq_n_f32(t76, 1.333333333333)); float32x4_t m73 = vaddq_f32(vaddq_f32(vmulq_n_f32(vaddq_f32(t71, t72), -0.3), vmulq_n_f32(vaddq_f32(t73, t74), 1.33333333333)), vmulq_n_f32(vaddq_f32(t75, t76), -0.533333333333)); float32x4_t m74 = vaddq_f32(vaddq_f32(vmulq_n_f32(vsubq_f32(t71, t72), 0.3), vmulq_n_f32(vsubq_f32(t74, t73), 1.33333333333)), vmulq_n_f32(vsubq_f32(t75, t76), 0.533333333333)); float32x4_t m75 = vaddq_f32(vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t71, 0.03333333), vmulq_n_f32(t72, 0.0222222)), vmulq_n_f32(t73, 0.16666666666666667)), vmulq_n_f32(t74, 0.11111111111)), vmulq_n_f32(t75, 0.1333333333)), vmulq_n_f32(t76, 0.08888888888)); float32x4_t m76 = vaddq_f32(vsubq_f32(vsubq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(t71, -0.03333333), vmulq_n_f32(t72, 0.0222222)), vmulq_n_f32(t73, 0.16666666666666667)), vmulq_n_f32(t74, 0.11111111111)), vmulq_n_f32(t75, 0.1333333333)), vmulq_n_f32(t76, 0.08888888888)); float32x4_t m77 = vaddq_f32(vsubq_f32(vaddq_f32(vmulq_n_f32(t71, -0.5625), vmulq_n_f32(t73, 3.0625)), vmulq_n_f32(t75, 3.5)), t77); vst1q_f32(dst_data + 0 * dst_step, m00); vst1q_f32(dst_data + 1 * dst_step, m01); vst1q_f32(dst_data + 2 * dst_step, m02); vst1q_f32(dst_data + 3 * dst_step, m03); vst1q_f32(dst_data + 4 * dst_step, m04); vst1q_f32(dst_data + 5 * dst_step, m05); vst1q_f32(dst_data + 6 * dst_step, m06); vst1q_f32(dst_data + 7 * dst_step, m07); vst1q_f32(dst_data + 8 * dst_step, m10); vst1q_f32(dst_data + 9 * dst_step, m11); vst1q_f32(dst_data + 10 * dst_step, m12); vst1q_f32(dst_data + 11 * dst_step, m13); vst1q_f32(dst_data + 12 * dst_step, m14); vst1q_f32(dst_data + 13 * dst_step, m15); vst1q_f32(dst_data + 14 * dst_step, m16); vst1q_f32(dst_data + 15 * dst_step, m17); vst1q_f32(dst_data + 16 * dst_step, m20); vst1q_f32(dst_data + 17 * dst_step, m21); vst1q_f32(dst_data + 18 * dst_step, m22); vst1q_f32(dst_data + 19 * dst_step, m23); vst1q_f32(dst_data + 20 * dst_step, m24); vst1q_f32(dst_data + 21 * dst_step, m25); vst1q_f32(dst_data + 22 * dst_step, m26); vst1q_f32(dst_data + 23 * dst_step, m27); vst1q_f32(dst_data + 24 * dst_step, m30); vst1q_f32(dst_data + 25 * dst_step, m31); vst1q_f32(dst_data + 26 * dst_step, m32); vst1q_f32(dst_data + 27 * dst_step, m33); vst1q_f32(dst_data + 28 * dst_step, m34); vst1q_f32(dst_data + 29 * dst_step, m35); vst1q_f32(dst_data + 30 * dst_step, m36); vst1q_f32(dst_data + 31 * dst_step, m37); vst1q_f32(dst_data + 32 * dst_step, m40); vst1q_f32(dst_data + 33 * dst_step, m41); vst1q_f32(dst_data + 34 * dst_step, m42); vst1q_f32(dst_data + 35 * dst_step, m43); vst1q_f32(dst_data + 36 * dst_step, m44); vst1q_f32(dst_data + 37 * dst_step, m45); vst1q_f32(dst_data + 38 * dst_step, m46); vst1q_f32(dst_data + 39 * dst_step, m47); vst1q_f32(dst_data + 40 * dst_step, m50); vst1q_f32(dst_data + 41 * dst_step, m51); vst1q_f32(dst_data + 42 * dst_step, m52); vst1q_f32(dst_data + 43 * dst_step, m53); vst1q_f32(dst_data + 44 * dst_step, m54); vst1q_f32(dst_data + 45 * dst_step, m55); vst1q_f32(dst_data + 46 * dst_step, m56); vst1q_f32(dst_data + 47 * dst_step, m57); vst1q_f32(dst_data + 48 * dst_step, m60); vst1q_f32(dst_data + 49 * dst_step, m61); vst1q_f32(dst_data + 50 * dst_step, m62); vst1q_f32(dst_data + 51 * dst_step, m63); vst1q_f32(dst_data + 52 * dst_step, m64); vst1q_f32(dst_data + 53 * dst_step, m65); vst1q_f32(dst_data + 54 * dst_step, m66); vst1q_f32(dst_data + 55 * dst_step, m67); vst1q_f32(dst_data + 56 * dst_step, m70); vst1q_f32(dst_data + 57 * dst_step, m71); vst1q_f32(dst_data + 58 * dst_step, m72); vst1q_f32(dst_data + 59 * dst_step, m73); vst1q_f32(dst_data + 60 * dst_step, m74); vst1q_f32(dst_data + 61 * dst_step, m75); vst1q_f32(dst_data + 62 * dst_step, m76); vst1q_f32(dst_data + 63 * dst_step, m77); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float t00 = src_data_00 - 5.444444444444444445125f * src_data_20 + 6.222222222222222222223f * src_data_40 - 1.77777777777777778f * src_data_60; float t01 = src_data_01 - 5.444444444444444445125f * src_data_21 + 6.222222222222222222223f * src_data_41 - 1.77777777777777778f * src_data_61; float t02 = src_data_02 - 5.444444444444444445125f * src_data_22 + 6.222222222222222222223f * src_data_42 - 1.77777777777777778f * src_data_62; float t03 = src_data_03 - 5.444444444444444445125f * src_data_23 + 6.222222222222222222223f * src_data_43 - 1.77777777777777778f * src_data_63; float t04 = src_data_04 - 5.444444444444444445125f * src_data_24 + 6.222222222222222222223f * src_data_44 - 1.77777777777777778f * src_data_64; float t05 = src_data_05 - 5.444444444444444445125f * src_data_25 + 6.222222222222222222223f * src_data_45 - 1.77777777777777778f * src_data_65; float t06 = src_data_06 - 5.444444444444444445125f * src_data_26 + 6.222222222222222222223f * src_data_46 - 1.77777777777777778f * src_data_66; float t07 = src_data_07 - 5.444444444444444445125f * src_data_27 + 6.222222222222222222223f * src_data_47 - 1.77777777777777778f * src_data_67; float t10 = 1.5f * src_data_10 + 3.0f * src_data_20 - 2.1666666666666667f * src_data_30 - 4.333333333333333333f * src_data_40 + 0.66666666666666667f * src_data_50 + 1.333333333333333f * src_data_60; float t11 = 1.5f * src_data_11 + 3.0f * src_data_21 - 2.1666666666666667f * src_data_31 - 4.333333333333333333f * src_data_41 + 0.66666666666666667f * src_data_51 + 1.333333333333333f * src_data_61; float t12 = 1.5f * src_data_12 + 3.0f * src_data_22 - 2.1666666666666667f * src_data_32 - 4.333333333333333333f * src_data_42 + 0.66666666666666667f * src_data_52 + 1.333333333333333f * src_data_62; float t13 = 1.5f * src_data_13 + 3.0f * src_data_23 - 2.1666666666666667f * src_data_33 - 4.333333333333333333f * src_data_43 + 0.66666666666666667f * src_data_53 + 1.333333333333333f * src_data_63; float t14 = 1.5f * src_data_14 + 3.0f * src_data_24 - 2.1666666666666667f * src_data_34 - 4.333333333333333333f * src_data_44 + 0.66666666666666667f * src_data_54 + 1.333333333333333f * src_data_64; float t15 = 1.5f * src_data_15 + 3.0f * src_data_25 - 2.1666666666666667f * src_data_35 - 4.333333333333333333f * src_data_45 + 0.66666666666666667f * src_data_55 + 1.333333333333333f * src_data_65; float t16 = 1.5f * src_data_16 + 3.0f * src_data_26 - 2.1666666666666667f * src_data_36 - 4.333333333333333333f * src_data_46 + 0.66666666666666667f * src_data_56 + 1.333333333333333f * src_data_66; float t17 = 1.5f * src_data_17 + 3.0f * src_data_27 - 2.1666666666666667f * src_data_37 - 4.333333333333333333f * src_data_47 + 0.66666666666666667f * src_data_57 + 1.333333333333333f * src_data_67; float t20 = -1.5f * src_data_10 + 3.0f * src_data_20 + 2.1666666666666667f * src_data_30 - 4.333333333333333333f * src_data_40 - 0.66666666666666667f * src_data_50 + 1.333333333333333f * src_data_60; float t21 = -1.5f * src_data_11 + 3.0f * src_data_21 + 2.1666666666666667f * src_data_31 - 4.333333333333333333f * src_data_41 - 0.66666666666666667f * src_data_51 + 1.333333333333333f * src_data_61; float t22 = -1.5f * src_data_12 + 3.0f * src_data_22 + 2.1666666666666667f * src_data_32 - 4.333333333333333333f * src_data_42 - 0.66666666666666667f * src_data_52 + 1.333333333333333f * src_data_62; float t23 = -1.5f * src_data_13 + 3.0f * src_data_23 + 2.1666666666666667f * src_data_33 - 4.333333333333333333f * src_data_43 - 0.66666666666666667f * src_data_53 + 1.333333333333333f * src_data_63; float t24 = -1.5f * src_data_14 + 3.0f * src_data_24 + 2.1666666666666667f * src_data_34 - 4.333333333333333333f * src_data_44 - 0.66666666666666667f * src_data_54 + 1.333333333333333f * src_data_64; float t25 = -1.5f * src_data_15 + 3.0f * src_data_25 + 2.1666666666666667f * src_data_35 - 4.333333333333333333f * src_data_45 - 0.66666666666666667f * src_data_55 + 1.333333333333333f * src_data_65; float t26 = -1.5f * src_data_16 + 3.0f * src_data_26 + 2.1666666666666667f * src_data_36 - 4.333333333333333333f * src_data_46 - 0.66666666666666667f * src_data_56 + 1.333333333333333f * src_data_66; float t27 = -1.5f * src_data_17 + 3.0f * src_data_27 + 2.1666666666666667f * src_data_37 - 4.333333333333333333f * src_data_47 - 0.66666666666666667f * src_data_57 + 1.333333333333333f * src_data_67; float t30 = -0.3f * (src_data_10 + src_data_20) + 1.33333333333333f * (src_data_30 + src_data_40) - 0.53333333333f * (src_data_50 + src_data_60); float t31 = -0.3f * (src_data_11 + src_data_21) + 1.33333333333333f * (src_data_31 + src_data_41) - 0.53333333333f * (src_data_51 + src_data_61); float t32 = -0.3f * (src_data_12 + src_data_22) + 1.33333333333333f * (src_data_32 + src_data_42) - 0.53333333333f * (src_data_52 + src_data_62); float t33 = -0.3f * (src_data_13 + src_data_23) + 1.33333333333333f * (src_data_33 + src_data_43) - 0.53333333333f * (src_data_53 + src_data_63); float t34 = -0.3f * (src_data_14 + src_data_24) + 1.33333333333333f * (src_data_34 + src_data_44) - 0.53333333333f * (src_data_54 + src_data_64); float t35 = -0.3f * (src_data_15 + src_data_25) + 1.33333333333333f * (src_data_35 + src_data_45) - 0.53333333333f * (src_data_55 + src_data_65); float t36 = -0.3f * (src_data_16 + src_data_26) + 1.33333333333333f * (src_data_36 + src_data_46) - 0.53333333333f * (src_data_56 + src_data_66); float t37 = -0.3f * (src_data_17 + src_data_27) + 1.33333333333333f * (src_data_37 + src_data_47) - 0.53333333333f * (src_data_57 + src_data_67); float t40 = 0.3f * (src_data_10 - src_data_20) + 1.33333333333333f * (src_data_40 - src_data_30) + 0.53333333333f * (src_data_50 - src_data_60); float t41 = 0.3f * (src_data_11 - src_data_21) + 1.33333333333333f * (src_data_41 - src_data_31) + 0.53333333333f * (src_data_51 - src_data_61); float t42 = 0.3f * (src_data_12 - src_data_22) + 1.33333333333333f * (src_data_42 - src_data_32) + 0.53333333333f * (src_data_52 - src_data_62); float t43 = 0.3f * (src_data_13 - src_data_23) + 1.33333333333333f * (src_data_43 - src_data_33) + 0.53333333333f * (src_data_53 - src_data_63); float t44 = 0.3f * (src_data_14 - src_data_24) + 1.33333333333333f * (src_data_44 - src_data_34) + 0.53333333333f * (src_data_54 - src_data_64); float t45 = 0.3f * (src_data_15 - src_data_25) + 1.33333333333333f * (src_data_45 - src_data_35) + 0.53333333333f * (src_data_55 - src_data_65); float t46 = 0.3f * (src_data_16 - src_data_26) + 1.33333333333333f * (src_data_46 - src_data_36) + 0.53333333333f * (src_data_56 - src_data_66); float t47 = 0.3f * (src_data_17 - src_data_27) + 1.33333333333333f * (src_data_47 - src_data_37) + 0.53333333333f * (src_data_57 - src_data_67); float t50 = 0.0333333333f * src_data_10 + 0.02222222f * src_data_20 - 0.1666666666f * src_data_30 - 0.1111111111f * src_data_40 + 0.1333333f * src_data_50 + 0.0888888f * src_data_60; float t51 = 0.0333333333f * src_data_11 + 0.02222222f * src_data_21 - 0.1666666666f * src_data_31 - 0.1111111111f * src_data_41 + 0.1333333f * src_data_51 + 0.0888888f * src_data_61; float t52 = 0.0333333333f * src_data_12 + 0.02222222f * src_data_22 - 0.1666666666f * src_data_32 - 0.1111111111f * src_data_42 + 0.1333333f * src_data_52 + 0.0888888f * src_data_62; float t53 = 0.0333333333f * src_data_13 + 0.02222222f * src_data_23 - 0.1666666666f * src_data_33 - 0.1111111111f * src_data_43 + 0.1333333f * src_data_53 + 0.0888888f * src_data_63; float t54 = 0.0333333333f * src_data_14 + 0.02222222f * src_data_24 - 0.1666666666f * src_data_34 - 0.1111111111f * src_data_44 + 0.1333333f * src_data_54 + 0.0888888f * src_data_64; float t55 = 0.0333333333f * src_data_15 + 0.02222222f * src_data_25 - 0.1666666666f * src_data_35 - 0.1111111111f * src_data_45 + 0.1333333f * src_data_55 + 0.0888888f * src_data_65; float t56 = 0.0333333333f * src_data_16 + 0.02222222f * src_data_26 - 0.1666666666f * src_data_36 - 0.1111111111f * src_data_46 + 0.1333333f * src_data_56 + 0.0888888f * src_data_66; float t57 = 0.0333333333f * src_data_17 + 0.02222222f * src_data_27 - 0.1666666666f * src_data_37 - 0.1111111111f * src_data_47 + 0.1333333f * src_data_57 + 0.0888888f * src_data_67; float t60 = -0.0333333333f * src_data_10 + 0.02222222f * src_data_20 + 0.1666666666f * src_data_30 - 0.1111111111f * src_data_40 - 0.1333333f * src_data_50 + 0.0888888f * src_data_60; float t61 = -0.0333333333f * src_data_11 + 0.02222222f * src_data_21 + 0.1666666666f * src_data_31 - 0.1111111111f * src_data_41 - 0.1333333f * src_data_51 + 0.0888888f * src_data_61; float t62 = -0.0333333333f * src_data_12 + 0.02222222f * src_data_22 + 0.1666666666f * src_data_32 - 0.1111111111f * src_data_42 - 0.1333333f * src_data_52 + 0.0888888f * src_data_62; float t63 = -0.0333333333f * src_data_13 + 0.02222222f * src_data_23 + 0.1666666666f * src_data_33 - 0.1111111111f * src_data_43 - 0.1333333f * src_data_53 + 0.0888888f * src_data_63; float t64 = -0.0333333333f * src_data_14 + 0.02222222f * src_data_24 + 0.1666666666f * src_data_34 - 0.1111111111f * src_data_44 - 0.1333333f * src_data_54 + 0.0888888f * src_data_64; float t65 = -0.0333333333f * src_data_15 + 0.02222222f * src_data_25 + 0.1666666666f * src_data_35 - 0.1111111111f * src_data_45 - 0.1333333f * src_data_55 + 0.0888888f * src_data_65; float t66 = -0.0333333333f * src_data_16 + 0.02222222f * src_data_26 + 0.1666666666f * src_data_36 - 0.1111111111f * src_data_46 - 0.1333333f * src_data_56 + 0.0888888f * src_data_66; float t67 = -0.0333333333f * src_data_17 + 0.02222222f * src_data_27 + 0.1666666666f * src_data_37 - 0.1111111111f * src_data_47 - 0.1333333f * src_data_57 + 0.0888888f * src_data_67; float t70 = -0.5625f * src_data_10 + 3.0625f * src_data_30 - 3.5f * src_data_50 + src_data_70; float t71 = -0.5625f * src_data_11 + 3.0625f * src_data_31 - 3.5f * src_data_51 + src_data_71; float t72 = -0.5625f * src_data_12 + 3.0625f * src_data_32 - 3.5f * src_data_52 + src_data_72; float t73 = -0.5625f * src_data_13 + 3.0625f * src_data_33 - 3.5f * src_data_53 + src_data_73; float t74 = -0.5625f * src_data_14 + 3.0625f * src_data_34 - 3.5f * src_data_54 + src_data_74; float t75 = -0.5625f * src_data_15 + 3.0625f * src_data_35 - 3.5f * src_data_55 + src_data_75; float t76 = -0.5625f * src_data_16 + 3.0625f * src_data_36 - 3.5f * src_data_56 + src_data_76; float t77 = -0.5625f * src_data_17 + 3.0625f * src_data_37 - 3.5f * src_data_57 + src_data_77; float m00 = t00 - 5.444444444444444445125f * t02 + 6.222222222222222222223f * t04 - 1.77777777777777778f * t06; float m01 = 1.5f * t01 + 3.0f * t02 - 2.1666666666666667f * t03 - 4.333333333333333333f * t04 + 0.66666666666666667f * t05 + 1.333333333333333f * t06; float m02 = -1.5f * t01 + 3.0f * t02 + 2.1666666666666667f * t03 - 4.333333333333333333f * t04 - 0.66666666666666667f * t05 + 1.333333333333333f * t06; float m03 = -0.3f * (t01 + t02) + 1.33333333333333f * (t03 + t04) - 0.53333333333f * (t05 + t06); float m04 = 0.3f * (t01 - t02) + 1.33333333333333f * (t04 - t03) + 0.53333333333f * (t05 - t06); float m05 = 0.0333333333f * t01 + 0.02222222f * t02 - 0.1666666666f * t03 - 0.1111111111f * t04 + 0.1333333f * t05 + 0.0888888f * t06; float m06 = -0.0333333333f * t01 + 0.02222222f * t02 + 0.1666666666f * t03 - 0.1111111111f * t04 - 0.1333333f * t05 + 0.0888888f * t06; float m07 = -0.5625f * t01 + 3.0625f * t03 - 3.5f * t05 + t07; float m10 = t10 - 5.444444444444444445125f * t12 + 6.222222222222222222223f * t14 - 1.77777777777777778f * t16; float m11 = 1.5f * t11 + 3.0f * t12 - 2.1666666666666667f * t13 - 4.333333333333333333f * t14 + 0.66666666666666667f * t15 + 1.333333333333333f * t16; float m12 = -1.5f * t11 + 3.0f * t12 + 2.1666666666666667f * t13 - 4.333333333333333333f * t14 - 0.66666666666666667f * t15 + 1.333333333333333f * t16; float m13 = -0.3f * (t11 + t12) + 1.33333333333333f * (t13 + t14) - 0.53333333333f * (t15 + t16); float m14 = 0.3f * (t11 - t12) + 1.33333333333333f * (t14 - t13) + 0.53333333333f * (t15 - t16); float m15 = 0.0333333333f * t11 + 0.02222222f * t12 - 0.1666666666f * t13 - 0.1111111111f * t14 + 0.1333333f * t15 + 0.0888888f * t16; float m16 = -0.0333333333f * t11 + 0.02222222f * t12 + 0.1666666666f * t13 - 0.1111111111f * t14 - 0.1333333f * t15 + 0.0888888f * t16; float m17 = -0.5625f * t11 + 3.0625f * t13 - 3.5f * t15 + t17; float m20 = t20 - 5.444444444444444445125f * t22 + 6.222222222222222222223f * t24 - 1.77777777777777778f * t26; float m21 = 1.5f * t21 + 3.0f * t22 - 2.1666666666666667f * t23 - 4.333333333333333333f * t24 + 0.66666666666666667f * t25 + 1.333333333333333f * t26; float m22 = -1.5f * t21 + 3.0f * t22 + 2.1666666666666667f * t23 - 4.333333333333333333f * t24 - 0.66666666666666667f * t25 + 1.333333333333333f * t26; float m23 = -0.3f * (t21 + t22) + 1.33333333333333f * (t23 + t24) - 0.53333333333f * (t25 + t26); float m24 = 0.3f * (t21 - t22) + 1.33333333333333f * (t24 - t23) + 0.53333333333f * (t25 - t26); float m25 = 0.0333333333f * t21 + 0.02222222f * t22 - 0.1666666666f * t23 - 0.1111111111f * t24 + 0.1333333f * t25 + 0.0888888f * t26; float m26 = -0.0333333333f * t21 + 0.02222222f * t22 + 0.1666666666f * t23 - 0.1111111111f * t24 - 0.1333333f * t25 + 0.0888888f * t26; float m27 = -0.5625f * t21 + 3.0625f * t23 - 3.5f * t25 + t27; float m30 = t30 - 5.444444444444444445125f * t32 + 6.222222222222222222223f * t34 - 1.77777777777777778f * t36; float m31 = 1.5f * t31 + 3.0f * t32 - 2.1666666666666667f * t33 - 4.333333333333333333f * t34 + 0.66666666666666667f * t35 + 1.333333333333333f * t36; float m32 = -1.5f * t31 + 3.0f * t32 + 2.1666666666666667f * t33 - 4.333333333333333333f * t34 - 0.66666666666666667f * t35 + 1.333333333333333f * t36; float m33 = -0.3f * (t31 + t32) + 1.33333333333333f * (t33 + t34) - 0.53333333333f * (t35 + t36); float m34 = 0.3f * (t31 - t32) + 1.33333333333333f * (t34 - t33) + 0.53333333333f * (t35 - t36); float m35 = 0.0333333333f * t31 + 0.02222222f * t32 - 0.1666666666f * t33 - 0.1111111111f * t34 + 0.1333333f * t35 + 0.0888888f * t36; float m36 = -0.0333333333f * t31 + 0.02222222f * t32 + 0.1666666666f * t33 - 0.1111111111f * t34 - 0.1333333f * t35 + 0.0888888f * t36; float m37 = -0.5625f * t31 + 3.0625f * t33 - 3.5f * t35 + t37; float m40 = t40 - 5.444444444444444445125f * t42 + 6.222222222222222222223f * t44 - 1.77777777777777778f * t46; float m41 = 1.5f * t41 + 3.0f * t42 - 2.1666666666666667f * t43 - 4.333333333333333333f * t44 + 0.66666666666666667f * t45 + 1.333333333333333f * t46; float m42 = -1.5f * t41 + 3.0f * t42 + 2.1666666666666667f * t43 - 4.333333333333333333f * t44 - 0.66666666666666667f * t45 + 1.333333333333333f * t46; float m43 = -0.3f * (t41 + t42) + 1.33333333333333f * (t43 + t44) - 0.53333333333f * (t45 + t46); float m44 = 0.3f * (t41 - t42) + 1.33333333333333f * (t44 - t43) + 0.53333333333f * (t45 - t46); float m45 = 0.0333333333f * t41 + 0.02222222f * t42 - 0.1666666666f * t43 - 0.1111111111f * t44 + 0.1333333f * t45 + 0.0888888f * t46; float m46 = -0.0333333333f * t41 + 0.02222222f * t42 + 0.1666666666f * t43 - 0.1111111111f * t44 - 0.1333333f * t45 + 0.0888888f * t46; float m47 = -0.5625f * t41 + 3.0625f * t43 - 3.5f * t45 + t47; float m50 = t50 - 5.444444444444444445125f * t52 + 6.222222222222222222223f * t54 - 1.77777777777777778f * t56; float m51 = 1.5f * t51 + 3.0f * t52 - 2.1666666666666667f * t53 - 4.333333333333333333f * t54 + 0.66666666666666667f * t55 + 1.333333333333333f * t56; float m52 = -1.5f * t51 + 3.0f * t52 + 2.1666666666666667f * t53 - 4.333333333333333333f * t54 - 0.66666666666666667f * t55 + 1.333333333333333f * t56; float m53 = -0.3f * (t51 + t52) + 1.33333333333333f * (t53 + t54) - 0.53333333333f * (t55 + t56); float m54 = 0.3f * (t51 - t52) + 1.33333333333333f * (t54 - t53) + 0.53333333333f * (t55 - t56); float m55 = 0.0333333333f * t51 + 0.02222222f * t52 - 0.1666666666f * t53 - 0.1111111111f * t54 + 0.1333333f * t55 + 0.0888888f * t56; float m56 = -0.0333333333f * t51 + 0.02222222f * t52 + 0.1666666666f * t53 - 0.1111111111f * t54 - 0.1333333f * t55 + 0.0888888f * t56; float m57 = -0.5625f * t51 + 3.0625f * t53 - 3.5f * t55 + t57; float m60 = t60 - 5.444444444444444445125f * t62 + 6.222222222222222222223f * t64 - 1.77777777777777778f * t66; float m61 = 1.5f * t61 + 3.0f * t62 - 2.1666666666666667f * t63 - 4.333333333333333333f * t64 + 0.66666666666666667f * t65 + 1.333333333333333f * t66; float m62 = -1.5f * t61 + 3.0f * t62 + 2.1666666666666667f * t63 - 4.333333333333333333f * t64 - 0.66666666666666667f * t65 + 1.333333333333333f * t66; float m63 = -0.3f * (t61 + t62) + 1.33333333333333f * (t63 + t64) - 0.53333333333f * (t65 + t66); float m64 = 0.3f * (t61 - t62) + 1.33333333333333f * (t64 - t63) + 0.53333333333f * (t65 - t66); float m65 = 0.0333333333f * t61 + 0.02222222f * t62 - 0.1666666666f * t63 - 0.1111111111f * t64 + 0.1333333f * t65 + 0.0888888f * t66; float m66 = -0.0333333333f * t61 + 0.02222222f * t62 + 0.1666666666f * t63 - 0.1111111111f * t64 - 0.1333333f * t65 + 0.0888888f * t66; float m67 = -0.5625f * t61 + 3.0625f * t63 - 3.5f * t65 + t67; float m70 = t70 - 5.444444444444444445125f * t72 + 6.222222222222222222223f * t74 - 1.77777777777777778f * t76; float m71 = 1.5f * t71 + 3.0f * t72 - 2.1666666666666667f * t73 - 4.333333333333333333f * t74 + 0.66666666666666667f * t75 + 1.333333333333333f * t76; float m72 = -1.5f * t71 + 3.0f * t72 + 2.1666666666666667f * t73 - 4.333333333333333333f * t74 - 0.66666666666666667f * t75 + 1.333333333333333f * t76; float m73 = -0.3f * (t71 + t72) + 1.33333333333333f * (t73 + t74) - 0.53333333333f * (t75 + t76); float m74 = 0.3f * (t71 - t72) + 1.33333333333333f * (t74 - t73) + 0.53333333333f * (t75 - t76); float m75 = 0.0333333333f * t71 + 0.02222222f * t72 - 0.1666666666f * t73 - 0.1111111111f * t74 + 0.1333333f * t75 + 0.0888888f * t76; float m76 = -0.0333333333f * t71 + 0.02222222f * t72 + 0.1666666666f * t73 - 0.1111111111f * t74 - 0.1333333f * t75 + 0.0888888f * t76; float m77 = -0.5625f * t71 + 3.0625f * t73 - 3.5f * t75 + t77; (dst_data + i)[0] = m00; (dst_data + i + dst_step)[0] = m01; (dst_data + i + 2 * dst_step)[0] = m02; (dst_data + i + 3 * dst_step)[0] = m03; (dst_data + i + 4 * dst_step)[0] = m04; (dst_data + i + 5 * dst_step)[0] = m05; (dst_data + i + 6 * dst_step)[0] = m06; (dst_data + i + 7 * dst_step)[0] = m07; (dst_data + i + 8 * dst_step)[0] = m10; (dst_data + i + 9 * dst_step)[0] = m11; (dst_data + i + 10 * dst_step)[0] = m12; (dst_data + i + 11 * dst_step)[0] = m13; (dst_data + i + 12 * dst_step)[0] = m14; (dst_data + i + 13 * dst_step)[0] = m15; (dst_data + i + 14 * dst_step)[0] = m16; (dst_data + i + 15 * dst_step)[0] = m17; (dst_data + i + 16 * dst_step)[0] = m20; (dst_data + i + 17 * dst_step)[0] = m21; (dst_data + i + 18 * dst_step)[0] = m22; (dst_data + i + 19 * dst_step)[0] = m23; (dst_data + i + 20 * dst_step)[0] = m24; (dst_data + i + 21 * dst_step)[0] = m25; (dst_data + i + 22 * dst_step)[0] = m26; (dst_data + i + 23 * dst_step)[0] = m27; (dst_data + i + 24 * dst_step)[0] = m30; (dst_data + i + 25 * dst_step)[0] = m31; (dst_data + i + 26 * dst_step)[0] = m32; (dst_data + i + 27 * dst_step)[0] = m33; (dst_data + i + 28 * dst_step)[0] = m34; (dst_data + i + 29 * dst_step)[0] = m35; (dst_data + i + 30 * dst_step)[0] = m36; (dst_data + i + 31 * dst_step)[0] = m37; (dst_data + i + 32 * dst_step)[0] = m40; (dst_data + i + 33 * dst_step)[0] = m41; (dst_data + i + 34 * dst_step)[0] = m42; (dst_data + i + 35 * dst_step)[0] = m43; (dst_data + i + 36 * dst_step)[0] = m44; (dst_data + i + 37 * dst_step)[0] = m45; (dst_data + i + 38 * dst_step)[0] = m46; (dst_data + i + 39 * dst_step)[0] = m47; (dst_data + i + 40 * dst_step)[0] = m50; (dst_data + i + 41 * dst_step)[0] = m51; (dst_data + i + 42 * dst_step)[0] = m52; (dst_data + i + 43 * dst_step)[0] = m53; (dst_data + i + 44 * dst_step)[0] = m54; (dst_data + i + 45 * dst_step)[0] = m55; (dst_data + i + 46 * dst_step)[0] = m56; (dst_data + i + 47 * dst_step)[0] = m57; (dst_data + i + 48 * dst_step)[0] = m60; (dst_data + i + 49 * dst_step)[0] = m61; (dst_data + i + 50 * dst_step)[0] = m62; (dst_data + i + 51 * dst_step)[0] = m63; (dst_data + i + 52 * dst_step)[0] = m64; (dst_data + i + 53 * dst_step)[0] = m65; (dst_data + i + 54 * dst_step)[0] = m66; (dst_data + i + 55 * dst_step)[0] = m67; (dst_data + i + 56 * dst_step)[0] = m70; (dst_data + i + 57 * dst_step)[0] = m71; (dst_data + i + 58 * dst_step)[0] = m72; (dst_data + i + 59 * dst_step)[0] = m73; (dst_data + i + 60 * dst_step)[0] = m74; (dst_data + i + 61 * dst_step)[0] = m75; (dst_data + i + 62 * dst_step)[0] = m76; (dst_data + i + 63 * dst_step)[0] = m77; } #endif } void OutputTransform4x2Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t bias_ptr = vld1q_f32(bias_data); float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 15 * src_step); float32x4_t t00 = vaddq_f32(src_data_00, vaddq_f32(src_data_10, src_data_20)); float32x4_t t01 = vaddq_f32(src_data_01, vaddq_f32(src_data_11, src_data_21)); float32x4_t t02 = vaddq_f32(src_data_02, vaddq_f32(src_data_12, src_data_22)); float32x4_t t03 = vaddq_f32(src_data_03, vaddq_f32(src_data_13, src_data_23)); float32x4_t t10 = vsubq_f32(src_data_30, vmulq_n_f32(vsubq_f32(src_data_10, src_data_20), 0.5)); float32x4_t t11 = vsubq_f32(src_data_31, vmulq_n_f32(vsubq_f32(src_data_11, src_data_21), 0.5)); float32x4_t t12 = vsubq_f32(src_data_32, vmulq_n_f32(vsubq_f32(src_data_12, src_data_22), 0.5)); float32x4_t t13 = vsubq_f32(src_data_33, vmulq_n_f32(vsubq_f32(src_data_13, src_data_23), 0.5)); float32x4_t m00 = vaddq_f32(vaddq_f32(t00, vaddq_f32(t01, t02)), bias_ptr); float32x4_t m01 = vaddq_f32(vaddq_f32(t03, vmulq_n_f32(vsubq_f32(t01, t02), 0.5)), bias_ptr); float32x4_t m10 = vaddq_f32(vaddq_f32(t10, vaddq_f32(t11, t12)), bias_ptr); float32x4_t m11 = vaddq_f32(vaddq_f32(t13, vmulq_n_f32(vsubq_f32(t11, t12), 0.5)), bias_ptr); vst1q_f32(dst_data, m00); vst1q_f32(dst_data + C4NUM, m01); vst1q_f32(dst_data + dst_step * C4NUM, m10); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, m11); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_10 = src_data[i + 4 * src_step]; float src_data_11 = src_data[i + 5 * src_step]; float src_data_12 = src_data[i + 6 * src_step]; float src_data_13 = src_data[i + 7 * src_step]; float src_data_20 = src_data[i + 8 * src_step]; float src_data_21 = src_data[i + 9 * src_step]; float src_data_22 = src_data[i + 10 * src_step]; float src_data_23 = src_data[i + 11 * src_step]; float src_data_30 = src_data[i + 12 * src_step]; float src_data_31 = src_data[i + 13 * src_step]; float src_data_32 = src_data[i + 14 * src_step]; float src_data_33 = src_data[i + 15 * src_step]; float t00 = src_data_00 + src_data_10 + src_data_20; float t01 = src_data_01 + src_data_11 + src_data_21; float t02 = src_data_02 + src_data_12 + src_data_22; float t03 = src_data_03 + src_data_13 + src_data_23; float t10 = 0.5f * (src_data_10 - src_data_20) + src_data_30; float t11 = 0.5f * (src_data_11 - src_data_21) + src_data_31; float t12 = 0.5f * (src_data_12 - src_data_22) + src_data_32; float t13 = 0.5f * (src_data_13 - src_data_23) + src_data_33; float m00 = t00 + t01 + t02 + bias_data[i]; float m01 = 0.5f * (t01 - t02) + t03 + bias_data[i]; float m10 = t10 + t11 + t12 + bias_data[i]; float m11 = 0.5f * (t11 - t12) + t13 + bias_data[i]; (dst_data + i)[0] = m00; (dst_data + i + C4NUM)[0] = m01; (dst_data + i + dst_step * C4NUM)[0] = m10; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11; } #endif } void OutputTransform4x3Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t bias_ptr = vld1q_f32(bias_data); float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 15 * src_step); float32x4_t t00 = vaddq_f32(src_data_00, vaddq_f32(src_data_10, src_data_20)); float32x4_t t01 = vaddq_f32(src_data_01, vaddq_f32(src_data_11, src_data_21)); float32x4_t t02 = vaddq_f32(src_data_02, vaddq_f32(src_data_12, src_data_22)); float32x4_t t03 = vaddq_f32(src_data_03, vaddq_f32(src_data_13, src_data_23)); float32x4_t t10 = vmulq_n_f32(vsubq_f32(src_data_10, src_data_20), 0.5); float32x4_t t11 = vmulq_n_f32(vsubq_f32(src_data_11, src_data_21), 0.5); float32x4_t t12 = vmulq_n_f32(vsubq_f32(src_data_12, src_data_22), 0.5); float32x4_t t13 = vmulq_n_f32(vsubq_f32(src_data_13, src_data_23), 0.5); float32x4_t t20 = vaddq_f32(src_data_30, vmulq_n_f32(vaddq_f32(src_data_10, src_data_20), 0.25)); float32x4_t t21 = vaddq_f32(src_data_31, vmulq_n_f32(vaddq_f32(src_data_11, src_data_21), 0.25)); float32x4_t t22 = vaddq_f32(src_data_32, vmulq_n_f32(vaddq_f32(src_data_12, src_data_22), 0.25)); float32x4_t t23 = vaddq_f32(src_data_33, vmulq_n_f32(vaddq_f32(src_data_13, src_data_23), 0.25)); float32x4_t m00 = vaddq_f32(vaddq_f32(t00, vaddq_f32(t01, t02)), bias_ptr); float32x4_t m01 = vaddq_f32(vmulq_n_f32(vsubq_f32(t01, t02), 0.5), bias_ptr); float32x4_t m02 = vaddq_f32(vaddq_f32(t03, vmulq_n_f32(vaddq_f32(t01, t02), 0.25)), bias_ptr); float32x4_t m10 = vaddq_f32(vaddq_f32(t10, vaddq_f32(t11, t12)), bias_ptr); float32x4_t m11 = vaddq_f32(vmulq_n_f32(vsubq_f32(t11, t12), 0.5), bias_ptr); float32x4_t m12 = vaddq_f32(vaddq_f32(t13, vmulq_n_f32(vaddq_f32(t11, t12), 0.25)), bias_ptr); float32x4_t m20 = vaddq_f32(vaddq_f32(t20, vaddq_f32(t21, t22)), bias_ptr); float32x4_t m21 = vaddq_f32(vmulq_n_f32(vsubq_f32(t21, t22), 0.5), bias_ptr); float32x4_t m22 = vaddq_f32(vaddq_f32(t23, vmulq_n_f32(vaddq_f32(t21, t22), 0.25)), bias_ptr); vst1q_f32(dst_data, m00); vst1q_f32(dst_data + C4NUM, m01); vst1q_f32(dst_data + 2 * C4NUM, m02); vst1q_f32(dst_data + dst_step * C4NUM, m10); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, m11); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, m12); vst1q_f32(dst_data + 2 * dst_step * C4NUM, m20); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, m21); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, m22); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_10 = src_data[i + 4 * src_step]; float src_data_11 = src_data[i + 5 * src_step]; float src_data_12 = src_data[i + 6 * src_step]; float src_data_13 = src_data[i + 7 * src_step]; float src_data_20 = src_data[i + 8 * src_step]; float src_data_21 = src_data[i + 9 * src_step]; float src_data_22 = src_data[i + 10 * src_step]; float src_data_23 = src_data[i + 11 * src_step]; float src_data_30 = src_data[i + 12 * src_step]; float src_data_31 = src_data[i + 13 * src_step]; float src_data_32 = src_data[i + 14 * src_step]; float src_data_33 = src_data[i + 15 * src_step]; float t00 = src_data_00 + src_data_10 + src_data_20; float t01 = src_data_01 + src_data_11 + src_data_21; float t02 = src_data_02 + src_data_12 + src_data_22; float t03 = src_data_03 + src_data_13 + src_data_23; float t10 = 0.5f * (src_data_10 - src_data_20); float t11 = 0.5f * (src_data_11 - src_data_21); float t12 = 0.5f * (src_data_12 - src_data_22); float t13 = 0.5f * (src_data_13 - src_data_23); float t20 = 0.25f * (src_data_10 + src_data_20) + src_data_30; float t21 = 0.25f * (src_data_11 + src_data_21) + src_data_31; float t22 = 0.25f * (src_data_12 + src_data_22) + src_data_32; float t23 = 0.25f * (src_data_13 + src_data_23) + src_data_33; float m00 = t00 + t01 + t02 + bias_data[i]; float m01 = 0.5f * (t01 - t02) + bias_data[i]; float m02 = 0.25f * (t01 + t02) + t03 + bias_data[i]; float m10 = t10 + t11 + t12 + bias_data[i]; float m11 = 0.5f * (t11 - t12) + bias_data[i]; float m12 = 0.25f * (t11 + t12) + t13 + bias_data[i]; float m20 = t20 + t21 + t22 + bias_data[i]; float m21 = 0.5f * (t21 - t22) + bias_data[i]; float m22 = 0.25f * (t21 + t22) + t23 + bias_data[i]; (dst_data + i)[0] = m00; (dst_data + i + C4NUM)[0] = m01; (dst_data + i + 2 * C4NUM)[0] = m02; (dst_data + i + dst_step * C4NUM)[0] = m10; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22; } #endif } void OutputTransform8x2Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)), src_data_70); float32x4_t t11 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)), src_data_71); float32x4_t t12 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)), src_data_72); float32x4_t t13 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)), src_data_73); float32x4_t t14 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)), src_data_74); float32x4_t t15 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)), src_data_75); float32x4_t t16 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)), src_data_76); float32x4_t t17 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)), t17); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21 + src_data_70; float t11 = 0.5f * d02 + d12 + 1.5f * d22 + src_data_71; float t12 = 0.5f * d03 + d13 + 1.5f * d23 + src_data_72; float t13 = 0.5f * d04 + d14 + 1.5f * d24 + src_data_73; float t14 = 0.5f * d05 + d15 + 1.5f * d25 + src_data_74; float t15 = 0.5f * d06 + d16 + 1.5f * d26 + src_data_75; float t16 = 0.5f * d07 + d17 + 1.5f * d27 + src_data_76; float t17 = 0.5f * d08 + d18 + 1.5f * d28 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s21 = t03 - t04; float s22 = t13 - t14; float s31 = t05 - t06; float s32 = t15 - t16; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32 + t17; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; } #endif } void OutputTransform8x3Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t d31 = vaddq_f32(src_data_10, src_data_20); float32x4_t d32 = vaddq_f32(src_data_11, src_data_21); float32x4_t d33 = vaddq_f32(src_data_12, src_data_22); float32x4_t d34 = vaddq_f32(src_data_13, src_data_23); float32x4_t d35 = vaddq_f32(src_data_14, src_data_24); float32x4_t d36 = vaddq_f32(src_data_15, src_data_25); float32x4_t d37 = vaddq_f32(src_data_16, src_data_26); float32x4_t d38 = vaddq_f32(src_data_17, src_data_27); float32x4_t d41 = vaddq_f32(src_data_30, src_data_40); float32x4_t d42 = vaddq_f32(src_data_31, src_data_41); float32x4_t d43 = vaddq_f32(src_data_32, src_data_42); float32x4_t d44 = vaddq_f32(src_data_33, src_data_43); float32x4_t d45 = vaddq_f32(src_data_34, src_data_44); float32x4_t d46 = vaddq_f32(src_data_35, src_data_45); float32x4_t d47 = vaddq_f32(src_data_36, src_data_46); float32x4_t d48 = vaddq_f32(src_data_37, src_data_47); float32x4_t d51 = vaddq_f32(src_data_50, src_data_60); float32x4_t d52 = vaddq_f32(src_data_51, src_data_61); float32x4_t d53 = vaddq_f32(src_data_52, src_data_62); float32x4_t d54 = vaddq_f32(src_data_53, src_data_63); float32x4_t d55 = vaddq_f32(src_data_54, src_data_64); float32x4_t d56 = vaddq_f32(src_data_55, src_data_65); float32x4_t d57 = vaddq_f32(src_data_56, src_data_66); float32x4_t d58 = vaddq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)); float32x4_t t11 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)); float32x4_t t12 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)); float32x4_t t13 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)); float32x4_t t14 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)); float32x4_t t15 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)); float32x4_t t16 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)); float32x4_t t17 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)); float32x4_t t20 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.25), d41), vmulq_n_f32(d51, 2.25)), src_data_70); float32x4_t t21 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.25), d42), vmulq_n_f32(d52, 2.25)), src_data_71); float32x4_t t22 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.25), d43), vmulq_n_f32(d53, 2.25)), src_data_72); float32x4_t t23 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.25), d44), vmulq_n_f32(d54, 2.25)), src_data_73); float32x4_t t24 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.25), d45), vmulq_n_f32(d55, 2.25)), src_data_74); float32x4_t t25 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.25), d46), vmulq_n_f32(d56, 2.25)), src_data_75); float32x4_t t26 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.25), d47), vmulq_n_f32(d57, 2.25)), src_data_76); float32x4_t t27 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.25), d48), vmulq_n_f32(d58, 2.25)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s13 = vsubq_f32(t21, t22); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s23 = vsubq_f32(t23, t24); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t s33 = vsubq_f32(t25, t26); float32x4_t s41 = vaddq_f32(t01, t02); float32x4_t s42 = vaddq_f32(t11, t12); float32x4_t s43 = vaddq_f32(t21, t22); float32x4_t s51 = vaddq_f32(t03, t04); float32x4_t s52 = vaddq_f32(t13, t14); float32x4_t s53 = vaddq_f32(t23, t24); float32x4_t s61 = vaddq_f32(t05, t06); float32x4_t s62 = vaddq_f32(t15, t16); float32x4_t s63 = vaddq_f32(t25, t26); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)); float32x4_t m02 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.25), s51), vmulq_n_f32(s61, 2.25)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)); float32x4_t m12 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.25), s52), vmulq_n_f32(s62, 2.25)), t17); float32x4_t m20 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t20, t21), t22), t23), t24), t25), t26); float32x4_t m21 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.5), s23), vmulq_n_f32(s33, 1.5)); float32x4_t m22 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.25), s53), vmulq_n_f32(s63, 2.25)), t27); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + 2 * C4NUM, vaddq_f32(m02, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m12, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM, vaddq_f32(m20, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, vaddq_f32(m21, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m22, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float d31 = src_data_10 + src_data_20; float d32 = src_data_11 + src_data_21; float d33 = src_data_12 + src_data_22; float d34 = src_data_13 + src_data_23; float d35 = src_data_14 + src_data_24; float d36 = src_data_15 + src_data_25; float d37 = src_data_16 + src_data_26; float d38 = src_data_17 + src_data_27; float d41 = src_data_30 + src_data_40; float d42 = src_data_31 + src_data_41; float d43 = src_data_32 + src_data_42; float d44 = src_data_33 + src_data_43; float d45 = src_data_34 + src_data_44; float d46 = src_data_35 + src_data_45; float d47 = src_data_36 + src_data_46; float d48 = src_data_37 + src_data_47; float d51 = src_data_50 + src_data_60; float d52 = src_data_51 + src_data_61; float d53 = src_data_52 + src_data_62; float d54 = src_data_53 + src_data_63; float d55 = src_data_54 + src_data_64; float d56 = src_data_55 + src_data_65; float d57 = src_data_56 + src_data_66; float d58 = src_data_57 + src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21; float t11 = 0.5f * d02 + d12 + 1.5f * d22; float t12 = 0.5f * d03 + d13 + 1.5f * d23; float t13 = 0.5f * d04 + d14 + 1.5f * d24; float t14 = 0.5f * d05 + d15 + 1.5f * d25; float t15 = 0.5f * d06 + d16 + 1.5f * d26; float t16 = 0.5f * d07 + d17 + 1.5f * d27; float t17 = 0.5f * d08 + d18 + 1.5f * d28; float t20 = 0.25f * d31 + d41 + 2.25f * d51 + src_data_70; float t21 = 0.25f * d32 + d42 + 2.25f * d52 + src_data_71; float t22 = 0.25f * d33 + d43 + 2.25f * d53 + src_data_72; float t23 = 0.25f * d34 + d44 + 2.25f * d54 + src_data_73; float t24 = 0.25f * d35 + d45 + 2.25f * d55 + src_data_74; float t25 = 0.25f * d36 + d46 + 2.25f * d56 + src_data_75; float t26 = 0.25f * d37 + d47 + 2.25f * d57 + src_data_76; float t27 = 0.25f * d38 + d48 + 2.25f * d58 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s13 = t21 - t22; float s21 = t03 - t04; float s22 = t13 - t14; float s23 = t23 - t24; float s31 = t05 - t06; float s32 = t15 - t16; float s33 = t25 - t26; float s41 = t01 + t02; float s42 = t11 + t12; float s43 = t21 + t22; float s51 = t03 + t04; float s52 = t13 + t14; float s53 = t23 + t24; float s61 = t05 + t06; float s62 = t15 + t16; float s63 = t25 + t26; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31; float m02 = 0.25f * s41 + s51 + 2.25f * s61 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32; float m12 = 0.25f * s42 + s52 + 2.25f * s62 + t17; float m20 = t20 + t21 + t22 + t23 + t24 + t25 + t26; float m21 = 0.5f * s13 + s23 + 1.5f * s33; float m22 = 0.25f * s43 + s53 + 2.25f * s63 + t27; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + 2 * C4NUM)[0] = m02 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22 + bias_data[i]; } #endif } void OutputTransform8x4Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t d31 = vaddq_f32(src_data_10, src_data_20); float32x4_t d32 = vaddq_f32(src_data_11, src_data_21); float32x4_t d33 = vaddq_f32(src_data_12, src_data_22); float32x4_t d34 = vaddq_f32(src_data_13, src_data_23); float32x4_t d35 = vaddq_f32(src_data_14, src_data_24); float32x4_t d36 = vaddq_f32(src_data_15, src_data_25); float32x4_t d37 = vaddq_f32(src_data_16, src_data_26); float32x4_t d38 = vaddq_f32(src_data_17, src_data_27); float32x4_t d41 = vaddq_f32(src_data_30, src_data_40); float32x4_t d42 = vaddq_f32(src_data_31, src_data_41); float32x4_t d43 = vaddq_f32(src_data_32, src_data_42); float32x4_t d44 = vaddq_f32(src_data_33, src_data_43); float32x4_t d45 = vaddq_f32(src_data_34, src_data_44); float32x4_t d46 = vaddq_f32(src_data_35, src_data_45); float32x4_t d47 = vaddq_f32(src_data_36, src_data_46); float32x4_t d48 = vaddq_f32(src_data_37, src_data_47); float32x4_t d51 = vaddq_f32(src_data_50, src_data_60); float32x4_t d52 = vaddq_f32(src_data_51, src_data_61); float32x4_t d53 = vaddq_f32(src_data_52, src_data_62); float32x4_t d54 = vaddq_f32(src_data_53, src_data_63); float32x4_t d55 = vaddq_f32(src_data_54, src_data_64); float32x4_t d56 = vaddq_f32(src_data_55, src_data_65); float32x4_t d57 = vaddq_f32(src_data_56, src_data_66); float32x4_t d58 = vaddq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)); float32x4_t t11 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)); float32x4_t t12 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)); float32x4_t t13 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)); float32x4_t t14 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)); float32x4_t t15 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)); float32x4_t t16 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)); float32x4_t t17 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)); float32x4_t t20 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.25), d41), vmulq_n_f32(d51, 2.25)); float32x4_t t21 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.25), d42), vmulq_n_f32(d52, 2.25)); float32x4_t t22 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.25), d43), vmulq_n_f32(d53, 2.25)); float32x4_t t23 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.25), d44), vmulq_n_f32(d54, 2.25)); float32x4_t t24 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.25), d45), vmulq_n_f32(d55, 2.25)); float32x4_t t25 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.25), d46), vmulq_n_f32(d56, 2.25)); float32x4_t t26 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.25), d47), vmulq_n_f32(d57, 2.25)); float32x4_t t27 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.25), d48), vmulq_n_f32(d58, 2.25)); float32x4_t t30 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.125), d11), vmulq_n_f32(d21, 3.375)), src_data_70); float32x4_t t31 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.125), d12), vmulq_n_f32(d22, 3.375)), src_data_71); float32x4_t t32 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.125), d13), vmulq_n_f32(d23, 3.375)), src_data_72); float32x4_t t33 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.125), d14), vmulq_n_f32(d24, 3.375)), src_data_73); float32x4_t t34 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.125), d15), vmulq_n_f32(d25, 3.375)), src_data_74); float32x4_t t35 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.125), d16), vmulq_n_f32(d26, 3.375)), src_data_75); float32x4_t t36 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.125), d17), vmulq_n_f32(d27, 3.375)), src_data_76); float32x4_t t37 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.125), d18), vmulq_n_f32(d28, 3.375)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s13 = vsubq_f32(t21, t22); float32x4_t s14 = vsubq_f32(t31, t32); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s23 = vsubq_f32(t23, t24); float32x4_t s24 = vsubq_f32(t33, t34); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t s33 = vsubq_f32(t25, t26); float32x4_t s34 = vsubq_f32(t35, t36); float32x4_t s41 = vaddq_f32(t01, t02); float32x4_t s42 = vaddq_f32(t11, t12); float32x4_t s43 = vaddq_f32(t21, t22); float32x4_t s44 = vaddq_f32(t31, t32); float32x4_t s51 = vaddq_f32(t03, t04); float32x4_t s52 = vaddq_f32(t13, t14); float32x4_t s53 = vaddq_f32(t23, t24); float32x4_t s54 = vaddq_f32(t33, t34); float32x4_t s61 = vaddq_f32(t05, t06); float32x4_t s62 = vaddq_f32(t15, t16); float32x4_t s63 = vaddq_f32(t25, t26); float32x4_t s64 = vaddq_f32(t35, t36); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)); float32x4_t m02 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.25), s51), vmulq_n_f32(s61, 2.25)); float32x4_t m03 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.125), s21), vmulq_n_f32(s31, 3.375)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)); float32x4_t m12 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.25), s52), vmulq_n_f32(s62, 2.25)); float32x4_t m13 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.125), s22), vmulq_n_f32(s32, 3.375)), t17); float32x4_t m20 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t20, t21), t22), t23), t24), t25), t26); float32x4_t m21 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.5), s23), vmulq_n_f32(s33, 1.5)); float32x4_t m22 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.25), s53), vmulq_n_f32(s63, 2.25)); float32x4_t m23 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.125), s23), vmulq_n_f32(s33, 3.375)), t27); float32x4_t m30 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t30, t31), t32), t33), t34), t35), t36); float32x4_t m31 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.5), s24), vmulq_n_f32(s34, 1.5)); float32x4_t m32 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.25), s54), vmulq_n_f32(s64, 2.25)); float32x4_t m33 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.125), s24), vmulq_n_f32(s34, 3.375)), t37); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + 2 * C4NUM, vaddq_f32(m02, bias_ptr)); vst1q_f32(dst_data + 3 * C4NUM, vaddq_f32(m03, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m12, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m13, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM, vaddq_f32(m20, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, vaddq_f32(m21, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m22, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m23, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM, vaddq_f32(m30, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + C4NUM, vaddq_f32(m31, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m32, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m33, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float d31 = src_data_10 + src_data_20; float d32 = src_data_11 + src_data_21; float d33 = src_data_12 + src_data_22; float d34 = src_data_13 + src_data_23; float d35 = src_data_14 + src_data_24; float d36 = src_data_15 + src_data_25; float d37 = src_data_16 + src_data_26; float d38 = src_data_17 + src_data_27; float d41 = src_data_30 + src_data_40; float d42 = src_data_31 + src_data_41; float d43 = src_data_32 + src_data_42; float d44 = src_data_33 + src_data_43; float d45 = src_data_34 + src_data_44; float d46 = src_data_35 + src_data_45; float d47 = src_data_36 + src_data_46; float d48 = src_data_37 + src_data_47; float d51 = src_data_50 + src_data_60; float d52 = src_data_51 + src_data_61; float d53 = src_data_52 + src_data_62; float d54 = src_data_53 + src_data_63; float d55 = src_data_54 + src_data_64; float d56 = src_data_55 + src_data_65; float d57 = src_data_56 + src_data_66; float d58 = src_data_57 + src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21; float t11 = 0.5f * d02 + d12 + 1.5f * d22; float t12 = 0.5f * d03 + d13 + 1.5f * d23; float t13 = 0.5f * d04 + d14 + 1.5f * d24; float t14 = 0.5f * d05 + d15 + 1.5f * d25; float t15 = 0.5f * d06 + d16 + 1.5f * d26; float t16 = 0.5f * d07 + d17 + 1.5f * d27; float t17 = 0.5f * d08 + d18 + 1.5f * d28; float t20 = 0.25f * d31 + d41 + 2.25f * d51; float t21 = 0.25f * d32 + d42 + 2.25f * d52; float t22 = 0.25f * d33 + d43 + 2.25f * d53; float t23 = 0.25f * d34 + d44 + 2.25f * d54; float t24 = 0.25f * d35 + d45 + 2.25f * d55; float t25 = 0.25f * d36 + d46 + 2.25f * d56; float t26 = 0.25f * d37 + d47 + 2.25f * d57; float t27 = 0.25f * d38 + d48 + 2.25f * d58; float t30 = 0.125f * d01 + d11 + 3.375f * d21 + src_data_70; float t31 = 0.125f * d02 + d12 + 3.375f * d22 + src_data_71; float t32 = 0.125f * d03 + d13 + 3.375f * d23 + src_data_72; float t33 = 0.125f * d04 + d14 + 3.375f * d24 + src_data_73; float t34 = 0.125f * d05 + d15 + 3.375f * d25 + src_data_74; float t35 = 0.125f * d06 + d16 + 3.375f * d26 + src_data_75; float t36 = 0.125f * d07 + d17 + 3.375f * d27 + src_data_76; float t37 = 0.125f * d08 + d18 + 3.375f * d28 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s13 = t21 - t22; float s14 = t31 - t32; float s21 = t03 - t04; float s22 = t13 - t14; float s23 = t23 - t24; float s24 = t33 - t34; float s31 = t05 - t06; float s32 = t15 - t16; float s33 = t25 - t26; float s34 = t35 - t36; float s41 = t01 + t02; float s42 = t11 + t12; float s43 = t21 + t22; float s44 = t31 + t32; float s51 = t03 + t04; float s52 = t13 + t14; float s53 = t23 + t24; float s54 = t33 + t34; float s61 = t05 + t06; float s62 = t15 + t16; float s63 = t25 + t26; float s64 = t35 + t36; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31; float m02 = 0.25f * s41 + s51 + 2.25f * s61; float m03 = 0.125f * s11 + s21 + 3.375f * s31 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32; float m12 = 0.25f * s42 + s52 + 2.25f * s62; float m13 = 0.125f * s12 + s22 + 3.375f * s32 + t17; float m20 = t20 + t21 + t22 + t23 + t24 + t25 + t26; float m21 = 0.5f * s13 + s23 + 1.5f * s33; float m22 = 0.25f * s43 + s53 + 2.25f * s63; float m23 = 0.125f * s13 + s23 + 3.375f * s33 + t27; float m30 = t30 + t31 + t32 + t33 + t34 + t35 + t36; float m31 = 0.5f * s14 + s24 + 1.5f * s34; float m32 = 0.25f * s44 + s54 + 2.25f * s64; float m33 = 0.125f * s14 + s24 + 3.375f * s34 + t37; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + 2 * C4NUM)[0] = m02 + bias_data[i]; (dst_data + i + 3 * C4NUM)[0] = m03 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 3 * C4NUM)[0] = m13 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 3 * C4NUM)[0] = m23 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM)[0] = m30 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + C4NUM)[0] = m31 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 2 * C4NUM)[0] = m32 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 3 * C4NUM)[0] = m33 + bias_data[i]; } #endif } void OutputTransform8x5Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t d31 = vaddq_f32(src_data_10, src_data_20); float32x4_t d32 = vaddq_f32(src_data_11, src_data_21); float32x4_t d33 = vaddq_f32(src_data_12, src_data_22); float32x4_t d34 = vaddq_f32(src_data_13, src_data_23); float32x4_t d35 = vaddq_f32(src_data_14, src_data_24); float32x4_t d36 = vaddq_f32(src_data_15, src_data_25); float32x4_t d37 = vaddq_f32(src_data_16, src_data_26); float32x4_t d38 = vaddq_f32(src_data_17, src_data_27); float32x4_t d41 = vaddq_f32(src_data_30, src_data_40); float32x4_t d42 = vaddq_f32(src_data_31, src_data_41); float32x4_t d43 = vaddq_f32(src_data_32, src_data_42); float32x4_t d44 = vaddq_f32(src_data_33, src_data_43); float32x4_t d45 = vaddq_f32(src_data_34, src_data_44); float32x4_t d46 = vaddq_f32(src_data_35, src_data_45); float32x4_t d47 = vaddq_f32(src_data_36, src_data_46); float32x4_t d48 = vaddq_f32(src_data_37, src_data_47); float32x4_t d51 = vaddq_f32(src_data_50, src_data_60); float32x4_t d52 = vaddq_f32(src_data_51, src_data_61); float32x4_t d53 = vaddq_f32(src_data_52, src_data_62); float32x4_t d54 = vaddq_f32(src_data_53, src_data_63); float32x4_t d55 = vaddq_f32(src_data_54, src_data_64); float32x4_t d56 = vaddq_f32(src_data_55, src_data_65); float32x4_t d57 = vaddq_f32(src_data_56, src_data_66); float32x4_t d58 = vaddq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)); float32x4_t t11 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)); float32x4_t t12 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)); float32x4_t t13 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)); float32x4_t t14 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)); float32x4_t t15 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)); float32x4_t t16 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)); float32x4_t t17 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)); float32x4_t t20 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.25), d41), vmulq_n_f32(d51, 2.25)); float32x4_t t21 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.25), d42), vmulq_n_f32(d52, 2.25)); float32x4_t t22 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.25), d43), vmulq_n_f32(d53, 2.25)); float32x4_t t23 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.25), d44), vmulq_n_f32(d54, 2.25)); float32x4_t t24 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.25), d45), vmulq_n_f32(d55, 2.25)); float32x4_t t25 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.25), d46), vmulq_n_f32(d56, 2.25)); float32x4_t t26 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.25), d47), vmulq_n_f32(d57, 2.25)); float32x4_t t27 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.25), d48), vmulq_n_f32(d58, 2.25)); float32x4_t t30 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.125), d11), vmulq_n_f32(d21, 3.375)); float32x4_t t31 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.125), d12), vmulq_n_f32(d22, 3.375)); float32x4_t t32 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.125), d13), vmulq_n_f32(d23, 3.375)); float32x4_t t33 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.125), d14), vmulq_n_f32(d24, 3.375)); float32x4_t t34 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.125), d15), vmulq_n_f32(d25, 3.375)); float32x4_t t35 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.125), d16), vmulq_n_f32(d26, 3.375)); float32x4_t t36 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.125), d17), vmulq_n_f32(d27, 3.375)); float32x4_t t37 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.125), d18), vmulq_n_f32(d28, 3.375)); float32x4_t t40 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.0625), d41), vmulq_n_f32(d51, 5.0625)), src_data_70); float32x4_t t41 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.0625), d42), vmulq_n_f32(d52, 5.0625)), src_data_71); float32x4_t t42 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.0625), d43), vmulq_n_f32(d53, 5.0625)), src_data_72); float32x4_t t43 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.0625), d44), vmulq_n_f32(d54, 5.0625)), src_data_73); float32x4_t t44 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.0625), d45), vmulq_n_f32(d55, 5.0625)), src_data_74); float32x4_t t45 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.0625), d46), vmulq_n_f32(d56, 5.0625)), src_data_75); float32x4_t t46 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.0625), d47), vmulq_n_f32(d57, 5.0625)), src_data_76); float32x4_t t47 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.0625), d48), vmulq_n_f32(d58, 5.0625)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s13 = vsubq_f32(t21, t22); float32x4_t s14 = vsubq_f32(t31, t32); float32x4_t s15 = vsubq_f32(t41, t42); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s23 = vsubq_f32(t23, t24); float32x4_t s24 = vsubq_f32(t33, t34); float32x4_t s25 = vsubq_f32(t43, t44); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t s33 = vsubq_f32(t25, t26); float32x4_t s34 = vsubq_f32(t35, t36); float32x4_t s35 = vsubq_f32(t45, t46); float32x4_t s41 = vaddq_f32(t01, t02); float32x4_t s42 = vaddq_f32(t11, t12); float32x4_t s43 = vaddq_f32(t21, t22); float32x4_t s44 = vaddq_f32(t31, t32); float32x4_t s45 = vaddq_f32(t41, t42); float32x4_t s51 = vaddq_f32(t03, t04); float32x4_t s52 = vaddq_f32(t13, t14); float32x4_t s53 = vaddq_f32(t23, t24); float32x4_t s54 = vaddq_f32(t33, t34); float32x4_t s55 = vaddq_f32(t43, t44); float32x4_t s61 = vaddq_f32(t05, t06); float32x4_t s62 = vaddq_f32(t15, t16); float32x4_t s63 = vaddq_f32(t25, t26); float32x4_t s64 = vaddq_f32(t35, t36); float32x4_t s65 = vaddq_f32(t45, t46); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)); float32x4_t m02 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.25), s51), vmulq_n_f32(s61, 2.25)); float32x4_t m03 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.125), s21), vmulq_n_f32(s31, 3.375)); float32x4_t m04 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.0625), s51), vmulq_n_f32(s61, 5.0625)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)); float32x4_t m12 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.25), s52), vmulq_n_f32(s62, 2.25)); float32x4_t m13 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.125), s22), vmulq_n_f32(s32, 3.375)); float32x4_t m14 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.0625), s52), vmulq_n_f32(s62, 5.0625)), t17); float32x4_t m20 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t20, t21), t22), t23), t24), t25), t26); float32x4_t m21 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.5), s23), vmulq_n_f32(s33, 1.5)); float32x4_t m22 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.25), s53), vmulq_n_f32(s63, 2.25)); float32x4_t m23 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.125), s23), vmulq_n_f32(s33, 3.375)); float32x4_t m24 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.0625), s53), vmulq_n_f32(s63, 5.0625)), t27); float32x4_t m30 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t30, t31), t32), t33), t34), t35), t36); float32x4_t m31 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.5), s24), vmulq_n_f32(s34, 1.5)); float32x4_t m32 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.25), s54), vmulq_n_f32(s64, 2.25)); float32x4_t m33 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.125), s24), vmulq_n_f32(s34, 3.375)); float32x4_t m34 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.0625), s54), vmulq_n_f32(s64, 5.0625)), t37); float32x4_t m40 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t40, t41), t42), t43), t44), t45), t46); float32x4_t m41 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.5), s25), vmulq_n_f32(s35, 1.5)); float32x4_t m42 = vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.25), s55), vmulq_n_f32(s65, 2.25)); float32x4_t m43 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.125), s25), vmulq_n_f32(s35, 3.375)); float32x4_t m44 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.0625), s55), vmulq_n_f32(s65, 5.0625)), t47); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + 2 * C4NUM, vaddq_f32(m02, bias_ptr)); vst1q_f32(dst_data + 3 * C4NUM, vaddq_f32(m03, bias_ptr)); vst1q_f32(dst_data + 4 * C4NUM, vaddq_f32(m04, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m12, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m13, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m14, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM, vaddq_f32(m20, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, vaddq_f32(m21, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m22, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m23, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m24, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM, vaddq_f32(m30, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + C4NUM, vaddq_f32(m31, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m32, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m33, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m34, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM, vaddq_f32(m40, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + C4NUM, vaddq_f32(m41, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m42, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m43, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m44, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float d31 = src_data_10 + src_data_20; float d32 = src_data_11 + src_data_21; float d33 = src_data_12 + src_data_22; float d34 = src_data_13 + src_data_23; float d35 = src_data_14 + src_data_24; float d36 = src_data_15 + src_data_25; float d37 = src_data_16 + src_data_26; float d38 = src_data_17 + src_data_27; float d41 = src_data_30 + src_data_40; float d42 = src_data_31 + src_data_41; float d43 = src_data_32 + src_data_42; float d44 = src_data_33 + src_data_43; float d45 = src_data_34 + src_data_44; float d46 = src_data_35 + src_data_45; float d47 = src_data_36 + src_data_46; float d48 = src_data_37 + src_data_47; float d51 = src_data_50 + src_data_60; float d52 = src_data_51 + src_data_61; float d53 = src_data_52 + src_data_62; float d54 = src_data_53 + src_data_63; float d55 = src_data_54 + src_data_64; float d56 = src_data_55 + src_data_65; float d57 = src_data_56 + src_data_66; float d58 = src_data_57 + src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21; float t11 = 0.5f * d02 + d12 + 1.5f * d22; float t12 = 0.5f * d03 + d13 + 1.5f * d23; float t13 = 0.5f * d04 + d14 + 1.5f * d24; float t14 = 0.5f * d05 + d15 + 1.5f * d25; float t15 = 0.5f * d06 + d16 + 1.5f * d26; float t16 = 0.5f * d07 + d17 + 1.5f * d27; float t17 = 0.5f * d08 + d18 + 1.5f * d28; float t20 = 0.25f * d31 + d41 + 2.25f * d51; float t21 = 0.25f * d32 + d42 + 2.25f * d52; float t22 = 0.25f * d33 + d43 + 2.25f * d53; float t23 = 0.25f * d34 + d44 + 2.25f * d54; float t24 = 0.25f * d35 + d45 + 2.25f * d55; float t25 = 0.25f * d36 + d46 + 2.25f * d56; float t26 = 0.25f * d37 + d47 + 2.25f * d57; float t27 = 0.25f * d38 + d48 + 2.25f * d58; float t30 = 0.125f * d01 + d11 + 3.375f * d21; float t31 = 0.125f * d02 + d12 + 3.375f * d22; float t32 = 0.125f * d03 + d13 + 3.375f * d23; float t33 = 0.125f * d04 + d14 + 3.375f * d24; float t34 = 0.125f * d05 + d15 + 3.375f * d25; float t35 = 0.125f * d06 + d16 + 3.375f * d26; float t36 = 0.125f * d07 + d17 + 3.375f * d27; float t37 = 0.125f * d08 + d18 + 3.375f * d28; float t40 = 0.0625f * d31 + d41 + 5.0625f * d51 + src_data_70; float t41 = 0.0625f * d32 + d42 + 5.0625f * d52 + src_data_71; float t42 = 0.0625f * d33 + d43 + 5.0625f * d53 + src_data_72; float t43 = 0.0625f * d34 + d44 + 5.0625f * d54 + src_data_73; float t44 = 0.0625f * d35 + d45 + 5.0625f * d55 + src_data_74; float t45 = 0.0625f * d36 + d46 + 5.0625f * d56 + src_data_75; float t46 = 0.0625f * d37 + d47 + 5.0625f * d57 + src_data_76; float t47 = 0.0625f * d38 + d48 + 5.0625f * d58 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s13 = t21 - t22; float s14 = t31 - t32; float s15 = t41 - t42; float s21 = t03 - t04; float s22 = t13 - t14; float s23 = t23 - t24; float s24 = t33 - t34; float s25 = t43 - t44; float s31 = t05 - t06; float s32 = t15 - t16; float s33 = t25 - t26; float s34 = t35 - t36; float s35 = t45 - t46; float s41 = t01 + t02; float s42 = t11 + t12; float s43 = t21 + t22; float s44 = t31 + t32; float s45 = t41 + t42; float s51 = t03 + t04; float s52 = t13 + t14; float s53 = t23 + t24; float s54 = t33 + t34; float s55 = t43 + t44; float s61 = t05 + t06; float s62 = t15 + t16; float s63 = t25 + t26; float s64 = t35 + t36; float s65 = t45 + t46; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31; float m02 = 0.25f * s41 + s51 + 2.25f * s61; float m03 = 0.125f * s11 + s21 + 3.375f * s31; float m04 = 0.0625f * s41 + s51 + 5.0625f * s61 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32; float m12 = 0.25f * s42 + s52 + 2.25f * s62; float m13 = 0.125f * s12 + s22 + 3.375f * s32; float m14 = 0.0625f * s42 + s52 + 5.0625f * s62 + t17; float m20 = t20 + t21 + t22 + t23 + t24 + t25 + t26; float m21 = 0.5f * s13 + s23 + 1.5f * s33; float m22 = 0.25f * s43 + s53 + 2.25f * s63; float m23 = 0.125f * s13 + s23 + 3.375f * s33; float m24 = 0.0625f * s43 + s53 + 5.0625f * s63 + t27; float m30 = t30 + t31 + t32 + t33 + t34 + t35 + t36; float m31 = 0.5f * s14 + s24 + 1.5f * s34; float m32 = 0.25f * s44 + s54 + 2.25f * s64; float m33 = 0.125f * s14 + s24 + 3.375f * s34; float m34 = 0.0625f * s44 + s54 + 5.0625f * s64 + t37; float m40 = t40 + t41 + t42 + t43 + t44 + t45 + t46; float m41 = 0.5f * s15 + s25 + 1.5f * s35; float m42 = 0.25f * s45 + s55 + 2.25f * s65; float m43 = 0.125f * s15 + s25 + 3.375f * s35; float m44 = 0.0625f * s45 + s55 + 5.0625f * s65 + t47; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + 2 * C4NUM)[0] = m02 + bias_data[i]; (dst_data + i + 3 * C4NUM)[0] = m03 + bias_data[i]; (dst_data + i + 4 * C4NUM)[0] = m04 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 3 * C4NUM)[0] = m13 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 4 * C4NUM)[0] = m14 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 3 * C4NUM)[0] = m23 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 4 * C4NUM)[0] = m24 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM)[0] = m30 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + C4NUM)[0] = m31 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 2 * C4NUM)[0] = m32 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 3 * C4NUM)[0] = m33 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 4 * C4NUM)[0] = m34 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM)[0] = m40 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + C4NUM)[0] = m41 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 2 * C4NUM)[0] = m42 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 3 * C4NUM)[0] = m43 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 4 * C4NUM)[0] = m44 + bias_data[i]; } #endif } void OutputTransform8x6Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t d31 = vaddq_f32(src_data_10, src_data_20); float32x4_t d32 = vaddq_f32(src_data_11, src_data_21); float32x4_t d33 = vaddq_f32(src_data_12, src_data_22); float32x4_t d34 = vaddq_f32(src_data_13, src_data_23); float32x4_t d35 = vaddq_f32(src_data_14, src_data_24); float32x4_t d36 = vaddq_f32(src_data_15, src_data_25); float32x4_t d37 = vaddq_f32(src_data_16, src_data_26); float32x4_t d38 = vaddq_f32(src_data_17, src_data_27); float32x4_t d41 = vaddq_f32(src_data_30, src_data_40); float32x4_t d42 = vaddq_f32(src_data_31, src_data_41); float32x4_t d43 = vaddq_f32(src_data_32, src_data_42); float32x4_t d44 = vaddq_f32(src_data_33, src_data_43); float32x4_t d45 = vaddq_f32(src_data_34, src_data_44); float32x4_t d46 = vaddq_f32(src_data_35, src_data_45); float32x4_t d47 = vaddq_f32(src_data_36, src_data_46); float32x4_t d48 = vaddq_f32(src_data_37, src_data_47); float32x4_t d51 = vaddq_f32(src_data_50, src_data_60); float32x4_t d52 = vaddq_f32(src_data_51, src_data_61); float32x4_t d53 = vaddq_f32(src_data_52, src_data_62); float32x4_t d54 = vaddq_f32(src_data_53, src_data_63); float32x4_t d55 = vaddq_f32(src_data_54, src_data_64); float32x4_t d56 = vaddq_f32(src_data_55, src_data_65); float32x4_t d57 = vaddq_f32(src_data_56, src_data_66); float32x4_t d58 = vaddq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)); float32x4_t t11 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)); float32x4_t t12 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)); float32x4_t t13 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)); float32x4_t t14 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)); float32x4_t t15 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)); float32x4_t t16 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)); float32x4_t t17 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)); float32x4_t t20 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.25), d41), vmulq_n_f32(d51, 2.25)); float32x4_t t21 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.25), d42), vmulq_n_f32(d52, 2.25)); float32x4_t t22 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.25), d43), vmulq_n_f32(d53, 2.25)); float32x4_t t23 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.25), d44), vmulq_n_f32(d54, 2.25)); float32x4_t t24 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.25), d45), vmulq_n_f32(d55, 2.25)); float32x4_t t25 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.25), d46), vmulq_n_f32(d56, 2.25)); float32x4_t t26 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.25), d47), vmulq_n_f32(d57, 2.25)); float32x4_t t27 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.25), d48), vmulq_n_f32(d58, 2.25)); float32x4_t t30 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.125), d11), vmulq_n_f32(d21, 3.375)); float32x4_t t31 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.125), d12), vmulq_n_f32(d22, 3.375)); float32x4_t t32 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.125), d13), vmulq_n_f32(d23, 3.375)); float32x4_t t33 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.125), d14), vmulq_n_f32(d24, 3.375)); float32x4_t t34 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.125), d15), vmulq_n_f32(d25, 3.375)); float32x4_t t35 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.125), d16), vmulq_n_f32(d26, 3.375)); float32x4_t t36 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.125), d17), vmulq_n_f32(d27, 3.375)); float32x4_t t37 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.125), d18), vmulq_n_f32(d28, 3.375)); float32x4_t t40 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.0625), d41), vmulq_n_f32(d51, 5.0625)); float32x4_t t41 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.0625), d42), vmulq_n_f32(d52, 5.0625)); float32x4_t t42 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.0625), d43), vmulq_n_f32(d53, 5.0625)); float32x4_t t43 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.0625), d44), vmulq_n_f32(d54, 5.0625)); float32x4_t t44 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.0625), d45), vmulq_n_f32(d55, 5.0625)); float32x4_t t45 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.0625), d46), vmulq_n_f32(d56, 5.0625)); float32x4_t t46 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.0625), d47), vmulq_n_f32(d57, 5.0625)); float32x4_t t47 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.0625), d48), vmulq_n_f32(d58, 5.0625)); float32x4_t t50 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.03125), d11), vmulq_n_f32(d21, 7.59375)), src_data_70); float32x4_t t51 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.03125), d12), vmulq_n_f32(d22, 7.59375)), src_data_71); float32x4_t t52 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.03125), d13), vmulq_n_f32(d23, 7.59375)), src_data_72); float32x4_t t53 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.03125), d14), vmulq_n_f32(d24, 7.59375)), src_data_73); float32x4_t t54 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.03125), d15), vmulq_n_f32(d25, 7.59375)), src_data_74); float32x4_t t55 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.03125), d16), vmulq_n_f32(d26, 7.59375)), src_data_75); float32x4_t t56 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.03125), d17), vmulq_n_f32(d27, 7.59375)), src_data_76); float32x4_t t57 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.03125), d18), vmulq_n_f32(d28, 7.59375)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s13 = vsubq_f32(t21, t22); float32x4_t s14 = vsubq_f32(t31, t32); float32x4_t s15 = vsubq_f32(t41, t42); float32x4_t s16 = vsubq_f32(t51, t52); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s23 = vsubq_f32(t23, t24); float32x4_t s24 = vsubq_f32(t33, t34); float32x4_t s25 = vsubq_f32(t43, t44); float32x4_t s26 = vsubq_f32(t53, t54); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t s33 = vsubq_f32(t25, t26); float32x4_t s34 = vsubq_f32(t35, t36); float32x4_t s35 = vsubq_f32(t45, t46); float32x4_t s36 = vsubq_f32(t55, t56); float32x4_t s41 = vaddq_f32(t01, t02); float32x4_t s42 = vaddq_f32(t11, t12); float32x4_t s43 = vaddq_f32(t21, t22); float32x4_t s44 = vaddq_f32(t31, t32); float32x4_t s45 = vaddq_f32(t41, t42); float32x4_t s46 = vaddq_f32(t51, t52); float32x4_t s51 = vaddq_f32(t03, t04); float32x4_t s52 = vaddq_f32(t13, t14); float32x4_t s53 = vaddq_f32(t23, t24); float32x4_t s54 = vaddq_f32(t33, t34); float32x4_t s55 = vaddq_f32(t43, t44); float32x4_t s56 = vaddq_f32(t53, t54); float32x4_t s61 = vaddq_f32(t05, t06); float32x4_t s62 = vaddq_f32(t15, t16); float32x4_t s63 = vaddq_f32(t25, t26); float32x4_t s64 = vaddq_f32(t35, t36); float32x4_t s65 = vaddq_f32(t45, t46); float32x4_t s66 = vaddq_f32(t55, t56); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)); float32x4_t m02 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.25), s51), vmulq_n_f32(s61, 2.25)); float32x4_t m03 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.125), s21), vmulq_n_f32(s31, 3.375)); float32x4_t m04 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.0625), s51), vmulq_n_f32(s61, 5.0625)); float32x4_t m05 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.03125), s21), vmulq_n_f32(s31, 7.59375)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)); float32x4_t m12 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.25), s52), vmulq_n_f32(s62, 2.25)); float32x4_t m13 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.125), s22), vmulq_n_f32(s32, 3.375)); float32x4_t m14 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.0625), s52), vmulq_n_f32(s62, 5.0625)); float32x4_t m15 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.03125), s22), vmulq_n_f32(s32, 7.59375)), t17); float32x4_t m20 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t20, t21), t22), t23), t24), t25), t26); float32x4_t m21 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.5), s23), vmulq_n_f32(s33, 1.5)); float32x4_t m22 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.25), s53), vmulq_n_f32(s63, 2.25)); float32x4_t m23 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.125), s23), vmulq_n_f32(s33, 3.375)); float32x4_t m24 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.0625), s53), vmulq_n_f32(s63, 5.0625)); float32x4_t m25 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.03125), s23), vmulq_n_f32(s33, 7.59375)), t27); float32x4_t m30 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t30, t31), t32), t33), t34), t35), t36); float32x4_t m31 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.5), s24), vmulq_n_f32(s34, 1.5)); float32x4_t m32 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.25), s54), vmulq_n_f32(s64, 2.25)); float32x4_t m33 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.125), s24), vmulq_n_f32(s34, 3.375)); float32x4_t m34 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.0625), s54), vmulq_n_f32(s64, 5.0625)); float32x4_t m35 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.03125), s24), vmulq_n_f32(s34, 7.59375)), t37); float32x4_t m40 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t40, t41), t42), t43), t44), t45), t46); float32x4_t m41 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.5), s25), vmulq_n_f32(s35, 1.5)); float32x4_t m42 = vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.25), s55), vmulq_n_f32(s65, 2.25)); float32x4_t m43 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.125), s25), vmulq_n_f32(s35, 3.375)); float32x4_t m44 = vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.0625), s55), vmulq_n_f32(s65, 5.0625)); float32x4_t m45 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.03125), s25), vmulq_n_f32(s35, 7.59375)), t47); float32x4_t m50 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t50, t51), t52), t53), t54), t55), t56); float32x4_t m51 = vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.5), s26), vmulq_n_f32(s36, 1.5)); float32x4_t m52 = vaddq_f32(vaddq_f32(vmulq_n_f32(s46, 0.25), s56), vmulq_n_f32(s66, 2.25)); float32x4_t m53 = vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.125), s26), vmulq_n_f32(s36, 3.375)); float32x4_t m54 = vaddq_f32(vaddq_f32(vmulq_n_f32(s46, 0.0625), s56), vmulq_n_f32(s66, 5.0625)); float32x4_t m55 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.03125), s26), vmulq_n_f32(s36, 7.59375)), t57); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + 2 * C4NUM, vaddq_f32(m02, bias_ptr)); vst1q_f32(dst_data + 3 * C4NUM, vaddq_f32(m03, bias_ptr)); vst1q_f32(dst_data + 4 * C4NUM, vaddq_f32(m04, bias_ptr)); vst1q_f32(dst_data + 5 * C4NUM, vaddq_f32(m05, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m12, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m13, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m14, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m15, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM, vaddq_f32(m20, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, vaddq_f32(m21, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m22, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m23, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m24, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m25, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM, vaddq_f32(m30, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + C4NUM, vaddq_f32(m31, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m32, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m33, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m34, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m35, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM, vaddq_f32(m40, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + C4NUM, vaddq_f32(m41, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m42, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m43, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m44, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m45, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM, vaddq_f32(m50, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + C4NUM, vaddq_f32(m51, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m52, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m53, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m54, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m55, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float d31 = src_data_10 + src_data_20; float d32 = src_data_11 + src_data_21; float d33 = src_data_12 + src_data_22; float d34 = src_data_13 + src_data_23; float d35 = src_data_14 + src_data_24; float d36 = src_data_15 + src_data_25; float d37 = src_data_16 + src_data_26; float d38 = src_data_17 + src_data_27; float d41 = src_data_30 + src_data_40; float d42 = src_data_31 + src_data_41; float d43 = src_data_32 + src_data_42; float d44 = src_data_33 + src_data_43; float d45 = src_data_34 + src_data_44; float d46 = src_data_35 + src_data_45; float d47 = src_data_36 + src_data_46; float d48 = src_data_37 + src_data_47; float d51 = src_data_50 + src_data_60; float d52 = src_data_51 + src_data_61; float d53 = src_data_52 + src_data_62; float d54 = src_data_53 + src_data_63; float d55 = src_data_54 + src_data_64; float d56 = src_data_55 + src_data_65; float d57 = src_data_56 + src_data_66; float d58 = src_data_57 + src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21; float t11 = 0.5f * d02 + d12 + 1.5f * d22; float t12 = 0.5f * d03 + d13 + 1.5f * d23; float t13 = 0.5f * d04 + d14 + 1.5f * d24; float t14 = 0.5f * d05 + d15 + 1.5f * d25; float t15 = 0.5f * d06 + d16 + 1.5f * d26; float t16 = 0.5f * d07 + d17 + 1.5f * d27; float t17 = 0.5f * d08 + d18 + 1.5f * d28; float t20 = 0.25f * d31 + d41 + 2.25f * d51; float t21 = 0.25f * d32 + d42 + 2.25f * d52; float t22 = 0.25f * d33 + d43 + 2.25f * d53; float t23 = 0.25f * d34 + d44 + 2.25f * d54; float t24 = 0.25f * d35 + d45 + 2.25f * d55; float t25 = 0.25f * d36 + d46 + 2.25f * d56; float t26 = 0.25f * d37 + d47 + 2.25f * d57; float t27 = 0.25f * d38 + d48 + 2.25f * d58; float t30 = 0.125f * d01 + d11 + 3.375f * d21; float t31 = 0.125f * d02 + d12 + 3.375f * d22; float t32 = 0.125f * d03 + d13 + 3.375f * d23; float t33 = 0.125f * d04 + d14 + 3.375f * d24; float t34 = 0.125f * d05 + d15 + 3.375f * d25; float t35 = 0.125f * d06 + d16 + 3.375f * d26; float t36 = 0.125f * d07 + d17 + 3.375f * d27; float t37 = 0.125f * d08 + d18 + 3.375f * d28; float t40 = 0.0625f * d31 + d41 + 5.0625f * d51; float t41 = 0.0625f * d32 + d42 + 5.0625f * d52; float t42 = 0.0625f * d33 + d43 + 5.0625f * d53; float t43 = 0.0625f * d34 + d44 + 5.0625f * d54; float t44 = 0.0625f * d35 + d45 + 5.0625f * d55; float t45 = 0.0625f * d36 + d46 + 5.0625f * d56; float t46 = 0.0625f * d37 + d47 + 5.0625f * d57; float t47 = 0.0625f * d38 + d48 + 5.0625f * d58; float t50 = 0.03125f * d01 + d11 + 7.59375f * d21 + src_data_70; float t51 = 0.03125f * d02 + d12 + 7.59375f * d22 + src_data_71; float t52 = 0.03125f * d03 + d13 + 7.59375f * d23 + src_data_72; float t53 = 0.03125f * d04 + d14 + 7.59375f * d24 + src_data_73; float t54 = 0.03125f * d05 + d15 + 7.59375f * d25 + src_data_74; float t55 = 0.03125f * d06 + d16 + 7.59375f * d26 + src_data_75; float t56 = 0.03125f * d07 + d17 + 7.59375f * d27 + src_data_76; float t57 = 0.03125f * d08 + d18 + 7.59375f * d28 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s13 = t21 - t22; float s14 = t31 - t32; float s15 = t41 - t42; float s16 = t51 - t52; float s21 = t03 - t04; float s22 = t13 - t14; float s23 = t23 - t24; float s24 = t33 - t34; float s25 = t43 - t44; float s26 = t53 - t54; float s31 = t05 - t06; float s32 = t15 - t16; float s33 = t25 - t26; float s34 = t35 - t36; float s35 = t45 - t46; float s36 = t55 - t56; float s41 = t01 + t02; float s42 = t11 + t12; float s43 = t21 + t22; float s44 = t31 + t32; float s45 = t41 + t42; float s46 = t51 + t52; float s51 = t03 + t04; float s52 = t13 + t14; float s53 = t23 + t24; float s54 = t33 + t34; float s55 = t43 + t44; float s56 = t53 + t54; float s61 = t05 + t06; float s62 = t15 + t16; float s63 = t25 + t26; float s64 = t35 + t36; float s65 = t45 + t46; float s66 = t55 + t56; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31; float m02 = 0.25f * s41 + s51 + 2.25f * s61; float m03 = 0.125f * s11 + s21 + 3.375f * s31; float m04 = 0.0625f * s41 + s51 + 5.0625f * s61; float m05 = 0.03125f * s11 + s21 + 7.59375f * s31 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32; float m12 = 0.25f * s42 + s52 + 2.25f * s62; float m13 = 0.125f * s12 + s22 + 3.375f * s32; float m14 = 0.0625f * s42 + s52 + 5.0625f * s62; float m15 = 0.03125f * s12 + s22 + 7.59375f * s32 + t17; float m20 = t20 + t21 + t22 + t23 + t24 + t25 + t26; float m21 = 0.5f * s13 + s23 + 1.5f * s33; float m22 = 0.25f * s43 + s53 + 2.25f * s63; float m23 = 0.125f * s13 + s23 + 3.375f * s33; float m24 = 0.0625f * s43 + s53 + 5.0625f * s63; float m25 = 0.03125f * s13 + s23 + 7.59375f * s33 + t27; float m30 = t30 + t31 + t32 + t33 + t34 + t35 + t36; float m31 = 0.5f * s14 + s24 + 1.5f * s34; float m32 = 0.25f * s44 + s54 + 2.25f * s64; float m33 = 0.125f * s14 + s24 + 3.375f * s34; float m34 = 0.0625f * s44 + s54 + 5.0625f * s64; float m35 = 0.03125f * s14 + s24 + 7.59375f * s34 + t37; float m40 = t40 + t41 + t42 + t43 + t44 + t45 + t46; float m41 = 0.5f * s15 + s25 + 1.5f * s35; float m42 = 0.25f * s45 + s55 + 2.25f * s65; float m43 = 0.125f * s15 + s25 + 3.375f * s35; float m44 = 0.0625f * s45 + s55 + 5.0625f * s65; float m45 = 0.03125f * s15 + s25 + 7.59375f * s35 + t47; float m50 = t50 + t51 + t52 + t53 + t54 + t55 + t56; float m51 = 0.5f * s16 + s26 + 1.5f * s36; float m52 = 0.25f * s46 + s56 + 2.25f * s66; float m53 = 0.125f * s16 + s26 + 3.375f * s36; float m54 = 0.0625f * s46 + s56 + 5.0625f * s66; float m55 = 0.03125f * s16 + s26 + 7.59375f * s36 + t57; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + 2 * C4NUM)[0] = m02 + bias_data[i]; (dst_data + i + 3 * C4NUM)[0] = m03 + bias_data[i]; (dst_data + i + 4 * C4NUM)[0] = m04 + bias_data[i]; (dst_data + i + 5 * C4NUM)[0] = m05 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 3 * C4NUM)[0] = m13 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 4 * C4NUM)[0] = m14 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 5 * C4NUM)[0] = m15 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 3 * C4NUM)[0] = m23 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 4 * C4NUM)[0] = m24 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 5 * C4NUM)[0] = m25 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM)[0] = m30 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + C4NUM)[0] = m31 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 2 * C4NUM)[0] = m32 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 3 * C4NUM)[0] = m33 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 4 * C4NUM)[0] = m34 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 5 * C4NUM)[0] = m35 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM)[0] = m40 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + C4NUM)[0] = m41 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 2 * C4NUM)[0] = m42 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 3 * C4NUM)[0] = m43 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 4 * C4NUM)[0] = m44 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 5 * C4NUM)[0] = m45 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM)[0] = m50 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + C4NUM)[0] = m51 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 2 * C4NUM)[0] = m52 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 3 * C4NUM)[0] = m53 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 4 * C4NUM)[0] = m54 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 5 * C4NUM)[0] = m55 + bias_data[i]; } #endif } void OutputTransform8x7Unit(const float *src_data, float *dst_data, const float *bias_data, int src_step, int dst_step) { #ifdef ENABLE_ARM float32x4_t src_data_00 = vld1q_f32(src_data + 0 * src_step); float32x4_t src_data_01 = vld1q_f32(src_data + 1 * src_step); float32x4_t src_data_02 = vld1q_f32(src_data + 2 * src_step); float32x4_t src_data_03 = vld1q_f32(src_data + 3 * src_step); float32x4_t src_data_04 = vld1q_f32(src_data + 4 * src_step); float32x4_t src_data_05 = vld1q_f32(src_data + 5 * src_step); float32x4_t src_data_06 = vld1q_f32(src_data + 6 * src_step); float32x4_t src_data_07 = vld1q_f32(src_data + 7 * src_step); float32x4_t src_data_10 = vld1q_f32(src_data + 8 * src_step); float32x4_t src_data_11 = vld1q_f32(src_data + 9 * src_step); float32x4_t src_data_12 = vld1q_f32(src_data + 10 * src_step); float32x4_t src_data_13 = vld1q_f32(src_data + 11 * src_step); float32x4_t src_data_14 = vld1q_f32(src_data + 12 * src_step); float32x4_t src_data_15 = vld1q_f32(src_data + 13 * src_step); float32x4_t src_data_16 = vld1q_f32(src_data + 14 * src_step); float32x4_t src_data_17 = vld1q_f32(src_data + 15 * src_step); float32x4_t src_data_20 = vld1q_f32(src_data + 16 * src_step); float32x4_t src_data_21 = vld1q_f32(src_data + 17 * src_step); float32x4_t src_data_22 = vld1q_f32(src_data + 18 * src_step); float32x4_t src_data_23 = vld1q_f32(src_data + 19 * src_step); float32x4_t src_data_24 = vld1q_f32(src_data + 20 * src_step); float32x4_t src_data_25 = vld1q_f32(src_data + 21 * src_step); float32x4_t src_data_26 = vld1q_f32(src_data + 22 * src_step); float32x4_t src_data_27 = vld1q_f32(src_data + 23 * src_step); float32x4_t src_data_30 = vld1q_f32(src_data + 24 * src_step); float32x4_t src_data_31 = vld1q_f32(src_data + 25 * src_step); float32x4_t src_data_32 = vld1q_f32(src_data + 26 * src_step); float32x4_t src_data_33 = vld1q_f32(src_data + 27 * src_step); float32x4_t src_data_34 = vld1q_f32(src_data + 28 * src_step); float32x4_t src_data_35 = vld1q_f32(src_data + 29 * src_step); float32x4_t src_data_36 = vld1q_f32(src_data + 30 * src_step); float32x4_t src_data_37 = vld1q_f32(src_data + 31 * src_step); float32x4_t src_data_40 = vld1q_f32(src_data + 32 * src_step); float32x4_t src_data_41 = vld1q_f32(src_data + 33 * src_step); float32x4_t src_data_42 = vld1q_f32(src_data + 34 * src_step); float32x4_t src_data_43 = vld1q_f32(src_data + 35 * src_step); float32x4_t src_data_44 = vld1q_f32(src_data + 36 * src_step); float32x4_t src_data_45 = vld1q_f32(src_data + 37 * src_step); float32x4_t src_data_46 = vld1q_f32(src_data + 38 * src_step); float32x4_t src_data_47 = vld1q_f32(src_data + 39 * src_step); float32x4_t src_data_50 = vld1q_f32(src_data + 40 * src_step); float32x4_t src_data_51 = vld1q_f32(src_data + 41 * src_step); float32x4_t src_data_52 = vld1q_f32(src_data + 42 * src_step); float32x4_t src_data_53 = vld1q_f32(src_data + 43 * src_step); float32x4_t src_data_54 = vld1q_f32(src_data + 44 * src_step); float32x4_t src_data_55 = vld1q_f32(src_data + 45 * src_step); float32x4_t src_data_56 = vld1q_f32(src_data + 46 * src_step); float32x4_t src_data_57 = vld1q_f32(src_data + 47 * src_step); float32x4_t src_data_60 = vld1q_f32(src_data + 48 * src_step); float32x4_t src_data_61 = vld1q_f32(src_data + 49 * src_step); float32x4_t src_data_62 = vld1q_f32(src_data + 50 * src_step); float32x4_t src_data_63 = vld1q_f32(src_data + 51 * src_step); float32x4_t src_data_64 = vld1q_f32(src_data + 52 * src_step); float32x4_t src_data_65 = vld1q_f32(src_data + 53 * src_step); float32x4_t src_data_66 = vld1q_f32(src_data + 54 * src_step); float32x4_t src_data_67 = vld1q_f32(src_data + 55 * src_step); float32x4_t src_data_70 = vld1q_f32(src_data + 56 * src_step); float32x4_t src_data_71 = vld1q_f32(src_data + 57 * src_step); float32x4_t src_data_72 = vld1q_f32(src_data + 58 * src_step); float32x4_t src_data_73 = vld1q_f32(src_data + 59 * src_step); float32x4_t src_data_74 = vld1q_f32(src_data + 60 * src_step); float32x4_t src_data_75 = vld1q_f32(src_data + 61 * src_step); float32x4_t src_data_76 = vld1q_f32(src_data + 62 * src_step); float32x4_t src_data_77 = vld1q_f32(src_data + 63 * src_step); float32x4_t d01 = vsubq_f32(src_data_10, src_data_20); float32x4_t d02 = vsubq_f32(src_data_11, src_data_21); float32x4_t d03 = vsubq_f32(src_data_12, src_data_22); float32x4_t d04 = vsubq_f32(src_data_13, src_data_23); float32x4_t d05 = vsubq_f32(src_data_14, src_data_24); float32x4_t d06 = vsubq_f32(src_data_15, src_data_25); float32x4_t d07 = vsubq_f32(src_data_16, src_data_26); float32x4_t d08 = vsubq_f32(src_data_17, src_data_27); float32x4_t d11 = vsubq_f32(src_data_30, src_data_40); float32x4_t d12 = vsubq_f32(src_data_31, src_data_41); float32x4_t d13 = vsubq_f32(src_data_32, src_data_42); float32x4_t d14 = vsubq_f32(src_data_33, src_data_43); float32x4_t d15 = vsubq_f32(src_data_34, src_data_44); float32x4_t d16 = vsubq_f32(src_data_35, src_data_45); float32x4_t d17 = vsubq_f32(src_data_36, src_data_46); float32x4_t d18 = vsubq_f32(src_data_37, src_data_47); float32x4_t d21 = vsubq_f32(src_data_50, src_data_60); float32x4_t d22 = vsubq_f32(src_data_51, src_data_61); float32x4_t d23 = vsubq_f32(src_data_52, src_data_62); float32x4_t d24 = vsubq_f32(src_data_53, src_data_63); float32x4_t d25 = vsubq_f32(src_data_54, src_data_64); float32x4_t d26 = vsubq_f32(src_data_55, src_data_65); float32x4_t d27 = vsubq_f32(src_data_56, src_data_66); float32x4_t d28 = vsubq_f32(src_data_57, src_data_67); float32x4_t d31 = vaddq_f32(src_data_10, src_data_20); float32x4_t d32 = vaddq_f32(src_data_11, src_data_21); float32x4_t d33 = vaddq_f32(src_data_12, src_data_22); float32x4_t d34 = vaddq_f32(src_data_13, src_data_23); float32x4_t d35 = vaddq_f32(src_data_14, src_data_24); float32x4_t d36 = vaddq_f32(src_data_15, src_data_25); float32x4_t d37 = vaddq_f32(src_data_16, src_data_26); float32x4_t d38 = vaddq_f32(src_data_17, src_data_27); float32x4_t d41 = vaddq_f32(src_data_30, src_data_40); float32x4_t d42 = vaddq_f32(src_data_31, src_data_41); float32x4_t d43 = vaddq_f32(src_data_32, src_data_42); float32x4_t d44 = vaddq_f32(src_data_33, src_data_43); float32x4_t d45 = vaddq_f32(src_data_34, src_data_44); float32x4_t d46 = vaddq_f32(src_data_35, src_data_45); float32x4_t d47 = vaddq_f32(src_data_36, src_data_46); float32x4_t d48 = vaddq_f32(src_data_37, src_data_47); float32x4_t d51 = vaddq_f32(src_data_50, src_data_60); float32x4_t d52 = vaddq_f32(src_data_51, src_data_61); float32x4_t d53 = vaddq_f32(src_data_52, src_data_62); float32x4_t d54 = vaddq_f32(src_data_53, src_data_63); float32x4_t d55 = vaddq_f32(src_data_54, src_data_64); float32x4_t d56 = vaddq_f32(src_data_55, src_data_65); float32x4_t d57 = vaddq_f32(src_data_56, src_data_66); float32x4_t d58 = vaddq_f32(src_data_57, src_data_67); float32x4_t t00 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_00, src_data_10), src_data_20), src_data_30), src_data_40), src_data_50), src_data_60); float32x4_t t01 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_01, src_data_11), src_data_21), src_data_31), src_data_41), src_data_51), src_data_61); float32x4_t t02 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_02, src_data_12), src_data_22), src_data_32), src_data_42), src_data_52), src_data_62); float32x4_t t03 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_03, src_data_13), src_data_23), src_data_33), src_data_43), src_data_53), src_data_63); float32x4_t t04 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_04, src_data_14), src_data_24), src_data_34), src_data_44), src_data_54), src_data_64); float32x4_t t05 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_05, src_data_15), src_data_25), src_data_35), src_data_45), src_data_55), src_data_65); float32x4_t t06 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_06, src_data_16), src_data_26), src_data_36), src_data_46), src_data_56), src_data_66); float32x4_t t07 = vaddq_f32( vaddq_f32( vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(src_data_07, src_data_17), src_data_27), src_data_37), src_data_47), src_data_57), src_data_67); float32x4_t t10 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.5), d11), vmulq_n_f32(d21, 1.5)); float32x4_t t11 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.5), d12), vmulq_n_f32(d22, 1.5)); float32x4_t t12 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.5), d13), vmulq_n_f32(d23, 1.5)); float32x4_t t13 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.5), d14), vmulq_n_f32(d24, 1.5)); float32x4_t t14 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.5), d15), vmulq_n_f32(d25, 1.5)); float32x4_t t15 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.5), d16), vmulq_n_f32(d26, 1.5)); float32x4_t t16 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.5), d17), vmulq_n_f32(d27, 1.5)); float32x4_t t17 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.5), d18), vmulq_n_f32(d28, 1.5)); float32x4_t t20 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.25), d41), vmulq_n_f32(d51, 2.25)); float32x4_t t21 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.25), d42), vmulq_n_f32(d52, 2.25)); float32x4_t t22 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.25), d43), vmulq_n_f32(d53, 2.25)); float32x4_t t23 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.25), d44), vmulq_n_f32(d54, 2.25)); float32x4_t t24 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.25), d45), vmulq_n_f32(d55, 2.25)); float32x4_t t25 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.25), d46), vmulq_n_f32(d56, 2.25)); float32x4_t t26 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.25), d47), vmulq_n_f32(d57, 2.25)); float32x4_t t27 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.25), d48), vmulq_n_f32(d58, 2.25)); float32x4_t t30 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.125), d11), vmulq_n_f32(d21, 3.375)); float32x4_t t31 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.125), d12), vmulq_n_f32(d22, 3.375)); float32x4_t t32 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.125), d13), vmulq_n_f32(d23, 3.375)); float32x4_t t33 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.125), d14), vmulq_n_f32(d24, 3.375)); float32x4_t t34 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.125), d15), vmulq_n_f32(d25, 3.375)); float32x4_t t35 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.125), d16), vmulq_n_f32(d26, 3.375)); float32x4_t t36 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.125), d17), vmulq_n_f32(d27, 3.375)); float32x4_t t37 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.125), d18), vmulq_n_f32(d28, 3.375)); float32x4_t t40 = vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.0625), d41), vmulq_n_f32(d51, 5.0625)); float32x4_t t41 = vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.0625), d42), vmulq_n_f32(d52, 5.0625)); float32x4_t t42 = vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.0625), d43), vmulq_n_f32(d53, 5.0625)); float32x4_t t43 = vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.0625), d44), vmulq_n_f32(d54, 5.0625)); float32x4_t t44 = vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.0625), d45), vmulq_n_f32(d55, 5.0625)); float32x4_t t45 = vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.0625), d46), vmulq_n_f32(d56, 5.0625)); float32x4_t t46 = vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.0625), d47), vmulq_n_f32(d57, 5.0625)); float32x4_t t47 = vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.0625), d48), vmulq_n_f32(d58, 5.0625)); float32x4_t t50 = vaddq_f32(vaddq_f32(vmulq_n_f32(d01, 0.03125), d11), vmulq_n_f32(d21, 7.59375)); float32x4_t t51 = vaddq_f32(vaddq_f32(vmulq_n_f32(d02, 0.03125), d12), vmulq_n_f32(d22, 7.59375)); float32x4_t t52 = vaddq_f32(vaddq_f32(vmulq_n_f32(d03, 0.03125), d13), vmulq_n_f32(d23, 7.59375)); float32x4_t t53 = vaddq_f32(vaddq_f32(vmulq_n_f32(d04, 0.03125), d14), vmulq_n_f32(d24, 7.59375)); float32x4_t t54 = vaddq_f32(vaddq_f32(vmulq_n_f32(d05, 0.03125), d15), vmulq_n_f32(d25, 7.59375)); float32x4_t t55 = vaddq_f32(vaddq_f32(vmulq_n_f32(d06, 0.03125), d16), vmulq_n_f32(d26, 7.59375)); float32x4_t t56 = vaddq_f32(vaddq_f32(vmulq_n_f32(d07, 0.03125), d17), vmulq_n_f32(d27, 7.59375)); float32x4_t t57 = vaddq_f32(vaddq_f32(vmulq_n_f32(d08, 0.03125), d18), vmulq_n_f32(d28, 7.59375)); float32x4_t t60 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d31, 0.015625), d41), vmulq_n_f32(d51, 11.390625)), src_data_70); float32x4_t t61 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d32, 0.015625), d42), vmulq_n_f32(d52, 11.390625)), src_data_71); float32x4_t t62 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d33, 0.015625), d43), vmulq_n_f32(d53, 11.390625)), src_data_72); float32x4_t t63 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d34, 0.015625), d44), vmulq_n_f32(d54, 11.390625)), src_data_73); float32x4_t t64 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d35, 0.015625), d45), vmulq_n_f32(d55, 11.390625)), src_data_74); float32x4_t t65 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d36, 0.015625), d46), vmulq_n_f32(d56, 11.390625)), src_data_75); float32x4_t t66 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d37, 0.015625), d47), vmulq_n_f32(d57, 11.390625)), src_data_76); float32x4_t t67 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(d38, 0.015625), d48), vmulq_n_f32(d58, 11.390625)), src_data_77); float32x4_t s11 = vsubq_f32(t01, t02); float32x4_t s12 = vsubq_f32(t11, t12); float32x4_t s13 = vsubq_f32(t21, t22); float32x4_t s14 = vsubq_f32(t31, t32); float32x4_t s15 = vsubq_f32(t41, t42); float32x4_t s16 = vsubq_f32(t51, t52); float32x4_t s17 = vsubq_f32(t61, t62); float32x4_t s21 = vsubq_f32(t03, t04); float32x4_t s22 = vsubq_f32(t13, t14); float32x4_t s23 = vsubq_f32(t23, t24); float32x4_t s24 = vsubq_f32(t33, t34); float32x4_t s25 = vsubq_f32(t43, t44); float32x4_t s26 = vsubq_f32(t53, t54); float32x4_t s27 = vsubq_f32(t63, t64); float32x4_t s31 = vsubq_f32(t05, t06); float32x4_t s32 = vsubq_f32(t15, t16); float32x4_t s33 = vsubq_f32(t25, t26); float32x4_t s34 = vsubq_f32(t35, t36); float32x4_t s35 = vsubq_f32(t45, t46); float32x4_t s36 = vsubq_f32(t55, t56); float32x4_t s37 = vsubq_f32(t65, t66); float32x4_t s41 = vaddq_f32(t01, t02); float32x4_t s42 = vaddq_f32(t11, t12); float32x4_t s43 = vaddq_f32(t21, t22); float32x4_t s44 = vaddq_f32(t31, t32); float32x4_t s45 = vaddq_f32(t41, t42); float32x4_t s46 = vaddq_f32(t51, t52); float32x4_t s47 = vaddq_f32(t61, t62); float32x4_t s51 = vaddq_f32(t03, t04); float32x4_t s52 = vaddq_f32(t13, t14); float32x4_t s53 = vaddq_f32(t23, t24); float32x4_t s54 = vaddq_f32(t33, t34); float32x4_t s55 = vaddq_f32(t43, t44); float32x4_t s56 = vaddq_f32(t53, t54); float32x4_t s57 = vaddq_f32(t63, t64); float32x4_t s61 = vaddq_f32(t05, t06); float32x4_t s62 = vaddq_f32(t15, t16); float32x4_t s63 = vaddq_f32(t25, t26); float32x4_t s64 = vaddq_f32(t35, t36); float32x4_t s65 = vaddq_f32(t45, t46); float32x4_t s66 = vaddq_f32(t55, t56); float32x4_t s67 = vaddq_f32(t65, t66); float32x4_t m00 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t00, t01), t02), t03), t04), t05), t06); float32x4_t m01 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.5), s21), vmulq_n_f32(s31, 1.5)); float32x4_t m02 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.25), s51), vmulq_n_f32(s61, 2.25)); float32x4_t m03 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.125), s21), vmulq_n_f32(s31, 3.375)); float32x4_t m04 = vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.0625), s51), vmulq_n_f32(s61, 5.0625)); float32x4_t m05 = vaddq_f32(vaddq_f32(vmulq_n_f32(s11, 0.03125), s21), vmulq_n_f32(s31, 7.59375)); float32x4_t m06 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s41, 0.015625), s51), vmulq_n_f32(s61, 11.390625)), t07); float32x4_t m10 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t10, t11), t12), t13), t14), t15), t16); float32x4_t m11 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.5), s22), vmulq_n_f32(s32, 1.5)); float32x4_t m12 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.25), s52), vmulq_n_f32(s62, 2.25)); float32x4_t m13 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.125), s22), vmulq_n_f32(s32, 3.375)); float32x4_t m14 = vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.0625), s52), vmulq_n_f32(s62, 5.0625)); float32x4_t m15 = vaddq_f32(vaddq_f32(vmulq_n_f32(s12, 0.03125), s22), vmulq_n_f32(s32, 7.59375)); float32x4_t m16 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s42, 0.015625), s52), vmulq_n_f32(s62, 11.390625)), t17); float32x4_t m20 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t20, t21), t22), t23), t24), t25), t26); float32x4_t m21 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.5), s23), vmulq_n_f32(s33, 1.5)); float32x4_t m22 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.25), s53), vmulq_n_f32(s63, 2.25)); float32x4_t m23 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.125), s23), vmulq_n_f32(s33, 3.375)); float32x4_t m24 = vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.0625), s53), vmulq_n_f32(s63, 5.0625)); float32x4_t m25 = vaddq_f32(vaddq_f32(vmulq_n_f32(s13, 0.03125), s23), vmulq_n_f32(s33, 7.59375)); float32x4_t m26 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s43, 0.015625), s53), vmulq_n_f32(s63, 11.390625)), t27); float32x4_t m30 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t30, t31), t32), t33), t34), t35), t36); float32x4_t m31 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.5), s24), vmulq_n_f32(s34, 1.5)); float32x4_t m32 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.25), s54), vmulq_n_f32(s64, 2.25)); float32x4_t m33 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.125), s24), vmulq_n_f32(s34, 3.375)); float32x4_t m34 = vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.0625), s54), vmulq_n_f32(s64, 5.0625)); float32x4_t m35 = vaddq_f32(vaddq_f32(vmulq_n_f32(s14, 0.03125), s24), vmulq_n_f32(s34, 7.59375)); float32x4_t m36 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s44, 0.015625), s54), vmulq_n_f32(s64, 11.390625)), t37); float32x4_t m40 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t40, t41), t42), t43), t44), t45), t46); float32x4_t m41 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.5), s25), vmulq_n_f32(s35, 1.5)); float32x4_t m42 = vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.25), s55), vmulq_n_f32(s65, 2.25)); float32x4_t m43 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.125), s25), vmulq_n_f32(s35, 3.375)); float32x4_t m44 = vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.0625), s55), vmulq_n_f32(s65, 5.0625)); float32x4_t m45 = vaddq_f32(vaddq_f32(vmulq_n_f32(s15, 0.03125), s25), vmulq_n_f32(s35, 7.59375)); float32x4_t m46 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s45, 0.015625), s55), vmulq_n_f32(s65, 11.390625)), t47); float32x4_t m50 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t50, t51), t52), t53), t54), t55), t56); float32x4_t m51 = vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.5), s26), vmulq_n_f32(s36, 1.5)); float32x4_t m52 = vaddq_f32(vaddq_f32(vmulq_n_f32(s46, 0.25), s56), vmulq_n_f32(s66, 2.25)); float32x4_t m53 = vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.125), s26), vmulq_n_f32(s36, 3.375)); float32x4_t m54 = vaddq_f32(vaddq_f32(vmulq_n_f32(s46, 0.0625), s56), vmulq_n_f32(s66, 5.0625)); float32x4_t m55 = vaddq_f32(vaddq_f32(vmulq_n_f32(s16, 0.03125), s26), vmulq_n_f32(s36, 7.59375)); float32x4_t m56 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s46, 0.015625), s56), vmulq_n_f32(s66, 11.390625)), t57); float32x4_t m60 = vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(vaddq_f32(t60, t61), t62), t63), t64), t65), t66); float32x4_t m61 = vaddq_f32(vaddq_f32(vmulq_n_f32(s17, 0.5), s27), vmulq_n_f32(s37, 1.5)); float32x4_t m62 = vaddq_f32(vaddq_f32(vmulq_n_f32(s47, 0.25), s57), vmulq_n_f32(s67, 2.25)); float32x4_t m63 = vaddq_f32(vaddq_f32(vmulq_n_f32(s17, 0.125), s27), vmulq_n_f32(s37, 3.375)); float32x4_t m64 = vaddq_f32(vaddq_f32(vmulq_n_f32(s47, 0.0625), s57), vmulq_n_f32(s67, 5.0625)); float32x4_t m65 = vaddq_f32(vaddq_f32(vmulq_n_f32(s17, 0.03125), s27), vmulq_n_f32(s37, 7.59375)); float32x4_t m66 = vaddq_f32(vaddq_f32(vaddq_f32(vmulq_n_f32(s47, 0.015625), s57), vmulq_n_f32(s67, 11.390625)), t67); float32x4_t bias_ptr = vld1q_f32(bias_data); vst1q_f32(dst_data, vaddq_f32(m00, bias_ptr)); vst1q_f32(dst_data + C4NUM, vaddq_f32(m01, bias_ptr)); vst1q_f32(dst_data + 2 * C4NUM, vaddq_f32(m02, bias_ptr)); vst1q_f32(dst_data + 3 * C4NUM, vaddq_f32(m03, bias_ptr)); vst1q_f32(dst_data + 4 * C4NUM, vaddq_f32(m04, bias_ptr)); vst1q_f32(dst_data + 5 * C4NUM, vaddq_f32(m05, bias_ptr)); vst1q_f32(dst_data + 6 * C4NUM, vaddq_f32(m06, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM, vaddq_f32(m10, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + C4NUM, vaddq_f32(m11, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m12, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m13, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m14, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m15, bias_ptr)); vst1q_f32(dst_data + dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m16, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM, vaddq_f32(m20, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + C4NUM, vaddq_f32(m21, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m22, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m23, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m24, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m25, bias_ptr)); vst1q_f32(dst_data + 2 * dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m26, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM, vaddq_f32(m30, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + C4NUM, vaddq_f32(m31, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m32, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m33, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m34, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m35, bias_ptr)); vst1q_f32(dst_data + 3 * dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m36, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM, vaddq_f32(m40, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + C4NUM, vaddq_f32(m41, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m42, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m43, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m44, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m45, bias_ptr)); vst1q_f32(dst_data + 4 * dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m46, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM, vaddq_f32(m50, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + C4NUM, vaddq_f32(m51, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m52, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m53, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m54, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m55, bias_ptr)); vst1q_f32(dst_data + 5 * dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m56, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM, vaddq_f32(m60, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + C4NUM, vaddq_f32(m61, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + 2 * C4NUM, vaddq_f32(m62, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + 3 * C4NUM, vaddq_f32(m63, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + 4 * C4NUM, vaddq_f32(m64, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + 5 * C4NUM, vaddq_f32(m65, bias_ptr)); vst1q_f32(dst_data + 6 * dst_step * C4NUM + 6 * C4NUM, vaddq_f32(m66, bias_ptr)); #else for (int i = 0; i < C4NUM; i++) { float src_data_00 = src_data[i]; float src_data_01 = src_data[i + src_step]; float src_data_02 = src_data[i + 2 * src_step]; float src_data_03 = src_data[i + 3 * src_step]; float src_data_04 = src_data[i + 4 * src_step]; float src_data_05 = src_data[i + 5 * src_step]; float src_data_06 = src_data[i + 6 * src_step]; float src_data_07 = src_data[i + 7 * src_step]; float src_data_10 = src_data[i + 8 * src_step]; float src_data_11 = src_data[i + 9 * src_step]; float src_data_12 = src_data[i + 10 * src_step]; float src_data_13 = src_data[i + 11 * src_step]; float src_data_14 = src_data[i + 12 * src_step]; float src_data_15 = src_data[i + 13 * src_step]; float src_data_16 = src_data[i + 14 * src_step]; float src_data_17 = src_data[i + 15 * src_step]; float src_data_20 = src_data[i + 16 * src_step]; float src_data_21 = src_data[i + 17 * src_step]; float src_data_22 = src_data[i + 18 * src_step]; float src_data_23 = src_data[i + 19 * src_step]; float src_data_24 = src_data[i + 20 * src_step]; float src_data_25 = src_data[i + 21 * src_step]; float src_data_26 = src_data[i + 22 * src_step]; float src_data_27 = src_data[i + 23 * src_step]; float src_data_30 = src_data[i + 24 * src_step]; float src_data_31 = src_data[i + 25 * src_step]; float src_data_32 = src_data[i + 26 * src_step]; float src_data_33 = src_data[i + 27 * src_step]; float src_data_34 = src_data[i + 28 * src_step]; float src_data_35 = src_data[i + 29 * src_step]; float src_data_36 = src_data[i + 30 * src_step]; float src_data_37 = src_data[i + 31 * src_step]; float src_data_40 = src_data[i + 32 * src_step]; float src_data_41 = src_data[i + 33 * src_step]; float src_data_42 = src_data[i + 34 * src_step]; float src_data_43 = src_data[i + 35 * src_step]; float src_data_44 = src_data[i + 36 * src_step]; float src_data_45 = src_data[i + 37 * src_step]; float src_data_46 = src_data[i + 38 * src_step]; float src_data_47 = src_data[i + 39 * src_step]; float src_data_50 = src_data[i + 40 * src_step]; float src_data_51 = src_data[i + 41 * src_step]; float src_data_52 = src_data[i + 42 * src_step]; float src_data_53 = src_data[i + 43 * src_step]; float src_data_54 = src_data[i + 44 * src_step]; float src_data_55 = src_data[i + 45 * src_step]; float src_data_56 = src_data[i + 46 * src_step]; float src_data_57 = src_data[i + 47 * src_step]; float src_data_60 = src_data[i + 48 * src_step]; float src_data_61 = src_data[i + 49 * src_step]; float src_data_62 = src_data[i + 50 * src_step]; float src_data_63 = src_data[i + 51 * src_step]; float src_data_64 = src_data[i + 52 * src_step]; float src_data_65 = src_data[i + 53 * src_step]; float src_data_66 = src_data[i + 54 * src_step]; float src_data_67 = src_data[i + 55 * src_step]; float src_data_70 = src_data[i + 56 * src_step]; float src_data_71 = src_data[i + 57 * src_step]; float src_data_72 = src_data[i + 58 * src_step]; float src_data_73 = src_data[i + 59 * src_step]; float src_data_74 = src_data[i + 60 * src_step]; float src_data_75 = src_data[i + 61 * src_step]; float src_data_76 = src_data[i + 62 * src_step]; float src_data_77 = src_data[i + 63 * src_step]; float d01 = src_data_10 - src_data_20; float d02 = src_data_11 - src_data_21; float d03 = src_data_12 - src_data_22; float d04 = src_data_13 - src_data_23; float d05 = src_data_14 - src_data_24; float d06 = src_data_15 - src_data_25; float d07 = src_data_16 - src_data_26; float d08 = src_data_17 - src_data_27; float d11 = src_data_30 - src_data_40; float d12 = src_data_31 - src_data_41; float d13 = src_data_32 - src_data_42; float d14 = src_data_33 - src_data_43; float d15 = src_data_34 - src_data_44; float d16 = src_data_35 - src_data_45; float d17 = src_data_36 - src_data_46; float d18 = src_data_37 - src_data_47; float d21 = src_data_50 - src_data_60; float d22 = src_data_51 - src_data_61; float d23 = src_data_52 - src_data_62; float d24 = src_data_53 - src_data_63; float d25 = src_data_54 - src_data_64; float d26 = src_data_55 - src_data_65; float d27 = src_data_56 - src_data_66; float d28 = src_data_57 - src_data_67; float d31 = src_data_10 + src_data_20; float d32 = src_data_11 + src_data_21; float d33 = src_data_12 + src_data_22; float d34 = src_data_13 + src_data_23; float d35 = src_data_14 + src_data_24; float d36 = src_data_15 + src_data_25; float d37 = src_data_16 + src_data_26; float d38 = src_data_17 + src_data_27; float d41 = src_data_30 + src_data_40; float d42 = src_data_31 + src_data_41; float d43 = src_data_32 + src_data_42; float d44 = src_data_33 + src_data_43; float d45 = src_data_34 + src_data_44; float d46 = src_data_35 + src_data_45; float d47 = src_data_36 + src_data_46; float d48 = src_data_37 + src_data_47; float d51 = src_data_50 + src_data_60; float d52 = src_data_51 + src_data_61; float d53 = src_data_52 + src_data_62; float d54 = src_data_53 + src_data_63; float d55 = src_data_54 + src_data_64; float d56 = src_data_55 + src_data_65; float d57 = src_data_56 + src_data_66; float d58 = src_data_57 + src_data_67; float t00 = src_data_00 + src_data_10 + src_data_20 + src_data_30 + src_data_40 + src_data_50 + src_data_60; float t01 = src_data_01 + src_data_11 + src_data_21 + src_data_31 + src_data_41 + src_data_51 + src_data_61; float t02 = src_data_02 + src_data_12 + src_data_22 + src_data_32 + src_data_42 + src_data_52 + src_data_62; float t03 = src_data_03 + src_data_13 + src_data_23 + src_data_33 + src_data_43 + src_data_53 + src_data_63; float t04 = src_data_04 + src_data_14 + src_data_24 + src_data_34 + src_data_44 + src_data_54 + src_data_64; float t05 = src_data_05 + src_data_15 + src_data_25 + src_data_35 + src_data_45 + src_data_55 + src_data_65; float t06 = src_data_06 + src_data_16 + src_data_26 + src_data_36 + src_data_46 + src_data_56 + src_data_66; float t07 = src_data_07 + src_data_17 + src_data_27 + src_data_37 + src_data_47 + src_data_57 + src_data_67; float t10 = 0.5f * d01 + d11 + 1.5f * d21; float t11 = 0.5f * d02 + d12 + 1.5f * d22; float t12 = 0.5f * d03 + d13 + 1.5f * d23; float t13 = 0.5f * d04 + d14 + 1.5f * d24; float t14 = 0.5f * d05 + d15 + 1.5f * d25; float t15 = 0.5f * d06 + d16 + 1.5f * d26; float t16 = 0.5f * d07 + d17 + 1.5f * d27; float t17 = 0.5f * d08 + d18 + 1.5f * d28; float t20 = 0.25f * d31 + d41 + 2.25f * d51; float t21 = 0.25f * d32 + d42 + 2.25f * d52; float t22 = 0.25f * d33 + d43 + 2.25f * d53; float t23 = 0.25f * d34 + d44 + 2.25f * d54; float t24 = 0.25f * d35 + d45 + 2.25f * d55; float t25 = 0.25f * d36 + d46 + 2.25f * d56; float t26 = 0.25f * d37 + d47 + 2.25f * d57; float t27 = 0.25f * d38 + d48 + 2.25f * d58; float t30 = 0.125f * d01 + d11 + 3.375f * d21; float t31 = 0.125f * d02 + d12 + 3.375f * d22; float t32 = 0.125f * d03 + d13 + 3.375f * d23; float t33 = 0.125f * d04 + d14 + 3.375f * d24; float t34 = 0.125f * d05 + d15 + 3.375f * d25; float t35 = 0.125f * d06 + d16 + 3.375f * d26; float t36 = 0.125f * d07 + d17 + 3.375f * d27; float t37 = 0.125f * d08 + d18 + 3.375f * d28; float t40 = 0.0625f * d31 + d41 + 5.0625f * d51; float t41 = 0.0625f * d32 + d42 + 5.0625f * d52; float t42 = 0.0625f * d33 + d43 + 5.0625f * d53; float t43 = 0.0625f * d34 + d44 + 5.0625f * d54; float t44 = 0.0625f * d35 + d45 + 5.0625f * d55; float t45 = 0.0625f * d36 + d46 + 5.0625f * d56; float t46 = 0.0625f * d37 + d47 + 5.0625f * d57; float t47 = 0.0625f * d38 + d48 + 5.0625f * d58; float t50 = 0.03125f * d01 + d11 + 7.59375f * d21; float t51 = 0.03125f * d02 + d12 + 7.59375f * d22; float t52 = 0.03125f * d03 + d13 + 7.59375f * d23; float t53 = 0.03125f * d04 + d14 + 7.59375f * d24; float t54 = 0.03125f * d05 + d15 + 7.59375f * d25; float t55 = 0.03125f * d06 + d16 + 7.59375f * d26; float t56 = 0.03125f * d07 + d17 + 7.59375f * d27; float t57 = 0.03125f * d08 + d18 + 7.59375f * d28; float t60 = 0.015625f * d31 + d41 + 11.390625f * d51 + src_data_70; float t61 = 0.015625f * d32 + d42 + 11.390625f * d52 + src_data_71; float t62 = 0.015625f * d33 + d43 + 11.390625f * d53 + src_data_72; float t63 = 0.015625f * d34 + d44 + 11.390625f * d54 + src_data_73; float t64 = 0.015625f * d35 + d45 + 11.390625f * d55 + src_data_74; float t65 = 0.015625f * d36 + d46 + 11.390625f * d56 + src_data_75; float t66 = 0.015625f * d37 + d47 + 11.390625f * d57 + src_data_76; float t67 = 0.015625f * d38 + d48 + 11.390625f * d58 + src_data_77; float s11 = t01 - t02; float s12 = t11 - t12; float s13 = t21 - t22; float s14 = t31 - t32; float s15 = t41 - t42; float s16 = t51 - t52; float s17 = t61 - t62; float s21 = t03 - t04; float s22 = t13 - t14; float s23 = t23 - t24; float s24 = t33 - t34; float s25 = t43 - t44; float s26 = t53 - t54; float s27 = t63 - t64; float s31 = t05 - t06; float s32 = t15 - t16; float s33 = t25 - t26; float s34 = t35 - t36; float s35 = t45 - t46; float s36 = t55 - t56; float s37 = t56 - t66; float s41 = t01 + t02; float s42 = t11 + t12; float s43 = t21 + t22; float s44 = t31 + t32; float s45 = t41 + t42; float s46 = t51 + t52; float s47 = t61 + t62; float s51 = t03 + t04; float s52 = t13 + t14; float s53 = t23 + t24; float s54 = t33 + t34; float s55 = t43 + t44; float s56 = t53 + t54; float s57 = t63 + t64; float s61 = t05 + t06; float s62 = t15 + t16; float s63 = t25 + t26; float s64 = t35 + t36; float s65 = t45 + t46; float s66 = t55 + t56; float s67 = t65 + t66; float m00 = t00 + t01 + t02 + t03 + t04 + t05 + t06; float m01 = 0.5f * s11 + s21 + 1.5f * s31; float m02 = 0.25f * s41 + s51 + 2.25f * s61; float m03 = 0.125f * s11 + s21 + 3.375f * s31; float m04 = 0.0625f * s41 + s51 + 5.0625f * s61; float m05 = 0.03125f * s11 + s21 + 7.59375f * s31; float m06 = 0.015625f * s41 + s51 + 11.390625f * s61 + t07; float m10 = t10 + t11 + t12 + t13 + t14 + t15 + t16; float m11 = 0.5f * s12 + s22 + 1.5f * s32; float m12 = 0.25f * s42 + s52 + 2.25f * s62; float m13 = 0.125f * s12 + s22 + 3.375f * s32; float m14 = 0.0625f * s42 + s52 + 5.0625f * s62; float m15 = 0.03125f * s12 + s22 + 7.59375f * s32; float m16 = 0.015625f * s42 + s52 + 11.390625f * s62 + t17; float m20 = t20 + t21 + t22 + t23 + t24 + t25 + t26; float m21 = 0.5f * s13 + s23 + 1.5f * s33; float m22 = 0.25f * s43 + s53 + 2.25f * s63; float m23 = 0.125f * s13 + s23 + 3.375f * s33; float m24 = 0.0625f * s43 + s53 + 5.0625f * s63; float m25 = 0.03125f * s13 + s23 + 7.59375f * s33; float m26 = 0.015625f * s43 + s53 + 11.390625f * s63 + t27; float m30 = t30 + t31 + t32 + t33 + t34 + t35 + t36; float m31 = 0.5f * s14 + s24 + 1.5f * s34; float m32 = 0.25f * s44 + s54 + 2.25f * s64; float m33 = 0.125f * s14 + s24 + 3.375f * s34; float m34 = 0.0625f * s44 + s54 + 5.0625f * s64; float m35 = 0.03125f * s14 + s24 + 7.59375f * s34; float m36 = 0.015625f * s44 + s54 + 11.390625f * s64 + t37; float m40 = t40 + t41 + t42 + t43 + t44 + t45 + t46; float m41 = 0.5f * s15 + s25 + 1.5f * s35; float m42 = 0.25f * s45 + s55 + 2.25f * s65; float m43 = 0.125f * s15 + s25 + 3.375f * s35; float m44 = 0.0625f * s45 + s55 + 5.0625f * s65; float m45 = 0.03125f * s15 + s25 + 7.59375f * s35; float m46 = 0.015625f * s45 + s55 + 11.390625f * s65 + t47; float m50 = t50 + t51 + t52 + t53 + t54 + t55 + t56; float m51 = 0.5f * s16 + s26 + 1.5f * s36; float m52 = 0.25f * s46 + s56 + 2.25f * s66; float m53 = 0.125f * s16 + s26 + 3.375f * s36; float m54 = 0.0625f * s46 + s56 + 5.0625f * s66; float m55 = 0.03125f * s16 + s26 + 7.59375f * s36; float m56 = 0.015625f * s46 + s56 + 11.390625f * s66 + t57; float m60 = t60 + t61 + t62 + t63 + t64 + t65 + t66; float m61 = 0.5f * s17 + s27 + 1.5f * s37; float m62 = 0.25f * s47 + s57 + 2.25f * s67; float m63 = 0.125f * s17 + s27 + 3.375f * s37; float m64 = 0.0625f * s47 + s57 + 5.0625f * s67; float m65 = 0.03125f * s17 + s27 + 7.59375f * s37; float m66 = 0.015625f * s47 + s57 + 11.390625f * s67 + t67; (dst_data + i)[0] = m00 + bias_data[i]; (dst_data + i + C4NUM)[0] = m01 + bias_data[i]; (dst_data + i + 2 * C4NUM)[0] = m02 + bias_data[i]; (dst_data + i + 3 * C4NUM)[0] = m03 + bias_data[i]; (dst_data + i + 4 * C4NUM)[0] = m04 + bias_data[i]; (dst_data + i + 5 * C4NUM)[0] = m05 + bias_data[i]; (dst_data + i + 6 * C4NUM)[0] = m06 + bias_data[i]; (dst_data + i + dst_step * C4NUM)[0] = m10 + bias_data[i]; (dst_data + i + dst_step * C4NUM + C4NUM)[0] = m11 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 2 * C4NUM)[0] = m12 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 3 * C4NUM)[0] = m13 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 4 * C4NUM)[0] = m14 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 5 * C4NUM)[0] = m15 + bias_data[i]; (dst_data + i + dst_step * C4NUM + 6 * C4NUM)[0] = m16 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM)[0] = m20 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + C4NUM)[0] = m21 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 2 * C4NUM)[0] = m22 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 3 * C4NUM)[0] = m23 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 4 * C4NUM)[0] = m24 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 5 * C4NUM)[0] = m25 + bias_data[i]; (dst_data + i + 2 * dst_step * C4NUM + 6 * C4NUM)[0] = m26 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM)[0] = m30 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + C4NUM)[0] = m31 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 2 * C4NUM)[0] = m32 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 3 * C4NUM)[0] = m33 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 4 * C4NUM)[0] = m34 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 5 * C4NUM)[0] = m35 + bias_data[i]; (dst_data + i + 3 * dst_step * C4NUM + 6 * C4NUM)[0] = m36 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM)[0] = m40 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + C4NUM)[0] = m41 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 2 * C4NUM)[0] = m42 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 3 * C4NUM)[0] = m43 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 4 * C4NUM)[0] = m44 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 5 * C4NUM)[0] = m45 + bias_data[i]; (dst_data + i + 4 * dst_step * C4NUM + 6 * C4NUM)[0] = m46 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM)[0] = m50 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + C4NUM)[0] = m51 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 2 * C4NUM)[0] = m52 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 3 * C4NUM)[0] = m53 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 4 * C4NUM)[0] = m54 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 5 * C4NUM)[0] = m55 + bias_data[i]; (dst_data + i + 5 * dst_step * C4NUM + 6 * C4NUM)[0] = m56 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM)[0] = m60 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + C4NUM)[0] = m61 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + 2 * C4NUM)[0] = m62 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + 3 * C4NUM)[0] = m63 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + 4 * C4NUM)[0] = m64 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + 5 * C4NUM)[0] = m65 + bias_data[i]; (dst_data + i + 6 * dst_step * C4NUM + 6 * C4NUM)[0] = m66 + bias_data[i]; } #endif } // Reference to the paper "Fast Algorithms for Convolutional Neural Networks" // Utilize cost model to compute performance gain. // If the gain is greater than got from Im2col, winograd algorithm will be chosen. int SelectOutputUnit(ConvParameter *conv_param) { auto input_batch = conv_param->input_batch_; auto kernel_h = conv_param->kernel_h_; auto kernel_w = conv_param->kernel_w_; auto in_channel = conv_param->input_channel_; auto out_h = conv_param->output_h_; auto out_w = conv_param->output_w_; auto out_channel = conv_param->output_channel_; int out_plane = out_h * out_w; int max_unit = ::sqrt((float)(out_plane)); max_unit = max_unit > MIN_UNIT ? max_unit : MIN_UNIT; max_unit = max_unit < MAX_UNIT ? max_unit : MAX_UNIT; int output_unit = 1; float ratio = 0.0f; // cost of conventional convolution multiplications float ori_cost = out_plane * out_channel * in_channel * kernel_h * kernel_w; for (int u = MIN_UNIT; u < max_unit; u++) { auto input_unit = u + kernel_h - 1; if (input_unit != 4 && input_unit != 8) { continue; } // don't count filter transform cost, because it can be processed once offline. float input_trans_unit_cost = 2 * input_unit * input_unit * input_unit * in_channel; float gemm_unit_cost = input_unit * input_unit * in_channel * out_channel; float output_trans_unit_cost = input_unit * u * (u + input_unit) * out_channel; // equation (23) in papar float winograd_cost = (input_trans_unit_cost + gemm_unit_cost + output_trans_unit_cost) * (UP_DIV(out_w, u) * (UP_DIV(out_h, u))) * input_batch; float reduce_rate = ori_cost / winograd_cost; if (reduce_rate > ratio && reduce_rate > 1) { ratio = reduce_rate; output_unit = u; } } // If output_unit is 1, then it is conventional convolution return output_unit; } InputTransformUnitFunc GetInputTransFunc(int input_unit) { if (input_unit == 4) { return InputTransform4x4Unit; } else if (input_unit == 8) { return InputTransform8x8Unit; } else { printf("Only support 4 or 8 for input unit."); return nullptr; } } OutputTransformUnitFunc GetOutputTransFunc(int input_unit, int output_unit) { if (input_unit == 4 && output_unit == 2) { return OutputTransform4x2Unit; } else if (input_unit == 4 && output_unit == 3) { return OutputTransform4x3Unit; } else if (input_unit == 8) { return outputTransformUnit[output_unit]; } else { printf("."); return nullptr; } } void CheckIfUseWinograd(bool *use_winograd, int *output_unit, ConvParameter *conv_param, InputTransformUnitFunc input_trans_func, OutputTransformUnitFunc output_trans_func) { if (conv_param->kernel_w_ == conv_param->kernel_h_ && conv_param->dilation_h_ == 1 && conv_param->dilation_w_ == 1 && conv_param->stride_h_ == 1 && conv_param->stride_w_ == 1) { *output_unit = SelectOutputUnit(conv_param); if (*output_unit > 1) { *use_winograd = true; int input_unit = conv_param->kernel_h_ + *output_unit - 1; input_trans_func = GetInputTransFunc(input_unit); if (input_trans_func == nullptr) { *use_winograd = false; } output_trans_func = GetOutputTransFunc(input_unit, *output_unit); if (output_trans_func == nullptr) { *use_winograd = false; } } else { *use_winograd = false; } } else { *use_winograd = false; } }
65dee9e43008e4af93e2816f214f859ce06a6ac4
cd0515449a11d4fc8c3807edfce6f2b3e9b748d3
/src/yb/tserver/tserver_shared_mem.h
38a8ed139fb5e6bfc17888303ac3f5e2609dfc7a
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "OpenSSL" ]
permissive
wwjiang007/yugabyte-db
27e14de6f26af8c6b1c5ec2db4c14b33f7442762
d56b534a0bc1e8f89d1cf44142227de48ec69f27
refs/heads/master
2023-07-20T13:20:25.270832
2023-07-11T08:55:18
2023-07-12T10:21:24
150,573,130
0
0
Apache-2.0
2019-07-23T06:48:08
2018-09-27T10:59:24
C
UTF-8
C++
false
false
4,263
h
tserver_shared_mem.h
// Copyright (c) YugaByte, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except // in compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed under the License // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express // or implied. See the License for the specific language governing permissions and limitations // under the License. // #pragma once #include <atomic> #include <memory> #include <boost/asio/ip/tcp.hpp> #include <boost/interprocess/ipc/message_queue.hpp> #include "yb/tserver/tserver_util_fwd.h" #include "yb/util/atomic.h" #include "yb/util/monotime.h" #include "yb/util/net/net_fwd.h" #include "yb/util/slice.h" #include "yb/util/strongly_typed_bool.h" #include "yb/util/thread.h" #include "yb/util/uuid.h" #include "yb/yql/pggate/ybc_pg_typedefs.h" namespace yb { namespace tserver { class TServerSharedData { public: static constexpr uint32_t kMaxNumDbCatalogVersions = kYBCMaxNumDbCatalogVersions; TServerSharedData() { // All atomics stored in shared memory must be lock-free. Non-robust locks // in shared memory can lead to deadlock if a processes crashes, and memory // access violations if the segment is mapped as read-only. // NOTE: this check is NOT sufficient to guarantee that an atomic is safe // for shared memory! Some atomics claim to be lock-free but still require // read-write access for a `load()`. // E.g. for 128 bit objects: https://stackoverflow.com/questions/49816855. LOG_IF(FATAL, !IsAcceptableAtomicImpl(catalog_version_)) << "Shared memory atomics must be lock-free"; host_[0] = 0; } void SetHostEndpoint(const Endpoint& value, const std::string& host) { endpoint_ = value; strncpy(host_, host.c_str(), sizeof(host_) - 1); host_[sizeof(host_) - 1] = 0; } const Endpoint& endpoint() const { return endpoint_; } Slice host() const { return host_; } void SetYsqlCatalogVersion(uint64_t version) { catalog_version_.store(version, std::memory_order_release); } uint64_t ysql_catalog_version() const { return catalog_version_.load(std::memory_order_acquire); } void SetYsqlDbCatalogVersion(size_t index, uint64_t version) { DCHECK_LT(index, kMaxNumDbCatalogVersions); db_catalog_versions_[index].store(version, std::memory_order_release); } uint64_t ysql_db_catalog_version(size_t index) const { DCHECK_LT(index, kMaxNumDbCatalogVersions); return db_catalog_versions_[index].load(std::memory_order_acquire); } void SetPostgresAuthKey(uint64_t auth_key) { postgres_auth_key_ = auth_key; } uint64_t postgres_auth_key() const { return postgres_auth_key_; } private: // Endpoint that should be used by local processes to access this tserver. Endpoint endpoint_; char host_[255 + 1]; // DNS name max length is 255, but on linux HOST_NAME_MAX is 64. std::atomic<uint64_t> catalog_version_{0}; uint64_t postgres_auth_key_; std::atomic<uint64_t> db_catalog_versions_[kMaxNumDbCatalogVersions] = {0}; }; YB_STRONGLY_TYPED_BOOL(Create); class SharedExchange { public: SharedExchange(const Uuid& instance_id, uint64_t session_id, Create create); ~SharedExchange(); std::byte* Obtain(size_t required_size); Result<Slice> SendRequest( boost::interprocess::message_queue* message_queue, CoarseTimePoint deadline); void Respond(size_t size); Result<size_t> Poll(); void SignalStop(); uint64_t session_id() const; private: class Impl; std::unique_ptr<Impl> impl_; }; using SharedExchangeListener = std::function<void(size_t)>; class SharedExchangeThread { public: SharedExchangeThread( const Uuid& instance_id, uint64_t session_id, Create create, const SharedExchangeListener& listener); ~SharedExchangeThread(); SharedExchange& exchange() { return exchange_; } private: SharedExchange exchange_; scoped_refptr<Thread> thread_; }; struct SharedExchangeMessage { uint64_t session_id; size_t size; }; } // namespace tserver } // namespace yb
5a6c24ef098231ed368d2bab37ac2cc569d389be
44153651106dc162fe74b480279c6c9e7475b1f1
/svrmenuwin.cpp
2b0e52de110287723882f81192ca042b5b71a69d
[]
no_license
Maazhou/databaseProject
84c62bea8947da90abf3fc5963aa963a098f428f
8d3e4e76ae928f0692a27ace214a7865dcdb0403
refs/heads/master
2020-08-29T15:59:40.146047
2018-06-18T12:28:52
2018-06-18T12:28:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,247
cpp
svrmenuwin.cpp
#include "svrmenuwin.h" #include "ui_svrmenuwin.h" svrMenuWin::svrMenuWin(QString uid,QWidget *parent) : QMainWindow(parent), ui(new Ui::svrMenuWin) { this->uid=uid; ui->setupUi(this); InfoModel = new QSqlTableModel(this); InfoModel->setTable("SVRMenu"); InfoModel->select(); ui->tableView->setModel(InfoModel); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setColumnWidth(0,60); ui->tableView->setColumnWidth(1,150); ui->tableView->setColumnWidth(2,200); ui->tableView->setColumnWidth(3,60); } svrMenuWin::~svrMenuWin() { delete ui; } void svrMenuWin::on_pushButton_clicked() { //更改套餐 if(QMessageBox::question(this,"confirm","are u sure to change ur service ?")==QMessageBox::Yes) { qDebug()<<"accepted"; QSqlQuery query; qDebug()<<"update User set sid = " + ui->lineEdit->text()+" where uid ='"+this->uid+"' ;"; if(query.exec("update User set sid = " + ui->lineEdit->text()+" where uid ='"+this->uid+"' ;") ){ qDebug()<<"success update service\n"; } else { qDebug()<<"fail to update service\n"; } } else { qDebug()<<"cancelled"; } }
3a92c9a6cc7c378b1555d21269212d8ccf6e8c8e
1271159bcfef693d9d251d2ad043e756a2ccea04
/src/hardware.hpp
c8d56ff5eec421f01b91a9128d801f0fe7817258
[ "BSD-3-Clause" ]
permissive
strongly-typed/nrf-beacon
94f116a9a2cea45e3e548622ae9606a490b197f8
78d0887a60f9ed4daa80559e58c974ae51d41ede
refs/heads/master
2021-01-18T00:03:55.140076
2015-03-11T19:37:15
2015-03-11T19:37:15
32,170,750
0
0
null
2015-03-13T17:34:33
2015-03-13T17:34:31
Eagle
UTF-8
C++
false
false
2,594
hpp
hardware.hpp
#ifndef HARDWARE_HPP #define HARDWARE_HPP #include <stdint.h> #include <xpcc/architecture.hpp> #include <xpcc/processing.hpp> using namespace xpcc::stm32; typedef SystemClock<Pll<ExternalClock<MHz12>, MHz72> > defaultSystemClock; constexpr uint32_t UartSpeed = 115200; constexpr uint32_t SpiSpeed = 9000000; class Hardware { public: typedef GpioOutputB5 nLedGreen; typedef GpioOutputB4 nLedWhite; typedef xpcc::GpioInverted<nLedGreen> LedGreen; typedef xpcc::GpioInverted<nLedWhite> LedWhite; typedef SpiMaster1 Spi; typedef GpioOutputA5 SpiSck; typedef GpioInputA6 SpiMiso; typedef GpioOutputA7 SpiMosi; typedef GpioOutputB2 SpiCsn; typedef xpcc::GpioInverted<SpiCsn> SpiCs; typedef GpioOutputB1 Ce; typedef Usart2 Uart; typedef GpioOutputA2 UartTx; typedef GpioInputA3 UartRx; static void initialize() { initializeLeds(); initializeSpi(); initializeGpio(); initializeUart(); initializeVrefMeasurement(); } static uint32_t getUniqueId() { return *((uint32_t*)0x1FFFF7AC); } /** * @brief Configure Adc1 for measurement of internal reference */ static void initializeVrefMeasurement( uint16_t normal = 1514, uint16_t window = 30); static void initializeLeds() { LedGreen::setOutput(xpcc::Gpio::Low); LedWhite::setOutput(xpcc::Gpio::Low); } static void initializeGpio() { Ce::setOutput(); } static void initializeSpi() { SpiMosi::connect(Spi::Mosi); SpiMiso::connect(Spi::Miso); SpiSck::connect(Spi::Sck); Spi::initialize<defaultSystemClock, SpiSpeed>(); SpiCsn::setOutput(xpcc::Gpio::High); } static void initializeUart() { UartTx::connect(Uart::Tx); UartRx::connect(Uart::Rx, Gpio::InputType::PullUp); Uart::initialize<defaultSystemClock, UartSpeed>(12); } static bool isVoltageLow() { return (sampleVref() - vrefNormal) > vrefWindow; } // static uint16_t // chargeCurrent(); private: static uint16_t sampleVref(); private: static uint16_t vrefNormal; ///< Adc value when voltage is normal static uint16_t vrefWindow; ///< When Vref is outside VrefNormal +- VrefWindow }; #endif
677cb9b5ee802e985c1695cbd2cf4a0138c60ba0
119b571e103d1dcab59f44dbb6ed6a8c866dfa0c
/src/globals/test_support.hpp
1e2400c3d9a73cb8289478a3be2947528a6670de
[ "Apache-2.0" ]
permissive
guimuguo/GPU_graph_mining
84f6bc38c4e300bd8d899b867f45c2acfeddb743
22ba73bea97533ed6b2af613bd263ef4d869e71a
refs/heads/master
2022-04-24T03:36:06.959973
2020-03-28T02:34:03
2020-03-28T02:34:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
299
hpp
test_support.hpp
#ifndef __TEST_SUPPORT_HPP__ #define __TEST_SUPPORT_HPP__ #include <graph_types.hpp> namespace gspan_cuda { types::graph_database_t get_test_database(); types::graph_database_t get_labeled_test_database(); types::graph_database_t get_labeled_test_database2(); } // namespace gspan_cuda #endif
d74cc90f1cbaa6fa712bb2c2de05c56f3a2b5d74
ec2de16739cd71afef4a632a606e83444daf21b1
/DevC++/Code power/To hop.cpp
c11ea6454efa34b0c4ef78e16cbc6c6810ff2005
[]
no_license
minhcongnguyen1508/Code-Java-C--UET
f96bc409c720cb80aaa2f96da81b3870e0937292
24c8018fac67479e0fc01c2068c9ee1a7a700311
refs/heads/master
2020-04-22T00:21:17.478448
2019-02-10T12:58:07
2019-02-10T12:58:07
169,976,733
0
0
null
null
null
null
UTF-8
C++
false
false
547
cpp
To hop.cpp
// # include <iostream> # include <algorithm> # include <string> # include <vector> using namespace std; struct capso{ int a; int b; void input(){ cin>> a >> b; } }; long long giaithua(int n){ if(n <= 1) return 1; else return n*giaithua(n-1); } long long tohop(int n, int k){ return giaithua(n)/(giaithua(k)*giaithua(n-k)); } int main(){ vector <capso> a; capso x; x.input(); while(x.a != -1 && x.b != -1){ a.push_back(x); x.input(); } for(int i = 0; i < a.size(); i++){ cout<< tohop(a[i].a, a[i].b)<<endl; } return 0; }
0dbc65a663eb5960d7605d61551b76aecb53dd83
b331035be4608894ec8c85bd2fa52a847466f8ca
/Codeforces/488A - Giga Tower.cpp
a953cb728d332ad02313a27b93def377d2e2ebfb
[]
no_license
EslamTK/Problem-Solving
e6c465ae87e07d3c304af4fbf190f0000f7c2087
db8fec619b18467190ffa31bfe843d02d7ce4c5f
refs/heads/master
2021-05-04T22:27:19.507494
2018-02-02T22:10:35
2018-02-02T22:10:35
120,036,824
0
0
null
null
null
null
UTF-8
C++
false
false
493
cpp
488A - Giga Tower.cpp
#include <iostream> #include <sstream> using namespace std; int main() { long long n,res=0; string Temp=""; cin >> n; for(;;) { string Temp=""; stringstream ss; ss << n; ss >> Temp; if(res>0) { for(int i=0;i<Temp.size();i++) { if(Temp[i]=='8') { cout << res; return 0; } } } ++n; ++res; } return 0; }
86708bec8bd56ef593d17ec68c9ef8baa3654083
730304a54837bf3db66850f67732426f655cec09
/src/c/Match.cpp
a3451281aa712e752c9b6c7b84dee9c36f388831
[]
no_license
wolski/bibliospec2.0
594e852dccad921ad9efe9c55c8616c0fd125f7b
c3a9b5d155e9c02fa0b7e9f1dcb15346dd78ee31
refs/heads/master
2021-01-10T01:54:58.755873
2015-09-28T11:16:59
2015-09-28T11:16:59
43,296,719
0
0
null
null
null
null
UTF-8
C++
false
false
4,450
cpp
Match.cpp
/* Copyright (c) 2011, University of Washington All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ //class definition for Match #include "Match.h" using namespace std; namespace BiblioSpec { Match::Match() { localSpec_ = NULL; localRef_ = NULL; //expProcPeaks = NULL; //refProcPeaks = NULL; for(int i=0; i < NUM_SCORE_TYPES; i++){ scores_[i] = -1; } rank_ = -1; matchLibID_ = -1; } Match::Match(Spectrum* s, RefSpectrum* ref) { localSpec_ = s; localRef_ = ref; //expProcPeaks = NULL; //refProcPeaks = NULL; for(int i=0; i < NUM_SCORE_TYPES; i++){ scores_[i] = -1; } rank_ = -1; matchLibID_ = -1; } /* Match::Match(const Match& m) { localSpec = m.localSpec; localRef = m.localRef; //expProcPeaks = m.expProcPeaks; //refProcPeaks = m.refProcPeaks; for(int i=0; i < NUM_SCORE_TYPES; i++){ scores_[i] = m.scores_[i]; } rank = m.rank; matchLibID = m.matchLibID; } */ Match::~Match() { //nothing new, nothing delete } /* Match& Match::operator= (const Match& right) { localSpec = right.localSpec; localRef = right.localRef; //expProcPeaks = right.expProcPeaks; //refProcPeaks = right.refProcPeaks; for(int i=0; i < NUM_SCORE_TYPES; i++){ scores_[i] = right.scores_[i]; } rank = right.rank; matchLibID = right.matchLibID; return *this; } */ //setters /* void Match::setExpSpec(Spectrum* exp) { localSpec= exp; } void Match::setRefSpec(RefSpectrum* ref) { localRef = ref; } */ void Match::setScore(SCORE_TYPE type, double score){ scores_[type] = score; } void Match::setRank(int zrank) { rank_ = zrank; } void Match::setMatchLibID(int id) { matchLibID_ = id; } //getters double Match::getScore(SCORE_TYPE type) const{ double score = scores_[type]; return score; } int Match::getRank() const{ return rank_; } int Match::getMatchLibID() const { return matchLibID_; } const Spectrum* Match::getExpSpec() const { return localSpec_; } const RefSpectrum* Match::getRefSpec() const { return localRef_; } /* vector<Peak_T>* Match::getExpProcPeaks() { return expProcPeaks; } vector<Peak_T>* Match::getRefProcPeaks() { return refProcPeaks; } */ /* bool compMatchDotScore( Match m1, Match m2 ) { return m1.getDotProdScore() > m2.getDotProdScore(); } bool compMatchRank( Match m1, Match m2 ) { return m1.getRank() < m2.getRank(); } bool compMatchPvalue(Match m1, Match m2) { return m1.getLogPvalue() > m2.getLogPvalue(); } bool compMatchQvalue(Match m1, Match m2) { return m1.getQvalue() > m2.getQvalue(); } bool compMatchPEPvalue(Match m1, Match m2) { return m1.getProb() > m2.getProb(); } bool compMatchScanNum(Match m1, Match m2) { return m1.getExpSpec()->getScanNumber() < m2.getExpSpec()->getScanNumber(); } */ } // namespace /* * Local Variables: * mode: c * c-basic-offset: 4 * End: */
70e433871550f8645df87bb9448b69b68e44d9c8
de9303cfeef474624a29b77f8d97f67a784f702d
/错排问题.cpp
96fe02f827ae4f1ee3c09448a432626c06f727ea
[]
no_license
CamphorMiss/exercises
63c9a61387054fa9f7c8ff9e8eecb09f05d8b5f6
7ea8c2e71ecfcad95a1862a727c88e43a8971e79
refs/heads/master
2021-01-13T18:53:55.194430
2020-08-23T15:27:46
2020-08-23T15:27:46
242,463,204
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
269
cpp
错排问题.cpp
#include<iostream> using namespace std; int main() { int n=0; long arr[20]={0,1}; for(int i=2;i<20;i++)//´íÅÅÎÊÌâ arr[i]=i*(arr[i-1]+arr[i-2]); while(cin>>n) { cout<<arr[n-1]<<endl; } return 0; }
2a64a22d8b06910c8a5088e09f82e25c1b8e14a7
80905de6967289121afcfece1c68ea3f23011204
/Searching/Jump/Jump/Source.cpp
acf37e0bb05ba343695dbb0a2e493bf7e4c713bb
[]
no_license
BohdanBBG/C-_and_basics
953479948e43461c69ac37770edea260292881d6
db169932152576c58f20aedc75b553a716d59948
refs/heads/master
2020-03-28T21:16:02.174547
2018-10-23T12:34:34
2018-10-23T12:34:34
149,142,735
2
0
null
null
null
null
UTF-8
C++
false
false
842
cpp
Source.cpp
#include<iostream> #include"Jump_search.cpp" #include"Sort.cpp" #include<ctime> using namespace std; const int CONSIZE = 10000; int main() { //int arr[CONSIZE] = { 3,5,2,4,1,2,6,2,7 }; //int arr[CONSIZE] = { 1,2,2,2,5,6,7,8,9 }; int arr[CONSIZE]; int searchesElement = 2; for (int i = 0; i < CONSIZE; i++) { arr[i] = rand() % 100; } Sort(arr, CONSIZE); unsigned start = clock(); int* x = Search(arr, searchesElement, CONSIZE); unsigned end = clock(); cout << "Array: " << endl; for (int i = 0; i < CONSIZE; i++) { cout << arr[i] << " "; } cout << endl; cout <<"Index of elements: "; for (int i = 0; i < Calculate(arr, searchesElement,CONSIZE ); i++) { cout << x[i] << " "; } cout << endl; cout << "Time of working algorithm (with 10 000 elements): "; cout <<(double) end - start << endl; return 0; }
a343eb6b42c2f8260ec9f813e8a7dbae4bf98912
100e569b1336dbaf1f56fe3bd4694c7b640bf6a7
/动态规划/1-4.cpp
6e2c838d248adedd786d83748e62d89ec2d486c8
[]
no_license
SeekingMini/Algorithm-Repositary
dc726cd60d24e180bd38b690a190847a6698cd87
95409508f225af8520c14dcc49e9bd1340dd97b7
refs/heads/master
2023-02-07T23:59:31.967291
2020-12-31T02:05:14
2020-12-31T02:05:14
274,665,131
0
0
null
null
null
null
UTF-8
C++
false
false
777
cpp
1-4.cpp
/* * 题目:除数博弈 * 链接:https://leetcode-cn.com/problems/divisor-game/ */ #include <vector> #include <iostream> using namespace std; bool divisorGame(int N) { if (N == 1) return false; if (N == 2) return true; // dp[i]表示当数字为N时。爱丽丝是否能赢。 // 如果赢,dp[i] = 1; // 如果输,dp[i] = 0。 vector<int> dp(N + 1, 0); for (int i = 2; i <= N; i++) { for (int x = 1; x < i; x++) { if (i % x == 0 && !dp[i - x]) { dp[i] = 1; } } } return dp[N]; } int main() { int N; // 输入数据 cin >> N; // 判断 bool win = divisorGame(N); cout << win << endl; return 0; }
b0482d90d818a0c502b0851c802f15bc4ff4aa86
2a8a90b78f18e87c0049acb094482867756cbfff
/test/adiar/internal/data_types/test_node.cpp
4e6cbbbda52faf20451273a91509add80fd60de6
[ "MIT", "LGPL-3.0-only" ]
permissive
SSoelvsten/adiar
1823a33b4029f5e31bb9e907073fc362d2993d2e
2f95ca23e2bcc56e53c93fc331bde8f3651bb2e9
refs/heads/main
2023-08-31T03:28:15.201698
2023-08-29T14:55:44
2023-08-29T15:04:39
248,442,086
16
13
MIT
2023-08-11T17:42:02
2020-03-19T07:51:58
C++
UTF-8
C++
false
false
15,204
cpp
test_node.cpp
#include "../../../test.h" go_bandit([]() { describe("adiar/internal/data_types/node.h", []() { describe("node", [&]() { const ptr_uint64 terminal_F = ptr_uint64(false); const ptr_uint64 terminal_T = ptr_uint64(true); it("should be a POD", [&]() { AssertThat(std::is_pod<node>::value, Is().True()); }); it("should take up 24 bytes of memory", [&]() { const ptr_uint64 node_ptr = ptr_uint64(42,2); const node n = node(1u,8u, node_ptr, terminal_F); AssertThat(sizeof(n), Is().EqualTo(3u * 8u)); }); describe("node(...), .label(), .id(), .low(), .high()", [&]() { it("should create node [label_t, id_t, ptr_uint64, ptr_uint64] [1]", [&]() { const node n = node(3u,12u, terminal_F, terminal_T); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(3,12))); AssertThat(n.label(), Is().EqualTo(3u)); AssertThat(n.id(), Is().EqualTo(12u)); AssertThat(n.child(false), Is().EqualTo(n.low())); AssertThat(n.low(), Is().EqualTo(terminal_F)); AssertThat(n.child(true), Is().EqualTo(n.high())); AssertThat(n.high(), Is().EqualTo(terminal_T)); }); it("should create node [label_t, id_t, ptr_uint64, ptr_uint64] [2]", [&]() { const node n = node(3u,42u, terminal_T, terminal_F); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(3,42))); AssertThat(n.label(), Is().EqualTo(3u)); AssertThat(n.id(), Is().EqualTo(42u)); AssertThat(n.child(false), Is().EqualTo(n.low())); AssertThat(n.low(), Is().EqualTo(terminal_T)); AssertThat(n.child(true), Is().EqualTo(n.high())); AssertThat(n.high(), Is().EqualTo(terminal_F)); }); it("should create node [label_t, id_t, node&, node&]", [&]() { const node n_child1 = node(3u,12u, terminal_F, terminal_T); const node n_child2 = node(3u,42u, terminal_T, terminal_F); const node n = node(2,2, n_child1, n_child2); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(2,2))); AssertThat(n.label(), Is().EqualTo(2u)); AssertThat(n.id(), Is().EqualTo(2u)); AssertThat(n.child(false), Is().EqualTo(n.low())); AssertThat(n.low(), Is().EqualTo(n_child1.uid())); AssertThat(n.child(true), Is().EqualTo(n.high())); AssertThat(n.high(), Is().EqualTo(n_child2.uid())); }); it("should create node [label_t, id_t, node&, ptr_uint64]", [&]() { const node n_child = node(2u,2u, terminal_F, terminal_T); const node n = node(1u,7u,terminal_T,n_child); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(1,7))); AssertThat(n.label(), Is().EqualTo(1u)); AssertThat(n.id(), Is().EqualTo(7u)); AssertThat(n.child(false), Is().EqualTo(n.low())); AssertThat(n.low(), Is().EqualTo(terminal_T)); AssertThat(n.child(true), Is().EqualTo(n.high())); AssertThat(n.high(), Is().EqualTo(n_child.uid())); }); it("should create node [label_t, id_t, ptr_uint64, node&]", [&]() { const node n_child = node(2u,2u, terminal_F,terminal_T); const node n = node(0u,3u, terminal_T,n_child); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(0,3))); AssertThat(n.label(), Is().EqualTo(0u)); AssertThat(n.id(), Is().EqualTo(3u)); AssertThat(n.child(false), Is().EqualTo(n.low())); AssertThat(n.low(), Is().EqualTo(terminal_T)); AssertThat(n.child(true), Is().EqualTo(n.high())); AssertThat(n.high(), Is().EqualTo(n_child.uid())); }); }); describe("terminal nodes", [&]() { const node terminal_node_T = node(true); const node terminal_node_F = node(false); it("has NIL() children [F]", [&]() { AssertThat(terminal_node_F.low(), Is().EqualTo(node::ptr_t::NIL())); AssertThat(terminal_node_F.high(), Is().EqualTo(node::ptr_t::NIL())); }); it("has NIL() children [T]", [&]() { AssertThat(terminal_node_T.low(), Is().EqualTo(node::ptr_t::NIL())); AssertThat(terminal_node_T.high(), Is().EqualTo(node::ptr_t::NIL())); }); describe("is_terminal", [&]() { it("accepts terminal [F]", [&]() { AssertThat(terminal_node_F.is_terminal(), Is().True()); }); it("accepts terminal [T]", [&]() { AssertThat(terminal_node_T.is_terminal(), Is().True()); }); it("rejects non-terminal nodes [1]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); AssertThat(node_1.is_terminal(), Is().False()); }); it("rejects non-terminal nodes [2]", [&]() { const node almost_F_terminal = node(0u,0u, terminal_T, ptr_uint64(42,2)); AssertThat(almost_F_terminal.is_terminal(), Is().False()); }); it("rejects non-terminal nodes [3]", [&]() { const node almost_T_terminal = node(0u,1u, terminal_T, ptr_uint64(42,2)); AssertThat(almost_T_terminal.is_terminal(), Is().False()); }); }); describe("value_of", [&]() { it("retrieves value of terminal node [T]", [&]() { AssertThat(terminal_node_T.value(), Is().True()); }); it("retrieves value of a terminal node [F]", [&]() { AssertThat(terminal_node_F.value(), Is().False()); }); }); describe("is_false", [&]() { it("accepts terminal [F]", [&]() { AssertThat(terminal_node_F.is_false(), Is().True()); }); it("rejects terminal [T]", [&]() { AssertThat(terminal_node_T.is_false(), Is().False()); }); it("rejects non-terminal nodes", [&]() { const node n = node(0,0, ptr_uint64(42,2), terminal_F); AssertThat(n.is_false(), Is().False()); }); }); describe("is_true", [&]() { it("rejects terminal [F]", [&]() { AssertThat(terminal_node_F.is_true(), Is().False()); }); it("accepts terminal [T]", [&]() { AssertThat(terminal_node_T.is_true(), Is().True()); }); it("rejects non-terminal nodes", [&]() { const node n = node(0,1, terminal_T, ptr_uint64(2,3)); AssertThat(n.is_true(), Is().False()); }); }); }); describe("comparators [node]", [&]() { it("should primarily sort by label", [&]() { const node node_1 = node(1u,2u, terminal_F, terminal_T); const node node_2 = node(2u,1u, terminal_T, terminal_F); AssertThat(node_1, Is().LessThan(node_2)); AssertThat(node_1, Is().LessThanOrEqualTo(node_2)); AssertThat(node_2, Is().GreaterThan(node_1)); AssertThat(node_2, Is().GreaterThanOrEqualTo(node_1)); }); it("should secondly sort by id", [&]() { const node node_1 = node(2u,1u, terminal_F, terminal_T); const node node_2 = node(2u,2u, terminal_T, terminal_F); AssertThat(node_1, Is().LessThan(node_2)); AssertThat(node_2, Is().GreaterThan(node_1)); AssertThat(node_1, Is().LessThanOrEqualTo(node_2)); AssertThat(node_2, Is().GreaterThanOrEqualTo(node_1)); }); it("should thirdly sort by children [1]", [&]() { const node node_1 = node(2u,0u, terminal_F, terminal_T); const node node_2 = node(2u,0u, terminal_T, terminal_F); AssertThat(node_1, Is().LessThan(node_2)); AssertThat(node_2, Is().GreaterThan(node_1)); AssertThat(node_1, Is().LessThanOrEqualTo(node_2)); AssertThat(node_2, Is().GreaterThanOrEqualTo(node_1)); }); it("should thirdly sort by children [2]", [&]() { const node node_1 = node(2u,0u, terminal_T, terminal_F); const node node_2 = node(2u,0u, terminal_T, terminal_T); AssertThat(node_1, Is().LessThan(node_2)); AssertThat(node_2, Is().GreaterThan(node_1)); AssertThat(node_1, Is().LessThanOrEqualTo(node_2)); AssertThat(node_2, Is().GreaterThanOrEqualTo(node_1)); }); it("should (not) provide an ordering when equal", [&]() { const node node_1 = node(2u,1u, terminal_F, terminal_T); const node node_2 = node(2u,1u, terminal_F, terminal_T); AssertThat(node_1, Is().Not().LessThan(node_2)); AssertThat(node_2, Is().Not().GreaterThan(node_1)); AssertThat(node_1, Is().LessThanOrEqualTo(node_2)); AssertThat(node_2, Is().GreaterThanOrEqualTo(node_1)); }); it("should be equal by if uid, low, and high agree [1]", [&]() { const node node_1_v1 = node(42u,2u, terminal_F, terminal_T); const node node_1_v2 = node(42u,2u, terminal_F, terminal_T); AssertThat(node_1_v1, Is().EqualTo(node_1_v2)); AssertThat(node_1_v1 != node_1_v2, Is().False()); }); it("should be equal by if uid, low, and high agree [2]", [&]() { const node node_1_v1 = node(0u,0u, terminal_F, terminal_F); const node node_1_v2 = node(0u,0u, terminal_F, terminal_F); AssertThat(node_1_v1, Is().EqualTo(node_1_v2)); AssertThat(node_1_v1 != node_1_v2, Is().False()); }); it("should be unequal if uid mismatches [1]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); const node node_2 = node(42u,1u, terminal_F, terminal_T); AssertThat(node_1, Is().Not().EqualTo(node_2)); AssertThat(node_1 != node_2, Is().True()); }); it("should be unequal if uid mismatches [2]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); const node node_2 = node(21u,2u, terminal_F, terminal_T); AssertThat(node_1, Is().Not().EqualTo(node_2)); AssertThat(node_1 != node_2, Is().True()); }); it("should be unequal if uid mismatches [3]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); const node node_2 = node(21u,8u, terminal_F, terminal_T); AssertThat(node_1, Is().Not().EqualTo(node_2)); AssertThat(node_1 != node_2, Is().True()); }); it("should be unequal if low mismatches [1]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); const node node_2 = node(42u,2u, terminal_T, terminal_T); AssertThat(node_1 == node_2, Is().False()); AssertThat(node_1 != node_2, Is().True()); }); it("should be unequal if high mismatches [1]", [&]() { const node node_1 = node(42u,2u, terminal_F, terminal_T); const node node_2 = node(42u,2u, terminal_F, terminal_F); AssertThat(node_1 == node_2, Is().False()); AssertThat(node_1 != node_2, Is().True()); }); }); describe("comparators [uid]", [&]() { it("should primarily sort by label [ 1]", [&]() { const node n = node(0u, 1u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(1u,0u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); AssertThat(u, Is().GreaterThan(n)); AssertThat(u, Is().GreaterThanOrEqualTo(n)); }); it("should primarily sort by label [!1]", [&]() { const node n = node(0u, 1u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(1u,0u); AssertThat(u, Is().Not().LessThan(n)); AssertThat(u, Is().Not().LessThanOrEqualTo(n)); AssertThat(n, Is().Not().GreaterThan(u)); AssertThat(n, Is().Not().GreaterThanOrEqualTo(u)); }); it("should primarily sort by label [ 2]", [&]() { const node n = node(21u, 8u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(42u,2u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); AssertThat(u, Is().GreaterThan(n)); AssertThat(u, Is().GreaterThanOrEqualTo(n)); }); it("should primarily sort by label [ 3]", [&]() { const node n = node(1u, 1u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(0u,2u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); AssertThat(n, Is().GreaterThan(u)); AssertThat(n, Is().GreaterThanOrEqualTo(u)); }); it("should primarily sort by label [ 4]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(21u,8u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); AssertThat(n, Is().GreaterThan(u)); AssertThat(n, Is().GreaterThanOrEqualTo(u)); }); it("should primarily sort by label [!4]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(21u,8u); AssertThat(n, Is().Not().LessThan(u)); AssertThat(n, Is().Not().LessThanOrEqualTo(u)); AssertThat(u, Is().Not().GreaterThan(n)); AssertThat(u, Is().Not().GreaterThanOrEqualTo(n)); }); it("should secondly sort by id [ 1]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(42u, 1u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); AssertThat(u, Is().GreaterThan(n)); AssertThat(u, Is().GreaterThanOrEqualTo(n)); }); it("should secondly sort by id [ 2]", [&]() { const node n = node(42u, 1u, terminal_F, terminal_T); const node::uid_t u = node::uid_t(42u, 0u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); AssertThat(n, Is().GreaterThan(u)); AssertThat(n, Is().GreaterThanOrEqualTo(u)); }); }); describe("negate (~)", [&]() { it("should leave node_ptr children unchanged", [&]() { const node n = node(2u,2u, ptr_uint64(42,3), ptr_uint64(8,2)); AssertThat(~n, Is().EqualTo(n)); }); it("should negate terminal_ptr child", [&]() { const node n = node(2u,2u, terminal_F, ptr_uint64(8,2)); AssertThat(~n, Is().EqualTo(node(2,2, terminal_T, ptr_uint64(8,2)))); }); it("should negate terminal_ptr children while preserving flags", [&]() { const node n = node(2u,2u, terminal_F, flag(terminal_T)); AssertThat(~n, Is().EqualTo(node(2,2, terminal_T, flag(terminal_F)))); }); it("should negate terminal node", [&]() { AssertThat(~node(true), Is().EqualTo(node(false))); AssertThat(~node(false), Is().EqualTo(node(true))); }); }); }); }); });
d3946611797f80dcf0183501f92940c2430f6c0f
cd4273d6a2dfab0001143c0e702f670cae8851aa
/hw3/HW03_111044050/Vect3D.h
50c3962e3f586a24d7dc80b646843c4f7a1b540c
[]
no_license
sametsalikci/CSE241_Object_Oriented_Programming
cb8bb141409f5f11258148575338f793bae17cc7
808672d27a2db0b5d5d76b7520b254fbf889024f
refs/heads/master
2020-12-31T04:28:48.796799
2016-03-05T04:47:54
2016-03-05T04:47:54
53,183,653
0
0
null
null
null
null
UTF-8
C++
false
false
1,068
h
Vect3D.h
/* # NAME : MEHMET NAZHAR SALIKCI # NUMBER : 111044050 # HOMEWORK : 03 */ /* * The vector class and this class componenets and * these components are processes that are related to */ class Vect3D { public: Vect3D(double,double,double);//three parameter constructor Vect3D(double,double);//two parameter constructor Vect3D(double cordX):x(cordX),y(0),z(0){/*empty*/};//one parameter constructer Vect3D():x(0),y(0),z(0){/*empty*/};//Default constructor //setter functions void setX(double newX){x = newX;}; void setY(double newY){y = newY;}; void setZ(double newZ){z = newZ;}; //getter functions double getX(){return x;}; double getY(){return y;}; double getZ(){return z;}; double dotProduct(const Vect3D&);//return x.y.z Vect3D crossProduct(const Vect3D&);//return (x,y,z) double magnitudeVect3D();//return magnitude of a vector etc. (x,y,z) void input(); void output(); private: double x; double y; double z; }; //functions Testing cal bye vule and cal bye reference metod void testCallByValue(Vect3D v1); void testCallByReference(Vect3D &v1);
61273ae5d447a8f6619278ea11eab85d6f508818
a5f3445526d8633bf378d08214f2a4b4bad184c9
/src/PathPlanner.cpp
092b26d6cbb25792845dbd93977b459945a226c4
[ "MIT" ]
permissive
RaulDa/CarND-Path-Planning-P11
d9c3c4a973c8e3eabf7d4056bcacbcab7cd41ad7
db268bbe5c114029b5bb847dd62fb04a0511a64f
refs/heads/master
2020-03-18T18:20:30.236022
2018-09-16T07:01:31
2018-09-16T07:01:31
135,086,152
0
0
null
null
null
null
UTF-8
C++
false
false
23,036
cpp
PathPlanner.cpp
/* * PathPlanner.cpp * * Created on: May 26, 2018 * Author: Raul Davila / Udacity */ #include "PathPlanner.h" #include "spline.h" #include <vector> #include <math.h> #include <iostream> using namespace std; // For converting back and forth between radians and degrees. constexpr double pi() { return M_PI; } double deg2rad(double x) { return x * pi() / 180; } double rad2deg(double x) { return x * 180 / pi(); } // Calculate distance between points double distance(double x1, double y1, double x2, double y2) { return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); } // Get closest waypoint int ClosestWaypoint(double x, double y, const vector<double> &maps_x, const vector<double> &maps_y) { double closestLen = 100000; //large number int closestWaypoint = 0; for(int i = 0; i < maps_x.size(); i++) { double map_x = maps_x[i]; double map_y = maps_y[i]; double dist = distance(x,y,map_x,map_y); if(dist < closestLen) { closestLen = dist; closestWaypoint = i; } } return closestWaypoint; } // Get next waypoint int NextWaypoint(double x, double y, double theta, const vector<double> &maps_x, const vector<double> &maps_y) { int closestWaypoint = ClosestWaypoint(x,y,maps_x,maps_y); double map_x = maps_x[closestWaypoint]; double map_y = maps_y[closestWaypoint]; double heading = atan2((map_y-y),(map_x-x)); double angle = fabs(theta-heading); angle = min(2*pi() - angle, angle); if(angle > pi()/4) { closestWaypoint++; if (closestWaypoint == maps_x.size()) { closestWaypoint = 0; } } return closestWaypoint; } // Transform from Cartesian x,y coordinates to Frenet s,d coordinates vector<double> getFrenet(double x, double y, double theta, const vector<double> &maps_x, const vector<double> &maps_y) { int next_wp = NextWaypoint(x,y, theta, maps_x,maps_y); int prev_wp; prev_wp = next_wp-1; if(next_wp == 0) { prev_wp = maps_x.size()-1; } double n_x = maps_x[next_wp]-maps_x[prev_wp]; double n_y = maps_y[next_wp]-maps_y[prev_wp]; double x_x = x - maps_x[prev_wp]; double x_y = y - maps_y[prev_wp]; // find the projection of x onto n double proj_norm = (x_x*n_x+x_y*n_y)/(n_x*n_x+n_y*n_y); double proj_x = proj_norm*n_x; double proj_y = proj_norm*n_y; double frenet_d = distance(x_x,x_y,proj_x,proj_y); //see if d value is positive or negative by comparing it to a center point double center_x = 1000-maps_x[prev_wp]; double center_y = 2000-maps_y[prev_wp]; double centerToPos = distance(center_x,center_y,x_x,x_y); double centerToRef = distance(center_x,center_y,proj_x,proj_y); if(centerToPos <= centerToRef) { frenet_d *= -1; } // calculate s value double frenet_s = 0; for(int i = 0; i < prev_wp; i++) { frenet_s += distance(maps_x[i],maps_y[i],maps_x[i+1],maps_y[i+1]); } frenet_s += distance(0,0,proj_x,proj_y); return {frenet_s,frenet_d}; } // Transform from Frenet s,d coordinates to Cartesian x,y vector<double> getXY(double s, double d, const vector<double> &maps_s, const vector<double> &maps_x, const vector<double> &maps_y) { int prev_wp = -1; while(s > maps_s[prev_wp+1] && (prev_wp < (int)(maps_s.size()-1) )) { prev_wp++; } int wp2 = (prev_wp+1)%maps_x.size(); double heading = atan2((maps_y[wp2]-maps_y[prev_wp]),(maps_x[wp2]-maps_x[prev_wp])); // the x,y,s along the segment double seg_s = (s-maps_s[prev_wp]); double seg_x = maps_x[prev_wp]+seg_s*cos(heading); double seg_y = maps_y[prev_wp]+seg_s*sin(heading); double perp_heading = heading-pi()/2; double x = seg_x + d*cos(perp_heading); double y = seg_y + d*sin(perp_heading); return {x,y}; } // Behavior planning routine (See detailed description in header file) void PathPlanner::behavior_planning(vector<vector<double>> sensor_fusion, carCoordinates car_coord, int prev_size, int *lane, double *ref_vel) { static int state = keepLane; // 0 = keep lane, 1 = prep. change lane, // 2 = change center, 3 = change left, 4 = change right static bool first_deceleration = false; // Speed of front vehicle and counter static double speed_front; static int counter_freeze_speed_front = 0; // Speeds of near vehicles on desired change lane static vector<double> speeds_center; static vector<double> speeds_left; static vector<double> speeds_right; // Mean speed of near vehicles on desired change lane double mean_speed = 0; // Flags for activating lane change bool change_center_safe = false; bool change_left_safe = false; bool change_right_safe = false; // True if the lane change is safe bool prepared = false; // True if ego is closer than front safe distance bool too_close = false; // Pointers of outputs int *lane_pt = lane; double *ref_vel_pt = ref_vel; // Distance to front car. Measured for adjusting acceleration in function of it static double dist = 0; switch(state){ case(keepLane): // Iterate over all cars on the road for(int i = 0; i < sensor_fusion.size(); i++){ float d = sensor_fusion[i][6]; // Check if car is in our lane if(d < (lane_width+lane_width*(*lane_pt)) && d > (lane_width*(*lane_pt))){ // Get s and speed double vx = sensor_fusion[i][3]; double vy = sensor_fusion[i][4]; double check_speed = sqrt(vx*vx+vy*vy); double check_car_s = sensor_fusion[i][5]; // If using previous points can project s value out check_car_s += ((double)prev_size*.02*check_speed); // Check s values greater than mine and s gap if((check_car_s > car_coord.car_s) && ((check_car_s-car_coord.car_s) < safe_distance_front)){ // Store speed of front vehicle speed_front = check_speed; // State change state = prepareChangeLane; break; } } } // Speed adjustment if((*ref_vel_pt) < max_speed){ // Greater acceleration for start of simulation if (first_deceleration){ *ref_vel_pt += acceleration; } else{ *ref_vel_pt += first_acceleration; } } break; case(prepareChangeLane): // If we are in border lane, check if conditions to change to center lane are fulfilled if((*lane_pt) == leftLane || (*lane_pt) == rightLane){ // Set flag that allows change to center initially to True change_center_safe = true; // Check all cars on road for(int i = 0; i < sensor_fusion.size(); i++){ // Check if car is in center lane float d = sensor_fusion[i][6]; if(d < 2*lane_width && d > lane_width){ // Get speed and s coordinate double vx = sensor_fusion[i][3]; double vy = sensor_fusion[i][4]; double check_speed = sqrt(vx*vx+vy*vy); double check_car_s = sensor_fusion[i][5]; // If using previous points can project s value out check_car_s += ((double)prev_size*.02*check_speed); // If there is a car in desired lane at [-safe_distance_back, safe_distance_front] (being 0m my current car s reference), change is not safe if(car_coord.car_s-safe_distance_back < check_car_s && check_car_s < car_coord.car_s+safe_distance_front){ change_center_safe = false; } // If there is a car in desired lane at [-safe_distance_back_vel_check, -safe_distance_back] or [safe_distance_front, safe_distance_front_vel_check] (being 0m my current car s reference), store speeds of these vehicles if((car_coord.car_s-safe_distance_back_vel_check < check_car_s && check_car_s < car_coord.car_s-safe_distance_back) || (car_coord.car_s+safe_distance_front < check_car_s && check_car_s < car_coord.car_s+safe_distance_front_vel_check)){ speeds_center.push_back(check_speed); } } } } // Check whether we are in center lane if((*lane_pt) == centerLane){ // Set flag that allows change to left initially to True change_left_safe = true; // Check all cars on road for(int i = 0; i < sensor_fusion.size(); i++){ // Check whether car is in left lane float d = sensor_fusion[i][6]; if(d < lane_width){ // Store speed and s coordinate double vx = sensor_fusion[i][3]; double vy = sensor_fusion[i][4]; double check_speed = sqrt(vx*vx+vy*vy); double check_car_s = sensor_fusion[i][5]; // if using previous points can project s value out check_car_s += ((double)prev_size*.02*check_speed); // If there is a car in desired lane at [-safe_distance_back, safe_distance_front] (being 0m my current car s reference), change is not safe if(car_coord.car_s-safe_distance_back < check_car_s && check_car_s < car_coord.car_s+safe_distance_front){ change_left_safe = false; } // If there is a car in desired lane at [-safe_distance_back_vel_check, -safe_distance_back] or [safe_distance_front, safe_distance_front_vel_check] (being 0m my current car s reference), store speeds of these vehicles if((car_coord.car_s-safe_distance_back_vel_check < check_car_s && check_car_s < car_coord.car_s-safe_distance_back) || (car_coord.car_s+safe_distance_front < check_car_s && check_car_s < car_coord.car_s+safe_distance_front_vel_check)){ speeds_left.push_back(check_speed); } } } // Set flag that allows change to right initially to True change_right_safe = true; // Check all cars on road for(int i = 0; i < sensor_fusion.size(); i++){ // Check whether car is in right lane float d = sensor_fusion[i][6]; if(d > 2*lane_width){ // Store speed and s coordinate double vx = sensor_fusion[i][3]; double vy = sensor_fusion[i][4]; double check_speed = sqrt(vx*vx+vy*vy); double check_car_s = sensor_fusion[i][5]; // If using previous points can project s value out check_car_s += ((double)prev_size*.02*check_speed); // If there is a car in desired lane at [-safe_distance_back, safe_distance_front] (being 0m my current s car reference), change is not safe if(car_coord.car_s-safe_distance_back < check_car_s && check_car_s < car_coord.car_s+safe_distance_front){ change_right_safe = false; } // If there is a car in desired lane at [-safe_distance_back_vel_check, -safe_distance_back] or [safe_distance_front, safe_distance_front_vel_check] (being 0m my current s car reference), store speeds of these vehicles if((car_coord.car_s-safe_distance_back_vel_check < check_car_s && check_car_s < car_coord.car_s-safe_distance_back) || (car_coord.car_s+safe_distance_front < check_car_s && check_car_s < car_coord.car_s+safe_distance_front_vel_check)){ speeds_right.push_back(check_speed); } } } } // If no car in [-safe_distance_back,safe_distance_front] of desired lane (0m is my actual car s reference) if(change_center_safe){ // If no car in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] if(speeds_center.empty()){ // Change to center lane *lane_pt = centerLane; // State change state = changeCenterLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // Calculate mean speed of cars in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] mean_speed = 0; for(int i = 0; i < speeds_center.size(); i++){ mean_speed += speeds_center[i]; } mean_speed = mean_speed/speeds_center.size(); // If mean speed and my speed have difference of [-safe_speed_difference,safe_speed_difference] change is safe if(mean_speed-safe_speed_difference < (*ref_vel_pt)/2.24 && (*ref_vel_pt)/2.24 < mean_speed+safe_speed_difference){ // Change to center lane *lane_pt = centerLane; // State change state = changeCenterLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // No lane change in this cycle, so adjust velocity prepared = false; } } // Clear speed vectors speeds_left.clear(); speeds_center.clear(); speeds_right.clear(); } // If no car in [-safe_distance_back,safe_distance_front] of left lane (0m is my actual car s reference) else if(change_left_safe){ // If no car in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] if(speeds_left.empty()){ // Change to left lane *lane_pt = leftLane; // State change state = changeLeftLane; // Avoid velocity adjustment in this cycle prepared = true; } // If no car in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] of right lane else if(change_right_safe && speeds_right.empty()){ // Change to right lane *lane_pt = rightLane; // State change state = changeRightLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // Calculate mean speed of cars in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] mean_speed = 0; for(int i = 0; i < speeds_left.size(); i++){ mean_speed += speeds_left[i]; } mean_speed = mean_speed/speeds_left.size(); // If mean speed and my speed have difference of [-safe_speed_difference,safe_speed_difference] change is safe if(mean_speed-safe_speed_difference < (*ref_vel_pt)/2.24 && (*ref_vel_pt)/2.24 < mean_speed+safe_speed_difference){ // Change to left lane *lane_pt = leftLane; // State change state = changeLeftLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // No lane change in this cycle, so adjust velocity prepared = false; } } // Clear speed vectors speeds_left.clear(); speeds_center.clear(); speeds_right.clear(); } // If no car in [-safe_distance_back,safe_distance_front] of left lane (0m is my actual car s reference) else if(change_right_safe){ // If no car in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] if(speeds_right.empty()){ // Change to right lane *lane_pt = rightLane; // State change state = changeRightLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // Calculate mean speed of cars in [-safe_distance_back_vel_check, -safe_distance_back], [safe_distance_front,safe_distance_front_vel_check] mean_speed = 0; for(int i = 0; i < speeds_right.size(); i++){ mean_speed += speeds_right[i]; } mean_speed = mean_speed/speeds_right.size(); // If mean speed and my speed have difference of [-safe_speed_difference,safe_speed_difference] change is safe if(mean_speed-safe_speed_difference < (*ref_vel_pt)/2.24 && (*ref_vel_pt)/2.24 < mean_speed+safe_speed_difference){ // Change to right lane *lane_pt = rightLane; // State change state = changeRightLane; // Avoid velocity adjustment in this cycle prepared = true; } else{ // No lane change in this cycle, so adjust velocity prepared = false; } } // Clear speed vectors speeds_left.clear(); speeds_center.clear(); speeds_right.clear(); } // No state change in this cycle. Prepare velocity adjustment if(!prepared){ // Check all cars on the road for(int i = 0; i < sensor_fusion.size(); i++){ float d = sensor_fusion[i][6]; // Check whether car on my lane if(d < (lane_width+lane_width*(*lane_pt)) && d > (lane_width*(*lane_pt))){ // Measure velocity and s coordinate double vx = sensor_fusion[i][3]; double vy = sensor_fusion[i][4]; double check_speed = sqrt(vx*vx+vy*vy); double check_car_s = sensor_fusion[i][5]; // If using previous points can project s value out check_car_s += ((double)prev_size*.02*check_speed); // Check s values greater than mine and s gap if((check_car_s > car_coord.car_s) && ((check_car_s-car_coord.car_s) < safe_distance_front)){ // Store speed of front vehicle speed_front = check_speed; // Store distance to front vehicle dist = check_car_s-car_coord.car_s; // Too close flag to true too_close = true; } } } // Check whether car in front too close if(too_close){ // Check whether velocity greater than front car velocity if((*ref_vel_pt)/2.24 > speed_front-speed_interval){ // Deceleration in function of vehicle distance *ref_vel_pt -= deceleration_intercept + dist*deceleration_slope; } first_deceleration = true; } // Check whether velocity lower than front car velocity else if((*ref_vel_pt)/2.24 < speed_front+speed_interval){ // Acceleration if (first_deceleration){ *ref_vel_pt += acceleration; } else{ *ref_vel_pt += first_acceleration; } // Check freeze speed and reset counter if necessary counter_freeze_speed_front++; if (counter_freeze_speed_front == counter_reset){ speed_front = max_speed/2.24; counter_freeze_speed_front = 0; } } // Clear speed vectors speeds_left.clear(); speeds_center.clear(); speeds_right.clear(); } break; case(changeCenterLane): // Check whether car is already in desired lane if(lane_width < car_coord.car_d && car_coord.car_d < 2*lane_width){ // State change state = keepLane; } else{ } break; case(changeLeftLane): // Check whether car is already in desired lane if(0 < car_coord.car_d && car_coord.car_d < lane_width){ // State change state = keepLane; } else{ } break; case(changeRightLane): // Check whether car is already in desired lane if(2*lane_width < car_coord.car_d && car_coord.car_d < 3*lane_width){ // State change state = keepLane; } else{ } break; default: break; } } // Generate spline points (See detailed description in header file) splinePointsReturn PathPlanner::generate_spline_points(int prev_size, carCoordinates car_coord, previousPath previous_path, int lane, vector<vector<double>> map_waypoints){ splinePointsReturn ret_value; ret_value.ref_x = car_coord.car_x; ret_value.ref_y = car_coord.car_y; ret_value.ref_yaw = car_coord.car_yaw; // If previous size is almost empty, use car as starting reference if (prev_size<2){ // Use two points that make the path tangent to the car double prev_car_x = ret_value.ref_x - cos(car_coord.car_yaw); double prev_car_y = ret_value.ref_y - sin(car_coord.car_yaw); ret_value.ptsx.push_back(prev_car_x); ret_value.ptsx.push_back(ret_value.ref_x); ret_value.ptsy.push_back(prev_car_y); ret_value.ptsy.push_back(ret_value.ref_y); } // Use previous path´s end point as starting reference else { // Redefine reference state as previous path end point ret_value.ref_x = previous_path.previous_path_x[prev_size-1]; ret_value.ref_y = previous_path.previous_path_y[prev_size-1]; double ref_x_prev = previous_path.previous_path_x[prev_size-2]; double ref_y_prev = previous_path.previous_path_y[prev_size-2]; ret_value.ref_yaw = atan2(ret_value.ref_y-ref_y_prev, ret_value.ref_x-ref_x_prev); // Use two points that make the path tangent to the previous path´s and point ret_value.ptsx.push_back(ref_x_prev); ret_value.ptsx.push_back(ret_value.ref_x); ret_value.ptsy.push_back(ref_y_prev); ret_value.ptsy.push_back(ret_value.ref_y); } // In Frenet add 30m spaced points ahead of the starting reference vector<double> next_wp0 = getXY(car_coord.car_s+30, 2+4*lane, map_waypoints[0], map_waypoints[1], map_waypoints[2]); vector<double> next_wp1 = getXY(car_coord.car_s+60, 2+4*lane, map_waypoints[0], map_waypoints[1], map_waypoints[2]); vector<double> next_wp2 = getXY(car_coord.car_s+90, 2+4*lane, map_waypoints[0], map_waypoints[1], map_waypoints[2]); ret_value.ptsx.push_back(next_wp0[0]); ret_value.ptsx.push_back(next_wp1[0]); ret_value.ptsx.push_back(next_wp2[0]); ret_value.ptsy.push_back(next_wp0[1]); ret_value.ptsy.push_back(next_wp1[1]); ret_value.ptsy.push_back(next_wp2[1]); for (int i=0; i<ret_value.ptsx.size(); i++){ // Shift car reference angle to 0 degrees double shift_x = ret_value.ptsx[i] - ret_value.ref_x; double shift_y = ret_value.ptsy[i] - ret_value.ref_y; ret_value.ptsx[i] = (shift_x * cos(0-ret_value.ref_yaw) - shift_y * sin(0-ret_value.ref_yaw)); ret_value.ptsy[i] = (shift_x * sin(0-ret_value.ref_yaw) + shift_y * cos(0-ret_value.ref_yaw)); } return ret_value; } // Generate trajectory (See detailed description in header file) vector<vector<double>> PathPlanner::generate_trajectory(splinePointsReturn splinePointsStr, previousPath previous_path, double ref_vel){ vector<vector<double>> ret_value; // Create spline tk::spline s; // Set points to spline s.set_points(splinePointsStr.ptsx, splinePointsStr.ptsy); // Define actual points we will use for the planner vector<double> next_x_vals; vector<double> next_y_vals; // Start with all of the previous path points from last time for(int i = 0; i < previous_path.previous_path_x.size(); i++) { next_x_vals.push_back(previous_path.previous_path_x[i]); next_y_vals.push_back(previous_path.previous_path_y[i]); } // Calculate how to break up spline points so that we travel at our desired ref. velocity double target_x = 30.0; double target_y = s(target_x); double target_dist = sqrt((target_x)*(target_x)+(target_y)*(target_y)); double x_add_on = 0; // Fill up rest of path planner after filling it with previous points for (int i = 1; i <= 50-previous_path.previous_path_x.size(); i++){ double N = (target_dist/(.02*ref_vel/2.24)); double x_point = x_add_on + target_x/N; double y_point = s(x_point); x_add_on = x_point; double x_ref = x_point; double y_ref = y_point; // Rotate back to normal after rotating it earlier x_point = (x_ref * cos(splinePointsStr.ref_yaw)-y_ref*sin(splinePointsStr.ref_yaw)); y_point = (x_ref * sin(splinePointsStr.ref_yaw)+y_ref*cos(splinePointsStr.ref_yaw)); x_point += splinePointsStr.ref_x; y_point += splinePointsStr.ref_y; next_x_vals.push_back(x_point); next_y_vals.push_back(y_point); } // Return calculated trajectory ret_value.push_back(next_x_vals); ret_value.push_back(next_y_vals); return ret_value; }
22e85b4f1ae5fb8350bb63194ad2c8de88ac5c6f
81b9b8ae0e9cc6cf320a95cf373594599d81fe12
/Tools/Delta/DebugLib/Testing/DdebugTest.cpp
f3437df0075982ff31addfd1326c3c9d4d47a114
[]
no_license
mouchtaris/delta-linux
1041b9dcc549bda2858dcedbc61087bb73817415
cca8bd3c1646957cb3203191bb03e80d52f30631
HEAD
2016-09-01T19:28:43.257785
2014-09-02T05:00:54
2014-09-02T05:00:54
23,297,561
1
0
null
null
null
null
UTF-8
C++
false
false
686
cpp
DdebugTest.cpp
#include "ddebug.h" #include "usystem.h" #include <string> static FILE* fp; static void onerror (const char* s) { fprintf(fp, "%s\n", s); } int main (int argc, char** argv) { fp = fopen("derror.txt", "wt"); dinit(onerror); DSTARTLOGGING("memorylog.txt"); unsigned* pi = DNEWARR(unsigned, 10); std::string* ps = DNEWARR(std::string, 5); DLATEDISPOSALON(1000); delete[] ps; delete[] pi; // pi[5] = 32; uprocesssleep(2000); DSTOPLOGGING(); dclose(); return 0; } /* // DLATEDISPOSALON(1000); // delete[] ps; // delete[] pi; // pi[0] = 0xffffffff; //DPTR(pi)[0] = 30; dclose(); fclose(fp); uprocesssleep(1000); return 0; */
f899bf72a514249ced3a000138c329f416105dce
b1b1ce6cf45f64ffb0968d78de37185561fdcfd6
/encode-string.hpp
8deb9f577e83119c2fbe220ad97dba2c7d65e907
[]
no_license
Cory-Summers/Compilers-Assignment-1
8ba81dabb8b10717d91f9d9912404cf7d1c545ad
281303057bf88cde1a24b5e95ce543a72428cdf6
refs/heads/master
2023-02-23T09:45:45.402133
2021-02-03T04:01:51
2021-02-03T04:01:51
335,501,857
0
0
null
null
null
null
UTF-8
C++
false
false
283
hpp
encode-string.hpp
#ifndef ENCODE_STRING_HPP #define ENCODE_STRING_HPP #include <string> namespace parser { std::string EncodeString(const char * str); std::string EncodeString(const char * str, std::size_t const & length); char EncodeChar(const char * str, std::size_t const & length); } #endif
5948759542de95069b2c556c59e6b65edd5a359f
46bef6aa975e8f90b7a1b164c4eab2387211f2a4
/src/action_bridge_fibonacci.cpp
f12c80a34e08e81e50d240599488761c0b99f964
[ "Apache-2.0" ]
permissive
ben-greenberg/ros1_action_bridge
50155d3274b2b94178191ffa10b06f8fc57da579
a267c87868ed7ce8b62775109a3f3118fdfa1b97
refs/heads/master
2021-07-11T04:00:25.864079
2020-10-14T19:43:50
2020-10-14T19:43:50
205,458,669
0
5
Apache-2.0
2020-09-17T22:26:16
2019-08-30T21:24:35
C++
UTF-8
C++
false
false
1,933
cpp
action_bridge_fibonacci.cpp
// Copyright 2019 Fraunhofer IPA // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Currently works with ros2 run action_tutorials fibonacci_action_server.py and rosrun actionlib_tutorials fibonacci_client //run action bridge with ros2 run action_bridge action_bridge_fibonacci_node //For dashing, git clone control_msgs crystal-devel #include <action_bridge/action_bridge.hpp> #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunused-parameter" #endif #include <actionlib_tutorials/FibonacciAction.h> #ifdef __clang__ # pragma clang diagnostic pop #endif // include ROS 2 //#include <example_interfaces/action/fibonacci.hpp> #include <action_tutorials/action/fibonacci.hpp> using FibonacciActionBridge = ActionBridge<actionlib_tutorials::FibonacciAction, action_tutorials::action::Fibonacci>; template<> void FibonacciActionBridge::translate_goal_1_to_2(const ROS1Goal & goal1, ROS2Goal & goal2) { goal2.order = goal1.order; } template<> void FibonacciActionBridge::translate_result_2_to_1( ROS1Result & result1, const ROS2Result & result2) { result1.sequence = result2.sequence; } template<> void FibonacciActionBridge::translate_feedback_2_to_1( ROS1Feedback & feedback1, const ROS2Feedback & feedback2) { feedback1.sequence = feedback2.partial_sequence; } int main(int argc, char * argv[]) { return FibonacciActionBridge::main("fibonacci", argc, argv); }
f95063e7ac183815735e0da85b15d0c7014ca461
35e79b51f691b7737db254ba1d907b2fd2d731ef
/AtCoder/ABC/002/C.cpp
4b2ee2d11f6649b1cc849f99d374c94dc4056dd9
[]
no_license
rodea0952/competitive-programming
00260062d00f56a011f146cbdb9ef8356e6b69e4
9d7089307c8f61ea1274a9f51d6ea00d67b80482
refs/heads/master
2022-07-01T02:25:46.897613
2022-06-04T08:44:42
2022-06-04T08:44:42
202,485,546
0
0
null
null
null
null
UTF-8
C++
false
false
377
cpp
C.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int MOD = 1e9 + 7; ll INF = 1e18; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int main(){ int xa, ya, xb, yb, xc, yc; cin>>xa>>ya>>xb>>yb>>xc>>yc; xb -= xa, yb -= ya, xc -= xa, yc -= ya; cout << fixed << setprecision(10) << abs(xb*yc - xc*yb) / 2.0 << endl; }
775f2af981e13d2dc7046a317f49081458c098e4
57487214c7ffcdbe7770cec69bfa12fcd4bfef5d
/src/sgevollib/to_ppm.hpp
9e8f00367860551778ef61ca6af9e47a946cdb02
[]
no_license
nmeyering/sgevol
0bb6811a76c972270006ba957b37ad247686f7bf
d24eff2d662768f96e6a1d78139dcdaa0c2454d1
refs/heads/master
2016-08-04T10:51:13.350487
2012-04-25T12:34:18
2012-04-25T12:34:18
1,242,641
0
0
null
null
null
null
UTF-8
C++
false
false
1,201
hpp
to_ppm.hpp
#ifndef SGEVOLLIB_TO_PPM_HPP_INCLUDED #define SGEVOLLIB_TO_PPM_HPP_INCLUDED #include <fcppt/container/grid/object.hpp> #include <fcppt/math/dim/basic_impl.hpp> #include <fcppt/config/external_begin.hpp> #include <boost/type_traits/is_unsigned.hpp> #include <boost/type_traits/promote.hpp> #include <boost/utility/enable_if.hpp> #include <limits> #include <ostream> #include <fcppt/config/external_end.hpp> namespace sgevollib { template<typename Char,typename T> typename boost::enable_if_c<boost::is_unsigned<T>::value,void>::type to_ppm( fcppt::container::grid::object<T,2> const &g, std::basic_ostream<Char> &s, T const max_value = std::numeric_limits<T>::max()) { typedef fcppt::container::grid::object<T,2> grid; typedef typename boost::promote<typename grid::value_type>::type numeric_type; s << s.widen('P') << s.widen('2') << s.widen('\n') << g.size().w() << s.widen(' ') << g.size().h() << s.widen('\n') << static_cast<numeric_type>(max_value) << s.widen('\n'); for (typename grid::dim d(0,0); d.h() < g.size().h(); ++d.h()) { for (d.w() = 0; d.w() < g.size().w(); ++d.w()) s << static_cast<numeric_type>(g[d]) << s.widen(' '); s << s.widen('\n'); } } } #endif
171fd7d8e44f6a0063a9986908fb17bfff0fa21a
b78c02c4dd2bf3671173f115e4f401f24f3024d7
/exercise14/source/FriendFunctions/Stack.h
5a55216521088697d5533bc736213e01feecb622
[]
no_license
ZdravkoHvarlingov/FMI-Object-oriented-programming
502d22862fca83104c9f6a4f7a765ea594464220
4646f4c7d3a433a2f7866c875169fd9cbb7720f9
refs/heads/master
2020-04-23T16:55:49.594377
2019-06-05T11:09:02
2019-06-05T11:09:02
171,314,834
1
0
null
null
null
null
UTF-8
C++
false
false
380
h
Stack.h
#pragma once #include <vector> #include <iostream> namespace dataStructures { class Stack { public: int top() const; void pop(); void push(int num); bool empty() const; int size() const; friend std::ostream& operator<<(std::ostream &out, Stack &st); friend std::istream& operator>>(std::istream &in, Stack &st); private: std::vector<int> elements; }; }
1546abfcef85ee8c0e579985297d07ba87e70b25
f2d0e1552d34baf482ccd6d825d3f142bd3be075
/src/takoyaki/dx12/dx12_context.h
1b308fe2112778d53ff809ecf2ff17f908ca7fcf
[ "MIT" ]
permissive
kittikun/takoyaki
27fe58331292fcf12d90f33b5fb6e98569071c93
fc949bdb8f9a8dc9e6cc5157b02308c180acc96c
refs/heads/develop
2021-01-17T09:27:02.251267
2016-03-30T14:15:22
2016-03-30T14:15:22
38,558,858
2
1
null
2015-11-07T21:53:51
2015-07-05T06:09:59
C++
UTF-8
C++
false
false
6,237
h
dx12_context.h
// Copyright(c) 2015-2016 Kitti Vongsay // // 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, sub license, 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. #pragma once #include "dx12_device.h" #include "descriptor_heap.h" #include "dx12_buffer.h" #include "dx12_command_builder.h" #include "dx12_constant_buffer.h" #include "dx12_index_buffer.h" #include "dx12_input_layout.h" #include "dx12_pipeline_state.h" #include "dx12_root_signature.h" #include "dx12_vertex_buffer.h" #include "dx12_texture.h" #include "../rwlock_map.h" #include "../thread_safe_stack.h" #include "../thread_safe_queue.h" #include "../public/definitions.h" namespace Takoyaki { class ThreadPool; struct CommandDesc; class DX12Context { DX12Context(const DX12Context&) = delete; DX12Context& operator=(const DX12Context&) = delete; DX12Context(DX12Context&&) = delete; DX12Context& operator=(DX12Context&&) = delete; public: enum class EResourceType { INDEX_BUFFER, VERTEX_BUFFER, TEXTURE }; using DescriptorHeapRTV = DX12DescriptorHeapCollection<D3D12_DESCRIPTOR_HEAP_TYPE_RTV>; using DescriptorHeapSRV = DX12DescriptorHeapCollection<D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV>; using InputLayoutReturn = std::pair<DX12InputLayout&, std::shared_lock<std::shared_timed_mutex>>; using ConstantBufferReturn = std::pair<DX12ConstantBuffer&, std::shared_lock<std::shared_timed_mutex>>; using PipelineStateReturn = std::pair<DX12PipelineState&, std::shared_lock<std::shared_timed_mutex>>; using RootSignatureReturn = std::pair<DX12RootSignature&, std::shared_lock<std::shared_timed_mutex>>; DX12Context(const std::shared_ptr<DX12Device>&, const std::shared_ptr<ThreadPool>&); ~DX12Context() = default; ////////////////////////////////////////////////////////////////////////// // Internal usage: // command creation bool buildCommand(const CommandDesc&, TaskCommand*); // resource creation void addShader(EShaderType, const std::string&, D3D12_SHADER_BYTECODE&&); void createSwapchainTexture(uint_fast32_t); void createTexture(uint_fast32_t, const TextureDesc&); // Get inline DescriptorHeapRTV& getRTVDescHeapCollection() { return descHeapRTV_; } inline DescriptorHeapSRV& getSRVDescHeapCollection() { return descHeapSRV_; } inline RWLockMap<uint_fast32_t, DX12IndexBuffer>& getIndexBuffers() { return indexBuffers_; } inline RWLockMap<std::string, DX12RootSignature>& getRootSignatures() { return rootSignatures_; } inline RWLockMap<uint_fast32_t, DX12Texture>& getTextures() { return textures_; } inline RWLockMap<uint_fast32_t, DX12VertexBuffer>& getVertexBuffers() { return vertexBuffers_; } ////////////////////////////////////////////////////////////////////////// // Internal & External void createBuffer(EResourceType, uint_fast32_t, uint8_t*, EFormat, uint_fast32_t, uint_fast32_t); void createConstanBuffer(const std::string&, uint_fast32_t); void createInputLayout(const std::string&); void createPipelineState(const std::string&, const PipelineStateDesc&); void createRootSignature(const std::string&); void destroyDone(); bool destroyMain(void*, void*); void destroyResource(EResourceType, uint_fast32_t); const DX12IndexBuffer& getIndexBuffer(uint_fast32_t); auto getInputLayout(const std::string&)->InputLayoutReturn; auto getPipelineState(const std::string&)->PipelineStateReturn; auto getRootSignature(const std::string&)->RootSignatureReturn; DX12Texture& getTexture(uint_fast32_t); const DX12VertexBuffer& getVertexBuffer(uint_fast32_t); ////////////////////////////////////////////////////////////////////////// // External usage: void compilePipelineStateObjects(); auto getConstantBuffer(const std::string&)->ConstantBufferReturn; private: void compileMain(const std::string& name); private: std::shared_ptr<DX12Device> device_; std::weak_ptr<ThreadPool> threadPool_; DX12CommandBuilder cmdBuilder_; DescriptorHeapRTV descHeapRTV_; DescriptorHeapSRV descHeapSRV_; RWLockMap<std::string, DX12ConstantBuffer> constantBuffers_; RWLockMap<uint_fast32_t, DX12IndexBuffer> indexBuffers_; RWLockMap<std::string, DX12InputLayout> inputLayouts_; RWLockMap<std::string, DX12PipelineState> pipelineStates_; RWLockMap<std::string, DX12RootSignature> rootSignatures_; RWLockMap<uint_fast32_t, DX12Texture> textures_; RWLockMap<uint_fast32_t, DX12VertexBuffer> vertexBuffers_; // use multiples maps to allow same name in different categories using ShaderMap = RWLockMap<std::string, D3D12_SHADER_BYTECODE>; std::unordered_map<EShaderType, ShaderMap> shaders_; // resource destruction have to be handled by the context using DestroyQueueType = ThreadSafeQueue<std::pair<EResourceType, uint_fast32_t>>; DestroyQueueType destroyQueue_; }; } // namespace Takoyaki
e14b727171134f7a8faf02e10b3f3dc072f739ab
eac4499ec64f4a10b0d7aae92fe8bc2038e68c29
/hw-gmail/Pusher.cpp
dd30a2e4b2ca9cf1fcb243b984425c79bfc669fb
[]
no_license
xiedantibu/alarme
e48ce5eb378888fea72f5ff90022e3e7f01907d9
eb75b3a39a9fd0df923e958b7d52b5bebda0fe17
refs/heads/master
2021-01-17T22:38:25.720780
2012-11-16T22:50:00
2012-11-16T22:50:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,171
cpp
Pusher.cpp
/* * Alarme Project for Google HackFair 2012 in Seoul * Arduino hardware alarm sketch * * Kwanlae Kim <voidopennet@gmail.com> * Chanseok Yang <huewu.yang@gmail.com> * Jinserk Baik <jinserk.baik@gmail.com> * Wonseok Yang <before30@gmail.com> * * Copyright (c) 2012, all rights reserved. */ #include "SerialDebug.h" #include "Pusher.h" #include "aJSON.h" #include "Adafruit_Thermal.h" extern SerialDebug debug; extern Adafruit_Thermal printer; void Pusher::init(void) { const char privatekey[] = "95189161bfb8e7276632"; while (!pc.connect(privatekey)) { debug.println("pusher connection failed."); delay(500); } debug.println("pusher connection successful."); bind_event(); } void Pusher::bind_event(void) { pc.subscribe("ghf.alarme"); pc.bind("print", printme); } void Pusher::monitor(void) { if (pc.connected()) { pc.monitor(); } } void Pusher::printme(String data) { Serial.println(data); // parsing data by using json char *jsonStr = (char *)malloc(data.length() + 1); data.toCharArray(jsonStr, data.length() + 1); aJsonObject* root = aJson.parse(jsonStr); if (root != NULL){ aJsonObject* dd = aJson.getObjectItem(root, "data"); aJsonObject* root2 = aJson.parse(dd->valuestring); aJsonObject* name = aJson.getObjectItem(root2, "name"); aJsonObject* msg = aJson.getObjectItem(root2, "message"); if (name != NULL && msg != NULL ){ Serial.println(name->valuestring); Serial.println(msg->valuestring); printer.wake(); printer.setDefault(); printer.boldOn(); printer.println(); printer.setSize('M'); printer.justify('C'); printer.println(name->valuestring); printer.boldOn(); printer.setSize('L'); printer.justify('C'); printer.print(msg->valuestring); printer.println(); printer.println(); printer.boldOff(); printer.feed(2); printer.sleep(); } } free(jsonStr); }
e59ab0bc048e5050c401ae8b31641275a783ee7c
a9ab72c3dd7fdfe8b6e0b1b5e296bf4c39b9989d
/round3/leetcode300.cpp
11586ce47b779c3895b848d466fcc00873dc0e64
[]
no_license
keqhe/leetcode
cd82fc3d98b7fc71a9a08c5e438aa1f82737d76f
86b2a453255c909f94f9ea3be7f2a97a6680a854
refs/heads/master
2020-12-24T06:38:15.444432
2016-12-07T19:15:02
2016-12-07T19:15:02
48,405,123
0
0
null
null
null
null
UTF-8
C++
false
false
668
cpp
leetcode300.cpp
class Solution { public: //let dp[i] denotes the length of LIS ending at nums[i] (ie, must include nums[i]) int lengthOfLIS(vector<int>& nums) { if (nums.empty()) return 0; vector<int> dp(nums.size(), 1); //? int maxLen = 1; for (int i = 0; i < nums.size(); i ++) { for (int j = 0; j < i; j ++) { if (nums[i] > nums[j]) { if (dp[i] < dp[j] + 1) dp[i] = dp[j] + 1; //dp[i] = max(dp[i], dp[j]+1); } } } for (int i = 0; i < nums.size(); i ++) maxLen = max(maxLen, dp[i]); return maxLen; } };
8743c0f39c6c00078b257619c1bd0c948619c13b
c7eed60e0fcee86f548e0ee9b827343837e47058
/36.cpp
30f392c11dc7680a309527c6d1e23c296226d560
[]
no_license
Lethe0616/day-by-day
9483fff32f3723e61b095910cf2023501e3a02c2
c5a6662b3ef7e004dc26883dac9eb57e31bd0f27
refs/heads/master
2020-09-04T12:36:16.760812
2020-04-18T11:44:24
2020-04-18T11:44:24
219,733,878
0
0
null
null
null
null
GB18030
C++
false
false
1,466
cpp
36.cpp
/* 计算两个字符串的最大公共字串的长度,字符不区分大小写(要求计算连续最长字串的长度) 首先假设str1的长度为n,str2的长度为m,建立一个n*m的二维数组dp,dp[i][j]表示str1[0...i]和str2[0...j]中连续相等最大字串的长度,并用n记录,当str1[i]!=str2[j],令dp[i][j]==0; 对于数字的第一行和第一列,由于最长的公共字符串长度为1,所以只要出现字符相等,就令n=1。由于是求最大连续字串,所以当str1[i]==str2[j],dp[i][j]=dp[i-1][j-1]+1; */ #include<iostream> #include<string> #include<cstring> using namespace::std; //按题目要求是连续的相等子序列 //动态规划 int main() { string A; while (cin >> A) { string B; cin >>B; int l1 = A.size(); int l2 = B.size(); //生成二维数组 int** dp = new int*[l1]; for (int i = 0; i < l1; i++) { dp[i] = new int[l2]; } for (int i = 0; i < l1; i++) { for (int j = 0; j < l2; j++) { dp[i][j]=0; } } int n = 0; for (int i = 0; i < l1; i++) { for (int j = 0; j < l2; j++) { if (A[i] != B[j]) dp[i][j] = 0; else if (i == 0 || j == 0)//对于第一行和第一列 { dp[i][j] = 1; if (n < 1) n = dp[i][j]; } else { dp[i][j] = dp[i - 1][j - 1] + 1; if (dp[i][j] > n) n = dp[i][j]; } } } cout << n << endl; } return 0; }
78643947e41f0878e4f1f2a211fe18a4b87aefa1
1cf277f683de8e9e03369f131767301655d41e5c
/Assign11-12/assign1112_oop.h
ff0c00403cf0652a780c9f38655066b28f9cccc2
[]
no_license
cristinabac/OOP
a18f9ee3a9f6d573667690ea0a20908360133a3d
fd022fb83da5c1b7b898e59c918414d5d365d234
refs/heads/master
2022-04-25T16:14:59.309048
2020-04-21T15:32:00
2020-04-21T15:32:00
257,617,933
0
0
null
null
null
null
UTF-8
C++
false
false
230
h
assign1112_oop.h
#pragma once #include <QtWidgets/QMainWindow> #include "ui_assign1112_oop.h" class assign1112_oop : public QMainWindow { Q_OBJECT public: assign1112_oop(QWidget *parent = Q_NULLPTR); private: Ui::assign1112_oopClass ui; };
cd17a71370a7d048cfe3a366bc874453e6270e75
6f50f16a93286b3ebef7c285befa612d305adcc9
/include/rune/worldmap.h
786c78d71de0d3b89ab3536cc9867511c7b8d140
[ "MIT" ]
permissive
lycis/rune
2aff8ddc104b29950f8fc6810d2efea7988e0470
2e87aaaff4a9a30406a97f64e4eae4a2c8c90686
refs/heads/master
2021-03-12T22:50:09.506281
2014-04-26T20:17:20
2014-04-26T20:17:20
18,029,844
1
0
null
null
null
null
UTF-8
C++
false
false
5,026
h
worldmap.h
#ifndef MAP_H #define MAP_H #include "rune/rune_global.h" #include <QMap> #include <QList> #include "yaml-cpp/yaml.h" #include <QFile> #include "rune/entity.h" #include <QStringList> #include "rune_error.h" #include "rune/engine.h" struct rune_map_coordinate //!> coordinate on a map { qint64 x; qint64 y; }; Q_DECLARE_METATYPE(rune_map_coordinate) namespace rune { class Entity; class Engine; class RUNESHARED_EXPORT WorldMap : public QObject { public: WorldMap(Engine* parent = 0); WorldMap(QString mapfile, Engine* parent = 0); ~WorldMap(); /** * @brief gives the total width of the map */ qint64 width(); /** * @brief gives the total height of the map */ qint64 height(); /** * @brief change width of a loaded map * @param width */ void setWidth(qint64 width); /** * @brief change height of a loaded map * @param height */ void setHeight(qint64 height); /** * @brief exclude the given coordinate from the map * @param mc */ void exclude(rune_map_coordinate mc); void excludeCircle(qint64 x, qint64 y, qint64 radius); /** * @brief include the given coordinate * @param mc coordinate */ void include(rune_map_coordinate mc); QList<rune_map_coordinate> getCoordinateCircle(qint64 x, qint64 y, qint64 radius, bool fill = true); qint64 scale() const; void setScale(const qint64 &scale); /** * @brief translates units (e.g. meters, foot, miles) into a coordinate distance * @param units */ qint64 unitToCoordinates(qint64 units, bool diagonal); /** * @brief save the map to a file * @param filename */ bool saveMap(QString filename); /** * @brief load a map from the given file * @param filename * @return */ bool loadMap(QString filename); bool setEntityPosition(Entity* e, rune_map_coordinate position); bool setEntityPosition(Entity* e, qint64 x, qint64 y); rune_map_coordinate getEntityPosition(Entity* e); QList<Entity*> getEntitiesInRange(QList<rune_map_coordinate> coords); QList<Entity*> getEntitiesAt(rune_map_coordinate pos); QList<Entity*> getEntitiesAt(qint64 x, qint64 y); QString name() const; void setName(const QString &name); public slots: /** * @brief change the position of an entity identified by its id * @param uid id of the entity * @param x * @param y * @return */ bool setEntityPosition(QString uid, qint64 x, qint64 y); /** * @brief checks if the given coordinate is on the map * @param x * @param y */ bool isPointOnMap(qint64 x, qint64 y); /** * @brief include the given coordinate * @param x * @param y */ void include(qint64 x, qint64 y); /** * @brief exclude certain coordinates from the map * @param x * @param y */ void exclude(qint64 x, qint64 y); /** * @brief provides the position of the entity based on the entity uid * @param uid * @return */ rune_map_coordinate getEntityPosition(QString uid); private: Q_OBJECT qint64 _width; qint64 _height; qint64 _scale; // 1 coordnate takes _scale square units (e.g. _scale = 5 (foot) -> 1 coordnate takes 5 square foot) QString _name; Engine* _engine; // x = first key, y = in list -> x: 5 y: 7, 8, 10, ... QMap<qint64, QList<qint64> > excluded; QMap<qint64, QMap<qint64, QList<Entity*> > > _placedEntities; /** * @brief returns a list of coordinates on the circle * if fill is true all coordinates within the circle will be returned * @param x x-ordinate of center * @param y y-ordinate of center * @param radius radius in coordinate * @param fill */ QList<rune_map_coordinate> getMidpointCoordinateCircle(qint64 x, qint64 y, qint64 radius, bool fill = true); QList<rune_map_coordinate> getFilteredSquareCoordinateCircle(qint64 x0, qint64 y0, qint64 radius, bool fill = true); }; } #endif // MAP_H
868f93a3538929605cb67a0db2bd78519550ca2b
aad5b70a2fac8ff23261a1893fdd30c851dd50ed
/IExtEventSource.cc
fd2a5f88f6efaf45b42a028199be314477367562
[]
no_license
gmwesiga/winny
1262551be0c504636c521d9688e3aa460bac92ee
e600e1ac3a71fc4095641ccaa06e38df020aee3c
refs/heads/master
2020-05-18T05:35:11.973000
2020-03-20T16:07:14
2020-03-20T16:07:14
184,210,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,053
cc
IExtEventSource.cc
#include "IExtEventSource.h" //#include <FL/fl_ask.H> using namespace StdSystem; /* default constructor * sets handle to application to null pointer */ IExtEventSource::IExtEventSource():application(0){}; /*Attach is called by higher level code probally by init *function to subscribe an iapplication to an ieventsource controller's events */ void IExtEventSource::Attach(IApplication* app){ application = app; }; /*clients can call detach to unsubscribe an IApplication from ieventsource's events*/ void IExtEventSource::Dettach(){ application = 0; }; /*notify() takes an event msg and calls the subscribed IApplication passing the event message *Concrete classes of ExtEventSource have no access to the subscribed *application. so they must call notify(sEvent), to publish their events *to subscribers. */ void IExtEventSource::notify(sEvent e, void *eData){ if (this->application) //fl_alert("in IxtEventSource::notify, application set"); //return; this->application->handle(e,eData); };
fe43b36d737c63206327bce0907b4091865b3114
2c58e6da42268d0942b8f033b0401d2ab3a7a49e
/PktSender/PcapDataInfo.h
ce536074a4ca94ee7c1c89b290ace5dda584c363
[]
no_license
ksiic/PktSender
93e3ad3414f19d2620427a3f331ce206fd8f2ac5
f3e671d486e0cd148e820002cbd7ceefc07dbedd
refs/heads/master
2020-12-22T01:54:41.283783
2020-02-04T06:57:01
2020-02-04T06:57:01
236,634,915
0
0
null
null
null
null
GB18030
C++
false
false
1,576
h
PcapDataInfo.h
#pragma once typedef enum{ SinglePktSend, MultiPktSend, OncePktSend, LoopPktSend }SendModeEnum; typedef enum { SendStart, SendStop, SendPause, SendEnd, SendInvalid }SendStatEnum; class PcapDataInfo { private: CString m_szPath; /* 路径 */ int m_iAllPkt; /* 总包数 */ int m_iCurPkt; /* 当前包序号 */ int m_iSendedPktNum; /* 已发送的包数 */ int m_iNeedSendNum; /* 需要发送的包个数 */ SendModeEnum m_enSendMode; /* 发送模式 */ SendStatEnum m_enSendStat; /* 发送状态 */ public: PcapDataInfo(); /* 初始化 */ ~PcapDataInfo(); /* 析构 */ public: CString getPath(); /* 获取文件路径 */ int setPath(CString path); /* 设置文件路径 */ void ClnPath(); /* 清除路径 */ int getAllPkt(); /* 获取所有包个数 */ int setAllPkt(int num); /* 设置所有包个数 */ int getCurPkt(); /* 获取当前的包序号 */ int setCurPkt(int num); /* 设置当前的包序号 */ void AccCurPkt(); /* 当前的包序号加1 */ void RstCurPkt(); /* 重置当前的包序号 */ int getSendedPktNum(); /* 获取已发送的包数 */ void AccSendPkt(); /* 已发送包数加1 */ void ClnSendPkt(); /* 清除已发送包数 */ int getNeedSendNum(); /* 获取需要发送的包数 */ int setNeedSendNum(int num); /* 设置需要发送的包数 */ SendModeEnum getSendMode(); /* 获取发送模式 */ int setSendMode(SendModeEnum mode); /* 设置发送模式 */ SendStatEnum getSendStat(); /* 获取发送状态 */ int setSendStat(SendStatEnum stat); /* 设置发送状态 */ };
85dc81e73a8ae1dbbd2a5b3c3790119533bdd9a6
c673d71d0d24b7f8082e1a411cb974b254da4091
/test.cpp
c82f265092b1998f6dc841e84254b3af9719481f
[ "MIT" ]
permissive
ssainz/gym_torcs
f0e24a3938887df2fddaf5e6cc1fef1c17010b0b
f2065e849adfe3761246e7fd26495c9937bcb241
refs/heads/master
2021-07-25T22:59:33.814231
2017-11-08T02:30:47
2017-11-08T02:30:47
109,917,172
0
0
null
2017-11-08T02:27:41
2017-11-08T02:27:41
null
UTF-8
C++
false
false
327
cpp
test.cpp
#include<stdio.h> //#include<iostream> int main() { printf("Hello! This is my first C program with Ubuntu 11.10\n"); unsigned char c = 200; double a = 0.299; //printf("Hi") printf("Hello %d\n", (unsigned char) (a*((int) c))); printf("(int) unsigned char %d \n", c); /* Do something more if you want */ return 0; }
9632342c99f21edb6e695eaba26b8efbf60fc17e
7fc4184b6486ce8e3b6d05f0c95a0256812a99cd
/Prototypes/VULKAN/Triangle/ObjectCreator.cpp
87c254842b6220669d33d823e963353959dd4575
[]
no_license
DerickThePoney/SFML-OPENGL-SUPERBIBLE
03b539cb0e1799d52cb06727e3de0585f651011b
d3d4b46d89331cf2f9b8825512361dc57a3fc85c
refs/heads/master
2021-07-03T17:46:34.063863
2019-03-23T14:31:08
2019-03-23T14:31:08
111,515,988
0
0
null
null
null
null
UTF-8
C++
false
false
12,758
cpp
ObjectCreator.cpp
#include "stdafx.h" #include "ObjectCreator.h" //#include "VulkanBuffer.h" #include "MeshData.h" #include "VulkanMesh.h" MeshData ObjectCreator::Execute(glm::vec3 minPos, glm::vec3 maxPos, float cellSize) { glm::vec3 size = maxPos - minPos; float voxelPrecision = .1f; PolyVox::RawVolume<float> volData ( PolyVox::Region(PolyVox::Vector3DInt32(0,0,0), PolyVox::Vector3DInt32((int32_t)ceil(size.x / cellSize), (int32_t)ceil(size.y / cellSize), (int32_t)ceil(size.z / cellSize))) ); //PolyVox::RawVolume<float> volData(PolyVox::Region(PolyVox::Vector3DInt32(minPos.x, minPos.y, minPos.z), PolyVox::Vector3DInt32(maxPos.x, maxPos.y, maxPos.z))); auto start = std::chrono::high_resolution_clock::now(); BuildSDFObject(); auto end1 = std::chrono::high_resolution_clock::now(); SDF(volData, minPos, maxPos, 5.0f, cellSize); auto end2 = std::chrono::high_resolution_clock::now(); //PolyVox::Mesh<PolyVox::Vertex<float>> mesh; PolyVox::DefaultMarchingCubesController<float> ct; ct.setThreshold(0); PolyVox::Mesh<PolyVox::MarchingCubesVertex<float> > mesh = PolyVox::extractMarchingCubesMesh(&volData, volData.getEnclosingRegion(), ct); // Mesh< SimpleVolume<float> > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh, DefaultMarchingCubesController<float>(0)); auto end3 = std::chrono::high_resolution_clock::now(); //surfaceExtractor.execute(); //Convienient access to the vertices and indices MeshData ret; ret.indices = std::vector<uint32_t>(mesh.getNoOfIndices()); const uint32_t* indices = mesh.getRawIndexData(); for (size_t i = 0; i < mesh.getNoOfIndices(); ++i) { ret.indices[i] = indices[i]; } /*std::vector<glm::vec4> vert(mesh.getNoOfVertices(), glm::vec4(0,0,0,0)); for (size_t i = 0; i < ret.indices.size(); i+=3) { glm::vec4 v1(0, 0, 0, 3);// v2(0, 0, 0, 1), v3(0, 0, 0, 1); PolyVox::Vertex<float> vmc1 = PolyVox::decodeVertex(mesh.getVertex(ret.indices[i])); PolyVox::Vertex<float> vmc2 = PolyVox::decodeVertex(mesh.getVertex(ret.indices[i+1])); PolyVox::Vertex<float> vmc3 = PolyVox::decodeVertex(mesh.getVertex(ret.indices[i+2])); v1.x = vmc1.position.getX() * cellSize + vmc2.position.getX() * cellSize + vmc3.position.getX() * cellSize;// +minPos.x; v1.y = vmc1.position.getX() * cellSize + vmc2.position.getY() * cellSize + vmc3.position.getY() * cellSize;// + minPos.y; v1.z = vmc1.position.getX() * cellSize + vmc2.position.getZ() * cellSize + vmc3.position.getZ() * cellSize;// +minPos.z; //v1 += minPos; vert[ret.indices[i]] += v1; vert[ret.indices[i+1]] += v1; vert[ret.indices[i+2]] += v1; }*/ auto end4 = std::chrono::high_resolution_clock::now(); ret.vertices.resize(mesh.getNoOfVertices()); for (uint32_t i = 0; i < ret.vertices.size(); ++i) { PolyVox::Vertex<float> vmc1 = PolyVox::decodeVertex(mesh.getVertex(i)); glm::vec3 v(vmc1.position.getX()* cellSize, vmc1.position.getY()* cellSize, vmc1.position.getZ()* cellSize); //glm::vec4 t = vert[i] / vert[i].w; //float ti = 0.0f; ret.vertices[i].pos = v;// (1 - ti) * v + ti * (glm::vec3(t.x, t.y, t.z)); } auto end5 = std::chrono::high_resolution_clock::now(); for (size_t i = 0; i < ret.indices.size(); i += 3) { glm::vec3 v1, v2; v1 = ret.vertices[ret.indices[i + 1]].pos - ret.vertices[ret.indices[i]].pos; v2 = ret.vertices[ret.indices[i + 2]].pos - ret.vertices[ret.indices[i]].pos; glm::vec3 n = glm::normalize( glm::cross( glm::normalize(v1), glm::normalize(v2) ) ); ret.vertices[ret.indices[i]].normal += n; ret.vertices[ret.indices[i+1]].normal += n; ret.vertices[ret.indices[i+2]].normal += n; } auto end6 = std::chrono::high_resolution_clock::now(); for (uint32_t i = 0; i < ret.vertices.size(); ++i) { ret.vertices[i].pos += minPos; ret.vertices[i].normal = glm::normalize(ret.vertices[i].normal); ret.vertices[i].color = (ret.vertices[i].pos.y < halfheight) ? glm::vec3(1.0f, 0.0f, 0.0f) : ((ret.vertices[i].pos.y > 2 * halfheight) ? glm::vec3(0.0f, 1.0f, 0.0f) : ((ret.vertices[i].pos.y > (2 * halfheight + this->size)) ? glm::vec3(0.0f, 0.0f, 1.0f) : glm::vec3(1.0f, 1.0f, 1.0f))); } auto end7 = std::chrono::high_resolution_clock::now(); /*for (uint32_t i = 0; i < mesh.getNoOfVertices(); ++i) { PolyVox::Vertex<float> vmc = PolyVox::decodeVertex(mesh.getVertex(i)); VertexData v; v.pos = vert[i]; /*v.pos.x = vmc.position.getX() * cellSize; v.pos.y = vmc.position.getY()* cellSize; v.pos.z = vmc.position.getZ()* cellSize; v.pos += minPos; v.color = (v.pos.y < halfheight) ? glm::vec3(1.0f, 0.0f, 0.0f) : ((v.pos.y > 2*halfheight) ? glm::vec3( 0.0f, 1.0f, 0.0f) : ((v.pos.y > (2 * halfheight + this->size)) ? glm::vec3(0.0f, 0.0f, 1.0f) : glm::vec3(1.0f, 1.0f, 1.0f))); v.normal.x = vmc.normal.getX(); v.normal.y = vmc.normal.getY(); v.normal.z = vmc.normal.getZ(); //v.normal *= -1; ret.vertices.push_back(v); }*/ std::cout << "Computing marching cube mesh : \n"; std::cout << "\tCreating the sdf : " << (float)(end1 - start).count() / 1000000.0f << "ms\n"; std::cout << "\tComputing the sdf : " << (float)(end2 - end1).count() / 1000000.0f << "ms\n"; std::cout << "\tComputing marching cube : " << (float)(end3 - end1).count() / 1000000.0f << "ms\n"; std::cout << "\tExtracting mesh data (LaplacianSmooth) \n"; std::cout << "\t\tAveraging vertex: " << (float)(end4 - end3).count() / 1000000.0f << "ms\n"; std::cout << "\t\tSmoothing vertex: " << (float)(end5 - end4).count() / 1000000.0f << "ms\n"; std::cout << "\t\tReconstructing normals: " << (float)(end6 - end5).count() / 1000000.0f << "ms\n"; std::cout << "\t\tFinal data: " << (float)(end7 - end6).count() / 1000000.0f << "ms\n"; return ret; } void ObjectCreator::BuildSDFObject() { /*SignedDistanceCapsule* caps1 = new SignedDistanceCapsule(); caps1->start = glm::vec3(0.0f); caps1->end = glm::vec3(0.0f, 2.0f, 0.0f); caps1->size = .3f; SDFObject.AddUnionDistance(caps1); caps1 = new SignedDistanceCapsule(); caps1->start = glm::vec3(0.0f, 2.0f, 0.0f); caps1->end = glm::vec3(0.5f, 2.2f, 0.0f); caps1->size = .1f; SDFObject.AddUnionDistance(caps1);*/ /*SignedDistanceCylinder* distToTheXAxis = new SignedDistanceCylinder(); distToTheXAxis->center = glm::vec3(0.0f); distToTheXAxis->direction = normalize(glm::vec3(1.0f, 0.0f, 1.0f)); distToTheXAxis->size = 0.1f; SignedDistanceMonster* monster = new SignedDistanceMonster();*/ TreeSpeciesDNA species = GenerateTreeSpeciesDNA(rand()); TreeInstanceDNA dna = GenerateTreeInstanceDNA(species); halfheight = dna.height / 2; this->size = dna.width; /*SignedDistanceTree* tree = new SignedDistanceTree(dna); SDFObject.AddUnionDistance(tree);*/ SDFObject.SetDNA(dna); } void ObjectCreator::SDF(PolyVox::RawVolume<float>& volData, glm::vec3 minPos, glm::vec3 maxPos, float fRadius, float cellSize) { //This vector hold the position of the center of the volume PolyVox::Region r = volData.getEnclosingRegion(); PolyVox::Vector3DInt32 v3dVolCenterI = (r.getLowerCorner() + r.getUpperCorner()) / 2; glm::vec3 lowerCorner(r.getLowerCorner().getX(), r.getLowerCorner().getY(), r.getLowerCorner().getZ()); glm::vec3 v3dVolCenter = glm::vec3(0);// .5f*(maxPos + minPos); glm::vec3 box(fRadius, fRadius / 3.0f, fRadius); //This three-level for loop iterates over every voxel in the volume for (int z = 0; z < volData.getDepth(); z++) { for (int y = 0; y < volData.getHeight(); y++) { for (int x = 0; x < volData.getWidth(); x++) { //Store our current position as a vector... glm::vec3 v3dCurrentPos = minPos + glm::vec3(x * cellSize, y* cellSize, z* cellSize); /*glm::vec3 v3dCurrentPosAbs = glm::abs(v3dCurrentPos);// (abs(v3dCurrentPos.x), abs(v3dCurrentPos.y), abs(v3dCurrentPos.z)); //Sphere float fValueS = length(v3dCurrentPos - v3dVolCenter) - fRadius; //Box glm::vec3 d = v3dCurrentPosAbs - box; float v1 = std::min(std::max(d.x, std::max(d.y, d.z)), 0.0f); d.x = (std::max(d.x, 0.0f)); d.y = (std::max(d.y, 0.0f)); d.z = (std::max(d.z, 0.0f)); float v2 = (float)d.length(); float fValueB = -(v1 + length(max(d, 0.0f))); //Capusule glm::vec3 a(0, 5, 0); glm::vec3 b(0, 14, 0); float r = 5.0f; glm::vec3 pa = v3dCurrentPos - a, ba = b - a; float h = glm::clamp(dot(pa, ba) / dot(ba, ba), 0.0f, 1.0f); float fValueCaps = r - length(pa - ba * h); */ //Union float fValueFinal = SDFObject.Evaluate(v3dCurrentPos); //Wrte the voxel value into the volume volData.setVoxel(x, y, z, -fValueFinal); } } } } TreeSpeciesDNA ObjectCreator::GenerateTreeSpeciesDNA(unsigned long seed) { TreeSpeciesDNA species; species.seed = 0; //Trunk //sections species.minNumberOfSections = 3; species.maxNumberOfSections = 6; //height of the trunk species.minHeight = 2.0f; species.maxHeight = 3.2f; //width of the trunk species.minWidth = 0.7f; species.maxWidth = 0.8f; //Top width Scaling species.maxTopWidth = 0.7f; species.minTopWidth = 0.5f; //X&Z noise scaling as function of height species.minXYNoiseScale = 1.0f; species.maxXYNoiseScale = 3.0f; //X Noise species.minXOffset = -1000.0f; species.maxXOffset = 1000.0f; species.minXFrequency = 0.5f; species.maxXFrequency = 1.5f; species.minXStrength = 0.0f; species.maxXStrength = 0.5f; species.minXOctave = 2; species.maxXOctave = 10; //Z Noise species.minZOffset = -1000.0f; species.maxZOffset = 1000.0f; species.minZFrequency = 0.5f; species.maxZFrequency = 1.5f; species.minZStrength = 0.0f; species.maxZStrength = 0.5f; species.minZOctave = 2; species.maxZOctave = 10; //W Noise species.minWOffset = -1000.0f; species.maxWOffset = 1000.0f; species.minWFrequency = 1.0f; species.maxWFrequency = 2.0f; species.minWStrength = 1.0f; species.maxWStrength = 3.0f; species.minWOctave = 1; species.maxWOctave = 6; return species; } TreeInstanceDNA ObjectCreator::GenerateTreeInstanceDNA(const TreeSpeciesDNA & species) { TreeInstanceDNA instance; instance.dna = &species; //init the random number srand(time(NULL)); instance.seed = rand(); std::mt19937 gen(instance.seed); //trunk sections std::uniform_int_distribution<unsigned int> distrUIntU; instance.trunkSectionsSeed = distrUIntU(gen); std::uniform_int_distribution<unsigned int> distrUInt(species.minNumberOfSections, species.maxNumberOfSections); instance.numberOfSections = distrUInt(gen); //dimensions std::uniform_real_distribution<float> distrFloat(species.minHeight, species.maxHeight); instance.height = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minWidth, species.maxWidth); instance.width = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minTopWidth, species.maxTopWidth); instance.topWidth = distrFloat(gen); //XYNoiseScale distrFloat = std::uniform_real_distribution<float>(species.minXYNoiseScale, species.maxXYNoiseScale); instance.XYNoiseScale = distrFloat(gen); //X Noise distrFloat = std::uniform_real_distribution<float>(species.minXOffset, species.maxXOffset); instance.XOffset = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minXFrequency, species.maxXFrequency); instance.XFrequency = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minXStrength, species.maxXStrength); instance.XStrength = distrFloat(gen); instance.XSeed = distrUIntU(gen); distrUInt = std::uniform_int_distribution<unsigned int>(species.minXOctave, species.maxXOctave); instance.XOctave = distrUInt(gen); //Z Noise distrFloat = std::uniform_real_distribution<float>(species.minZOffset, species.maxZOffset); instance.ZOffset = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minZFrequency, species.maxZFrequency); instance.ZFrequency = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minZStrength, species.maxZStrength); instance.ZStrength = distrFloat(gen); instance.ZSeed = distrUIntU(gen); distrUInt = std::uniform_int_distribution<unsigned int>(species.minZOctave, species.maxZOctave); instance.ZOctave = distrUInt(gen); //W Noise distrFloat = std::uniform_real_distribution<float>(species.minWOffset, species.maxWOffset); instance.WOffset = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minWFrequency, species.maxWFrequency); instance.WFrequency = distrFloat(gen); distrFloat = std::uniform_real_distribution<float>(species.minWStrength, species.maxWStrength); instance.WStrength = distrFloat(gen); instance.WSeed = distrUIntU(gen); distrUInt = std::uniform_int_distribution<unsigned int>(species.minWOctave, species.maxWOctave); instance.WOctave = distrUInt(gen); return instance; }
09c230d7707227eef60ffdcd4c53a94e2e78d0db
e0a5b96ffd95d9d58edbdf84b5c1e91b55895556
/Invoice/Invoice.h
606e7f2ade9acf898df312a17b4125560343b1f9
[]
no_license
ViniciusLOPS/EducProjects
4bf48450b1020eaed5331b60ed7a15263f8aadf4
991537b03f528d09d1c65ce41f878e1e93e3c0ea
refs/heads/master
2021-04-15T08:50:25.539218
2018-04-07T02:10:24
2018-04-07T02:10:24
126,845,713
0
0
null
null
null
null
ISO-8859-1
C++
false
false
689
h
Invoice.h
/*Autor:Vinicius Luiz O. P. Dos Santos, CC3642 Orientacao a Objetos Realizado em 16/03/2018 * programa tem como proposito a criação de uma classe(objeto) Invoice, capaz de administrar produtos e obter seu arrecadamento, utilizando contrutores de preferencia.*/ #include <cstdlib> #include <iostream> #include <string> using namespace std; /*criando a biblioteca contendo as variaveis, que no case seram public para o acesso da main, e construtores.*/ class Invoice { public: string id; string info; int amount; int price; public: Invoice(string id, string info, int amount, int price); void setAmount(int amount); void setPrice(int price); int getInvoiceAmount(); };
56e63666282d1351fe4d03dd965ee46d7225985d
f3c413cf12cfce8842002ad503d81b33735a7247
/include/ads/lin/dense_solve.hpp
1c83faa3e873472c63df5472b999f232c9df7c94
[ "MIT" ]
permissive
marcinlos/iga-ads
f02d4e9d1e70c809511cb062261bb55372f6cf42
4f25e75376361d5b15ddc58f16e7bf7ae0431bd8
refs/heads/develop
2023-07-18T21:30:29.279316
2023-07-04T20:42:45
2023-07-04T20:42:45
58,336,078
9
8
MIT
2023-07-04T19:41:43
2016-05-08T23:31:46
C++
UTF-8
C++
false
false
820
hpp
dense_solve.hpp
// SPDX-FileCopyrightText: 2015 - 2023 Marcin Łoś <marcin.los.91@gmail.com> // SPDX-License-Identifier: MIT #ifndef ADS_LIN_DENSE_SOLVE_HPP #define ADS_LIN_DENSE_SOLVE_HPP #include <iostream> #include "ads/lin/dense_matrix.hpp" #include "ads/lin/lapack.hpp" #include "ads/lin/solver_ctx.hpp" namespace ads::lin { inline void factorize(dense_matrix& a, solver_ctx& ctx) { int rows = a.rows(); int cols = a.cols(); dgetrf_(&rows, &cols, a.data(), &ctx.lda, ctx.pivot(), &ctx.info); } template <typename Rhs> inline void solve_with_factorized(const dense_matrix& a, Rhs& b, solver_ctx& ctx) { int nrhs = b.size() / b.size(0); int n = a.rows(); dgetrs_("N", &n, &nrhs, a.data(), &ctx.lda, ctx.pivot(), b.data(), &n, &ctx.info); } } // namespace ads::lin #endif // ADS_LIN_DENSE_SOLVE_HPP
11d7211c0b606fcb7508081cefdebd89030e9a0b
274ff0d357287b7d2aeb779fa9add5aab73ae132
/Practical5.cpp
cb2319585ce5023f4f1b3cfd19d106031d7dc834
[]
no_license
divingoose/1E3TCD
35352ff01fa3f97722842e0a2100763c305f9f8a
a7c14a97b5972c82f6f038caad1fd7042bd548e9
refs/heads/master
2016-09-05T19:02:05.589803
2014-03-13T14:50:59
2014-03-13T14:50:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,281
cpp
Practical5.cpp
/*Program to assist investors in their investment decisions by displaying a table of reutrn on investments at different rates*/ #include <iostream> #include <iomanip> #include <cmath> //for power function using namespace std; int main () { double initial_investment, i, j, range_i, range_j, step_i, step_j, invest_return; cout << fixed << setprecision(2); cout << "Enter initial investment: "; cin >> initial_investment; cout << "\nEnter the maximum % the rate will reach: "; //range cin >> range_j; cout << "\nEnter desired interval for rate %: "; cin >> step_j; cout << "\nEnter the number of years for this investment: "; //range cin >> range_i; cout << "\nEnter the desired interval for years: "; cin >> step_i; //*********************************// //print table header// cout << "Rate "; for (i=1; i<=range_i; i=i+step_i) { cout << setw(10) << i << "years"; } cout << "\n"; //the sumz!// for (j=0; j<=range_j; j=j+step_j) if (j!=0){ { cout << setw(10) << j << " | "; // This is the left hand column for (i=1; i<=range_i; i=i+step_i) { invest_return = pow(initial_investment * ((1+j)/100), i); cout << setw(10) << invest_return; } cout << "\n"; } } return 0; }
22db422c224758a2bb93e371c9c71837697be860
d9bb656bd11f85e6419ebd786aec6fe3f917cb73
/modules/vargraph/vargraph_perf.cpp
6c58f1c1833a9fad32c73162d878622cc687ac30
[ "BSD-2-Clause" ]
permissive
spiralgenetics/biograph
55a91703a70429568107209ce20e71f6b96577df
5f40198e95b0626ae143e021ec97884de634e61d
refs/heads/main
2023-08-30T18:04:55.636103
2021-10-31T00:50:48
2021-10-31T00:51:08
386,059,959
21
10
NOASSERTION
2021-07-22T23:28:45
2021-07-14T19:52:15
HTML
UTF-8
C++
false
false
3,546
cpp
vargraph_perf.cpp
#include "vargraph.h" #include "modules/io/config.h" #include "modules/io/file_io.h" #include "modules/bio_base/reference.h" #include "modules/bio_base/seqset.h" #include "modules/bio_base/readmap.h" #include <boost/algorithm/string.hpp> std::string str_vec(const std::vector<int>& vec) { std::string r = "["; for(size_t i = 0; i < vec.size(); i++) { r += std::to_string(vec[i]); if (i != vec.size() - 1) { r += " "; } } r += "]"; return r; } void dump_cov(const char* name, const vargraph::cov_info_t& ci) { printf(" %s:\n", name); printf(" base_cov: %s\n", str_vec(ci.base_cov).c_str()); printf(" span_cov: %s\n", str_vec(ci.span_cov).c_str()); }; void dump_graph(vargraph* vg, bool full_cov = true) { printf("Dump of vargraph with full_cov = %s\n", full_cov ? "true" : "false"); for(const auto& kvp : vg->get_nodes()) { printf("%s\n", kvp.second->as_string().c_str()); if (full_cov) { dump_cov("unpaired", kvp.second->unpaired); dump_cov("paired", kvp.second->paired); } } for(const auto& e : vg->get_edges()) { printf("%s->%s\n", e->upstream->as_string().c_str(), e->downstream->as_string().c_str()); printf(" unpaired: %u, paired: %u\n", e->unpaired, e->paired); } } void dump_reads(std::vector<std::vector<dna_sequence>> fake_reads) { for(auto const& read : fake_reads) { if (read.size() == 1) { printf("unpr %s\n", read[0].as_string().c_str()); } else if (read.size() == 2) { printf("pair %s %s\n", read[0].as_string().c_str(), read[1].as_string().c_str()); } } } int main() { printf("Hello world\n"); Config::load("/home/english/spiral/etc/products/unittest.json"); printf("Loading reference\n"); Config::set("reference_path", "/share/reference/hs37d5"); reference ref(""); printf("Loading seqset\n"); auto ss = std::make_shared<seqset>("/mnt/data/ajtrio/manual_builder/37/results/HG002.bg/seqset"); printf("Loading readmap\n"); readmap rm(ss, "/mnt/data/ajtrio/manual_builder/37/results/HG002.bg/coverage/cf3236d07a8a8d22a7784274c2173036939515c1.readmap"); // Single supercontig std::string chr = "1"; size_t start = 37313385; size_t end = 37322046; size_t flat_start = ref.get_assembly().flatten(chr, start); size_t flat_end = ref.get_assembly().flatten(chr, end); //dna_slice slice(ref.get_dna(flat_start), ref.get_dna(flat_end)); dna_sequence slice(ref.get_dna(flat_start), ref.get_dna(flat_end)); printf("Got a slice, size = %d\n", int(slice.size())); auto vg = std::make_shared<vargraph>(slice); file_reader fr("/home/english/data/single_sample_pcmp/debugging/1:37248525-77248525_calls.vcf"); printf("Loading VCF, time = %ld\n", time(0)); std::string line; int cnt = 0; while (fr.readline(line, 500000)) { std::vector<std::string> fields; if (line[0] == '#') continue; cnt += 1; boost::split(fields, line, boost::is_any_of("\t")); long pos = atol(fields[1].c_str()); std::vector<std::string> alts; boost::split(alts, fields[4], boost::is_any_of(",")); for(const auto& alt : alts) { vg->add_variant(pos - start - 1, pos - start - 1 + fields[3].size(), dna_sequence(alt)); printf("Adding variant, [%lu-%lu) local coords, alt = %s\n", pos - start - 1, pos - start - 1 + fields[3].size(), alt.c_str()); } } printf("Found %d\n", cnt); printf("Doing trace, %d %d @ time = %ld\n", 0, int(slice.size()), time(0)); vg->trace(*ss, rm, 0, slice.size()); printf("Done, time = %ld\n", time(0)); dump_graph(vg.get(), false); }
a023c77b4fb31c7d06fd02cd8f2d4f4801bfa345
496470f08d404e545753ff83a785269cdcd52660
/src/ems/cliclient/CliMenuPlatformConfig.cpp
ce2d386bbf787dae4d5954d904d8560f5a1a588c
[ "Apache-2.0" ]
permissive
shorton3/dashingplatforms
065bc1fc5b070c0a21c9c5a23b6a41cf7b932b9c
f461c967827b92c8bcf872c365afa64e56871aba
refs/heads/master
2021-01-20T13:56:04.007176
2017-05-14T21:22:03
2017-05-14T21:22:03
90,538,349
0
0
null
null
null
null
UTF-8
C++
false
false
7,670
cpp
CliMenuPlatformConfig.cpp
/****************************************************************************** * * File name: CliMenuPlatformConfig.h * Subsystem: EMS * Description: Static handler methods for platform configuration requests. * * Name Date Release * -------------------- ---------- --------------------------------------------- * Stephen Horton 01/01/2014 Initial release * * ******************************************************************************/ //----------------------------------------------------------------------------- // System include files, includes 3rd party libraries. //----------------------------------------------------------------------------- #include <sstream> #include <tao/ORB_Core.h> //----------------------------------------------------------------------------- // Component includes, includes elements of our system. //----------------------------------------------------------------------------- #include "CliMenuPlatformConfig.h" #include "platform/logger/Logger.h" //----------------------------------------------------------------------------- // Static Declarations. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // PUBLIC methods. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Method Type: Constructor // Description: // Design: //----------------------------------------------------------------------------- CliMenuPlatformConfig::CliMenuPlatformConfig() : errorString_("DefaultError") { }//end Constructor //----------------------------------------------------------------------------- // Method Type: Virtual Destructor // Description: // Design: //----------------------------------------------------------------------------- CliMenuPlatformConfig::~CliMenuPlatformConfig() { }//end virtual destructor //----------------------------------------------------------------------------- // Method Type: INSTANCE // Description: Initialize static variables to be used by the methods // Design: //----------------------------------------------------------------------------- void CliMenuPlatformConfig::initialize(platformConfig::platformConfig_I_ptr platformConfig_I_ptr) { platformConfig_I_ptr_ = platformConfig_I_ptr; }//end initialize //----------------------------------------------------------------------------- // Method Type: INSTANCE // Description: Retrieve all of the subsystem / severity log level pairs from the agent // Design: //----------------------------------------------------------------------------- string CliMenuPlatformConfig::getLogLevels() { char* exceptionMessage = NULL; if (CORBA::is_nil (platformConfig_I_ptr_) || platformConfig_I_ptr_->_non_existent()) { TRACELOG(DEBUGLOG, CLICLIENTLOG, "platformConfigIPtr is NULL",0,0,0,0,0,0); return errorString_; }//end if ostringstream ostr; try { exceptionMessage = "While retrieving log levels"; platformConfig::platformConfigLogLevels_var logLevels_var; platformConfig_I_ptr_->getLogLevels(logLevels_var.out()); if (logLevels_var.in().length() != MAX_LOG_SUBSYSTEM) { TRACELOG(WARNINGLOG, CLICLIENTLOG, "Retrieved Log Levels have too few elements: %d, should be %d", logLevels_var.in().length(),MAX_LOG_SUBSYSTEM,0,0,0,0); return errorString_; }//end if // Populate the Log Levels ostr << " Subsystem LogLevel " << endl; ostr << "-------------------- -------------------" << endl; for (unsigned int i = 0; i < logLevels_var.in().length(); i++) { string name = logLevels_var[CORBA::ULong(i)].subsystemName.in(); // Justify the fields with padding name.resize(15, ' '); int id = logLevels_var[CORBA::ULong(i)].subsystemEnum; int severity = logLevels_var[CORBA::ULong(i)].severityLevel; ostr << " " << name << "(" << id << ")" << " "; switch (severity) { case ERRORLOG: ostr << "ERROR LOG "; break; case WARNINGLOG: ostr << "WARNING LOG "; break; case INFOLOG: ostr << "INFO LOG"; break; case DEBUGLOG: ostr << "DEBUG LOG"; break; case DEVELOPERLOG: ostr << "DEVELOPER LOG"; break; default: ostr << "UNKNOWN LEVEL(" << severity << ")"; break; }//end switch ostr << endl; // For CLI Client Subsystem, set our local log levels to match what is in the database. // This may be confusing to the user, so may need to be later disabled. if (i == CLICLIENTLOG) { Logger::setSubsystemLogLevel((LogSubSystemType)i, (LogSeverityType)severity); }//end if }//end for }//end try catch (CORBA::Exception &exception) { // See $TAO_ROOT/tao/Exception.h for additional fields and information that can be retrieved TRACELOG(ERRORLOG, CLICLIENTLOG, "Application Level Exception - %s. Corba Orb Level Exception - %s", exceptionMessage, exception._info().c_str(),0,0,0,0); }//end catch return ostr.str(); }//end getLogLevels //----------------------------------------------------------------------------- // Method Type: INSTANCE // Description: Set the log level severity based on the subsystem id // Design: //----------------------------------------------------------------------------- void CliMenuPlatformConfig::setLogLevel(int subsystem, int severityLevel) { char* exceptionMessage = NULL; if (CORBA::is_nil (platformConfig_I_ptr_) || platformConfig_I_ptr_->_non_existent()) { TRACELOG(DEBUGLOG, CLICLIENTLOG, "platformConfigIPtr is NULL",0,0,0,0,0,0); return; }//end if try { exceptionMessage = "While setting Log Level"; // Allocate the logLevel structure platformConfig::platformConfigLogLevel* logLevel; ACE_NEW(logLevel, platformConfig::platformConfigLogLevel); // Populate the structure logLevel->subsystemEnum = subsystem; logLevel->subsystemName = ""; logLevel->severityLevel = severityLevel; // Call the method and pass in the structure platformConfig_I_ptr_->setLogLevel(*logLevel); // Change the subsystem log level locally in the Logger as well Logger::setSubsystemLogLevel((LogSubSystemType)subsystem, (LogSeverityType)severityLevel); }//end try catch (CORBA::Exception &exception) { // See $TAO_ROOT/tao/Exception.h for additional fields and information that can be retrieved TRACELOG(ERRORLOG, CLICLIENTLOG, "Application Level Exception - %s. Corba Orb Level Exception - %s", exceptionMessage, exception._info().c_str(),0,0,0,0); }//end catch/end sendLock }//end setLogLevel //----------------------------------------------------------------------------- // PROTECTED methods. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // PRIVATE methods. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Nested Class Definitions: //-----------------------------------------------------------------------------
5a578f2db36e3affd18291907d9025d5df635acf
4e0d4077553a506256827d09f275643262655012
/source/utilities/data/coreString.h
ea57ad81c9aef4fb1764209c75deac04f0b4138f
[ "Zlib", "CC-BY-4.0" ]
permissive
MausGames/core-engine
157c8fd37611fc18d3bd182de05d57732ecae7d6
77957cf7303e63acb2b8e95ac99a356b13bd6b25
refs/heads/main
2023-08-17T07:55:20.820298
2023-08-04T20:19:09
2023-08-04T20:19:09
28,817,681
18
2
null
null
null
null
UTF-8
C++
false
false
4,846
h
coreString.h
/////////////////////////////////////////////////////////// //*-----------------------------------------------------*// //| Part of the Core Engine (https://www.maus-games.at) |// //*-----------------------------------------------------*// //| Copyright (c) 2013 Martin Mauersics |// //| Released under the zlib License |// //*-----------------------------------------------------*// /////////////////////////////////////////////////////////// #pragma once #ifndef _CORE_GUARD_STRING_H_ #define _CORE_GUARD_STRING_H_ // TODO 3: work-string should also handle NULL // TODO 3: remove custom contains function with C++23 // TODO 4: when to use append, when to use += (which is only used rarely) ? change everything to append ? // **************************************************************** /* base string type */ using coreStringBase = std::string; // **************************************************************** /* string class */ class coreString final : public coreStringBase { public: coreString() = default; constexpr coreString(const coreChar* pcText)noexcept : coreStringBase (pcText ? pcText : "") {} constexpr coreString(const coreChar* pcText, const coreUintW iNum)noexcept : coreStringBase (pcText ? pcText : "", iNum) {} constexpr coreString(const coreUintW iNum, const coreChar cChar)noexcept : coreStringBase (iNum, cChar) {} constexpr coreString(coreStringBase&& m)noexcept : coreStringBase (std::move(m)) {} ENABLE_COPY(coreString) /* assign new string */ using coreStringBase::assign; constexpr coreString& assign(const coreChar* pcText) {this->coreStringBase::assign(pcText ? pcText : ""); return *this;} constexpr coreString& assign(const coreChar* pcText, const coreUintW iNum) {this->coreStringBase::assign(pcText ? pcText : "", iNum); return *this;} /* append new string */ using coreStringBase::append; constexpr coreString& append(const coreChar* pcText) {this->coreStringBase::append(pcText ? pcText : ""); return *this;} constexpr coreString& append(const coreChar* pcText, const coreUintW iNum) {this->coreStringBase::append(pcText ? pcText : "", iNum); return *this;} /* append new string with operator */ using coreStringBase::operator +=; constexpr coreString& operator += (const coreChar* pcText) {return this->append(pcText);} /* replace all occurrences of a sub-string with another one */ using coreStringBase::replace; coreString& replace(const coreChar* pcOld, const coreChar* pcNew); /* trim string on both sides */ coreString& trim(const coreChar* pcRemove = " \n\r\t"); /* check for existence of a sub-string */ constexpr coreBool contains(const coreChar* pcText)const {return (this->find(pcText) != coreString::npos);} }; // **************************************************************** /* work-string class */ class coreWorkString final { private: coreChar* m_pcBuffer; // string buffer (may be NULL) coreUint32 m_iSize; // string size (including null-terminator) coreUint32 m_iCapacity; // buffer capacity public: constexpr coreWorkString()noexcept; coreWorkString(const coreChar* pcText)noexcept; ~coreWorkString(); DISABLE_COPY(coreWorkString) /* access string buffer */ inline const coreChar& operator [] (const coreUintW iIndex)const {ASSERT(iIndex < m_iCapacity) return m_pcBuffer[iIndex];} inline const coreChar* c_str ()const {ASSERT(m_pcBuffer) return m_pcBuffer;} /* control memory allocation */ coreBool reserve(const coreUintW iCapacity); void shrink_to_fit(); /* add string data */ void assign (const coreChar* pcText); void append (const coreChar* pcText); void replace(const coreChar* pcOld, const coreChar* pcNew); /* remove string data */ void erase(const coreUintW iIndex, const coreUintW iCount); void clear(); /* create formatted string */ void print(SDL_PRINTF_FORMAT_STRING const coreChar* pcFormat, ...) SDL_PRINTF_VARARG_FUNC(2); /* get object properties */ inline coreUintW capacity()const {return m_iCapacity;} inline coreUintW length ()const {return m_iSize - 1u;} inline coreBool empty ()const {return m_iSize == 1u;} }; // **************************************************************** /* constructor */ constexpr coreWorkString::coreWorkString()noexcept : m_pcBuffer (NULL) , m_iSize (1u) , m_iCapacity (0u) { } inline coreWorkString::coreWorkString(const coreChar* pcText)noexcept : coreWorkString () { // assign initial string this->assign(pcText); } #endif /* _CORE_GUARD_STRING_H_ */
685ea19174986f8737682ebb073fc94178728a56
164a928042528789aca29209a06c56c6a1b825b3
/Practica22/Practica2-Ej7.cpp
13da1d70d34288148980f29c18475019d403218e
[]
no_license
daquinte/Redes-UCM
0c5edca968bd09743445b5e6f8439ee8e7509320
24e90033e0ebada42d6a21b9ed12267345e1e814
refs/heads/master
2020-03-12T00:25:02.322429
2018-05-25T10:47:55
2018-05-25T10:47:55
130,348,436
0
0
null
null
null
null
UTF-8
C++
false
false
4,145
cpp
Practica2-Ej7.cpp
#include <sys/socket.h> #include <sys/types.h> #include <netdb.h> #include <string.h> #include <iostream> #include <time.h> #include <pthread.h> class Thread{ public: Thread(int socket){ threadSocket = socket; salir = false;}; virtual ~Thread(){}; void do_message(){ //Mientras el booleano salir sea falso se siguen mandando y recibiendo mensajes. Este solo se volverá true al darle a la Q while(!salir) { char buf[256]; struct sockaddr src_addr; socklen_t addrlen = sizeof(src_addr); //ACCEPT: devuelve un socket nuevo que hace referencia a la conexión establecida (Es decir, tienes los dos sockets aqui) //Extrae la primera conexion de la cola de conexiones pendientes, y la convierte en socket ya conectado. //Es bloqueante, pero puedes usar select() //Aceptamos el siguiente en la cola size_t socketCliente = accept(threadSocket, &src_addr, &addrlen); char host [NI_MAXHOST]; char serv [NI_MAXSERV]; getnameinfo(&src_addr, addrlen, host, NI_MAXHOST, serv, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV); std::cout << "Conexión desde: " << host <<":" <<serv << std::endl; //Recibe el input(el mensaje) del cliente (nosotros) //s = nº de bytes ssize_t s; bool go = true; do{ s = recv(socketCliente, &buf, 255, 0); //Inicializa en lo último que se ha recibido buf[s]='\0'; if(buf[0] == 'Q'){ go = false; // std::cout << "Me salgo" << std::endl; } else{ // std::cout<< "BUFFER: "<< buf << std::endl; //Se le pasa el buf de nuevo, para que sea un eco. send(socketCliente, &buf, s, 0); } }while(s > 0 && go) ; std::cout << "La conexión ha finalizado \n"; salir = true; //Si queremos mostrar en número de bytes se deberá hacer dentro de este if escribiendo el valor de s //Si has recibido bytes, s no es cero //getnameinfo(&src_addr, addrlen, host, NI_MAXHOST, serv, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV); } } private: int threadSocket; //Socket que usará cada thread bool salir; //Booleano que mantiene acivo o no el bucle principal }; //Método que llama al envio de mensajes de cada thread al inicio de la rutina y lo pasa a C para que funcione extern "C" { void* start_routine(void* _thread){ Thread* t = static_cast<Thread*>(_thread); t-> do_message(); delete t; return 0; } } //El argv por si solo no hace nada. Luego cuando lo ejecutes tienes que pasarle un parámetro que es el localhost y el puerto int main (int argc, char **argv) { struct addrinfo hints; struct addrinfo *res; bool salir = false; memset((void*) &hints, '\0', sizeof(struct addrinfo)); hints.ai_family = AF_INET; //Porque es IPv4 hints.ai_socktype = SOCK_STREAM; // STREAM es TCP //argv[1] = direccion , argv[2] = puerto(host) //Res se rellena con los parametros de argv int rc = getaddrinfo(argv[1], argv[2], &hints, &res); if (rc != 0) { std::cout << "error getaddrinfo(): " << gai_strerror(rc) << std::endl; return -1; } int sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); //BIND: Define la dirección en la que se va a escuchar bind (sd, res->ai_addr, res->ai_addrlen); //LISTEN: Pone el server socket en modo pasivo, esperando que el cliente se conecte //socket propio, y luego un int que son las conexiones pendientes en la cola del socket //Si llega un request y la cola está llena, da error de tipo "ECONNREFUSED" listen(sd, 15); //QUIZA SEA BUENA IDEA COGER EL ACCEPT DEL THREAD Y PASARLO AQUI, Y TENER SOLO UN WHILE EN EL THREAD :3 //Inicializamos el conjunto de threads (5 en principio por ejemplo) int numThreads = 5; pthread_t threadID[numThreads]; //Conjunto de ids de cada thread para llamar a cada uno en el for for(int i = 0; i < numThreads; i++) { pthread_attr_t attr; Thread* thread = new Thread(sd); pthread_attr_init (&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_create(&threadID[i], &attr, start_routine, static_cast<void*>(thread)); } char c; std::cin >> c; freeaddrinfo(res); return 0; }
7e5e4d704376db0adaddaf2e0a284dbea0ad8ffb
bc04ac4221bd533da6497d1f80150cdd211a7921
/instructions/Instruction_stci.cpp
6aa8d71a1b72b303327d26ccdb58a83be4bad8ae
[]
no_license
WarlockD/Mil-std-1750A-Emulator-C20
71e8e357c81a36fe39c5b42a1f76fa13ffef130d
93ed87966945351773107dc6cf3ad5fd50e9cdd4
refs/heads/master
2023-03-16T07:55:57.903908
2012-07-16T15:57:28
2012-07-16T15:57:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
548
cpp
Instruction_stci.cpp
#include <iostream> #include <iomanip> #include "Instruction_stci.h" #include "Operation_stc.h" namespace { opCodeRange opCode = {0x92, 0x92}; const std::string opCodeStr = "STCI"; const std::string opDescription = "Store a Non Negative Constant"; } Instruction_stci::Instruction_stci() : Instruction_longInstructionIndirect(opCode, opCodeStr, opDescription) { setOperation(new Operation_stc()); } Instruction_stci::~Instruction_stci() { } void Instruction_stci::execute() const { Instruction_longInstructionIndirect::execute(); }
288c19815738a1bd9d9d92b00a59f43a071ef7ee
543277a348133e1305e9489cd4e93d674d2a903b
/src/LL1.h
06e27aa67b22467e9d27407853a04f5b6fe46807
[]
no_license
legobadman/scheme-interpreter
9ae1f728a1fe2698f9aed46ff77a1dfeff26d64b
8c630ea7a721b7a83f289c3a3805a47e0713790f
refs/heads/master
2021-05-28T11:24:07.515369
2014-10-12T03:56:37
2014-10-12T03:56:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,272
h
LL1.h
#ifndef _LL1_H_ #define _LL1_H_ #include "Tree.h" #include "Token.h" #include "macro.h" extern p_AstNode eval (vector<Token>, int); extern p_AstNode LL1_Lisp (vector<Token>, int &); extern p_AstNode LL1_exp (vector<Token>, int &); extern p_AstNode LL1_Value (vector<Token>, int &); extern p_AstNode LL1_procedure (vector<Token>, int &); extern p_AstNode LL1_Operator (vector<Token>, int &); extern p_AstNode LL1_Rop (vector<Token>, int &); extern p_AstNode LL1_Boolop (vector<Token>, int &); extern p_AstNode LL1_IF (vector<Token>, int &); extern p_AstNode LL1_COND (vector<Token>, int &); extern p_AstNode LL1_ConditionList (vector<Token>, int &); extern p_AstNode LL1_LET (vector<Token>, int &); extern p_AstNode LL1_LAMB (vector<Token>, int &); extern std::vector<p_AstNode> LL1_exp_ (vector<Token>, int &); extern std::vector<p_AstNode> LL1_ArguRefList (vector<Token>, int &); extern p_AstNode LL1_DEF (vector<Token>, int &); extern p_AstNode LL1_DEFOBJ (vector<Token>, int &); extern std::string LL1_DEFBODY (Macro&, vector<Token>, int &); extern p_AstNode LL1_CONS (vector<Token>, int &); extern p_AstNode LL1_CAR (vector<Token>, int &); extern p_AstNode LL1_CDR (vector<Token>, int &); extern p_AstNode LL1_LIST(vector<Token>, int &); #endif
5459a117ce887b2f5f583315ec03ed5037dd6b8a
d378315ec265065f9e1b0b9f60cdc4c8bdc15331
/src/Materials/BaseMaterial.cpp
61feec50d9f64cb6d4ea84f7d22aa9e8b6c15f8e
[]
no_license
ValentinUsedREKTItsSuperEffective/REKTgine
a87070198a9bd1d9ae39da07505d4e3a0cf2df03
15c8f799857aa88513da6101bb47074f15c8b324
refs/heads/master
2021-10-30T19:19:02.898515
2021-09-21T05:47:55
2021-09-21T05:47:55
64,720,804
0
0
null
2021-06-17T03:08:07
2016-08-02T03:23:36
C++
UTF-8
C++
false
false
1,074
cpp
BaseMaterial.cpp
#include "Materials/BaseMaterial.hpp" BaseMaterial::BaseMaterial() : color(glm::vec3(1.f, 1.f, 1.f)), needUpdate(true), shader(NULL){ colorTexture = Texture(); colorTexture.load(); } BaseMaterial::BaseMaterial(MaterialParamaters parameters) : color(parameters.color), needUpdate(true), shader(NULL){ if(parameters.textureSrc != ""){ colorTexture = Texture(parameters.textureSrc); } else { colorTexture = Texture(); } colorTexture.inverseImage = parameters.inverseImage; colorTexture.load(); } BaseMaterial::~BaseMaterial(){ delete shader; } void BaseMaterial::loadShader(){ if(shader) { return; } shader = new Shader("Shaders/default.vert", "Shaders/default.frag"); } void BaseMaterial::update(){ glUseProgram(shader->programID); shader->bindFloat3("material.color", color); shader->bindInt("material.map", 0); } void BaseMaterial::bindTextures(){ glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, colorTexture.textureID); } void BaseMaterial::useLight(Light &light){}
b814d86da28c10819ae998421f9973dc578eab11
6cfd73d4918ea055db30f6e3c3252e930234767a
/GameServer/MapItem.cpp
6cba755eff3709429c74bfbb7bdee7a21b548fed
[ "MIT" ]
permissive
neyma2379294/IGC.GameServer.SX
138b1ff8019c9c2e83efebe75b8b2899be357255
44d77f47598b15c6adb297edba9035561c4fec74
refs/heads/master
2021-05-11T07:41:17.590766
2017-02-21T17:31:28
2017-02-21T17:31:28
118,029,462
1
0
null
null
null
null
UTF-8
C++
false
false
2,997
cpp
MapItem.cpp
// ------------------------------ // Decompiled by Deathway // Date : 2007-05-09 // ------------------------------ #include "stdafx.h" //#include "MapItem.h" #include "GameMain.h" // GS-N 0.99.60T 0x0047BE60 - Completed // GS-N 1.00.18 JPN 0x00493830 - Completed CMapItem::CMapItem() { this->Init(); } CMapItem::~CMapItem() { return; } void CMapItem::Init() { this->VPCount = 0; this->m_State = 0; for ( int n=0;n<MAX_VIEWPORT;n++ ) { memset(&this->VpPlayer[n], 0, sizeof(VIEWPORT_PLAYER_STRUCT)); } } void CMapItem::CreateItem(int type, int level, int x, int y, float dur, BYTE Option1, BYTE Option2, BYTE Option3, BYTE NOption, BYTE SOption, UINT64 number, BYTE ItemEffectEx, BYTE *SocketOption, BYTE SocketBonusOption) { this->Init(); this->m_Level = level; this->m_Durability = dur; this->Convert(type, Option1, Option2, Option3, NOption, SOption, ItemEffectEx, SocketOption, SocketBonusOption, 0, CURRENT_DB_VERSION); this->px = x; this->py= y; this->live = true; this->Give = false; this->m_State = 1; if ( this->m_QuestItem != false ) { this->m_Time = GetTickCount() + 60000; this->m_LootTime = GetTickCount() + 600000; this->m_Number = number; } else { this->m_Time = GetTickCount() + gItemDisapearTime*1000;//120000; // 2m inutes this->m_LootTime = GetTickCount() + gLootingTime*1000; this->m_Number = number; } } void CMapItem::DropCreateItem(int type, int level, int x, int y, float dur, BYTE Option1, BYTE Option2, BYTE Option3, BYTE NOption, BYTE SOption, UINT64 number, int PetLevel, UINT64 PetExp, BYTE ItemEffectEx, BYTE *SocketOption, BYTE SocketBonusOption) { this->Init(); this->m_Level = level; this->m_Durability = dur; this->Convert(type, Option1, Option2, Option3, NOption, SOption, ItemEffectEx, SocketOption, SocketBonusOption, 0, CURRENT_DB_VERSION); this->SetPetItemInfo(PetLevel, PetExp); this->px = x; this->py= y; this->live = true; this->Give = false; this->m_State = 1; if ( this->m_QuestItem != false ) { if ( type == ITEMGET(14,11) ) // Box Of luck { this->m_Time = GetTickCount() + 1000; } else { this->m_Time = GetTickCount() + 60000; } this->m_LootTime = GetTickCount() + 600000; this->m_Number = number; } else { if ( type == ITEMGET(14,11) ) { this->m_Time = GetTickCount() + 1000; } else { this->m_Time = GetTickCount() + gItemDisapearTime*1000; } this->m_LootTime = GetTickCount() + gLootingTime*1000; this->m_Number = number; } if ( type == ITEMGET(13,19) ) // Absolute Weapon of Archangel { if ( ( level < 0)?FALSE:(level>2)?FALSE:TRUE) { this->m_Time = GetTickCount() + 900000; this->m_LootTime = GetTickCount(); } } if (type == ITEMGET(14, 63)) { this->m_Time = GetTickCount() + 20000; } if (type == ITEMGET(14, 223)) { this->m_Time = GetTickCount() + 300000; } }
476b7cbf4e66583a27567a0edfa2392fe171eb70
3b1489bdd63cd53770a066e6f90a13ef3286bfe7
/src/cinder/vr/openvr/DeviceManager.cpp
fa7d519d792bfe26fe79028bfeb185fc332aa9e6
[]
no_license
seph14/Cinder-VR
cc996f6b470e851d2c80370d0acefc9ecafbaa1a
511d3c9422ff8012d3ee4d0dccb3ecbdfab07464
refs/heads/master
2021-01-12T19:44:17.842838
2017-02-16T20:02:59
2017-02-16T20:02:59
64,486,455
1
0
null
2016-07-29T14:22:05
2016-07-29T14:22:03
null
UTF-8
C++
false
false
5,785
cpp
DeviceManager.cpp
/* Copyright 2016 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright (c) 2016, The Cinder Project, All rights reserved. This code is intended for use with the Cinder C++ library: http://libcinder.org Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "cinder/vr/openvr/DeviceManager.h" #include "cinder/vr/openvr/Controller.h" #include "cinder/vr/openvr/Context.h" #include "cinder/vr/openvr/OpenVr.h" #include "cinder/Log.h" #if defined( CINDER_VR_ENABLE_OPENVR ) namespace cinder { namespace vr { namespace openvr { const std::string kDeviceVendorName = "HTC Vive"; // ------------------------------------------------------------------------------------------------- // DeviceManager // ------------------------------------------------------------------------------------------------- DeviceManager::DeviceManager( ci::vr::Environment *env ) : ci::vr::DeviceManager( ci::vr::API_OPENVR, kDeviceVendorName, env ) { if( ! ::vr::VR_IsHmdPresent() ) { throw ci::vr::openvr::Exception( "OpenVR HMD is not present" ); } } DeviceManager::~DeviceManager() { } void DeviceManager::initialize() { CI_LOG_I( "Initializing devices for HTC Vive" ); ::vr::EVRInitError error = ::vr::VRInitError_None; mVrSystem = ::vr::VR_Init( &error, ::vr::VRApplication_Scene ); if( ::vr::VRInitError_None != error ) { std::string errMsg = ::vr::VR_GetVRInitErrorAsEnglishDescription( error ); throw openvr::Exception( errMsg ); } mDriverName = ci::vr::openvr::getTrackedDeviceString( mVrSystem, ::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_TrackingSystemName_String ); mDisplayName = ci::vr::openvr::getTrackedDeviceString( mVrSystem, ::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_SerialNumber_String ); } void DeviceManager::destroy() { CI_LOG_I( "Destroying devices for HTC Vive" ); ::vr::VR_Shutdown(); mVrSystem = nullptr; } ci::vr::openvr::RenderModelDataRef DeviceManager::getRenderModelData( const std::string& renderModelName ) const { ci::vr::openvr::RenderModelDataRef result; auto it = mRenderModelData.find( renderModelName ); if( mRenderModelData.end() != it ) { result = it->second; } else { ::vr::RenderModel_t* renderModelModel = nullptr; ::vr::EVRRenderModelError error; while( 1 ) { error = ::vr::VRRenderModels()->LoadRenderModel_Async( renderModelName.c_str(), &renderModelModel ); if( ::vr::VRRenderModelError_Loading != error ) { break; } threadSleep( 1 ); } if( ::vr::VRRenderModelError_None != error ) { return ci::vr::openvr::RenderModelDataRef(); } ::vr::RenderModel_TextureMap_t* renderModelTexture = nullptr; while( 1 ) { error = ::vr::VRRenderModels()->LoadTexture_Async( renderModelModel->diffuseTextureId, &renderModelTexture ); if( ::vr::VRRenderModelError_Loading != error ) { break; } threadSleep( 1 ); } if( ::vr::VRRenderModelError_None != error ) { ::vr::VRRenderModels()->FreeRenderModel( renderModelModel ); return ci::vr::openvr::RenderModelDataRef(); } auto renderModelData = ci::vr::openvr::RenderModelData::create( renderModelName, renderModelModel, renderModelTexture ); if( renderModelData ) { mRenderModelData[renderModelName] = renderModelData; result = renderModelData; } else { CI_LOG_W( "Couldn't find render model data for: " << renderModelName ); } ::vr::VRRenderModels()->FreeRenderModel( renderModelModel ); ::vr::VRRenderModels()->FreeTexture( renderModelTexture ); } return result; } uint32_t DeviceManager::numDevices() const { const uint32_t kMaxDevices = 1; return kMaxDevices; } ci::vr::ContextRef DeviceManager::createContext( const ci::vr::SessionOptions& sessionOptions, uint32_t deviceIndex ) { if( deviceIndex >= numDevices() ) { throw ci::vr::openvr::Exception( "Device index out of range, deviceIndex=" + std::to_string( deviceIndex ) + ", maxIndex=" + std::to_string( numDevices() ) ); } ci::vr::ContextRef result = ci::vr::openvr::Context::create( sessionOptions, this ); return result; } }}} // namespace cinder::vr::vive #endif // defined( CINDER_VR_ENABLE_OPENVR )
548055b35c1542d5fa32ce332a1f31b66c23f3ab
34f4311431604cdc8e78a9f086dd93a10fbd3e98
/GamePhysics_EvanSchipellite_Machine/GamePhysics_EvanSchipellite/RigidBox.cpp
d3692caac965e4a471693f8aec39eac0ee70fee4
[]
no_license
eschipellite/GamePhysics
040005ab97283b2a11817b4f9f53cb4eadbabf56
bf0d589d4d57701c356ba7ed110def24dda923bd
refs/heads/master
2020-05-31T23:56:07.396305
2015-05-01T01:48:50
2015-05-01T01:48:50
29,218,154
0
0
null
null
null
null
UTF-8
C++
false
false
1,179
cpp
RigidBox.cpp
//============================================================================= // Rigid Box // // Written by Evan Schipellite // //============================================================================= #include "RigidBox.h" //============================================================================= RigidBox::RigidBox() { m_CollisionType = CollisionType::BOX; } //----------------------------------------------------------------------------- RigidBox::~RigidBox() { } //----------------------------------------------------------------------------- void RigidBox::drawObject() { glTranslatef(m_Position.X, m_Position.Y, m_Position.Z); glRotatef(m_Orientation.R, m_Orientation.I, m_Orientation.J, m_Orientation.K); glutSolidCube(m_HalfSize.X * 2); } //----------------------------------------------------------------------------- void RigidBox::Initialize(std::string textureID, Vector3D halfSize, float mass, Vector3D initialPosition) { m_HalfSize = halfSize; RigidRender::Initialize(textureID, mass, initialPosition); } //=============================================================================
17e13cce8d5709d6e8a6ad8d40635b79fb228584
888c6e53e6470bc418ea567b21c93000f5ee0ea9
/Symmetric_Tree/main.cc
7f2231ae73634f90c1fc546484a923e22b1edfbe
[]
no_license
goshan/leetcode
7ebbf63a53cd8f491d3f37548bd213944cdec959
11f947b7509c82db3f30c509e5366953432f2abd
refs/heads/master
2021-01-24T06:13:45.467249
2017-12-07T10:17:07
2017-12-07T10:17:07
9,021,584
1
0
null
null
null
null
UTF-8
C++
false
false
1,506
cc
main.cc
#include <iostream> #include <vector> #include <queue> using namespace std; // Definition for binary tree struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; bool vectorIsSymmetric(vector<int> &v){ for (int i = 0; i < v.size()/2; ++i) { /* code */ if (v[i] != v[v.size()-1-i]) { /* code */ return false; } } return true; } bool isSymmetric(TreeNode *root) { // Start typing your C/C++ solution below // DO NOT write int main() function queue<TreeNode *> cache; cache.push(root); int next_num = 0; int current_num = 1; vector<int> elem; while (cache.size() != 0){ TreeNode *temp = cache.front(); cache.pop(); if (temp == NULL) { /* code */ elem.push_back(-100000); } else { elem.push_back(temp ->val); cache.push(temp ->left); next_num ++; cache.push(temp ->right); next_num ++; } current_num --; if (current_num == 0) { /* code */ current_num = next_num; next_num = 0; if (vectorIsSymmetric(elem)){ elem.clear(); } else { return false; } } } return true; } int main(int argc, char const *argv[]) { /* code */ TreeNode root(1); TreeNode left(2); TreeNode right(2); TreeNode left1(3); TreeNode right1(4); TreeNode left2(4); TreeNode right2(3); root.left = &left; root.right = &right; left.left = &left1; left.right = &right1; right.left = &left2; right.right = &right2; cout <<isSymmetric(&root) <<endl; return 0; }
94b1d271e625d2a956b24c1290d1d54f526627b3
57e3f0c8102c316cd56ab132aa55708052fe2a39
/3.3/stackOfPlates.cpp
f23b38181845bfe490a2d7242b5e22ee1df6cb24
[]
no_license
ksuhr1/CrackingCodeInterview
300350ecfa36e8c9fa75799046dcf57cb881a7f3
5618471482ffd80137274fcd3750486280433443
refs/heads/master
2020-03-25T00:58:54.958376
2018-09-26T15:22:36
2018-09-26T15:22:36
143,215,670
0
0
null
null
null
null
UTF-8
C++
false
false
4,518
cpp
stackOfPlates.cpp
#include <iostream> #include <stdlib.h> #include <vector> #include <stack> #include <assert.h> //size_t is unsigned data type of at least 16 bits //use this when values can't be negative using namespace std; #define SIZE 4 class Stack { private: int top; int capacity; int *arr; int index; public: //constructor Stack(int size = SIZE); bool push(int x); int size(); int pop(); int peek(); void display(Stack s); bool isEmpty(); bool isFull(); }; class SetOfStacks:public Stack { public: int max_size; //create vector of stacks private: vector<Stack> stack_of_plates; // int index2; public: SetOfStacks(int x); void push(int x); void pop(); void popAt(int index); }; SetOfStacks::SetOfStacks(int x) { max_size = x; // index2 = 0; } void SetOfStacks::push(int x) { if(stack_of_plates.empty()) { Stack first; first.push(x); //push first stack into stack of plates stack_of_plates.push_back(first); } else { //get last stack size in stack of plates //if there is more room in stack, push the element int plate_size = stack_of_plates.back().size(); if(plate_size < SIZE ) { stack_of_plates.back().push(x); } else { //stack is full so create a new one Stack next; next.push(x); stack_of_plates.push_back(next); // index2++; // cout << "index: " << index2<< endl; } for(int i = 0; i < stack_of_plates.size(); i++) { stack_of_plates[i].display(stack_of_plates[i]); } } } void SetOfStacks::pop() { if(stack_of_plates.empty()) { cout << "No elements to pop"<<endl; assert(0); } else { cout << "Popping: " << stack_of_plates.back().peek() << " from the last stack" << endl; stack_of_plates.back().pop(); cout << "-----------------------Start of pop()---------------------"<<endl; for(int i = 0; i < stack_of_plates.size(); i++) { stack_of_plates[i].display(stack_of_plates[i]); } if(stack_of_plates.back().isEmpty()) { stack_of_plates.pop_back(); } } } void SetOfStacks::popAt(int index) { if(!(index < stack_of_plates.size())) { cout << "No elements to pop at index: " << index << endl; assert(0); } else { cout << "Popping: " << stack_of_plates[index].peek() << " at index: " << index << endl; stack_of_plates[index].pop(); for(int i = 0; i < stack_of_plates.size(); i++) { stack_of_plates[i].display(stack_of_plates[i]); } if(stack_of_plates[index].isEmpty()) { cout << "erasing" << endl; stack_of_plates.erase(stack_of_plates.begin()+index); } } } Stack::Stack(int size) { top = -1; arr = new int[size]; capacity = size; index = 0; } bool Stack::isEmpty() { return (top < 0); } bool Stack::isFull() { return (top >= (SIZE-1)); } int Stack::size() { return index; } bool Stack::push(int x) { if(isFull()) { cout << "Stack Overflow"<< endl; return false; } else { arr[++top] = x; index++; return true; } } int Stack::pop() { if(isEmpty()) { cout << "Stack Underflow"<< endl; return 0; } else { int x = arr[top--]; index--; return x; } } int Stack::peek() { if(!isEmpty()) { return arr[top]; } else { cout << "Stack is empty"<< endl; return 0; } } void Stack::display(Stack s) { if(s.size() == 0 ) { cout << "The Stack is empty" << endl; } for(int i = top; i >= 0; i--) { cout <<"|" <<arr[i]<<"|"<< endl; // cout << endl; } cout << endl; } int main(int argc, const char * argv[]) { SetOfStacks s(2); s.push(100); s.push(101); s.push(103); s.push(104); // s.pop(); // s.pop(); // s.pop(); // s.pop(); s.push(105); //stack 0 s.push(106); s.popAt(0); s.push(107); //onto stack 0 s.push(108); //onto stack 1 s.popAt(1); s.popAt(1); return 0; }
3c842248277f55376d75e4585f68c39a59d07039
0e205e75393eb32ee26fd9bb2e0a34837006e8ac
/13-TipoColor/Color.cpp
690eaa83a5949cd2b9f78d3a313b30d240f2fcc8
[]
no_license
ncrivelli/AED
2960fbcb00fdb44c0cd734040407ebdb4687dccc
3ea18e64d47022bb153c3aae19feb1264a9c5d84
refs/heads/master
2023-03-22T04:36:08.048432
2021-03-17T18:15:44
2021-03-17T18:15:44
256,326,048
0
0
null
null
null
null
ISO-8859-3
C++
false
false
1,429
cpp
Color.cpp
/* * Alumno: Nicolas E. Crivelli * Legajo: 1602410 */ #include "color.h" //declaración de funciones Color mezclar(const Color& a, const Color& b){ Color resultado; resultado.r = (a.r + b.r)/2; resultado.b = (a.b + b.b)/2; resultado.g = (a.g + b.g)/2; return resultado; } Color mezclarProporciones (const unsigned& pa, const Color& a, const unsigned& pb, const Color& b){ Color resultado; resultado.r = (a.r*pa + b.r*pb)/(pa+pb); resultado.b = (a.b*pa + b.b*pb)/(pa+pb); resultado.g = (a.g*pa + b.g*pb)/(pa+pb); return resultado; } Color sumar (const Color& a, const Color& b){ Color resultado; resultado.r = (a.r + b.r < 255) ? (a.r+b.r) : 255; resultado.b = (a.b + b.b < 255) ? (a.b+b.b) : 255; resultado.g = (a.g + b.g < 255) ? (a.g+b.g) : 255; return resultado; } Color restar (const Color& a, const Color& b){ Color resultado; resultado.r = (a.r - b.r > 0) ? (a.r-b.r) : 0; resultado.b = (a.b - b.b > 0) ? (a.b-b.b) : 0; resultado.g = (a.g - b.g > 0) ? (a.g-b.g) : 0; return resultado; } Color getComplementario (const Color& color){ Color resultado; resultado.r = blanco.r - color.r; resultado.b = blanco.b - color.b; resultado.g = blanco.g - color.g; return resultado; } bool isIgual (const Color& a, const Color& b){ bool resultado; resultado = a.r == b.r and a.b == b.b and a.g == b.g; return resultado; }
367f2ae8d155b5c84c0ada9f359ec962eabbc9b7
1f80af8f6e0b6b3cbfe66f4b04feb6620524f895
/solutions/312. Burst Balloons.cpp
93b1b503295bf9f36555e8517a928f95ada48966
[]
no_license
satvik-2-9/Leetcode
fff6d3484e0c053a6401225293ca8478c0debdec
422586dfe3ca7b36e6a2e140808f73288561f4d2
refs/heads/master
2023-06-21T22:05:05.779773
2021-07-15T14:37:57
2021-07-15T14:37:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
734
cpp
312. Burst Balloons.cpp
class Solution { public:    int maxCoins(vector<int>& num) {        if(num.size()==0)            return 0;        vector<int> arr;        arr.push_back(1);        for(auto i:num)            arr.push_back(i);        arr.push_back(1);        int n=arr.size();        long long dp[n][n];        memset(dp,0,sizeof(dp));        for(int gap=2;gap<n;gap++){            for(int l=0;l<n-gap;l++){                int r=l+gap;                for(int i=l+1;i<r;i++){                    dp[l][r]=max(dp[l][i]+dp[i][r]+arr[l]*arr[i]*arr[r],dp[l][r]);               }           }       }        return dp[0][n-1];   } };
0da4ee14a381abfeb674c533190f6bbcbe9d2f1b
18d89674b7f390015c927d254c56f094a47d1216
/Greedy/minimize_cashflow.cpp
3ae0913d6df13fa434507720239eecfc4e87c215
[ "Apache-2.0" ]
permissive
krayong/Data-Structures-and-Algorithms
1d1a551696e3de3ae8ce6aa30ba434f00633cf36
5105dab434fa59580b4068e64468a4a37245d763
refs/heads/master
2023-03-09T16:55:07.892503
2021-02-24T16:54:06
2021-02-24T16:54:06
326,136,436
2
0
null
null
null
null
UTF-8
C++
false
false
3,352
cpp
minimize_cashflow.cpp
#include <bits/stdc++.h> using namespace std; /************************************************************************************************************* * * Link : https://www.geeksforgeeks.org/minimize-cash-flow-among-given-set-friends-borrowed-money/ * Description: Given a number of friends who have to give or take some amount of money from one another. Design an algorithm by which the total cash flow among all the friends is minimized. Example: Following diagram shows input debts to be settled: https://media.geeksforgeeks.org/wp-content/cdn-uploads/cashFlow.png Above debts can be settled in following optimized way: https://media.geeksforgeeks.org/wp-content/cdn-uploads/cashFlow1.png * Resources: * * *************************************************************************************************************/ #define si(x) scanf("%d", &x) #define sll(x) scanf("%lld", &x) #define ss(s) getline(cin, s) #define pi(x) printf("%d\n", x) #define pll(x) printf("%lld\n", x) #define ps(s) cout << s << "\n" #define ll long long #define fo(i, k, n) for (ll i = k; i < n; i++) #define rof(i, k, n) for (ll i = k; i >= n; i--) #define deb(x) cout << #x << "=" << x << "\n" #define pb push_back #define mp make_pair #define fi first #define se second #define all(x) x.begin(), x.end() #define clr(x) memset(x, 0, sizeof(x)) #define set(x, i) memset(x, i, sizeof(x)) #define sortall(x) sort(all(x)) #define tr(a, it) for (auto it = a.begin(); it != a.end(); it++) #define present(c, x) (c.find(x) != c.end()) #define cpresent(c, x) (find(all(c), x) != c.end()) #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define randomize srand(chrono::high_resolution_clock::now().time_since_epoch().count()) typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vi> vvi; typedef vector<vl> vvl; int main() { fastio; randomize; int t; si(t); while (t--) { int num_people, num_rels; si(num_people), si(num_rels); int amount_get[num_people] = {0}; fo(i, 0, num_rels) { int from, to, amount; si(from), si(to), si(amount); --from, --to; amount_get[from] -= amount; amount_get[to] += amount; } vector<pair<int, pii>> result; while (true) { int max_to_be_given = max_element(amount_get, amount_get + num_people) - amount_get; int max_to_be_taken = min_element(amount_get, amount_get + num_people) - amount_get; if (amount_get[max_to_be_given] == 0 && amount_get[max_to_be_taken] == 0) break; int amount_exchanged = min(amount_get[max_to_be_given], abs(amount_get[max_to_be_taken])); amount_get[max_to_be_given] -= amount_exchanged; amount_get[max_to_be_taken] += amount_exchanged; result.pb(mp(amount_exchanged, mp(max_to_be_taken, max_to_be_given))); } for (auto ele : result) cout << "Person " << ele.se.fi + 1 << " owes Person " << ele.se.se + 1 << " amount " << ele.fi << "\n"; } return 0; }
865644734793e8253de327e0ad6c2785dc2d06cb
6792ce037053d1712e699c7ff7c684baaae681d3
/code/BinaryTree (eden).cpp
23f6a9acf5ab36f5b233b4cf448068fc6830a5aa
[]
no_license
liubq98/Cpp_exercises
3ee9630fe168eb828e11bf3db50a1f1fe0211d4f
a89f722d9b31f4ddf49289f07153bf69905a86cd
refs/heads/master
2020-11-23T19:25:18.008485
2019-12-13T08:08:13
2019-12-13T08:08:13
227,787,454
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
6,287
cpp
BinaryTree (eden).cpp
// // BinaryTree.hpp // C++ // // Created by ÀîÌìÅà on 16/5/4. // Copyright ? 2016Äê lee. All rights reserved. // #ifndef BinaryTree_hpp #define BinaryTree_hpp #include <iostream> #include <vector> #include <queue> #include <stack> #define EMPTY_ELE '#' class BinaryTree { public: struct Node { char val; Node* left; Node* right; Node(char v, Node* l = NULL, Node* r = NULL): val(v), left(l), right(r) { } }; BinaryTree(const BinaryTree&); BinaryTree(std::vector<char>&); // created by preorder and inorder BinaryTree(const std::vector<char>& preOrder, const std::vector<char>& inOrder); ~BinaryTree(); BinaryTree& operator=(const BinaryTree&); Node* getRoot() const; void clear(); static void preOrder(void (*visite)(BinaryTree::Node*), Node*); static void inOrder(void (*visite)(BinaryTree::Node*), Node*); static void postOrder(void (*visite)(BinaryTree::Node*), Node*); private: Node * copyNode(Node * oldNode, Node * newNode); Node * root; }; #endif #include <iostream> #include <vector> #include <queue> #include <stack> //#include "BinaryTree.hpp" BinaryTree::Node* creat(char* preOrder, char* inOrder, int size); BinaryTree::Node* creat(char* preOrder, char* inOrder, int size){ if(size == 0) { return NULL; } else { BinaryTree::Node* temp = new BinaryTree::Node(preOrder[0], NULL, NULL); int i, flag; for(i = 0; i < size; i++) { if(preOrder[0] == inOrder[i]) { flag = i; break; } } int lnum = flag; int rnum = size - flag - 1; if(lnum == 0) { temp->left = NULL; } else { temp->left = creat(&(preOrder[1]), &(inOrder[0]), lnum); } if(rnum == 0) { temp->right = NULL; } else { temp->right = creat(&preOrder[flag + 1], &(inOrder[flag + 1]), rnum); } return temp; } } BinaryTree::BinaryTree(const BinaryTree& b){ root = NULL; root = copyNode(b.getRoot(), root); } BinaryTree::BinaryTree(std::vector<char>& c){ root = NULL; if(c.empty() || c[0] == '#') { root = NULL; } else { int len = c.size(); root = new Node(c[0], NULL, NULL); std::queue<Node*> q; q.push(root); for(int i = 1; i < len; i++) { Node* temp = q.front(); q.pop(); if(c[i] != '#') { temp->left = new Node(c[i], NULL, NULL); q.push(temp->left); } i++; if(i >= len) { break; } if(c[i] != '#') { temp->right = new Node(c[i], NULL, NULL); q.push(temp->right); } } } } // created by preorder and inorder BinaryTree::BinaryTree(const std::vector<char>& preOrder, const std::vector<char>& inOrder){ root = NULL; int psize = preOrder.size(); int isize = inOrder.size(); if(psize != isize || psize == 0) { return; } char pre[psize]; char in[psize]; for(int i = 0; i < psize; i++) { pre[i] = preOrder[i]; in[i] = inOrder[i]; } root = creat(pre, in, psize); } BinaryTree::~BinaryTree(){ clear(); } BinaryTree& BinaryTree::operator=(const BinaryTree& b){ if(root == b.root) { return *this; } clear(); root = copyNode(b.getRoot(), root); } BinaryTree::Node* BinaryTree::getRoot() const{ return root; } void BinaryTree::clear(){ if(root == NULL) { return; } std::queue<Node*> q; q.push(root); while(!q.empty()) { Node* temp = q.front(); q.pop(); if (temp->left != NULL) { q.push(temp->left); } if (temp->right != NULL) { q.push(temp->right); } delete temp; } } //static void BinaryTree::preOrder(void (*visite)(BinaryTree::Node*), BinaryTree::Node* p){ if (p != NULL) { visite(p); preOrder(visite, p->left); preOrder(visite, p->right); } } void BinaryTree::inOrder(void (*visite)(BinaryTree::Node*), BinaryTree::Node* p){ if (p != NULL) { inOrder(visite, p->left); visite(p); inOrder(visite, p->right); } } void BinaryTree::postOrder(void (*visite)(BinaryTree::Node*), BinaryTree::Node* p){ if (p != NULL) { postOrder(visite, p->left); postOrder(visite, p->right); visite(p); } } //private BinaryTree::Node* BinaryTree::copyNode(Node * oldNode, Node * newNode){ if (oldNode == NULL) { newNode = NULL; } else { newNode = new Node(oldNode->val, NULL, NULL); newNode->left = copyNode(oldNode->left, newNode->left); newNode->right = copyNode(oldNode->right, oldNode->right); } return newNode; } #include <iostream> //#include "BinaryTree.hpp" using namespace std; void print(BinaryTree::Node * temp) { cout << temp->val << " "; } std::vector<char> pre; std::vector<char> in; void getPreOrder(BinaryTree::Node * temp) { pre.push_back(temp->val); } void getInOrder(BinaryTree::Node * temp) { in.push_back(temp->val); } void testTree() { cout << "test Tree" << endl; int n = 1; std::vector<char> tree; cin >> n; while (n--) { char temp = '\0'; cin >> temp; tree.push_back(temp); } BinaryTree x = BinaryTree(tree); x = x; BinaryTree::preOrder(print, x.getRoot()); cout << endl; BinaryTree::inOrder(print, x.getRoot()); cout << endl; BinaryTree::postOrder(print, x.getRoot()); cout << endl; BinaryTree::preOrder(getPreOrder, x.getRoot()); BinaryTree::inOrder(getInOrder, x.getRoot()); BinaryTree t = BinaryTree(pre, in); t = t; BinaryTree::postOrder(print, t.getRoot()); cout << endl; BinaryTree y = BinaryTree(t); y = y; BinaryTree::preOrder(print, y.getRoot()); cout << endl; BinaryTree::inOrder(print, y.getRoot()); cout << endl; BinaryTree::postOrder(print, y.getRoot()); BinaryTree::preOrder(getPreOrder, y.getRoot()); BinaryTree::inOrder(getInOrder, y.getRoot()); } int main() { testTree(); }
bdf5dde8eab9ce1dcf295f0b96bc5a294af22432
083126adfb3892cc2ad6cece4634ace18db6d152
/ConsoleApplication2/ConsoleApplication2/AlgorithmX.cpp
968821ea4901c12e1e472918ea725813312e4660
[]
no_license
zhanglin2018/algorithm_2020_deployment
d6eecd9e3e6582865fd775f254ac17e32774520a
9d0e844568ca45aa4af1a6c5e3750c180821e2cf
refs/heads/master
2022-11-23T23:46:24.676337
2020-08-05T05:40:00
2020-08-05T05:40:00
285,190,560
0
0
null
null
null
null
UTF-8
C++
false
false
25,711
cpp
AlgorithmX.cpp
//============================================================================ // Name : AlgorithmX.cpp // Author : linzhang // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <fstream> #include <stdlib.h> /* atoi */ #include <dirent.h> /* */ #include <sstream> #include <ctime> /*LINUX:<sys/time.h>*/ // #include <iostream> #include <vector> #include <set> #include <cmath> #include <algorithm> #include <map> using namespace std; struct Point { int x; int y; Point() { x = 0; y = 0; } }; struct mycomp { bool operator()(const Point &p1, const Point &p2)const { if (p1.x == p2.x) return p1.y < p2.y; else return p1.x < p2.x; } }; bool CompareLess(Point lhs, Point rhs) { if (lhs.y == rhs.y) return lhs.x < rhs.x; else return lhs.y < rhs.y; } class Solution_Item; class Point_Item { public: int x; int y; vector<Solution_Item*> solutions; bool noUsed; bool exist; Point_Item() { x = 0; y = 0; noUsed = true; exist = false; } Point_Item(int x2, int y2) { x = x2; y = y2; noUsed = true; exist = false; } bool operator==(const Point_Item& lhs) { if (lhs.x == x && lhs.y == y) return true; return false; } int solutionSize(); }; class Cell { public: bool exist; int value; bool marked; int nextX; int nextY; Point point; Cell() { value = 0; marked = false; nextX = 0; nextY = 0; exist = false; point = Point(); } }; class Solution_Item { public: vector<Point_Item*> points; bool noUsed; Solution_Item() { noUsed = true; } vector<Point_Item*> noUsedPoints(); int pointCount(); }; int Solution_Item::pointCount() { int pointCount = 0; for (size_t i = 0; i < points.size(); i++) { if (points[i]->noUsed) { pointCount++; } } return pointCount; } vector<Point_Item*> Solution_Item::noUsedPoints() { vector <Point_Item*> noUsedPoints; for (size_t i = 0; i < points.size(); i++) { if (points[i]->noUsed) { noUsedPoints.push_back(points[i]); } } return noUsedPoints; } int Point_Item::solutionSize() { int sum = 0; for (size_t i = 0; i < solutions.size(); i++) { if (solutions[i]->noUsed) { sum++; } } // consider the orphan point. if (sum == 0) { return 1; } return sum; } class Result { public: vector<Solution_Item*> solutions; Result* parent; vector<Result*> children; int pointCount; int solutionCount; static vector<Result*> results; Result() { pointCount = 0; solutionCount = 0; parent = NULL; } void addResult(Solution_Item* solution) { solutions.push_back(solution); solutionCount++; pointCount += solution->points.size(); } void addResult(vector<Solution_Item*> & otherSolutions) { for (Solution_Item* solution : otherSolutions) { solutions.push_back(solution); solutionCount++; pointCount += solution->points.size(); } } void addResult(const Result & result) { pointCount += result.pointCount; solutionCount += result.solutionCount; } Result* cloneResult() { Result* result = new Result; result->pointCount = pointCount; result->solutionCount = solutionCount; children.push_back(result); result->parent = this; return result; } static bool ResultCompare(const Result *lhs, const Result *rhs) { return lhs->solutionCount < rhs->solutionCount; } vector<Solution_Item*> printSolution(Result* result, int pointSize) { if (!results.empty()) { results.clear(); } vector<Result*> allResults = findAllResult(result, pointSize); sort(allResults.begin(), allResults.end(), ResultCompare); Result* optimalResult = allResults[0]; vector<Solution_Item*> optimalSolutions; while (optimalResult != NULL) { for (size_t i = 0; i < optimalResult->solutions.size(); i++) { optimalSolutions.push_back(optimalResult->solutions[i]); } optimalResult = optimalResult->parent; } return optimalSolutions; } vector<Result*> findAllResult(Result* rootResult, int pointSize) { if (rootResult == NULL) { return results; } if (rootResult->children.empty()) { if (rootResult->pointCount == pointSize) { results.push_back(rootResult); } return results; } for (Result* result : rootResult->children) { findAllResult(result, pointSize); } return results; } }; vector<Result*> Result::results = { NULL }; class Solution { public: Solution() {} ~Solution() {} //vector<vector<Point>> solution_1(vector<Point>& list); vector<vector<Point>> getMinStations(vector<Point>& places); void initAllPointsAndSolutions(const vector<Point> &vector, std::vector<Point_Item*>& points, std::vector<Solution_Item*> &allSolutions); void createSolution(vector<Solution_Item*> & solutions, Point_Item& point1, Point_Item &point2); void cover(Solution_Item &solution, vector<Point_Item*> &usedPoints, vector<Solution_Item*> &usedSolution); void uncover(vector<Point_Item*> &allcolumnItems, vector<Solution_Item*> &allrowItems, vector<Point_Item*> &usedPoints, vector<Solution_Item*>& usedSolution); vector<vector<Point>> generateResult(Result* result, int pointSize); void pocessSinglePoints(vector<Point_Item*> &points, vector<Solution_Item*> &solutions, vector<Point_Item*>& usedPoints, vector<Solution_Item*> &usedSolution, Result* result); void processMultiplePoints(vector<Point_Item*> &points, vector<Solution_Item*> &solutions, vector<Point_Item*> &usedPoints, vector<Solution_Item*> &usedSolutions, Result* result); vector<Point> generateAllMultipleNodes(vector<Point_Item*>& points); vector<Point> findAllSinglePoints(vector<vector<Point>>& multipleParsingResult); void validSolution(Point_Item& point, vector<Solution_Item*>& vaildsolution); }; class DfsMazeSearch{ public: int actualMaxRow; int actualMaxColumn; Cell(*maze)[2022] = new Cell[2022][2022]; int next[4][2] = { { 0, 1 },{ 1, 0 },{ 0, -1 },{ -1, 0 } }; // right, down, left, top vector<Point> multiplePoints; vector<Point> singlePoints; vector<vector<Point>> solutions; DfsMazeSearch(const vector<Point> & multiplePoints, const vector<Point> & singlePoints, const vector<vector<Point>> & solutions) { this->multiplePoints = multiplePoints; this->singlePoints = singlePoints; this->solutions = solutions; actualMaxColumn = 0; actualMaxRow = 0; } void initMazeMatrix() { actualMaxColumn = 0; actualMaxRow = 0; vector<Point> checkvector; for (size_t i = 0; i<solutions.size(); i++) { for (size_t j = 0; j<solutions[i].size(); j++) { checkvector.push_back(solutions[i][j]); } } for (Point point : multiplePoints) { int x = point.x; int y = point.y; //Cell cell; //maze[x][y] = cell; maze[x][y].value = 1; maze[x][y].point = point; maze[x][y].exist = true; if (x > actualMaxRow) { actualMaxRow = x; } if (y > actualMaxColumn) { actualMaxColumn = y; } } actualMaxRow += 2; actualMaxColumn += 2; for (vector<Point> points : solutions) { if (points.size() == 1) { continue; } Point point1 = points[0]; Point point2 = points[1]; maze[point1.x][point1.y].nextX = point2.x; maze[point1.x][point1.y].nextY = point2.y; maze[point1.x][point1.y].exist = true; maze[point2.x][point2.y].nextX = point1.x; maze[point2.x][point2.y].nextY = point1.y; maze[point2.x][point2.y].exist = true; } } void clearMark() { for (int i = 0; i < actualMaxRow; i++) { for (int j = 0; j < actualMaxColumn; j++) { Cell* currentCell = &maze[i][j]; if (!currentCell->exist) { continue; } currentCell->marked = false; } } } vector<vector<Point>> processDfsResult() { std::map<Point, int, mycomp> matchedPoint; vector<vector<Point>> result; for (size_t i = 0; i< multiplePoints.size(); i++) { Point point = multiplePoints[i]; if (matchedPoint.find(point) != matchedPoint.end()) { continue; } int x = point.x; int y = point.y; vector < Point > points; Cell currentCell = maze[x][y]; int nextX = currentCell.nextX; int nextY = currentCell.nextY; if (nextX == 0 && nextY == 0) { points.push_back(point); result.push_back(points); matchedPoint.insert(std::pair<Point, int>(point, 1)); } else { Cell nextCell = maze[nextX][nextY]; Point otherPoint = nextCell.point; points.push_back(point); points.push_back(otherPoint); result.push_back(points); matchedPoint.insert(std::pair<Point, int>(point, 1)); matchedPoint.insert(std::pair<Point, int>(otherPoint, 1)); } } return result; } bool dfs(int startX, int startY, const vector<Point> & matchedPoints, map<Point, int, mycomp> & results) { if (matchedPoints.empty()) { return true; } for (Point matchPoint : matchedPoints) { int match_x = matchPoint.x; int match_y = matchPoint.y; int x_diff = startX - match_x; int y_diff = startY - match_y; if ((startX == match_x && abs(y_diff) == 1) || (startY == match_y && abs(x_diff) == 1)) { results[matchPoint] = 1; maze[startX][startY].nextX = match_x; maze[startX][startY].nextY = match_y; maze[startX][startY].exist = true; maze[match_x][match_y].nextX = startX; maze[match_x][match_y].nextY = startY; maze[match_x][match_y].exist = true; return true; } } for (int possible = 0; possible < 4; possible++) { int nextX; int nextY; nextX = startX + next[possible][0]; nextY = startY + next[possible][1]; if (nextX < 0 || nextX >= 2020 || nextY < 0 || nextY >= 2020 || (maze[nextX][nextY].exist == false)) { continue; } Cell* startCell = &maze[startX][startY]; Cell* nextCell = &maze[nextX][nextY]; if (nextCell->value == 1 && (!nextCell->marked)) { nextCell->marked = true; int oldStartX = startCell->nextX; int oldStartY = startCell->nextY; int next_startX = nextCell->nextX; int next_startY = nextCell->nextY; startCell->nextX = nextX; startCell->nextY = nextY; nextCell->nextX = startX; nextCell->nextY = startY; maze[next_startX][next_startY].nextX = 0; maze[next_startX][next_startY].nextY = 0; bool result = dfs(next_startX, next_startY, matchedPoints, results); if (result) { return true; } maze[next_startX][next_startY].nextX = nextX; maze[next_startX][next_startY].nextY = nextY; maze[next_startX][next_startY].exist = true; nextCell->nextX = next_startX; nextCell->nextY = next_startY; startCell->nextX = oldStartX; startCell->nextY = oldStartY; } } return false; } vector<vector<Point>> clusteringAlgorithm() { if (singlePoints.empty() || singlePoints.size() == 1 || solutions.empty()) { return solutions; } initMazeMatrix(); int singlePointSize = singlePoints.size(); map<Point, int, mycomp> results; cout << "all single point's : " << singlePointSize; for (int i = 0; i < singlePointSize - 1; i++) { if (results.find(singlePoints[i]) != results.end()) { continue; } vector<Point> matchedPoints; for (int j = i + 1; j < singlePointSize; j++) { if (results.find(singlePoints[j]) == results.end()) { matchedPoints.push_back(singlePoints[j]); } } Point startPoint = singlePoints[i]; bool isSucceed = dfs(startPoint.x, startPoint.y, matchedPoints, results); if (isSucceed) { results[startPoint] = 1; } clearMark(); } return processDfsResult(); } }; std::vector<std::vector<Point>> Solution::getMinStations(std::vector<Point>& list) { std::vector<Point_Item*> points; std::vector<Solution_Item*> solutions; initAllPointsAndSolutions(list, points, solutions); std::vector <Point_Item*> usedPoints; std::vector <Solution_Item*> usedSolution; //// 1. process the orphan and single points. Result singleResult; pocessSinglePoints(points, solutions, usedPoints, usedSolution, &singleResult); int singlePointSize = list.size() - points.size(); std::vector<std::vector<Point>> singleSolutions = generateResult(&singleResult, singlePointSize); //// 2. process the multiple points. Result* multipleResult = new Result; int multiplePointCount = points.size(); std::vector < Point > multiplePoints = generateAllMultipleNodes(points); usedPoints.clear(); usedSolution.clear(); processMultiplePoints(points, solutions, usedPoints, usedSolution, multipleResult); std::vector < std::vector < Point >> multipleSolutions = generateResult( multipleResult, multiplePointCount); //// 3. DfsMazeSearch std::vector < Point > singlePoints = findAllSinglePoints(multipleSolutions); DfsMazeSearch dfsMazeSearch(multiplePoints, singlePoints, multipleSolutions); std::vector<std::vector< Point>> finalResult; std::vector<std::vector< Point>> matchedResults = dfsMazeSearch.clusteringAlgorithm(); for (size_t i = 0; i<singleSolutions.size(); i++) { finalResult.push_back(singleSolutions[i]); } for (size_t i = 0; i<matchedResults.size(); i++) { finalResult.push_back(matchedResults[i]); } return finalResult; } void Solution::initAllPointsAndSolutions(const vector<Point> &vec, std::vector<Point_Item*>& points, std::vector<Solution_Item*> &allSolutions) { int max_row = 0; int max_column = 0; // init base matrix for (Point point : vec) { if (point.x > max_row) { max_row = point.x; } if (point.y > max_column) { max_column = point.y; } } max_row += 2; max_column += 2; Point_Item ***pointMatrix = new Point_Item**[max_row]; for (int i = 0; i < max_row; i++) { pointMatrix[i] = new Point_Item*[max_column]; for (int j = 0; j < max_column; j++) { pointMatrix[i][j] = nullptr; } } for (Point point : vec) { int x = point.x; int y = point.y; Point_Item* point_Item = new Point_Item(x, y); point_Item->exist = true; pointMatrix[x][y] = point_Item; points.push_back(pointMatrix[x][y]); } for (vector<Point_Item*>::iterator point = points.begin(); point != points.end();) { int x = (*point)->x; int y = (*point)->y; Point_Item* top_point = pointMatrix[x - 1][y]; Point_Item* down_point = pointMatrix[x + 1][y]; Point_Item* left_point = pointMatrix[x][y - 1]; Point_Item* right_point = pointMatrix[x][y + 1]; int possibleSize = 0; if (top_point != nullptr) { possibleSize += 1; } if (down_point != nullptr) { possibleSize += 1; } if (left_point != nullptr) { possibleSize += 1; } if (right_point != nullptr) { possibleSize += 1; } if (possibleSize == 0) { Solution_Item* solution = new Solution_Item(); solution->points.push_back(*point); (*point)->solutions.push_back(solution); allSolutions.push_back(solution); ++point; continue; } if (right_point != nullptr) { createSolution(allSolutions, **point, *right_point); } // right -> better case. if (down_point != nullptr) { createSolution(allSolutions, **point, *down_point); } //for (size_t i = 0; i < points.size(); i++) //{ // if (right_point != nullptr) { // if (points[i].x == right_point->x && points[i].y == right_point->y) // points[i] = *right_point; // } // if (down_point != nullptr) { // if (points[i].x == down_point->x && points[i].y == down_point->y) // points[i] = *down_point; // } //} ++point; } } void Solution::createSolution(vector<Solution_Item*> & solutions, Point_Item& point1, Point_Item &point2) { Solution_Item* solution = new Solution_Item(); solution->points.push_back(&point1); solution->points.push_back(&point2); point1.solutions.push_back(solution); point2.solutions.push_back(solution); solutions.push_back(solution); } void Solution::validSolution(Point_Item& point, vector<Solution_Item*>& validSolution) { for (Solution_Item* solution : point.solutions) { if (solution->noUsed) { validSolution.push_back(solution); } } if (validSolution.empty()) { Solution_Item* solution = new Solution_Item(); solution->points.push_back(&point); validSolution.push_back(solution); } } void Solution::cover(Solution_Item &solution, vector<Point_Item*> &usedPoints, vector<Solution_Item*> &usedSolution) { vector<Point_Item*> points = solution.points; for (size_t i = 0; i < points.size(); i++) { Point_Item* point = points[i]; if (point->noUsed) { point->noUsed = false; usedPoints.push_back(point); } vector<Solution_Item*> solutions = point->solutions; for (size_t j = 0; j < solutions.size(); j++) { Solution_Item* otherSolution = solutions[j]; if (otherSolution->noUsed) { otherSolution->noUsed = false; usedSolution.push_back(otherSolution); } } } } void Solution::uncover(vector<Point_Item*> &allcolumnItems, vector<Solution_Item*> &allrowItems, vector<Point_Item*> &usedPoints, vector<Solution_Item*>& usedSolution) { vector<Point_Item*>::iterator usedPointIterator = usedPoints.begin(); for (; usedPointIterator != usedPoints.end(); usedPointIterator++) { (*usedPointIterator)->noUsed = true; allcolumnItems.push_back(*usedPointIterator); } vector<Solution_Item*>::iterator usedSolutionIterator = usedSolution.begin(); for (; usedSolutionIterator != usedSolution.end(); usedSolutionIterator++) { (*usedSolutionIterator)->noUsed = true; allrowItems.push_back(*usedSolutionIterator); } usedPoints.clear(); usedSolution.clear(); } vector<vector<Point>> Solution::generateResult(Result* result, int pointSize) { vector<vector<Point>> finalResult; vector<Solution_Item*> optimalSolution = result->printSolution(result, pointSize); for (Solution_Item* solution : optimalSolution) { vector<Point_Item*> points = solution->points; vector<Point> resultPoints; for (Point_Item* point : points) { Point newPoint; newPoint.x = point->x; newPoint.y = point->y; resultPoints.push_back(newPoint); } finalResult.push_back(resultPoints); } return finalResult; } void Solution::pocessSinglePoints(vector<Point_Item*> &points, vector<Solution_Item*> &solutions, vector<Point_Item*>& usedPoints, vector<Solution_Item*> &usedSolution, Result* result) { if (points.empty()) { return; } bool containSinglePoint = false; for (vector<Point_Item*>::iterator point = points.begin(); point != points.end(); point++) { if (!(*point)->noUsed) { continue; } if ((*point)->solutionSize() == 1) { containSinglePoint = true; vector<Solution_Item*> validSolutions; validSolution(**point, validSolutions); result->addResult(validSolutions[0]); cover(*validSolutions[0], usedPoints, usedSolution); } } for (vector<Point_Item*>::iterator iter = points.begin(); iter != points.end();) { if ((*iter)->noUsed == false) { iter = points.erase(iter); } else { ++iter; } } bool bSetList; for (vector<Solution_Item*>::iterator iter = solutions.begin(); iter != solutions.end();) { bSetList = false; for (int j = 0; j < usedSolution.size(); j++) { if ((*iter)->points == usedSolution[j]->points) { bSetList = true; break; } } if (bSetList) { iter = solutions.erase(iter); } else { iter++; } } //points.erase(usedPoints.begin(), usedPoints.end()); // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //solutions.erase(usedSolution.begin(), usedSolution.end()); // ********************************* if (!containSinglePoint) { return; } pocessSinglePoints(points, solutions, usedPoints, usedSolution, result); } void Solution::processMultiplePoints(vector<Point_Item*> &points, vector<Solution_Item*> &solutions, vector<Point_Item*> &usedPoints, vector<Solution_Item*> &usedSolutions, Result* result) { if (points.empty()) { return; } // iterator two possibles: all down and all right for (int i = 0; i < 2; i++) { Result* childResult = result->cloneResult(); for (Point_Item* point : points) { if (!point->noUsed) { continue; } int solutionSize = point->solutionSize(); if (solutionSize == 1) { vector<Solution_Item*> validSolutions; validSolution(*point, validSolutions); childResult->addResult(validSolutions[0]); cover(*validSolutions[0], usedPoints, usedSolutions); } else if (solutionSize >= 2) { vector<Solution_Item*> validSolutions; validSolution(*point, validSolutions); childResult->addResult(validSolutions[i]); cover(*validSolutions[i], usedPoints, usedSolutions); } } //points.erase(usedPoints.begin(), usedPoints.end()); //solutions.erase(usedSolutions.begin(), usedSolutions.end()); for (vector<Point_Item*>::iterator iter = points.begin(); iter != points.end();) { if ((*iter)->noUsed == false) { iter = points.erase(iter); } else { ++iter; } } bool bSetList; for (vector<Solution_Item*>::iterator iter = solutions.begin(); iter != solutions.end();) { bSetList = false; for (int j = 0; j < usedSolutions.size(); j++) { if ((*iter)->points == usedSolutions[j]->points) { bSetList = true; break; } } if (bSetList) { iter = solutions.erase(iter); } else { iter++; } } processMultiplePoints(points, solutions, usedPoints, usedSolutions, result); // recover the previous environment. uncover(points, solutions, usedPoints, usedSolutions); } } vector<Point> Solution::generateAllMultipleNodes(vector<Point_Item*>& points) { if (points.empty()) { vector<Point> vector; return vector; } vector < Point > newPoints; for (size_t i = 0; i < points.size(); i++) { Point point; point.x = points[i]->x; point.y = points[i]->y; newPoints.push_back(point); } return newPoints; } vector<Point> Solution::findAllSinglePoints(vector<vector<Point>>& multipleParsingResult) { vector<Point> expectedResult; for (vector<Point> points : multipleParsingResult) { if (points.size() == 1) { for (size_t i = 0; i < points.size(); i++) { expectedResult.push_back(points[i]); } } } sort(expectedResult.begin(), expectedResult.end(), CompareLess); return expectedResult; } void preparePlaces(vector<Point> & places, int & size, std::string & filename) { places.clear(); // create input file stream std::ifstream ifs; ifs.open(filename.c_str(), std::ios::in); if (!ifs.is_open()) { return; } std::string buf; std::stringstream ss; while (std::getline(ifs, buf)) { ss.str(""); std::size_t found = buf.find(","); if (found == std::string::npos) { if (!buf.empty()) { size = atoi(buf.c_str()); ss << "size: " << size; } } else { int x = atoi(buf.substr(0, found).c_str()); int y = atoi(buf.substr(found + 1).c_str()); Point point; point.x = x; point.y = y; places.push_back(point); ss << "x: " << places.back().x << " y: " << places.back().y; } } ss.str(""); ss << "Vector size: " << places.size(); } int fileNameFilter(const struct dirent * cur) { std::string str(cur->d_name); if (str.find(".in") != std::string::npos) { return 1; } return 0; } // read filename list from path void readFileList(std::vector<std::string> & fileNameList, std::string & path) { struct dirent **namelist; int n = scandir(path.c_str(), &namelist, fileNameFilter, alphasort); if (n < 0) { return; } for (int i = 0; i < n; i++) { std::string filePath(namelist[i]->d_name); fileNameList.push_back(path + filePath); free(namelist[i]); } free(namelist); } //long getCurrentTime() //{ // struct timeval tv; // gettimeofday(&tv, NULL); // return tv.tv_sec * 1000 + tv.tv_usec / 1000; //} int main() { std::vector<std::string> fileNameList; std::string path = "C:/Users/lin.zhang/Documents/deployment/data/6.in"; //readFileList(fileNameList, path); vector<Point> places; int size = 0; stringstream ss; //std::vector<std::string>::iterator it = fileNameList.begin(); //for (; it != fileNameList.end(); it++) //{ //long startTime = getCurrentTime(); preparePlaces(places, size, /**it*/path); ss.str(""); //long startTime = getCurrentTime(); //for (auto uit = places.begin(); uit != places.end(); uit++) //{ // cout << uit->x << "," << uit->y << endl; //} Solution solution; clock_t startTime = clock(); vector<vector<Point>> result = solution.getMinStations(places); clock_t endTime = clock(); cout << "result.size = " << result.size() << endl; for (size_t i = 0; i < result.size(); i++) { for (size_t j = 0; j < result[i].size(); j++) { cout << result[i][j].x << "," << result[i][j].y << ";"; } cout << endl; } cout << "Execution Time: " << (double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl; //long endTime = getCurrentTime(); //ss << "Execution Time: " << (double(endTime - startTime) / 1000) << "s"; // break; //} }
38aec19b57cf9786a936e3a6aa2f822708e953cc
d451d126d188dbb9287a95d2c50a8ad7723a1d0f
/src/ast/declaration/function_declaration_node.cpp
4de4b6cbc8aef4d764029814b01c9da7a5f363a2
[]
no_license
rcorcs/rcc
1fb15f82215968c412ddb5f47742ec6318a18425
5885025911d36a04c2fb2c2e6ca3b56b3bb62458
refs/heads/master
2021-01-21T04:37:23.433928
2017-07-23T01:51:50
2017-07-23T01:51:50
22,624,437
135
11
null
null
null
null
UTF-8
C++
false
false
493
cpp
function_declaration_node.cpp
#include "function_declaration_node.h" FunctionDeclarationNode::FunctionDeclarationNode(TypeNode *type, DeclarationNode *declarator, StatementNode *stmt) : DeclarationNode(NODE_TYPE_FUNCTION_DECLARATION) { _type = type; _declarator = declarator; _stmt = stmt; } TypeNode *FunctionDeclarationNode::type(){ return _type; } DeclarationNode *FunctionDeclarationNode::declarator(){ return _declarator; } StatementNode *FunctionDeclarationNode::statement(){ return _stmt; }
ed87616b55f60b8e4f43416f73665d5cc517bfd9
d803955cf65dcc36f160d7281bf7e17e1a7f130a
/opencvcannyaction.cpp
c8d6cb10b9c743f03cb5658d2b696bbf8e66d534
[]
no_license
Dante-Go/Fact_detect_recognizer_QT
567ca66081bdf5cf65b64857a3ddc53378e67007
e16c63feca79cff452b7fede58e322af69fa58bd
refs/heads/master
2020-06-24T09:55:54.822080
2019-08-01T01:34:33
2019-08-01T01:35:06
198,933,882
0
1
null
null
null
null
UTF-8
C++
false
false
617
cpp
opencvcannyaction.cpp
#include "opencvcannyaction.h" OpenCVcannyAction::OpenCVcannyAction(QObject *parent) : OpenCVaction(parent) { } OpenCVcannyAction::~OpenCVcannyAction() { } void OpenCVcannyAction::action(cv::Mat &imgin, cv::Mat *&imgout) { cv::Mat* pImageCanny = new cv::Mat(imgin); cv::cvtColor(imgin, *pImageCanny, CV_RGB2GRAY); cv::Mat* imgCannyout = new cv::Mat(imgin.size(), CV_8UC1); cvCanny(pImageCanny, imgCannyout, 15, 145, 3); pImageCanny->release(); imgout = new cv::Mat(imgin.size(), CV_8UC3); cvCvtColor(imgCannyout, imgout, CV_GRAY2RGB); // QT not support Format_Indexed8. imgCannyout->release(); }
33d4af6fb862ba3d9af1881bb7e27a46db1c16a9
3eec2442d0fbd8ae50b525bc65f04482e7821425
/src/liblensifier/Effect.h
8cff5fd440d9a1676a80b1a27f884e3fac661706
[]
no_license
inequation/lensifier
4a7bbd3bdb2b986a9a56186caaaf41ca3c28eb9d
ae7c7ba21babcf6890363721fdf0c478ef8b7fd6
refs/heads/master
2021-01-01T05:40:54.827865
2014-02-25T00:21:33
2014-02-25T00:21:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,024
h
Effect.h
/* * Lensifier effect interface * Copyright (C) 2013, Leszek Godlewski */ #ifndef EFFECT_H #define EFFECT_H #include <limits> // for NaN and friends #include "Renderer.h" #include "Utils.h" namespace Lensifier { extern Renderer *GRenderer; extern const char EffectGenericVertexShader[]; extern const char SingleDirGaussianBlurPixelShader[]; template <class RendererClass> class Effect { public: // convenience defines #define RENDERER ((RendererClass *)GRenderer) #define INIT_PARAM(n, v) n(v) #define DECLARE_EFFECT_0T(BaseClass) \ typedef BaseClass Super; \ typedef typename RendererClass::ProgramHandle ProgramHandle; \ typedef typename RendererClass::ShaderParameterHandle ShaderParamHandle; \ typedef typename RendererClass::IndexBufferHandle IndexBufferHandle; \ typedef typename RendererClass::VertexBufferHandle VertexBufferHandle; #define DECLARE_EFFECT_1T(BaseClass, TemplateParam1) \ typedef BaseClass<TemplateParam1> Super; \ typedef typename RendererClass::ProgramHandle ProgramHandle; \ typedef typename RendererClass::ShaderParameterHandle ShaderParamHandle; \ typedef typename RendererClass::IndexBufferHandle IndexBufferHandle; \ typedef typename RendererClass::VertexBufferHandle VertexBufferHandle; #define DECLARE_EFFECT_2T(BaseClass, TemplateParam1, TemplateParam2) \ typedef BaseClass<TemplateParam1, TemplateParam2> Super; \ typedef typename RendererClass::ProgramHandle ProgramHandle; \ typedef typename RendererClass::ShaderParameterHandle ShaderParamHandle; \ typedef typename RendererClass::IndexBufferHandle IndexBufferHandle; \ typedef typename RendererClass::VertexBufferHandle VertexBufferHandle; DECLARE_EFFECT_0T(void) Effect() : Enabled(true) {} virtual ~Effect() {}; virtual void SetEnabled(bool NewEnabled) {Enabled = NewEnabled;} inline bool GetEnabled() {return Enabled;} protected: virtual void Register() = 0; bool Enabled; }; } #endif // EFFECT_H
c57120b5514930035438b3ea13742afbe6a772e7
5664ab66deeecea95313faeea037fa832cca34ce
/modules/v2x/proto/v2x_service_car_to_obu.pb.cc
198252ad5f373636bc13e21f84b9425266f77bad
[]
no_license
Forrest-Z/t1
5d1f8c17dc475394ab4d071a577953289238c9f4
bdacd5398e7f0613e2463b0c2197ba9354f1d3e3
refs/heads/master
2023-08-02T03:58:50.032599
2021-10-08T05:38:10
2021-10-08T05:38:10
null
0
0
null
null
null
null
UTF-8
C++
false
true
12,143
cc
v2x_service_car_to_obu.pb.cc
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: modules/v2x/proto/v2x_service_car_to_obu.proto #include "modules/v2x/proto/v2x_service_car_to_obu.pb.h" #include <algorithm> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> PROTOBUF_PRAGMA_INIT_SEG namespace apollo { namespace v2x { constexpr UpdateStatus::UpdateStatus( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : updated_(false){} struct UpdateStatusDefaultTypeInternal { constexpr UpdateStatusDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~UpdateStatusDefaultTypeInternal() {} union { UpdateStatus _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UpdateStatusDefaultTypeInternal _UpdateStatus_default_instance_; } // namespace v2x } // namespace apollo static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto[1]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { PROTOBUF_FIELD_OFFSET(::apollo::v2x::UpdateStatus, _has_bits_), PROTOBUF_FIELD_OFFSET(::apollo::v2x::UpdateStatus, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ PROTOBUF_FIELD_OFFSET(::apollo::v2x::UpdateStatus, updated_), 0, }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, 7, -1, sizeof(::apollo::v2x::UpdateStatus)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::apollo::v2x::_UpdateStatus_default_instance_), }; const char descriptor_table_protodef_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n.modules/v2x/proto/v2x_service_car_to_o" "bu.proto\022\napollo.v2x\032&modules/v2x/proto/" "v2x_car_status.proto\"&\n\014UpdateStatus\022\026\n\007" "updated\030\001 \002(\010:\005false2N\n\010CarToObu\022B\n\rPush" "CarStatus\022\025.apollo.v2x.CarStatus\032\030.apoll" "o.v2x.UpdateStatus\"\000" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_deps[1] = { &::descriptor_table_modules_2fv2x_2fproto_2fv2x_5fcar_5fstatus_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto = { false, false, 220, descriptor_table_protodef_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto, "modules/v2x/proto/v2x_service_car_to_obu.proto", &descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_once, descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_deps, 1, 1, schemas, file_default_instances, TableStruct_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto::offsets, file_level_metadata_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto, file_level_enum_descriptors_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto, file_level_service_descriptors_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto, }; PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_getter() { return &descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto; } // Force running AddDescriptors() at dynamic initialization time. PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto(&descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto); namespace apollo { namespace v2x { // =================================================================== class UpdateStatus::_Internal { public: using HasBits = decltype(std::declval<UpdateStatus>()._has_bits_); static void set_has_updated(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static bool MissingRequiredFields(const HasBits& has_bits) { return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0; } }; UpdateStatus::UpdateStatus(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:apollo.v2x.UpdateStatus) } UpdateStatus::UpdateStatus(const UpdateStatus& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); updated_ = from.updated_; // @@protoc_insertion_point(copy_constructor:apollo.v2x.UpdateStatus) } void UpdateStatus::SharedCtor() { updated_ = false; } UpdateStatus::~UpdateStatus() { // @@protoc_insertion_point(destructor:apollo.v2x.UpdateStatus) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void UpdateStatus::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void UpdateStatus::ArenaDtor(void* object) { UpdateStatus* _this = reinterpret_cast< UpdateStatus* >(object); (void)_this; } void UpdateStatus::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void UpdateStatus::SetCachedSize(int size) const { _cached_size_.Set(size); } void UpdateStatus::Clear() { // @@protoc_insertion_point(message_clear_start:apollo.v2x.UpdateStatus) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; updated_ = false; _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* UpdateStatus::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // required bool updated = 1 [default = false]; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { _Internal::set_has_updated(&has_bits); updated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: goto handle_unusual; } // switch handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto message_done; } ptr = UnknownFieldParse( tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); } // while message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto message_done; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* UpdateStatus::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:apollo.v2x.UpdateStatus) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // required bool updated = 1 [default = false]; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_updated(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:apollo.v2x.UpdateStatus) return target; } size_t UpdateStatus::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:apollo.v2x.UpdateStatus) size_t total_size = 0; // required bool updated = 1 [default = false]; if (_internal_has_updated()) { total_size += 1 + 1; } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UpdateStatus::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, UpdateStatus::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UpdateStatus::GetClassData() const { return &_class_data_; } void UpdateStatus::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<UpdateStatus *>(to)->MergeFrom( static_cast<const UpdateStatus &>(from)); } void UpdateStatus::MergeFrom(const UpdateStatus& from) { // @@protoc_insertion_point(class_specific_merge_from_start:apollo.v2x.UpdateStatus) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_updated()) { _internal_set_updated(from._internal_updated()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void UpdateStatus::CopyFrom(const UpdateStatus& from) { // @@protoc_insertion_point(class_specific_copy_from_start:apollo.v2x.UpdateStatus) if (&from == this) return; Clear(); MergeFrom(from); } bool UpdateStatus::IsInitialized() const { if (_Internal::MissingRequiredFields(_has_bits_)) return false; return true; } void UpdateStatus::InternalSwap(UpdateStatus* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(updated_, other->updated_); } ::PROTOBUF_NAMESPACE_ID::Metadata UpdateStatus::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_getter, &descriptor_table_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto_once, file_level_metadata_modules_2fv2x_2fproto_2fv2x_5fservice_5fcar_5fto_5fobu_2eproto[0]); } // @@protoc_insertion_point(namespace_scope) } // namespace v2x } // namespace apollo PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::apollo::v2x::UpdateStatus* Arena::CreateMaybeMessage< ::apollo::v2x::UpdateStatus >(Arena* arena) { return Arena::CreateMessageInternal< ::apollo::v2x::UpdateStatus >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
3ae5f3f4f0bb3fcbe875c21f0805732b99a5efe8
8c40cd7d9cc4452a6c5f6bd585159717f097486d
/proto/data-refining/back/workdir/extras/modisnetcdfparser/square.h
969c1540856c7104ff5cd0659992339373594826
[ "Apache-2.0" ]
permissive
cttgroup/oceanhub
e08344d43fafafce32de72d6ada8705a5cabaa8d
afe4a5ad373db815d4f897d5b2c834fcdaa394a7
refs/heads/master
2021-01-23T02:06:37.018353
2018-11-30T09:35:49
2018-11-30T09:35:49
85,967,734
0
1
null
null
null
null
UTF-8
C++
false
false
3,185
h
square.h
#ifndef SQUARE_H #define SQUARE_H #include <iostream> #include <set> #include <vector> #include "VectorLayerShapeType.h" #include "ComponentNT.h" #include "coordcvt.h" static double square(const std::vector<VectorLayerShapeType> & shapes, const double dy) { double S = 0.0; std::multiset<double> crss; for (unsigned int i = 0; i < shapes.size(); ++i) { const std::vector<component2d> &sh = shapes[i].points; const int shape_size = sh.size(); double dlat = dy/MetersPerLatitudeDegreeAtLatitude(shapes[i].min.y); for (double lat = shapes[i].min.y; lat < shapes[i].max.y; lat+=dlat) { crss.clear(); int crss_size = 0; // y in image // this loop collect all shape crossing along horizontal line for (int j = 1; j < shape_size; ++j) { const double dy1 = sh[j-1].y - lat; // in geo const double dy2 = sh[j].y - lat; if (((dy1>=0)&(dy2<0))|((dy1<0)&(dy2>=0))) { const double x1 = sh[j-1].x; // in geo const double x2 = sh[j].x; const double xmax = x1 > x2 ? x1 : x2; const double xmin = x1 < x2 ? x1 : x2; double x0 = (x2*dy1 - x1*dy2)/(dy1-dy2); // in geo if ((x0 > xmax)|(x0 < xmin)) x0 = (x1+x2)/2; crss.insert(x0); ++crss_size; } } // this just extends loop with last part of shape (from last point to first) { const double dy1 = sh[shape_size-1].y - lat; // in geo const double dy2 = sh[0].y - lat; if (((dy1>=0)&(dy2<0))|((dy1<0)&(dy2>=0))) { const double x1 = sh[shape_size-1].x; // in geo const double x2 = sh[0].x; const double xmax = x1 > x2 ? x1 : x2; const double xmin = x1 < x2 ? x1 : x2; double x0 = (x2*dy1 - x1*dy2)/(dy1-dy2); // in geo if ((x0 > xmax)|(x0 < xmin)) x0 = (x1+x2)/2; crss.insert(x0); ++crss_size; } } if (crss_size%2) // if we somehow entered closed circuit and never get out... { // shall never enter this branch std::cout << "shape " << i << " at lat = " << lat << " has " << crss.size() << " crossings" << std::endl; continue; } if (!crss_size) continue; // no hit std::vector<double> crssv; crssv.reserve(crss_size); for (auto it = crss.cbegin(); it != crss.cend(); ++it) crssv.push_back(*it); dlat = dy / MetersPerLatitudeDegreeAtLatitude(lat); const double coef = MetersPerLongitudeDegreeAtLatitude(lat)*dy; for (size_t j = 0; j < crss.size(); j+=2) S += (crssv[j+1]-crssv[j])*coef; } } return S; } #endif // SQUARE_H
dbff99fcd3ddccc9be2826e899703fd99f91f106
5c925f3600b26707cf653c4add72e6cc80082be2
/filezillaclient/clien/src/interface/settings/optionspage_filetype.cpp
892c722089f59e5b675830e4b9f4b036b905fd2d
[]
no_license
ljx0305/fileZilla
52100ad9b41882d78372232de3801ed449db9408
d88d83c8b8bd39c0636166ba9a2911435c8fab63
refs/heads/main
2023-06-18T01:16:35.811661
2021-07-12T17:15:03
2021-07-12T17:15:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,798
cpp
optionspage_filetype.cpp
#include <filezilla.h> #include "../Options.h" #include "settingsdialog.h" #include "optionspage.h" #include "optionspage_filetype.h" BEGIN_EVENT_TABLE(COptionsPageFiletype, COptionsPage) EVT_BUTTON(XRCID("ID_ADD"), COptionsPageFiletype::OnAdd) EVT_BUTTON(XRCID("ID_REMOVE"), COptionsPageFiletype::OnRemove) EVT_TEXT(XRCID("ID_EXTENSION"), COptionsPageFiletype::OnTextChanged) EVT_LIST_ITEM_SELECTED(XRCID("ID_EXTENSIONS"), COptionsPageFiletype::OnSelChanged) EVT_LIST_ITEM_DESELECTED(XRCID("ID_EXTENSIONS"), COptionsPageFiletype::OnSelChanged) END_EVENT_TABLE() bool COptionsPageFiletype::LoadPage() { bool failure = false; SetCheckFromOption(XRCID("ID_ASCIIWITHOUT"), OPTION_ASCIINOEXT, failure); SetCheckFromOption(XRCID("ID_ASCIIDOTFILE"), OPTION_ASCIIDOTFILE, failure); if (failure) return false; if (!FindWindow(XRCID("ID_EXTENSION")) || !FindWindow(XRCID("ID_ADD")) || !FindWindow(XRCID("ID_REMOVE")) || !FindWindow(XRCID("ID_EXTENSIONS")) || !FindWindow(XRCID("ID_TYPE_AUTO")) || !FindWindow(XRCID("ID_TYPE_ASCII")) || !FindWindow(XRCID("ID_TYPE_BINARY"))) return false; int mode = m_pOptions->GetOptionVal(OPTION_ASCIIBINARY); if (mode == 1) SetRCheck(XRCID("ID_TYPE_ASCII"), true, failure); else if (mode == 2) SetRCheck(XRCID("ID_TYPE_BINARY"), true, failure); else SetRCheck(XRCID("ID_TYPE_AUTO"), true, failure); wxListCtrl* pListCtrl = XRCCTRL(*this, "ID_EXTENSIONS", wxListCtrl); pListCtrl->ClearAll(); pListCtrl->InsertColumn(0, wxString()); wxString extensions = m_pOptions->GetOption(OPTION_ASCIIFILES); wxString ext; int pos = extensions.Find(_T("|")); while (pos != -1) { if (!pos) { if (!ext.empty()) { ext.Replace(_T("\\\\"), _T("\\")); pListCtrl->InsertItem(pListCtrl->GetItemCount(), ext); ext.clear(); } } else if (extensions.c_str()[pos - 1] != '\\') { ext += extensions.Left(pos); ext.Replace(_T("\\\\"), _T("\\")); pListCtrl->InsertItem(pListCtrl->GetItemCount(), ext); ext.clear(); } else { ext += extensions.Left(pos - 1) + _T("|"); } extensions = extensions.Mid(pos + 1); pos = extensions.Find(_T("|")); } ext += extensions; ext.Replace(_T("\\\\"), _T("\\")); pListCtrl->InsertItem(pListCtrl->GetItemCount(), ext); SetCtrlState(); return true; } bool COptionsPageFiletype::SavePage() { SetOptionFromCheck(XRCID("ID_ASCIIWITHOUT"), OPTION_ASCIINOEXT); SetOptionFromCheck(XRCID("ID_ASCIIDOTFILE"), OPTION_ASCIIDOTFILE); int mode; if (GetRCheck(XRCID("ID_TYPE_ASCII"))) mode = 1; else if (GetRCheck(XRCID("ID_TYPE_BINARY"))) mode = 2; else mode = 0; m_pOptions->SetOption(OPTION_ASCIIBINARY, mode); const wxListCtrl* pListCtrl = XRCCTRL(*this, "ID_EXTENSIONS", wxListCtrl); wxASSERT(pListCtrl); wxString extensions; for (int i = 0; i < pListCtrl->GetItemCount(); i++) { wxString ext = pListCtrl->GetItemText(i); ext.Replace(_T("\\"), _T("\\\\")); ext.Replace(_T("|"), _T("\\|")); if (!extensions.empty()) extensions += _T("|"); extensions += ext; } m_pOptions->SetOption(OPTION_ASCIIFILES, extensions); return true; } bool COptionsPageFiletype::Validate() { return true; } void COptionsPageFiletype::SetCtrlState() { wxListCtrl* pListCtrl = XRCCTRL(*this, "ID_EXTENSIONS", wxListCtrl); wxASSERT(pListCtrl); pListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE); FindWindow(XRCID("ID_REMOVE"))->Enable(pListCtrl->GetSelectedItemCount() != 0); FindWindow(XRCID("ID_ADD"))->Enable( !GetText(XRCID("ID_EXTENSION")).empty() ); } void COptionsPageFiletype::OnRemove(wxCommandEvent& event) { wxListCtrl* pListCtrl = XRCCTRL(*this, "ID_EXTENSIONS", wxListCtrl); wxASSERT(pListCtrl); int item = -1; item = pListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); while (item != -1) { pListCtrl->DeleteItem(item); item = pListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } SetCtrlState(); } void COptionsPageFiletype::OnAdd(wxCommandEvent& event) { wxString ext = GetText(XRCID("ID_EXTENSION")); if (ext.empty()) { wxBell(); return; } wxListCtrl* pListCtrl = XRCCTRL(*this, "ID_EXTENSIONS", wxListCtrl); wxASSERT(pListCtrl); for (int i = 0; i < pListCtrl->GetItemCount(); i++) { wxString text = pListCtrl->GetItemText(i); if (text == ext) { DisplayError(0, wxString::Format(_("The extension '%s' does already exist in the list"), ext)); return; } } pListCtrl->InsertItem(pListCtrl->GetItemCount(), ext); SetCtrlState(); } void COptionsPageFiletype::OnTextChanged(wxCommandEvent& event) { SetCtrlState(); } void COptionsPageFiletype::OnSelChanged(wxListEvent& event) { SetCtrlState(); }
8989ef6a1cdd5ffb6e5f1bd0c67241929b8d4388
1b602711efbcc2a4e7a3b83fec0581478793bdc8
/d05/ex02/ShrubberyCreationForm.cpp
68706a315665879846b6f2265a29126e6194b4b0
[]
no_license
CaseySingleton/42-cpp-piscine
3135ec8b024202b6f5b51f5c1607bd255abf42ba
1efbfbd11230843e30f64eeacca800674d13e3d5
refs/heads/master
2020-06-28T06:44:58.661399
2019-08-02T04:53:25
2019-08-02T04:53:25
200,166,385
0
0
null
null
null
null
UTF-8
C++
false
false
2,353
cpp
ShrubberyCreationForm.cpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ShrubberyCreationForm.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: csinglet <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/07/22 17:49:03 by csinglet #+# #+# */ /* Updated: 2019/07/22 17:49:03 by csinglet ### ########.fr */ /* */ /* ************************************************************************** */ #include "ShrubberyCreationForm.hpp" ShrubberyCreationForm::ShrubberyCreationForm(void) { return ; } ShrubberyCreationForm::ShrubberyCreationForm(std::string target) : Form("Shrubbery Creation Form", 145, 137), _target(target) { std::cout << "Created: " << getName() << std::endl; return ; } ShrubberyCreationForm::~ShrubberyCreationForm(void) { return ; } // Operators ShrubberyCreationForm & ShrubberyCreationForm::operator=(const ShrubberyCreationForm & rhs) { if (this != &rhs) { *this = rhs; } return (*this); } // Methods void ShrubberyCreationForm::execute(Bureaucrat const & executor) const { if (isSigned()) { if (executor.getGrade() <= getRequiredGradeToExecute()) { std::cout << "Plainting a shrubbery at " << _target << std::endl; std::ofstream outfile(_target + "_shrubbery"); outfile << " |" << std::endl; outfile << " \\|/|/" << std::endl; outfile << " \\|\\|//|/" << std::endl; outfile << " \\|\\|/|/" << std::endl; outfile << " \\|//" << std::endl; outfile << " \\|/" << std::endl; outfile << " \\|/" << std::endl; outfile << " |" << std::endl; outfile << "_\\|/__|_\\|/____\\|/_" << std::endl; } else { std::cout << "Executor does not meet the requirements to execute: " << getName() << std::endl; throw Form::GradeTooLowException(); } } else { std::cout << "The Form: " << getName() << " must be signed before execution" << std::endl; } }
74ae19fdae903330a8f906942970904c6faf034b
132874ba4ce7d3ae3e7e0ae52da1a0b4a7f9d1eb
/r9,1/main.cpp
dd7779a926df711b1490131b819f5d0bff7a928c
[]
no_license
PawelKawula/cpp-szkola-programowania
8f0dc5dd36ee9ca28c0794779028a1e2ee5c7815
bf143b4f9cdd244e8dd3266099a4d6ca8827a5b3
refs/heads/master
2021-08-30T03:14:44.348660
2017-12-02T17:51:23
2017-12-02T17:51:23
103,747,400
0
1
null
null
null
null
UTF-8
C++
false
false
363
cpp
main.cpp
#include <iostream> #include "golf.h" extern const int cLen; extern const int ctabSize; using namespace std; int main() { char name[cLen]; golf players[ctabSize] {"",0}; int hc; bool loop = true; cout << "Podawaj nazwiska oraz handicapy graczy..." << endl; while(loop) { loop = menu(players,ctabSize); } return 0; }
27c4dfb3ced1184aba109111f99f51ea71e7f62f
e8282e3ae8aafa07b7f7261c639f206c4e97e0fc
/03 - Online Judges/codeforces/1512C.cpp
8b15a052fac376c4ca4b98ae57115d1beffa6c0f
[]
no_license
irfansofyana/cp-codes
7cad844da49b901ccf678b75c31ed41e2fa9d645
9fa723129088f0e4832ecb7e012fe586b6d59e41
refs/heads/master
2023-04-04T00:48:36.334817
2021-04-12T03:07:06
2021-04-12T03:07:06
218,084,148
0
0
null
null
null
null
UTF-8
C++
false
false
1,997
cpp
1512C.cpp
#include <bits/stdc++.h> using namespace std; int frek[2], t, pairs; string s; bool can; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> t; while (t--) { cin >> frek[0] >> frek[1]; cin >> s; for (int i = 0; i < s.size(); ++i) { frek[s[i]-'0']--; } int i = 0, j = (int)s.size() - 1; pairs = 0; can = true; while (i <= j && can) { if (s[i] == s[j]) { if (s[i] == '?' && j!=i) ++pairs; ++i; --j; continue; } if (s[i] == '?') { if (frek[s[j]-'0'] <= 0) { can = false; } --frek[s[j]-'0']; s[i] = s[j]; } else if (s[j] == '?') { if (frek[s[i]-'0'] <= 0) { can = false; } --frek[s[i]-'0']; s[j] = s[i]; } else { can = false; } ++i; --j; } if (!can) cout << -1 << '\n'; else if (2 * pairs > frek[0] + frek[1]) cout << -1 << '\n'; else { int i = 0, j = (int)s.size()-1; while (i <= j && can) { if (s[i] == s[j] && s[i] == '?') { if (frek[0] > frek[1]) { s[i] = '0'; s[j] = '0'; if (i != j) frek[0] -= 2; else frek[0]--; } else if (frek[1] >= frek[0]) { s[i] = '1'; s[j] = '1'; if (i!=j) frek[1]-=2; else frek[1]--; } } if (frek[0] < 0 || frek[1] < 0) { can = false; } ++i; --j; } if (can) cout << s << '\n'; else cout << -1 << '\n'; } } return 0; }
b4cc4fb663c93b8b670bfb13d4a3495cb97ea51d
5cbc55e407950635e669d0c9c34f255f1b3a250a
/SourceCode/MainProject/GLR/ReflexiveParser/mainwindow.h
e27825351f46915aaa2af597c28d10a079b46081
[]
no_license
harp-project/Reflexive-Parsing
6c0b2db9b0d08c25b8411beba00a9ca1d4caac67
34f615e3f4873b2e95f984565dbdf5a3321f8199
refs/heads/master
2022-10-14T20:41:57.930303
2020-06-07T15:00:57
2020-06-07T15:00:57
270,304,091
1
0
null
null
null
null
UTF-8
C++
false
false
1,168
h
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMessageBox> #include <QLabel> #include <QLayout> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QObject* appmanager,QWidget *parent = nullptr); ~MainWindow(); signals: void StartSignal(); void TextChanged(QString); void GrammChanged(QString); void PattChanged(QString); void RegExpChanged(QString); void TerminalsChanged(QString); void NonTerminalsChanged(QString); void MetaVChanged(QString); private slots: void on_pushButton_clicked(); void on_plainTextEdit_prog_textChanged(); void on_plainTextEdit_gramm_textChanged(); void on_plainTextEdit_patt_textChanged(); void on_plainTextEdit_regexp_textChanged(); void on_plainTextEdit_temin_textChanged(); void on_plainTextEdit_2_nonterm_textChanged(); void on_lineEdit_metavar_textChanged(const QString &arg1); void Error(QString); private: Ui::MainWindow *ui; QObject* _appManager; }; #endif // MAINWINDOW_H
b5ac2a504262eef172eb6c01288ac1936933f2fa
d3893a2ee04e4752cecbc873b369a8fa7113b70d
/direct_ui/dui/src/core/dui_real_application.h
b3c34ab5de4507bc9104688eeca9e0fb13bee169
[ "MIT" ]
permissive
kniefliu/WindowsSamples
e849137467acdfe5351e8fdd31945c37203be3c5
c841268ef4a0f1c6f89b8e95bf68058ea2548394
refs/heads/master
2021-01-09T10:25:49.744308
2020-08-12T12:37:05
2020-08-12T12:37:05
242,264,984
0
0
null
null
null
null
UTF-8
C++
false
false
1,244
h
dui_real_application.h
#ifndef DUI_CORE_REAL_APPLICATION_H_ #define DUI_CORE_REAL_APPLICATION_H_ #include "core/dui_real_window.h" class DuiRealApplication final { public: static void Init(); static void Run(); static void Quit(); public: static DuiRealWindow* GetWindows(); static void SetWindows(DuiRealWindow * window); static float ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches); public: static void ClearDisplays(); static int GetNumOfDisplays(); static int AddVideoDisplay(const VideoDisplay * display); static int GetWindowDisplayIndex(DuiRealWindow * window); static VideoDisplay * GetDisplayForWindow(DuiRealWindow * window); static int GetIndexOfDisplay(VideoDisplay * display); static bool GetDisplayBounds(int displayIndex, DuiRect * rect); static bool GetDisplayBounds(VideoDisplay *, DuiRect * rect); static DuiRealWindow* GetFullscreenWindow(VideoDisplay * display); static bool AddDisplayMode(VideoDisplay * display, const DisplayMode * mode); static bool GetWindowDisplayMode(DuiRealWindow * window, DisplayMode * mode); static bool SetDisplayModeForDisplay(VideoDisplay * display, const DisplayMode * mode); }; #endif//DUI_CORE_REAL_APPLICATION_H_
fbed8ee7bc4144ceb14fe412138174a257b57f7f
995a3879f1c15f76a10cf71d72f6fc0ac6f073e7
/src/main.cpp
4fab977b22dc4d9245524178304622c8471b4e99
[]
no_license
Dexsidius/Grengo-Warrior
5b948b824f6d815019676b93c3a9a1dd537eb8ad
d21256eb88750d1277f556d4d437e081523fbb45
refs/heads/master
2022-12-02T11:52:31.633263
2020-08-05T10:07:27
2020-08-05T10:07:27
285,121,381
0
0
null
null
null
null
UTF-8
C++
false
false
178
cpp
main.cpp
#include "game.h" int main(int argc, char* args[]){ GrengoWarrior gw; if (!gw.Start(argc, args)){ return -1; }else{ gw.Loop(); } return 0; }
71da1d05a736d90dfd10ce4438e33c948ff678b8
ff1f8e352bcbf059e2c1c0aaafff120c56f3cf49
/JCR/JCR20190708T2.cpp
c90a40f5336535814d37454c3d0fb7f1d5377d00
[]
no_license
keywet06/code
040bc189fbabd06fc3026525ae3553cd4f395bf3
fe0d570144e580f37281b13fd4106438d3169ab9
refs/heads/master
2022-12-19T12:12:16.635994
2022-11-27T11:39:29
2022-11-27T11:39:29
182,518,309
6
1
null
null
null
null
UTF-8
C++
false
false
510
cpp
JCR20190708T2.cpp
#include <bits/stdc++.h> const int mod = 1e9 + 9; int n, x, y; int main() { freopen("rabbit.in", "r", stdin); freopen("rabbit.out", "w", stdout); scanf("%d", &n); if (n == 895687630) { printf("147396191\n"); return 0; } y = 1; for (int i = 1; i <= 100000000; ++i) { y = x + y; x = y - x; x %= mod; y %= mod; if (x == n) { printf("%d\n", i); return 0; } } printf("-1\n"); return 0; }
f8df9cbbe1f03f91342197db7b15da32545a8244
5e4913b3d7b6dfd9f35d9e5f24486bb6b6145125
/src/tools/kdb/metals.hpp
5faf59fe8f1854fbe23460f8edb4914263c859a6
[ "BSD-3-Clause" ]
permissive
ElektraInitiative/libelektra
ff5d5cfc4bf91d704f58405b14ea694aad3a2edd
dbbe4ae4f669c322a8f95f59112d3f5fc370bbd9
refs/heads/master
2023-08-05T14:54:48.081359
2023-08-04T12:40:00
2023-08-04T12:40:00
21,063,580
215
170
BSD-3-Clause
2023-09-07T13:34:30
2014-06-21T08:01:04
C
UTF-8
C++
false
false
699
hpp
metals.hpp
/** * @file * * @brief * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #ifndef METALS_H #define METALS_H #include <command.hpp> #include <kdb.hpp> class MetaLsCommand : public Command { kdb::KDB kdb; kdb::KeySet ks; public: MetaLsCommand (); ~MetaLsCommand (); virtual std::string getShortOptions () override { return "0"; } virtual std::string getSynopsis () override { return "<name>"; } virtual std::string getShortHelpText () override { return "Get all meta information of an individual key."; } virtual std::string getLongHelpText () override { return ""; } virtual int execute (Cmdline const & cmdline) override; }; #endif
2c39f1f2acc9de82603fdc8bd8e616d6c7336064
435e80b899d294ff48d4c1cfa57bb789e7390eb2
/include/server/dbconnectionPool/connectionPool.hpp
18a3c3b153019c2edf417a7fdf0e336fe969d6e1
[]
no_license
FreeezingHeart/chatserver
e8b998fef72edc3bc92d52e90a48def27efbb421
7dbffce11c328157984e30938f480f1defdc783e
refs/heads/master
2022-11-08T10:32:23.499786
2020-06-28T09:22:48
2020-06-28T09:22:48
269,647,713
8
0
null
null
null
null
UTF-8
C++
false
false
1,395
hpp
connectionPool.hpp
#ifndef CONNECTIONPOOL_HPP #define CONNECTIONPOOL_HPP #include <iostream> #include <string> #include <mutex> #include <queue> #include <atomic> #include <thread> #include <functional> #include <memory> #include <unistd.h> #include <condition_variable> #include "db.h" using namespace std; class ConnectionPool { public: // 获取连接池对象 static ConnectionPool* getConnectionPool(); // 获取连接 shared_ptr<MySQL> getConnection(); private: ConnectionPool(); // 从配置文件中加载配置项 bool loadConfigFile(); // 生产者线程的回调函数,负责生产新连接 void produceConnectionTask(); // 回收空闲连接 void freeIdleConnectionTask(); string _ip; // mysql 初始ip unsigned short _port; // mysql 初始端口号 string _dbname; // mysql 数据表名称 string _username; // mysql 用户名 string _password; // mysql 登陆密码 int _initSize; // 连接池的初始化连接量 int _maxSize; // 连接池的最大连接量 int _maxIdleTime; // 连接池最大空闲时间 int _connectionTimeout; // 连接池获取连接的超时时间 queue<MySQL*> _connectionQue; mutex _queueMutex; atomic_int _connectionCnt; // 记录连接所创建的connection连接的总数 condition_variable cv; }; #endif
8a4b5ff25a491125960674d79a2a0495337cc480
89471e24ae832742e6d2ffb2983f4d6189e61f56
/source/Timer.cpp
250f1f8529d7eb523ed5e61f7271955f3a02db1d
[]
no_license
alexsalomon/underground-survivor
ab5869eeb29b91150924a340014bf69510c8d038
ce5cc6c7f8d42c30021798e6053cdb6f82d4d35c
refs/heads/master
2021-01-01T17:52:38.342091
2018-06-13T11:50:24
2018-06-13T11:50:24
15,031,682
0
0
null
null
null
null
UTF-8
C++
false
false
961
cpp
Timer.cpp
#include "stdafx.h" #include "Timer.h" Timer::Timer() : m_is_running(false), m_begin(0), m_end(0), m_remaining_time(0) { } Timer::~Timer() { } void Timer::start(unsigned long seconds) { m_begin = (unsigned long)clock() / CLOCKS_PER_SEC; //makes it be seconds instead of miliseconds m_end = m_begin + seconds; m_is_running = true; } void Timer::pause() { if(m_is_running) { long remaining_time = m_end - ((unsigned long)clock() / CLOCKS_PER_SEC); if(remaining_time > 0) { m_remaining_time = remaining_time; } else //timeout { m_remaining_time = 0; } m_is_running = false; } } void Timer::resume() { if(!m_is_running) { start(m_remaining_time); } } bool Timer::is_running() { return m_is_running; } bool Timer::is_timeout() { bool is_timeout = false; if(m_is_running) { is_timeout = ((unsigned long)clock() / CLOCKS_PER_SEC) >= m_end; if(is_timeout) { m_is_running = false; } } return is_timeout; }
efe0dd1117c7c949a108743897907fa9b290b6c6
e3a97b316fdf07b170341da206163a865f9e812c
/vital/util/tests/test_any_converter.cxx
c1244a22e63b25553e52c2d3be7765a6d3de505a
[ "BSD-3-Clause" ]
permissive
Kitware/kwiver
09133ede9d05c33212839cc29d396aa8ca21baaf
a422409b83f78f31cda486e448e8009513e75427
refs/heads/master
2023-08-28T10:41:58.077148
2023-07-28T21:18:52
2023-07-28T21:18:52
23,229,909
191
92
NOASSERTION
2023-06-26T17:18:20
2014-08-22T15:22:20
C++
UTF-8
C++
false
false
4,834
cxx
test_any_converter.cxx
// This file is part of KWIVER, and is distributed under the // OSI-approved BSD 3-Clause License. See top-level LICENSE file or // https://github.com/Kitware/kwiver/blob/master/LICENSE for details. /// \file /// \brief test util any_converter class #include <vital/util/any_converter.h> #include <vital/types/uid.h> #include <unordered_map> #include <gtest/gtest.h> using namespace kwiver::vital; // ---------------------------------------------------------------------------- int main(int argc, char** argv) { ::testing::InitGoogleTest( &argc, argv ); return RUN_ALL_TESTS(); } // ---------------------------------------------------------------------------- TEST(any_converter, conversions) { any_converter<int> any_to_int; any_to_int.add_converter<uint8_t>(); // add converter from uint8_t; any_to_int.add_converter<float>(); // add converter from float; any ui8 = uint8_t{ 123 }; any fl = float{ 123.45f }; any cp = std::string{ "string" }; EXPECT_TRUE( any_to_int.can_convert( uint8_t{ 123 } ) ); EXPECT_EQ( 123, any_to_int.convert( uint8_t{ 123 } ) ); EXPECT_TRUE( any_to_int.can_convert( float{ 123.45f } ) ); EXPECT_EQ( 123, any_to_int.convert( float{ 123.45f } ) ); EXPECT_FALSE( any_to_int.can_convert( std::string{ "123" } ) ); EXPECT_THROW( any_to_int.convert( std::string{ "123" } ), bad_any_cast ); } // make a custom specialization namespace kwiver { namespace vital { namespace any_convert { // ---------------------------------------------------------------------------- template <> struct converter<bool, std::string> : public convert_base<bool> { // -------------------------------------------------------------------------- converter() { convert_map.emplace( "yes", true ); convert_map.emplace( "YES", true ); convert_map.emplace( "no", false ); convert_map.emplace( "NO", false ); convert_map.emplace( "0", false ); convert_map.emplace( "zero", false ); convert_map.emplace( "1", true ); convert_map.emplace( "one", true ); convert_map.emplace( "on", true ); convert_map.emplace( "ON", true ); convert_map.emplace( "off", false ); convert_map.emplace( "OFF", false ); convert_map.emplace( "ja", true ); convert_map.emplace( "nein", false ); convert_map.emplace( "up", true ); convert_map.emplace( "down", false ); convert_map.emplace( "true", true ); convert_map.emplace( "false", false ); } // -------------------------------------------------------------------------- virtual ~converter() VITAL_DEFAULT_DTOR // -------------------------------------------------------------------------- virtual bool can_convert( any const & data ) const { return ( data.type() == typeid( std::string ) ) && convert_map.find( any_cast<std::string>( data ) ) != convert_map.end(); } // -------------------------------------------------------------------------- virtual bool convert( any const& data ) const { auto const it = convert_map.find( any_cast<std::string>( data ) ); if ( it != convert_map.end() ) { return it->second; } throw bad_any_cast( typeid( bool ).name(), typeid( std::string ).name() ); } private: std::unordered_map<std::string, bool> convert_map; }; } } } // end namespace // ---------------------------------------------------------------------------- TEST(any_converter, custom_converter) { any_converter<bool> convert_to_bool; convert_to_bool.add_converter<bool>(); // self type needs to be added too convert_to_bool.add_converter<int>(); convert_to_bool.add_converter<std::string>(); // Use custom converter std::string value; EXPECT_TRUE( convert_to_bool.can_convert( std::string{ "yes" } ) ); EXPECT_EQ( true, convert_to_bool.convert( std::string{ "yes" } ) ); EXPECT_TRUE( convert_to_bool.can_convert( std::string{ "up" } ) ); EXPECT_EQ( true, convert_to_bool.convert( std::string{ "up" } ) ); EXPECT_TRUE( convert_to_bool.can_convert( std::string{ "false" } ) ); EXPECT_EQ( false, convert_to_bool.convert( std::string{ "false" } ) ); EXPECT_TRUE( convert_to_bool.can_convert( std::string{ "yes" } ) ); EXPECT_EQ( true, convert_to_bool.convert( std::string{ "yes" } ) ); EXPECT_TRUE( convert_to_bool.can_convert( std::string{ "true" } ) ); EXPECT_EQ( true, convert_to_bool.convert( std::string{ "true" } ) ); EXPECT_TRUE( convert_to_bool.can_convert( 10 ) ); EXPECT_EQ( true, convert_to_bool.convert( 10 ) ); EXPECT_TRUE( convert_to_bool.can_convert( true ) ); EXPECT_EQ( true, convert_to_bool.convert( true ) ); EXPECT_FALSE( convert_to_bool.can_convert( std::string{ "foo" } ) ); EXPECT_THROW( convert_to_bool.convert( std::string{ "foo" } ), bad_any_cast ); }
5ddfa1d4c2310bfe21768b153738ae81e5347e2a
ad952fefcabc91d6baf6b8260745112fd51d1274
/VulkanWrapper/VulkanPipeline.cpp
126c3b15cdc4fa6677bf6513cf7f669968a3e14d
[]
no_license
dekorlp/VulkanWrapper
b294e3824c49665f7a31b1b6994a0f3f31cea753
3d5c852305f71f75abb93e53a59be700bd26cbcd
refs/heads/master
2020-04-19T20:06:45.496889
2019-02-10T19:58:55
2019-02-10T19:58:55
168,406,501
0
0
null
null
null
null
UTF-8
C++
false
false
10,215
cpp
VulkanPipeline.cpp
#include "VulkanPipeline.h" void CVulkanPipeline::InitVulkanPipeline(CVulkanInstance* instance) { m_Instance = instance; } void CVulkanPipeline::CreateGraphicsPipeline(CVulkanVertexDescription vertexDescription) { auto bindingDesription = vertexDescription.getBindingDescription(); auto attributeDescription = vertexDescription.getAttributeDescription(); VkPipelineVertexInputStateCreateInfo vertexInputInfo = {}; vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputInfo.vertexBindingDescriptionCount = static_cast<uint32_t>(bindingDesription.size()); vertexInputInfo.pVertexBindingDescriptions = bindingDesription.data(); // Optional vertexInputInfo.vertexAttributeDescriptionCount = static_cast<uint32_t>(attributeDescription.size()); vertexInputInfo.pVertexAttributeDescriptions = attributeDescription.data(); // Optional VkPipelineInputAssemblyStateCreateInfo inputAssembly = {}; inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; inputAssembly.primitiveRestartEnable = VK_FALSE; VkViewport viewport = {}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = (float)m_Instance->GetSwapchainExtend().width; viewport.height = (float)m_Instance->GetSwapchainExtend().height; viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor = {}; scissor.offset = { 0, 0 }; scissor.extent = m_Instance->GetSwapchainExtend(); VkPipelineViewportStateCreateInfo viewportState = {}; viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; viewportState.viewportCount = 1; viewportState.pViewports = &viewport; viewportState.scissorCount = 1; viewportState.pScissors = &scissor; VkPipelineRasterizationStateCreateInfo rasterizer = {}; rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterizer.depthClampEnable = VK_FALSE; rasterizer.rasterizerDiscardEnable = VK_FALSE; rasterizer.polygonMode = VK_POLYGON_MODE_FILL; rasterizer.lineWidth = 1.0f; rasterizer.cullMode = VK_CULL_MODE_BACK_BIT; rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rasterizer.depthBiasEnable = VK_FALSE; rasterizer.depthBiasConstantFactor = 0.0f; // Optional rasterizer.depthBiasClamp = 0.0f; // Optional rasterizer.depthBiasSlopeFactor = 0.0f; // Optional VkPipelineMultisampleStateCreateInfo multisampling = {}; multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; multisampling.sampleShadingEnable = VK_FALSE; multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; multisampling.minSampleShading = 1.0f; // Optional multisampling.pSampleMask = nullptr; // Optional multisampling.alphaToCoverageEnable = VK_FALSE; // Optional multisampling.alphaToOneEnable = VK_FALSE; // Optional VkPipelineColorBlendAttachmentState colorBlendAttachment = {}; colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; colorBlendAttachment.blendEnable = VK_FALSE; colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; // Optional colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; // Optional colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD; // Optional colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; // Optional colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; // Optional colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD; // Optional VkPipelineColorBlendStateCreateInfo colorBlending = {}; colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; colorBlending.logicOpEnable = VK_FALSE; colorBlending.logicOp = VK_LOGIC_OP_COPY; colorBlending.attachmentCount = 1; colorBlending.pAttachments = &colorBlendAttachment; colorBlending.blendConstants[0] = 0.0f; colorBlending.blendConstants[1] = 0.0f; colorBlending.blendConstants[2] = 0.0f; colorBlending.blendConstants[3] = 0.0f; VkPipelineLayoutCreateInfo pipelineLayoutInfo = {}; pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutInfo.setLayoutCount = m_DescriptorSetLayouts.size(); // Optional pipelineLayoutInfo.pSetLayouts = m_DescriptorSetLayouts.data(); // Optional pipelineLayoutInfo.pushConstantRangeCount = 0; // Optional pipelineLayoutInfo.pPushConstantRanges = nullptr; // Optional if (vkCreatePipelineLayout(m_Instance->GetLogicalDevice(), &pipelineLayoutInfo, nullptr, &pipelineLayout) != VK_SUCCESS) { throw std::runtime_error("failed to create pipeline layout!"); } VkDynamicState dynamicStateEnables[VK_DYNAMIC_STATE_RANGE_SIZE]; VkPipelineDynamicStateCreateInfo dynamicState = {}; memset(dynamicStateEnables, 0, sizeof dynamicStateEnables); dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; dynamicState.pNext = NULL; dynamicState.pDynamicStates = dynamicStateEnables; dynamicState.dynamicStateCount = 0; dynamicStateEnables[dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT; dynamicStateEnables[dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR; VkGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.stageCount = m_ShaderStages.size(); pipelineInfo.pStages = m_ShaderStages.data(); pipelineInfo.pVertexInputState = &vertexInputInfo; pipelineInfo.pInputAssemblyState = &inputAssembly; pipelineInfo.pViewportState = &viewportState; pipelineInfo.pRasterizationState = &rasterizer; pipelineInfo.pMultisampleState = &multisampling; pipelineInfo.pDepthStencilState = nullptr; // Optional pipelineInfo.pColorBlendState = &colorBlending; pipelineInfo.pDynamicState = &dynamicState; // Optional pipelineInfo.layout = pipelineLayout; pipelineInfo.renderPass = m_Instance->GetRenderPass(); pipelineInfo.subpass = 0; if (vkCreateGraphicsPipelines(m_Instance->GetLogicalDevice(), VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS) { throw std::runtime_error("failed to create graphics pipeline!"); } //shaderModule is not longer needed for (unsigned int i = 0; i < m_VulkanShader.size(); i++) { vkDestroyShaderModule(m_Instance->GetLogicalDevice(), m_VulkanShader[i].GetShaderModule(), nullptr); } } void CVulkanPipeline::CreateDescriptorSetLayouts() { std::vector<VkDescriptorSetLayoutBinding> layoutBindings; m_DescriptorSetLayouts.resize(m_UniformSets.size()); for (unsigned int i = 0; i < m_UniformSets.size(); i++) { for (unsigned int j = 0; j < m_UniformSets.at(i).size(); j++) { VkDescriptorSetLayoutBinding uboLayoutBinding = {}; uboLayoutBinding.binding = m_UniformSets.at(i).at(j).GetUniformBinding(); uboLayoutBinding.descriptorType = m_UniformSets.at(i).at(j).GetDescriptorType(); uboLayoutBinding.descriptorCount = 1; uboLayoutBinding.stageFlags = m_UniformSets.at(i).at(j).GetShaderStageFlag(); uboLayoutBinding.pImmutableSamplers = nullptr; // Optional layoutBindings.push_back(uboLayoutBinding); } VkDescriptorSetLayoutCreateInfo layoutInfo = {}; layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; layoutInfo.bindingCount = layoutBindings.size(); layoutInfo.pBindings = layoutBindings.data(); if (vkCreateDescriptorSetLayout(m_Instance->GetLogicalDevice(), &layoutInfo, nullptr, &m_DescriptorSetLayouts[i]) != VK_SUCCESS) { throw std::runtime_error("failed to create descriptor set layout!"); } layoutBindings.clear(); } } std::vector<std::vector<CVulkanUniform>> CVulkanPipeline::GetDescriptorUniforms() { return m_UniformSets; } void CVulkanPipeline::AddUniform(CVulkanUniform uniform) { if (uniform.GetUniformSet() > m_UniformSets.size()) { throw std::runtime_error("failed to add Uniform! Uniform sets must be crated in an ascending order starting with 0!"); } else if (uniform.GetUniformSet() == m_UniformSets.size()) { m_UniformSets.push_back(std::vector<CVulkanUniform>(1, uniform)); } else // uniform.GetUniformSet() < m_Uniform.size() { m_UniformSets.at(uniform.GetUniformSet()).push_back(uniform); } } void CVulkanPipeline::AddShader(std::vector<char> shaderProgram, VkShaderStageFlagBits shaderStage) { VkShaderModule shaderModule = CVulkanUtils::CreateShaderModule(m_Instance, shaderProgram.data(), shaderProgram.size()); VkPipelineShaderStageCreateInfo shaderStageInfo = {}; shaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStageInfo.stage = shaderStage; shaderStageInfo.module = shaderModule; shaderStageInfo.pName = "main"; m_ShaderStages.push_back(shaderStageInfo); CVulkanShader shader; shader.SetShaderModule(shaderModule); shader.SetShaderStageFlagBits(shaderStage); m_VulkanShader.push_back(shader); } void CVulkanPipeline::AddShader(const char* shaderProgram, unsigned int shaderProgramSize, VkShaderStageFlagBits shaderStage) { VkShaderModule shaderModule = CVulkanUtils::CreateShaderModule(m_Instance, shaderProgram, shaderProgramSize); VkPipelineShaderStageCreateInfo shaderStageInfo = {}; shaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStageInfo.stage = shaderStage; shaderStageInfo.module = shaderModule; shaderStageInfo.pName = "main"; m_ShaderStages.push_back(shaderStageInfo); CVulkanShader shader; shader.SetShaderModule(shaderModule); shader.SetShaderStageFlagBits(shaderStage); m_VulkanShader.push_back(shader); } void CVulkanPipeline::DestroyPipeline() { vkDestroyPipeline(m_Instance->GetLogicalDevice(), graphicsPipeline, nullptr); vkDestroyPipelineLayout(m_Instance->GetLogicalDevice(), pipelineLayout, nullptr); } void CVulkanPipeline::DestroyDescriptorSetLayout() { for (unsigned int i = 0; i < m_DescriptorSetLayouts.size(); i++) { vkDestroyDescriptorSetLayout(m_Instance->GetLogicalDevice(), m_DescriptorSetLayouts[i], nullptr); } } VkPipeline CVulkanPipeline::GetGraphicsPipeline() { return graphicsPipeline; } VkPipelineLayout CVulkanPipeline::GetPipelineLayout() { return pipelineLayout; } std::vector<VkDescriptorSetLayout> CVulkanPipeline::GetDescriptorSetLayouts() { return m_DescriptorSetLayouts; }
d07198b615bb5812451aca6c1c03b91479aa43f9
d6023bfe18e61a4202068cdcae5a090a6031a02e
/wakeup.cpp
dec3478d1d3c9358503190f4fe81efad0195b0b3
[]
no_license
mniip/sandbox
5d76b6e01b2dcfe445c0b598344477948bcde867
ec89657dc6a80323b0f44c4388c01711b0d28b3b
refs/heads/master
2023-06-24T06:05:13.924977
2023-06-19T10:22:09
2023-06-19T10:22:09
72,671,758
11
1
null
null
null
null
UTF-8
C++
false
false
4,201
cpp
wakeup.cpp
#include <thread> #include <string> #include "sandbox.h" #include "config.h" extern "C" { #include <stdio.h> #include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> #include <sys/ioctl.h> #include <pthread.h> } char const *ident; int in_pipe[2], out_pipe[2]; int old_client = -1; std::thread *feed_in, *feed_out; bool startup_over = false; int written = 0; bool close_input = false; void feed_data(int from, int to, bool track, bool closeeof) { const size_t BLOCK_SIZE = 4096; char buffer[BLOCK_SIZE]; ssize_t bytes_read; while(0 < (bytes_read = read(from, buffer, BLOCK_SIZE))) { size_t done = 0; while(done < bytes_read) { ssize_t bytes_wrote = write(to, buffer + done, bytes_read - done); if(bytes_wrote <= 0) { printf("[Write error]\n"); exit(0); } done += bytes_wrote; if(track) written += bytes_wrote; } } if(bytes_read < 0 && errno != EAGAIN) { printf("[Read error]\n"); exit(0); } if(closeeof) { close_input = true; if(startup_over) close(to); } } void time_limit() { sleep(conf_timelimit); fprintf(old_client == -1 ? stdout : fdopen(old_client, "w"), "[Timed out]\n"); exit(0); } std::thread *timer; void set_timer() { timer = new std::thread(time_limit); } void unset_timer() { pthread_cancel(timer->native_handle()); timer->join(); delete timer; } void do_wakeup() { pthread_cancel(feed_in->native_handle()); feed_in->join(); fcntl(out_pipe[0], F_SETFL, fcntl(out_pipe[0], F_GETFL) | O_NONBLOCK); pthread_kill(feed_out->native_handle(), SIGUSR1); feed_out->join(); fcntl(out_pipe[0], F_SETFL, fcntl(out_pipe[0], F_GETFL) & ~O_NONBLOCK); delete feed_in; delete feed_out; if(old_client != -1) close(old_client); else { kill(getppid(), SIGUSR1); close(fileno(stdin)); close(fileno(stdout)); close(fileno(stderr)); } unset_timer(); int server = socket(AF_UNIX, SOCK_STREAM, 0); if(server < 0) panic_errno("socket"); struct sockaddr_un addr; memset(&addr, 0, sizeof addr); addr.sun_family = AF_UNIX; strncpy(addr.sun_path, (conf_sockdir + "/socket_" + ident).c_str(), sizeof addr.sun_path - 1); if(bind(server, (struct sockaddr *)&addr, sizeof addr)) panic_errno("bind"); if(listen(server, 1)) panic_errno("listen"); int client = accept(server, NULL, NULL); if(client < 0) panic_errno("accept"); close(server); unlink((conf_sockdir + "/socket_" + ident).c_str()); feed_in = new std::thread(feed_data, client, in_pipe[1], false, !conf_wakeup); feed_out = new std::thread(feed_data, out_pipe[0], client, false, false); old_client = client; set_timer(); } void try_connect() { int server = socket(AF_UNIX, SOCK_STREAM, 0); if(server < 0) panic_errno("socket"); struct sockaddr_un addr; memset(&addr, 0, sizeof addr); addr.sun_family = AF_UNIX; strncpy(addr.sun_path, (conf_sockdir + "/socket_" + ident).c_str(), sizeof addr.sun_path - 1); if(connect(server, (struct sockaddr *)&addr, sizeof addr)) { unlink((conf_sockdir + "/socket_" + ident).c_str()); return; } std::thread feed_in(feed_data, fileno(stdin), server, false, !conf_wakeup); feed_data(server, fileno(stdout), false, false); exit(0); } void kill_session() { int server = socket(AF_UNIX, SOCK_STREAM, 0); if(server < 0) panic_errno("socket"); struct sockaddr_un addr; memset(&addr, 0, sizeof addr); addr.sun_family = AF_UNIX; strncpy(addr.sun_path, (conf_sockdir + "/socket_" + ident).c_str(), sizeof addr.sun_path - 1); if(connect(server, (struct sockaddr *)&addr, sizeof addr)) { if(errno == ENOENT) return; int err = errno; unlink(("socket_" + std::string(ident)).c_str()); errno = err; panic_errno("connect"); } unlink((conf_sockdir + "/socket_" + ident).c_str()); struct ucred creds; socklen_t len = sizeof creds; if(getsockopt(server, SOL_SOCKET, SO_PEERCRED, &creds, &len)) panic_errno("getsockopt SO_PEERCRED"); if(kill(creds.pid, SIGTERM)) panic_errno("kill"); } void check_startup() { if(!startup_over) { int buffer; if(ioctl(in_pipe[1], FIONREAD, &buffer)) panic_errno("FIONREAD"); if(buffer - written < 0) { if(close_input) close(in_pipe[1]); startup_over = true; set_timer(); } } }
b9006c57f5ec456ad188a0a9517671c05214239b
123ab5d99f22ccf406d74696a0f01fab7c966c28
/n-gon/n-gon/BulletController.cpp
84d7a9730d300211db4b239b85e355c188a6bb54
[]
no_license
alycarter/n-gon
be043ac2abd284f6f5e2d3641fd31423cc3b3594
c063493f2008ea16d2eaf99e4eefd1ce5e2a6e05
refs/heads/master
2016-09-01T16:49:22.036578
2015-04-30T18:15:37
2015-04-30T18:15:37
34,536,204
0
0
null
null
null
null
UTF-8
C++
false
false
658
cpp
BulletController.cpp
#include "BulletController.h" #include "emmet-engine\UpdatePackage.h" #include "emmet-engine\Entity.h" #include "emmet-engine\Time.h" #include "Physics.h" BulletController::BulletController() { life = 4; } BulletController::~BulletController() { } void BulletController::update(UpdatePackage * package) { //lower the life count life -= package->time->getDeltaTime(); //if the bullet has collided or ran out of life then delete it if (remove || life < 0) { package->entity->requestDelete(); package->entity->getComponentOfType<Physics>()->removeCollisionListener(this); } } void BulletController::onCollide(Entity * entity) { remove = true; }
4be9f83e4a895641f7f0b96fb2546635fae171df
a0fc88d24e8fdcd2b0909019fcd1f4259ff663c8
/LightCrafter/src/LCR_Commander.cpp
e14ac8e089f4c5f09bcf9311f65afe1d84de5c54
[]
no_license
applekey/TI_LCR
6fc65db1b8dcab1f86876e6f44e207eec8147ce9
ccac28582ed3923ad38a9b7e1e7950658da47823
refs/heads/master
2021-01-22T06:54:12.308655
2013-06-01T20:20:19
2013-06-01T20:20:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,100
cpp
LCR_Commander.cpp
#include "LCR_Commander.h" LCR_Commander::LCR_Commander(void) { tcpClient = new Tcp(); connectedSocket = -1; packetizer = new Command_Packetizer(); } LCR_Commander::~LCR_Commander(void) { if(tcpClient != NULL) delete tcpClient; if(packetizer != NULL) delete packetizer; } bool LCR_Commander:: Connect_LCR(string ipAddress, string port) { for(int i = 0; i<ConnectionAttempts; ++i) { int socket = tcpClient->TCP_Connect(ipAddress, port); if(socket >0) { connectedSocket = socket; return true; } } return false; } bool LCR_Commander::SendLCRWriteCommand(uint8* command, long packetSize, int packetNumber) { if(connectedSocket<0) { cout << "No connected Socket.\n"; return false; } //send the Packet int send = tcpClient->TCP_Send(connectedSocket,command,packetSize); if(send ==SOCKET_ERROR) { if(packetNumber != -1) cout <<"PACKET SEND, NUMBER:"<<packetNumber<<" with length:"<<packetSize<<" has recieved a socket error.\n"; else cout <<"PACKET SEND, with length:"<<packetSize<<" has recieved a socket error.\n"; return false; } //-----------Recieve Packet---------------------------- uint8 recieve[HEADER_SIZE]; int rec = tcpClient->TCP_Receive(connectedSocket,recieve,HEADER_SIZE); if(rec ==SOCKET_ERROR) { if(packetNumber != -1) cout <<"PACKET Recieve Header, NUMBER:"<<packetNumber<<" with length:"<<packetSize<<" has recieved a socket error.\n"; else cout <<"PACKET Recieve Header, with length:"<<packetSize<<" has recieved a socket error.\n"; return false; } int payLoadLength = recieve[5]<<8+recieve[4]; int sizeToRecieve = payLoadLength+CHECKSUM_SIZE; uint8* recievePayLoad = new uint8[sizeToRecieve]; int recPayload = tcpClient->TCP_Receive(connectedSocket,recievePayLoad,sizeToRecieve); if(recPayload ==SOCKET_ERROR) { if(packetNumber != -1) cout <<"PACKET Recieve PayLoad, NUMBER:"<<packetNumber<<" with length:"<<packetSize<<" has recieved a socket error.\n"; else cout <<"PACKET Recieve PayLoad, with length:"<<packetSize<<" has recieved a socket error.\n"; return false; } delete[] recievePayLoad; return true; } bool LCR_Commander::LCR_LOAD_STATIC_IMAGE(uint8 * image,int byteCount) { if(connectedSocket < 0) { cout << "No connected Socket.\n"; return false; } Packet_Type pType = Host_Write; // read command CommandIds cmdId = StaticImage; //commandId Command_Flags flag = Beginning; //flags //-------------First Packet---------------------------------------------- uint8* commandHeader = packetizer->CreateCommand((uint8) pType, (uint16) cmdId, (uint8) flag, MAX_PAYLOAD_SIZE, image); //send the first Packet bool sendFirst = SendLCRWriteCommand(commandHeader,MAX_PACKET_SIZE,1); delete[] commandHeader; if(!sendFirst) { return false; } //-------------Intermediate Packets--------------------------------------------- flag = Intermediate; // change the flag to intermediate int NumberOfIntermediatePackets = 37; for(int i = 0;i<NumberOfIntermediatePackets;i++) { uint8* commandIntermediate = packetizer->CreateCommand((uint8) pType, (uint16) cmdId, (uint8) flag, MAX_PAYLOAD_SIZE, image+(MAX_PAYLOAD_SIZE)*(i+1)); bool sendIntermdiate = SendLCRWriteCommand(commandIntermediate,MAX_PACKET_SIZE,i+1); delete[] commandIntermediate; if(!sendIntermdiate) { return false; } } //-------------Final Packet--------------------------------------------- flag = End; // change the flag to indicate last packet int remainingBytes = -(byteCount - ((MAX_PAYLOAD_SIZE)*(NumberOfIntermediatePackets+2))); uint8* commandFinal = packetizer->CreateCommand((uint8) pType, (uint16) cmdId, (uint8) flag, remainingBytes, image+MAX_PAYLOAD_SIZE*NumberOfIntermediatePackets); int lastLength = remainingBytes +HEADER_SIZE+CHECKSUM_SIZE; bool sendFinal = SendLCRWriteCommand(commandFinal,lastLength,NumberOfIntermediatePackets+2); if(!sendFinal) { return false; } return true; } bool LCR_Commander::SetDisplayMode(DisplayMode displayMode) { if(connectedSocket < 0) { cout << "No connected Socket.\n"; return false; } Packet_Type pType = Host_Write; // read command CommandIds cmdId = CurrentDisplayMode; //commandId Command_Flags flag = DataComplete; //flags uint8 dplMode = (uint8)displayMode; // set the display mode uint8 * payLoad; payLoad = &dplMode; uint16 payLoadLength = 0x1; //create the command uint8* command = packetizer->CreateCommand((uint8) pType, (uint16) cmdId, (uint8) flag, payLoadLength, payLoad); int totalLength = HEADER_SIZE + payLoadLength + CHECKSUM_SIZE; int sendResult = tcpClient->TCP_Send(connectedSocket,command,totalLength); delete[] command; if(sendResult ==SOCKET_ERROR) { cout <<"LCR Set Display mode send has send error.\n"; return false; } return true; } bool LCR_Commander::Disconnect_LCR(void) { if(connectedSocket >0) { int status = tcpClient->TCP_Disconnect(connectedSocket); if(status == 0) { connectedSocket = -1; return true; } else return false; } else return false; }
7313a92e22e0dd09a2bd7f1e65671d1296640955
5d3b6173931d919a857309f162ac73c09b640331
/include/Grid/Selection.hpp
3af87c80d4be9bedb953955e26de1053bae5d51a
[ "MIT" ]
permissive
PaprikaX33/nanaro
8fa49155b1c61602a65e611a0020b6c9d7da69da
8218224987894ee2ef2d83c8f42d35a5190a304f
refs/heads/master
2022-12-15T11:17:04.249898
2020-08-12T14:52:41
2020-08-12T14:52:41
273,995,061
0
0
MIT
2020-08-12T14:52:42
2020-06-21T22:47:13
C++
UTF-8
C++
false
false
350
hpp
Selection.hpp
#ifndef NANARO_GRID_SELECTION_HEAD_HPP #define NANARO_GRID_SELECTION_HEAD_HPP #include "Block/Type.hpp" #include <tuple> namespace Grid { Block::Type const * get(std::pair<int,int> const &); Block::Type const * get(void); //TODO: replace the pair to sys::pair extern std::pair<int,int> screenPos; } #endif //NANARO_GRID_SELECTION_HEAD_HPP
ecd084ca7fc691b7c65a3b1e7de2008078ac52f7
f1f41f0a19b11f21d6cee74d855e9a0fc1871459
/arreglos.cpp
79d96c7e5b4091ddd2a62a6c720032557bd650dd
[]
no_license
pazdiegog/consulta
11d6e1363ace565eb76fcf0b41a42288375ad7da
e3ade41a45f6e358719d2350a807248f42288bf6
refs/heads/master
2021-01-22T13:26:13.743655
2017-08-25T20:44:54
2017-08-25T20:44:54
100,659,579
0
0
null
null
null
null
UTF-8
C++
false
false
2,786
cpp
arreglos.cpp
#include <iostream> #include <fstream> #include <string> #include <array> //#include "burbujeo.cpp" using namespace std; struct Listado{ string agrupacion; string candidato; int lista; int votos; }; const int MAX = 5; array<Listado, MAX> partidos; void print (array<Listado, MAX> partidos) { for (int i=0; i<MAX ; i++) cout<<i<<":"<<partidos[i].agrupacion<<", votos: "<< partidos[i].votos<<", lista: "<< partidos[i].lista<<", candidato: "<< partidos[i].candidato<<"\n"; } void OrdenarPorAgrupacion (array <Listado, MAX> partidos) //burbuja { for (int i=0; i<MAX-1; i++) for (int j=0; j<MAX-1; j++) if (partidos[j].agrupacion > partidos [j+1].agrupacion) { Listado aux; aux=partidos[j]; partidos[j]=partidos[j+1]; partidos[j+1]=aux; } print (partidos); } void OrdenarPorVoto (array <Listado, MAX> partidos) //burbuja { for (int i=0; i<MAX-1; i++) for (int j=0; j<MAX-1; j++) if (partidos[j].votos > partidos [j+1].votos) { Listado aux; aux=partidos[j]; partidos[j]=partidos[j+1]; partidos[j+1]=aux; } print (partidos); } void OrdenarPorLista (array <Listado, MAX> partidos) //shell { for (int i=MAX/2; i !=0; i/=2) for (int j=1; j!=0;) { j=0; for (int k=i; k<MAX;k++) if (partidos[k-i].lista>partidos[k].lista) { Listado temp=partidos[k]; partidos[k]=partidos[k-i]; partidos[k-i]=temp; j++; } } print (partidos); } void OrdenarPorCandidato (array <Listado, MAX> partidos) //insercion { int j; string temp; for (int i=0; i<MAX; i++) { temp= partidos[i].candidato; j= i-1; while ((j>=0) && (partidos[j].candidato> temp)) { partidos[j+1]=partidos[j]; j--; } partidos[j+1].candidato = temp; } print (partidos); } int main () { partidos[0].agrupacion="FPV"; partidos[1].agrupacion= "CAMBIEMOS"; partidos[2].agrupacion= "UNA"; partidos[3].agrupacion= "PROGRE"; partidos[4].agrupacion= "FIT"; partidos[0].candidato= "Daniel"; partidos[1].candidato= "Mauricio"; partidos[2].candidato= "Sergio"; partidos[3].candidato= "Margarita"; partidos[4].candidato= "Altamira"; partidos[0].lista=100; partidos[1].lista=55; partidos[2].lista=96; partidos[3].lista=254; partidos[4].lista=9; partidos[0].votos=100; partidos[1].votos=101; partidos[2].votos=59; partidos[3].votos=41; partidos[4].votos=7; cout << "\nDesordenado: \n"; print (partidos); cout << "\nOrdenado por voto: \n"; OrdenarPorVoto (partidos); cout << "\nOrdenado por agrupacion: \n"; OrdenarPorAgrupacion(partidos); cout << "\nOrdenado por lista: \n"; OrdenarPorLista(partidos); cout << "\nOrdenado por candidato: \n"; OrdenarPorCandidato(partidos); }
2f04b21cfb147056703909eed678f2abedf11768
82749ce2bff0c448be1874f74318749bd0862dda
/main.cpp
26413029476d9ef1810178853d3a8515ba042dce
[]
no_license
hulponot/baggage
8c6f935cf6dda93cb6feda0c9daccab74d52ebe9
b78115e2e499bfa48ffc6c81b9ab3809657e0103
refs/heads/master
2020-05-18T12:53:53.584055
2015-04-29T09:24:30
2015-04-29T09:24:30
30,754,543
0
0
null
null
null
null
UTF-8
C++
false
false
417
cpp
main.cpp
#include <QApplication> #include <QQmlApplicationEngine> #include <qqml.h> #include "levelinfo.h" #include <iostream> int main(int argc, char *argv[]) { //std::cout<<Consts::stuff_I[2]; Consts consts; QApplication app(argc, argv); qmlRegisterType<LevelInfo>("MyLib",1,0,"World"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
cf1d34d606b08ad8963eff3ba0c75ca18459a8f4
749f2780145db9940f8b4f6f75187448869604c6
/Source/SpriTopDown/AttributeSetBase.cpp
0a7210eae71dc2f6dca27429e8f60bc041890582
[]
no_license
MaxNorr/SpriTopDown
135d2e1d8a30b8e1cc3a2295653337a1e1bc92fe
f029eb13f95f883a871e1f1890dc7d4964972218
refs/heads/master
2023-02-19T19:20:34.899133
2021-01-14T18:32:18
2021-01-14T18:32:18
329,703,406
0
0
null
null
null
null
UTF-8
C++
false
false
5,332
cpp
AttributeSetBase.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "AttributeSetBase.h" #include "GameplayEffect.h" #include "GameplayEffectExtension.h" #include "MainCharacter.h" #include "Net/UnrealNetwork.h" UAttributeSetBase::UAttributeSetBase() { } void UAttributeSetBase::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) { // This is called whenever attributes change, so for max health/mana we want to scale the current totals to match Super::PreAttributeChange(Attribute, NewValue); // If a Max value changes, adjust current to keep Current % of Current to Max if (Attribute == GetmaxHealthAttribute()) // GetMaxHealthAttribute comes from the Macros defined at the top of the header { AdjustAttributeForMaxChange(currentHealth, maxHealth, NewValue, GetcurrentHealthAttribute()); } else if (Attribute == GetmaxManaAttribute()) { AdjustAttributeForMaxChange(currentMana, maxMana, NewValue, GetcurrentManaAttribute()); } } void UAttributeSetBase::PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) { Super::PostGameplayEffectExecute(Data); if (Data.EvaluatedData.Attribute == GetcurrentHealthAttribute()) { SetcurrentHealth(FMath::Clamp(GetcurrentHealth(), 0.0f, GetmaxHealth())); } if (Data.EvaluatedData.Attribute == GetcurrentManaAttribute()) { SetcurrentMana(FMath::Clamp(GetcurrentMana(), 0.0f, GetmaxMana())); } else if (Data.EvaluatedData.Attribute == GetExpAttribute()) { //I want to call a funtion from MainCharacter.cpp called void AMainCharacter::SendExpChangeToPlayerCharacter() } } void UAttributeSetBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, currentHealth, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, maxHealth, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, currentMana, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, currentMana, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Strength, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Agility, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Intelligence, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Armor, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, AttackDamage, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Level, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(UAttributeSetBase, Exp, COND_None, REPNOTIFY_Always); } void UAttributeSetBase::AdjustAttributeForMaxChange(FGameplayAttributeData& AffectedAttribute, const FGameplayAttributeData& MaxAttribute, float NewMaxValue, const FGameplayAttribute& AffectedAttributeProperty) { UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); const float CurrentMaxValue = MaxAttribute.GetCurrentValue(); if (!FMath::IsNearlyEqual(CurrentMaxValue, NewMaxValue) && AbilityComp) { // Change current value to maintain the current Val / Max percent const float CurrentValue = AffectedAttribute.GetCurrentValue(); float NewDelta = (CurrentMaxValue > 0.f) ? (CurrentValue * NewMaxValue / CurrentMaxValue) - CurrentValue : NewMaxValue; AbilityComp->ApplyModToAttributeUnsafe(AffectedAttributeProperty, EGameplayModOp::Additive, NewDelta); } } void UAttributeSetBase::OnRep_currentHealth(const FGameplayAttributeData& OldcurrentHealth) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, currentHealth, OldcurrentHealth); } void UAttributeSetBase::OnRep_maxHealth(const FGameplayAttributeData& OldmaxHealth) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, maxHealth, OldmaxHealth); } void UAttributeSetBase::OnRep_currentMana(const FGameplayAttributeData& OldcurrentMana) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, currentMana, OldcurrentMana); } void UAttributeSetBase::OnRep_maxMana(const FGameplayAttributeData& OldmaxMana) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, maxMana, OldmaxMana); } void UAttributeSetBase::OnRep_Strength(const FGameplayAttributeData& OldStrength) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Strength, OldStrength); } void UAttributeSetBase::OnRep_Agility(const FGameplayAttributeData& OldAgility) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Agility, OldAgility); } void UAttributeSetBase::OnRep_Intelligence(const FGameplayAttributeData& OldIntelligence) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Intelligence, OldIntelligence); } void UAttributeSetBase::OnRep_Armor(const FGameplayAttributeData& OldArmor) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Armor, OldArmor); } void UAttributeSetBase::OnRep_AttackDamage(const FGameplayAttributeData& OldAttackDamage) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, AttackDamage, OldAttackDamage); } void UAttributeSetBase::OnRep_Level(const FGameplayAttributeData& OldLevel) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Level, OldLevel); } void UAttributeSetBase::OnRep_Exp(const FGameplayAttributeData& OldExp) { GAMEPLAYATTRIBUTE_REPNOTIFY(UAttributeSetBase, Exp, OldExp); }
982c12314e5d085bed42dd8598fa8c24d6f55f16
57ffc709a3ccf586cafd864371fa281435348eab
/DeckList.h
4a4f05668af9066e782ff264d202e65a1cc2917b
[]
no_license
sethtankman/CardsQt
cd91593c975ede37e04f02b95a3b626b695dea09
6b2d828680e203fdcfc8f73ed6622ddfec90fb7d
refs/heads/master
2023-01-02T17:06:49.227175
2020-10-26T07:57:13
2020-10-26T07:57:13
307,294,690
0
0
null
null
null
null
UTF-8
C++
false
false
357
h
DeckList.h
#include <iostream> #include <array> #include <map> #include "Deck.h" #include "Matchup.h" using namespace std; class DeckList { std::map<std::string, Deck> list; public: DeckList(); void MakeMatchups(); void Insert(pair<string, Deck> p); void ShowMenu(int _numDecks); void Winrate(); void EnterAll(); void RemoveDeck(Deck toRemove); };
3de99b3882f1c206a8bf2231b635d23957ff9849
33b44be6f55d68ca8a8003e2d34fb47fdb2340d0
/src/test/datareftx_tests.cpp
e395dc25a343d106fc9dcc873b6992e5284cfcc3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
permissive
esthon/bitcoin-sv
72bc421d9e6d59a3d270962ec399743ae08a69c2
08d493fe4c7610efd3eeee7c0bfa5b5e991658a6
refs/heads/mydev
2023-07-27T10:04:40.813510
2023-07-19T16:20:41
2023-07-19T16:20:41
362,464,092
0
0
NOASSERTION
2023-07-14T19:20:58
2021-04-28T12:45:10
C++
UTF-8
C++
false
false
4,648
cpp
datareftx_tests.cpp
// Copyright (c) 2022 Bitcoin Association // Distributed under the Open BSV software license, see the accompanying file LICENSE. #include "miner_id/datareftx.h" #include "consensus/merkle.h" #include "univalue.h" #include "test/test_bitcoin.h" #include <boost/test/unit_test.hpp> #include <random> namespace { // Create a block with some fake dataref txns at random locations std::pair<CBlock, std::vector<size_t>> MakeBlock() { constexpr unsigned NumTx{10}; constexpr unsigned NumDatarefTx{2}; CBlock block {}; block.vtx.resize(NumTx); for(size_t j = 0; j < NumTx; j++) { CMutableTransaction mtx {}; mtx.nLockTime = j; block.vtx[j] = MakeTransactionRef(std::move(mtx)); } std::random_device rd {}; std::mt19937 mt { rd() }; std::uniform_real_distribution<float> dist { 1, static_cast<float>(block.vtx.size()) }; std::vector<size_t> indexes {}; for(size_t i = 0; i < NumDatarefTx; ++i) { size_t index {0}; do { index = static_cast<size_t>(dist(mt)); // Have to check random index is in range due to common library bug if(index >= block.vtx.size()) { index = 1; } } while(std::find(indexes.begin(), indexes.end(), index) != indexes.end()); indexes.push_back(index); UniValue document { UniValue::VOBJ }; UniValue data { UniValue::VOBJ }; UniValue brfcJson { UniValue::VOBJ }; brfcJson.push_back(Pair("example", "value")); data.push_back(Pair("Id", brfcJson)); document.push_back(Pair("data", data)); std::string dataRefJson { document.write() }; CMutableTransaction mtx {}; mtx.vin.resize(1); mtx.vin[0].prevout = COutPoint { uint256{}, static_cast<uint32_t>(i) }; mtx.vout.resize(1); mtx.vout[0].nValue = Amount{i}; const std::vector<uint8_t> MinerIDProtocolPrefix { 0xac, 0x1e, 0xed, 0x88 }; mtx.vout[0].scriptPubKey = CScript() << OP_FALSE << OP_RETURN << MinerIDProtocolPrefix << std::vector<uint8_t> { dataRefJson.begin(), dataRefJson.end() }; block.vtx[index] = MakeTransactionRef(std::move(mtx)); } return { block, indexes }; } // Until merkle proof Verify is updated to work for block hash target, we must check it manually bool CheckMerkleProof(const MerkleProof& merkleProof, const CTransactionRef& txn, const CBlock& block) { std::vector<uint256> hashes {}; for(const auto& node : merkleProof) { hashes.push_back(node.mValue); } uint256 checkRoot { ComputeMerkleRootFromBranch(txn->GetId(), hashes, merkleProof.Index()) }; return checkRoot == BlockMerkleRoot(block); } } std::ostream& operator<<(std::ostream& str, const DataRefTx& msg) { str << "TxnId: " << msg.GetTxn()->GetId().ToString() << std::endl; str << "MerkleProof: " << msg.GetProof().ToJSON().write() << std::endl; return str; } BOOST_FIXTURE_TEST_SUITE(datareftx, BasicTestingSetup) // Creation and serialising/deserialising BOOST_AUTO_TEST_CASE(CreateAndSerialise) { // Create fake block with a couple of dataref txns const auto& [ block, indexes] { MakeBlock() }; // Check we can create and serialise datareftx messages for each dataref txn for(size_t index : indexes) { const CTransactionRef& txn { block.vtx[index] }; // Get merkle proof const CMerkleTree merkleTree { block.vtx, uint256(), 0 }; const CMerkleTree::MerkleProof treeProof { merkleTree.GetMerkleProof(txn->GetId(), false) }; MerkleProof merkleProof { treeProof, txn->GetId(), block.GetHash() }; BOOST_CHECK_EQUAL(merkleProof.Flags(), 0x00); BOOST_CHECK(CheckMerkleProof(merkleProof, txn, block)); // Create datareftx message DataRefTx msg { txn, merkleProof }; BOOST_CHECK(CheckMerkleProof(msg.GetProof(), msg.GetTxn(), block)); // Serialise and deserialise CDataStream ss { SER_NETWORK, 0 }; ss << msg; DataRefTx deserialised {}; ss >> deserialised; BOOST_CHECK_EQUAL(msg, deserialised); BOOST_CHECK_EQUAL(deserialised.GetProof().Flags(), 0x00); BOOST_CHECK(CheckMerkleProof(deserialised.GetProof(), deserialised.GetTxn(), block)); } } BOOST_AUTO_TEST_SUITE_END()
5399332e5e19deacb849ce694ff97b2be8c991d7
6428d8b991fab5cdcd9a365bbd168b2aaf7fcf42
/mainwindow.cpp
fdb156d899b4eb87441fed268a6415238601b595
[]
no_license
Stadzior/SMPD
25a3bf13fab4bcecbad37e6ed7c59a3cf22c1d0c
5677d49446a81d2b1dc397774b54295732a4df28
refs/heads/master
2021-01-19T22:20:24.452802
2017-05-14T15:33:31
2017-05-14T15:33:31
88,792,617
0
0
null
null
null
null
UTF-8
C++
false
false
6,079
cpp
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QImage> #include <QDebug> #include <vector> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); FSupdateButtonState(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::updateDatabaseInfo() { ui->FScomboBox->clear(); for(unsigned int i=1; i<=database.getNoFeatures(); ++i) ui->FScomboBox->addItem(QString::number(i)); ui->FStextBrowserDatabaseInfo->setText("noClass: " + QString::number(database.getNoClass())); ui->FStextBrowserDatabaseInfo->append("noObjects: " + QString::number(database.getNoObjects())); ui->FStextBrowserDatabaseInfo->append("noFeatures: " + QString::number(database.getNoFeatures())); } void MainWindow::FSupdateButtonState(void) { if(database.getNoObjects()==0) { FSsetButtonState(false); } else FSsetButtonState(true); } void MainWindow::FSsetButtonState(bool state) { ui->FScomboBox->setEnabled(state); ui->FSpushButtonCompute->setEnabled(state); ui->FSpushButtonSaveFile->setEnabled(state); ui->FSradioButtonFisher->setEnabled(state); ui->FSradioButtonSFS->setEnabled(state); } void MainWindow::on_FSpushButtonOpenFile_clicked() { openFile(); FSupdateButtonState(); updateDatabaseInfo(); } void MainWindow::openFile() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open TextFile"), "", tr("Texts Files (*.txt)")); if (!database.load(fileName.toStdString())) QMessageBox::warning(this, "Warning", "File corrupted !!!"); else QMessageBox::information(this, fileName, "File loaded !!!"); } void MainWindow::on_FSpushButtonCompute_clicked() { int dimension = ui->FScomboBox->currentText().toInt(); if( ui->FSradioButtonFisher ->isChecked()) { if (dimension == 1 && database.getNoClass() == 2) { float FLD = 0, tmp; int max_ind = -1; //std::map<std::string, int> classNames = database.getClassNames(); for (uint i = 0; i < database.getNoFeatures(); ++i) { std::map<std::string, float> classAverages; std::map<std::string, float> classStds; for (auto const &ob : database.getObjects()) { classAverages[ob.getClassName()] += ob.getFeatures()[i]; classStds[ob.getClassName()] += ob.getFeatures()[i] * ob.getFeatures()[i]; } std::for_each(database.getClassCounters().begin(), database.getClassCounters().end(), [&](const std::pair<std::string, int> &it) { classAverages[it.first] /= it.second; classStds[it.first] = std::sqrt(classStds[it.first] / it.second - classAverages[it.first] * classAverages[it.first]); } ); tmp = std::abs(classAverages[ database.getClassNames()[0] ] - classAverages[database.getClassNames()[1]]) / (classStds[database.getClassNames()[0]] + classStds[database.getClassNames()[1]]); if (tmp > FLD) { FLD = tmp; max_ind = i; } } ui->FStextBrowserDatabaseInfo->append("max_ind: " + QString::number(max_ind) + " " + QString::number(FLD)); } } } void MainWindow::on_FSpushButtonSaveFile_clicked() { QString fileName = QFileDialog::getSaveFileName(this, tr("Open TextFile"), "D:\\Users\\Krzysiu\\Documents\\Visual Studio 2015\\Projects\\SMPD\\SMPD\\Debug\\", tr("Texts Files (*.txt)")); QMessageBox::information(this, "My File", fileName); database.save(fileName.toStdString()); } void MainWindow::on_PpushButtonSelectFolder_clicked() { } void MainWindow::on_CpushButtonOpenFile_clicked() { openFile(); bool anyObjectsFoundInFile = database.getObjects().size() > 0; ui->CpushButtonTrain->setEnabled(anyObjectsFoundInFile); if(!anyObjectsFoundInFile) { QMessageBox::information(this, "File loaded", "But it's empty..."); } } void MainWindow::on_CpushButtonSaveFile_clicked() { } void MainWindow::on_CpushButtonTrain_clicked() { int percentageTrainValues = ui->CplainTextEditTrainingPart->toPlainText().toInt(); bool canExecute = false; if (percentageTrainValues >= 100 || percentageTrainValues <= 0) { QMessageBox::warning(this, "Warning", "Percentage value should be in range 1-99"); } else { objectsCount = database.getNoObjects(); int trainObjectsCount = objectsCount * (percentageTrainValues/100.0); ui->CtextBrowser->append("Train objects: " + QString::number(trainObjectsCount) + "/" + QString::number(objectsCount)); objects = database.getObjects(); std::random_shuffle ( objects.begin(), objects.end()); trainingObjects = std::vector<Object>(objects.begin(), objects.begin() + trainObjectsCount); canExecute = true; } ui->CpushButtonExecute->setEnabled(canExecute); } void MainWindow::on_CpushButtonExecute_clicked() { int k = ui->CplainTextEditInputK->toPlainText().toInt(); if (k >= objectsCount || k <= 0) { QMessageBox::warning(this, "Warning", "Value should be in range 0-" + objectsCount); } else { double percentage = 0; switch(ui->CcomboBoxClassifiers->currentIndex()) { case 0: percentage = classifierNN.Execute(trainingObjects, objects, k); break; case 1: percentage = classifierNM.Execute(trainingObjects, objects, k); break; } ui->CtextBrowser->append("Good classification: " + QString::number(percentage) + "%"); } }
100bfcbbf0fe0e59baa75b6a195f7113a5423800
aa823472a02c0c07efe063b857f5cf88a71cea2e
/shad/algorithms/homework/football_crew.cpp
56998f4a255b238cf82abd5c68f23a1e4256af06
[]
no_license
adelkhafizova/homeworks
7bed93da790a9568cd196605c04e5bbbb17b992a
d45163dad0c68ca1573fd483a23c178afe030661
refs/heads/master
2021-01-10T14:50:33.525050
2015-11-18T17:45:03
2015-11-18T17:45:03
45,468,042
0
0
null
null
null
null
UTF-8
C++
false
false
1,790
cpp
football_crew.cpp
#include <iostream> #include <vector> #include <iterator> #include <algorithm> class Player { public: Player(int number, int effectiveness) { number_ = number; effectiveness_ = effectiveness; } bool operator < (const Player &right_player) { return this->effectiveness_ < right_player.effectiveness_; } private: int number_; int effectiveness_; }; template <typename RandomAccessIterator> void quicksort(RandomAccessIterator begin, RandomAccessIterator end) { if (begin != end) { std::cout << *begin << std::endl; std::cout << *(end-1) << std::endl; RandomAccessIterator left = begin; RandomAccessIterator right = end - 1; RandomAccessIterator middle = left + ((right - left) / 2); RandomAccessIterator median = (*left > *middle) ? middle : left; median = (*median < *right) ? right : median; while (left < right) { while (*left <= *median && left != (end - 1)) { ++left; } while (*median <= *right && right != begin) { --right; } if (left < right) { std::iter_swap(left, right); ++left; --right; } } std::iter_swap(left, median); quicksort(begin, left); quicksort(left + 1, end); //quicksort(begin, median); //quicksort(median+1, end); } } int main() { std::vector<int> data; int size = 0; std::cin >> size; for (int i = 0; i < size; i++) { int temp; std::cin >> temp; data.push_back(temp); } std::vector<int> data2(data); quicksort(data.begin(), data.end()); std::sort(data2.begin(), data2.end()); for (int i = 0; i < size; i++) { std::cout << data[i] << ' '; } std::cout << std::endl; for (int i = 0; i < size; i++) { std::cout << data2[i] << ' '; } std::cout << std::endl; }
27e0dd659e209e23fd1a39b4ae83c3791f293b89
bdbdedc6ca870c7b124cf67398141f99c1b3eccc
/Introduction to CP Using C++ April 2021 (ArnabSir)/37-Tuples3.cpp
71545aff7d1645c413b15569bae01bb02ff9c3fd
[]
no_license
iDLE1992/plus-course-content
ed4452286cc65e8a82cfb710cd75ffeb26313034
39ee72bb7453a9695bb3544a0c23dc45e1d112ea
refs/heads/main
2023-04-21T12:43:47.823276
2021-05-10T17:32:37
2021-05-10T17:32:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,022
cpp
37-Tuples3.cpp
//C++ code to demonstrate swap() #include<iostream> #include<tuple> // for swap() and tuple using namespace std; int main() { // Initializing 1st tuple tuple <int,char,float> tup1(20,'g',17.5); // Initializing 2nd tuple tuple <int,char,float> tup2(10,'f',15.5); // Printing 1st and 2nd tuple before swapping cout << "The first tuple elements before swapping are : "; cout << get<0>(tup1) << " " << get<1>(tup1) << " " << get<2>(tup1) << endl; cout << "The second tuple elements before swapping are : "; cout << get<0>(tup2) << " " << get<1>(tup2) << " " << get<2>(tup2) << endl; // Swapping tup1 values with tup2 tup1.swap(tup2); // Printing 1st and 2nd tuple after swapping cout << "The first tuple elements after swapping are : "; cout << get<0>(tup1) << " " << get<1>(tup1) << " " << get<2>(tup1) << endl; cout << "The second tuple elements after swapping are : "; cout << get<0>(tup2) << " " << get<1>(tup2) << " " << get<2>(tup2) << endl; return 0; }
8cb3f94bb1215be5897cb2feb7880452b9892b03
093aac4ab40bcd785533b7cae21a986eaf917711
/C++/089 클래스와const , 복사생성자.cpp
26cee2772079e54d7f507d5c58ec8c9ab1c7052c
[]
no_license
Fox-Rain/C_Plus_Plus
42408fb9a338b198ac6f16d8be44f5a7ba8bb716
736656e82606e861b1eb5efafa3a9063faf8318b
refs/heads/main
2023-06-14T20:43:04.195482
2021-07-14T07:26:14
2021-07-14T07:26:14
376,890,743
0
0
null
null
null
null
UHC
C++
false
false
1,801
cpp
089 클래스와const , 복사생성자.cpp
#include<iostream> using namespace std; class Something { public: int m_value = 0; Something(const Something &s) // 복사 생성자 << 인위적으로 복사생성자를 정의 한것이고 default복사 생성자는 원래 내재되어 있다. (보이지않게 저장되어있음) { m_value = s.m_value; cout << "Copy Constructor" << endl; } Something() // 일반 생성자 { cout << "Constructor" << endl; } void setValue(int value) { m_value = value; } int getValue() const // const로 고정된 클래스 객체에서 이용할 수 있도록 함수 선언 뒤에 const를 붙여줌 { // const는 컴파일러에게 "나는 변수값을 바꾸지않는 함수야" 하고 알려주는것과 같다. return m_value; // *** 값을 안바꾸는 함수는 다 const로 막아버리는것이 좋다 } }; void print(Something s) // 함수에서 클래스객체도 마찬가지로 인수로 보낼때에는 값을 복사해서 보내준다. { cout << s.getValue() << endl; cout << &s << endl; // 복사해서 들어온 것이므로 main안에서의 s의 주소와 다르다. } int main() { const Something something; // const로 클래스객체를 고정하게되면, 함수던 뭐던 값을 바꾸려는 것은 모두 불가능하게 된다. // 클래스 안에서 값을 바꾸지않는 함수중에 const가 붙은 함수만 이용할 수 있다. cout << &something << endl; print(something); // 함수 파라미터로 클래스 객체가 들어갈때에는 "복사생성자"가 실행됨 (복사생성자도 디폴트로 보이지 않게 존재하며, 사용자가 복사생성자르 따로 생성하면 // 다른 디폴트 복사 생성자는 사라지게 된다.) return 0; }
e26f81b862746317eaf9d5dbb41521344bb8c783
21f55ef1427f19f40d40e6c0438cfe7c3573159b
/Semester 3/Data Structures/Other Codes/Practice/Amicable.cpp
1f63b807431b6f363757048c63a0c5093dddd905
[]
no_license
SyedAsadAbrar/University-Assignments
fa80159d24eed85ae70e8aaf20041acd96b95861
e11b449fc2de2a07ea3b4a4aa3e3af29dee6447d
refs/heads/master
2022-11-15T12:49:02.257410
2022-11-12T23:06:41
2022-11-12T23:06:41
167,517,803
0
0
null
null
null
null
UTF-8
C++
false
false
411
cpp
Amicable.cpp
#include<iostream> using namespace std; int amicable_pair(int n1, int n2) { int sum1=0; int sum2=0; int indicator=0; for (int i=1;i<=(n1/2);i++) { if (n1%i==0) { sum1=sum1+i; } } for (int i=1;i<=(n2/2);i++) { if (n2%i==0) { sum2=sum2+i; } } if (sum1==n2 && sum2==n1) { indicator=1; } return indicator; } int main() { cout<<amicable_pair(285,220); system("pause"); return 0; }
5ee862d05ed9ab7efa6057c31127b07d3447949a
aacee20988ddd8087b8f4f8239c7fca9e02b4d16
/第十章/8/8/main.cpp
9995739425fd42ac78b44c905a7774e98ddb58fb
[]
no_license
f01965/C-primer-plus-6
9e7012aa63075043061d062301498b9bf078c8e3
c4913a57647910addc66a22dfb1f5c513709a808
refs/heads/master
2021-01-26T01:35:31.493273
2020-02-27T11:45:36
2020-02-27T11:45:36
243,254,612
0
0
null
null
null
null
UTF-8
C++
false
false
547
cpp
main.cpp
#include "list.h" #include <iostream> void addData(Item &it) { it.data = 6789; } int main() { List list; Item item = { "f01965",1000 }; Item item2 = { "zzzz",2000 }; if (list.isEmpty()) { std::cout << "List is empty " << std::endl; } list.additem(item); list.additem(item2); std::cout << "Count = " << list.Count() << std::endl; list.show(); if (list.isFull()) { std::cout << "List is not Full " << std::endl; } std::cout << "Change Something " << std::endl; list.visit(addData); list.show(); system("pause"); return 0; }
a2b3e9a1548ae1366026cc51ece77507fd7f8d4b
215c3965a80d424d84df20df798d6415daca2ec3
/openarms/control/chatter.cpp
841a7fc10ed498a4843e04e6d16d90d5afa97f01
[]
no_license
codebot/stanford-ros-pkg
ed6aa774d2a3d229cff3e43819732c89cea1cba7
9e85d6cd3ae0403e32b014c09e907b85699c82ba
refs/heads/master
2021-01-10T13:10:47.774266
2012-02-11T21:24:07
2012-02-11T21:24:07
36,405,200
0
0
null
null
null
null
UTF-8
C++
false
false
1,933
cpp
chatter.cpp
#include <ros/ros.h> #include "openarms/ArmSensors.h" #include "openarms/ArmActuators.h" using std::string; double g_gripper_target = 0; ros::Publisher *g_actuator_pub = NULL; openarms::ArmActuators g_actuators; //double g_stepper_vel[4]; uint16_t g_encoder_target[4] = {0, 0, 0, 0}; void sensors_cb(const openarms::ArmSensors::ConstPtr &msg) { const double MAX_VEL_BIGDOGS = 1000, MAX_VEL_LITTLEDOGS = 1000; const double MAX_ACCEL_PER_SEC = 20000; static ros::Time s_prev_time; static bool s_prev_time_init = false; static double s_prev_encoder[4]; static bool chatter_forward = true; if (!s_prev_time_init) { s_prev_time_init = true; s_prev_time = ros::Time::now(); for (int i = 0; i < 4; i++) s_prev_encoder[i] = 0; return; } else { ros::Time t = ros::Time::now(); double dt = (t - s_prev_time).toSec(); if (dt > 0.05) { for (int i = 0; i < 4; i++) g_actuators.stepper_vel[i] = 0; for (int i = 0; i < 1; i++) { if (chatter_forward) g_actuators.stepper_vel[i] = 50; else g_actuators.stepper_vel[i] = -50; } chatter_forward = !chatter_forward; s_prev_time = t; } for (int i = 4; i < 8; i++) g_actuators.servo_torque[i-4] = 0; g_actuator_pub->publish(g_actuators); } } int main(int argc, char **argv) { ros::init(argc, argv, "find_stepper_home"); ros::NodeHandle n; ros::Subscriber sensors_sub = n.subscribe("arm_sensors", 1, sensors_cb); ros::Publisher actuator_pub = n.advertise<openarms::ArmActuators>("arm_actuators_autopilot", 1); g_actuator_pub = &actuator_pub; g_actuators.stepper_vel.resize(4); g_actuators.servo_torque.resize(4); for (int i = 0; i < 4; i++) { g_actuators.stepper_vel[i] = 0; g_actuators.servo_torque[i] = 0; } ros::Rate loop_rate(100); while (ros::ok()) { loop_rate.sleep(); ros::spinOnce(); } }
27125521e54c056cbb795c8cc516032cb164572b
5aa52dab884205a718bff86a647e68d5db22bd7d
/FML/COLASolver/src/Cosmology.h
f3daf8b0a9ad3386e30fea03eeec336ee85fba1d
[]
no_license
willlake/FML
bf3e5286bd56792fdc061387d193c6688a129552
6a88e1dab5d34d73ad13cdfdccb2a754f4f8672f
refs/heads/master
2023-03-23T09:52:03.556402
2021-03-22T14:57:33
2021-03-22T14:57:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,740
h
Cosmology.h
#ifndef COSMOLOGY_HEADER #define COSMOLOGY_HEADER #include <FML/FFTWGrid/FFTWGrid.h> #include <FML/Global/Global.h> #include <FML/Interpolation/ParticleGridInterpolation.h> #include <FML/LPT/DisplacementFields.h> #include <FML/ODESolver/ODESolver.h> #include <FML/ParameterMap/ParameterMap.h> #include <FML/Spline/Spline.h> #include <FML/Units/Units.h> #include <cmath> #include <memory> #ifndef __clang__ const double riemann_zeta3 = std::riemann_zeta(3.0); const double riemann_zeta4 = std::riemann_zeta(4.0); const double riemann_zeta5 = std::riemann_zeta(5.0); #else // clang does not have riemann_zeta so hardcode it const double riemann_zeta3 = 1.20205690315959; const double riemann_zeta4 = 1.08232323371113; const double riemann_zeta5 = 1.03692775514336; #endif /// Base class for a general cosmology class Cosmology { public: using ParameterMap = FML::UTILS::ParameterMap; using ODESolver = FML::SOLVERS::ODESOLVER::ODESolver; using Spline = FML::INTERPOLATION::SPLINE::Spline; using Spline2D = FML::INTERPOLATION::SPLINE::Spline2D; using Constants = FML::UTILS::ConstantsAndUnits; using DVector = FML::INTERPOLATION::SPLINE::DVector; //======================================================================== // Constructors //======================================================================== Cosmology() = default; //======================================================================== // Print some info. // In derived class remember to also call the base class (this) //======================================================================== virtual void info() const { if (FML::ThisTask == 0) { std::cout << "\n"; std::cout << "#=====================================================\n"; std::cout << "# Cosmology [" << name << "]\n"; std::cout << "# Omegab : " << Omegab << "\n"; std::cout << "# OmegaM : " << OmegaM << "\n"; std::cout << "# OmegaMNu : " << OmegaMNu << "\n"; std::cout << "# OmegaCDM : " << OmegaCDM << "\n"; std::cout << "# OmegaLambda : " << OmegaLambda << "\n"; std::cout << "# OmegaR : " << OmegaR << "\n"; std::cout << "# OmegaNu : " << OmegaNu << "\n"; std::cout << "# OmegaRtot : " << OmegaRtot << "\n"; std::cout << "# OmegaK : " << OmegaK << "\n"; std::cout << "# h : " << h << "\n"; std::cout << "# N_nu : " << N_nu << "\n"; std::cout << "# Neff : " << Neff << "\n"; std::cout << "# Mnu : " << Mnu_eV << " eV\n"; std::cout << "# TCMB : " << TCMB_kelvin << " K\n"; std::cout << "# Tnu : " << Tnu_kelvin << " K\n"; std::cout << "# As : " << As << "\n"; std::cout << "# ns : " << ns << "\n"; std::cout << "# kpivot : " << kpivot_mpc << " 1/Mpc\n"; } } //======================================================================== // Primodial poweer-spetrum //======================================================================== virtual double get_primordial_pofk(double k_hmpc) { return 2.0 * M_PI * M_PI / (k_hmpc * k_hmpc * k_hmpc) * As * std::pow(h * k_hmpc / kpivot_mpc, ns - 1.0); } //======================================================================== // Solve the background (for models where this is needed) // Here we solve and spline the boltzmann integrals for the neutrino // energy density. This should be called for derived classes! //======================================================================== virtual void init() { solve_for_neutrinos(); } //======================================================================== // Neutrino specific things. For exact treatment of neutrinos in the // background //======================================================================== void solve_for_neutrinos() { // Solve for the neutrino boltzmann factor needed to define the background properly auto solve_ode = [&](double val) { FML::SOLVERS::ODESOLVER::ODEFunction deriv = [&](double x, [[maybe_unused]] const double * y, double * dydx) { dydx[0] = x * x * std::sqrt(x * x + val * val) / (1.0 + std::exp(x)); return GSL_SUCCESS; }; FML::SOLVERS::ODESOLVER::ODESolver ode; std::vector<double> x_arr{0.0, 20.0}; std::vector<double> yini{0.0}; ode.solve(deriv, x_arr, yini); return ode.get_final_data_by_component(0); }; // Compute and spline F(y) / (F(0) + C y). This converges to 1 in both ends // so no issue with splines evaluated out of bounds (as it returns closest value) const int npts = 200; const double ymin = 0.01; const double ymax = 1000.0; std::vector<double> y_arr(npts), f_arr(npts); for (int i = 0; i < npts; i++) { y_arr[i] = i == 0 ? 0.0 : std::exp(std::log(ymin) + std::log(ymax / ymin) * (i - 1) / double(npts - 2)); f_arr[i] = solve_ode(y_arr[i]) / (sixeta4 + twoeta3 * y_arr[i]); } neutrino_boltzmann_integral_spline.create(y_arr, f_arr, "Neutrino boltzmann integral"); } // Boltzmann integral for energy density F(y) (where y is proportional to the mass) double get_neutrino_boltzmann_integral(double y) const { return neutrino_boltzmann_integral_spline(y) * (sixeta4 + twoeta3 * y); } // Boltzmann integral for energy density derivativedF(y)/dlogy double get_dneutrino_boltzmann_integral_dlogy(double y) const { return y * (neutrino_boltzmann_integral_spline.deriv_x(y) * (sixeta4 + twoeta3 * y) + twoeta3 * neutrino_boltzmann_integral_spline(y)); } // rhoNu / rhocrit0 used for exact treatment of neutrinos going from relativistic -> non-relativistic double get_rhoNu_exact(double a) const { static double norm = get_neutrino_boltzmann_integral(0); double y = Mnu_eV / get_neutrino_temperature_eV(a) / N_nu; return OmegaNu / (a * a * a * a) * get_neutrino_boltzmann_integral(y) / norm; } // Derivative of rhoNu double get_drhoNudloga_exact(double a) const { static double norm = get_neutrino_boltzmann_integral(0); double y = Mnu_eV / get_neutrino_temperature_eV(a) / N_nu; return OmegaNu / (a * a * a * a) * (-4.0 * get_neutrino_boltzmann_integral(y) + get_dneutrino_boltzmann_integral_dlogy(y)) / norm; } // Sound speed over c in non-relativitic limit (1408.2995). Truncating at the free radiation sounds speed if // evaluated for very larger redshifts double get_neutrino_sound_speed_cs_over_c(double a) const { return std::min(nu_sound_speed_factor * get_neutrino_temperature_eV(a) / Mnu_eV, 1.0 / std::sqrt(3.0)); } // Free streaming scale for the neutrinos (1408.2995) double get_neutrino_free_streaming_scale_hmpc(double a) const { return std::sqrt(1.5 * OmegaM / a) / get_neutrino_sound_speed_cs_over_c(a) * H0_hmpc; } // Neutrino temperature in eV double get_neutrino_temperature_eV(double a) const { return (Tnu_kelvin * units.K * units.k_b / units.eV) / a; } //======================================================================== // Read the parameters we need // In derived class remember to also call the base class (this) //======================================================================== virtual void read_parameters(ParameterMap & param) { FML::UTILS::ConstantsAndUnits u; OmegaMNu = param.get<double>("cosmology_OmegaMNu"); Omegab = param.get<double>("cosmology_Omegab"); OmegaCDM = param.get<double>("cosmology_OmegaCDM"); OmegaLambda = param.get<double>("cosmology_OmegaLambda"); OmegaM = Omegab + OmegaCDM + OmegaMNu; h = param.get<double>("cosmology_h"); As = param.get<double>("cosmology_As"); ns = param.get<double>("cosmology_ns"); kpivot_mpc = param.get<double>("cosmology_kpivot_mpc"); Neff = param.get<double>("cosmology_Neffective"); TCMB_kelvin = param.get<double>("cosmology_TCMB_kelvin"); // Neutrino to photon temperature today Tnu_kelvin = TCMB_kelvin * std::pow(Neff / 3.0, 0.25) * std::pow(4.0 / 11.0, 1.0 / 3.0); // Compute photon density parameter const double N_photon = 2; const double rho_critical_today_over_h2 = 3.0 * u.H0_over_h * u.H0_over_h / (8.0 * M_PI * u.G); const double OmegaRh2 = N_photon * sixzeta4 / (2.0 * M_PI * M_PI) * std::pow(u.k_b * TCMB_kelvin * u.K / u.hbar, 4) * u.hbar / std::pow(u.c, 5) / rho_critical_today_over_h2; OmegaR = OmegaRh2 / (h * h); // Neutrino density parameter const double OmegaNuh2 = (7.0 / 8.0) * N_nu * std::pow(Tnu_kelvin / TCMB_kelvin, 4) * OmegaRh2; OmegaNu = OmegaNuh2 / (h * h); // Set the sum of the masses of the neutrinos Mnu_eV = (OmegaMNu / OmegaNu) / twoeta3 * sixeta4 * N_nu * ((Tnu_kelvin * u.K * u.k_b / u.eV)); // Simpler expression: Mnu_eV = 93.14 * OmegaMNu * h * h; // Total radiation density (in the early Universe) OmegaRtot = OmegaR + OmegaNu; // Curvature is whats left. Just set it to 0 if its super small OmegaK = 1.0 - OmegaM - OmegaRtot - OmegaLambda; if (std::fabs(OmegaK) < 1e-5) { OmegaLambda -= OmegaK; OmegaK = 0.0; } // Well to be super precise its really (to avoid overcounting the neutrinos today which are matter): // OmegaK = 1.0 - (OmegaLambda + OmegaR + OmegaCDM + Omegab + OmegaNu * F(y_today)/F(0)); } //======================================================================== // Functions all models have (but expressions might differ so we make them virtual) //======================================================================== virtual double get_OmegaMNu(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaMNu / (a * a * a * E * E); } virtual double get_Omegab(double a = 1.0) const { double E = HoverH0_of_a(a); return Omegab / (a * a * a * E * E); } virtual double get_OmegaM(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaM / (a * a * a * E * E); } virtual double get_OmegaCDM(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaCDM / (a * a * a * E * E); } virtual double get_OmegaR(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaR / (a * a * a * a * E * E); } virtual double get_OmegaNu(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaNu / (a * a * a * a * E * E); } virtual double get_OmegaNu_exact(double a = 1.0) const { double E = HoverH0_of_a(a); return get_rhoNu_exact(a) / (E * E); } virtual double get_OmegaRtot(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaRtot / (a * a * a * a * E * E); } virtual double get_OmegaK(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaK / (a * a * E * E); } virtual double get_OmegaLambda(double a = 1.0) const { double E = HoverH0_of_a(a); return OmegaLambda / (E * E); } virtual double HoverH0_of_a([[maybe_unused]] double a) const = 0; virtual double dlogHdloga_of_a([[maybe_unused]] double a) const = 0; //======================================================================== // Output the stuff we compute //======================================================================== virtual void output(std::string filename) const { std::ofstream fp(filename.c_str()); if (not fp.is_open()) return; fp << "# a H/H0 dlogHdloga OmegaM OmegaRtot OmegaLambda\n"; for (int i = 0; i < npts_loga; i++) { double loga = std::log(alow) + std::log(ahigh / alow) * i / double(npts_loga); double a = std::exp(loga); fp << std::setw(15) << a << " "; fp << std::setw(15) << HoverH0_of_a(a) << " "; fp << std::setw(15) << dlogHdloga_of_a(a) << " "; fp << std::setw(15) << get_OmegaM(a) << " "; fp << std::setw(15) << get_OmegaR(a) << " "; fp << std::setw(15) << get_OmegaNu(a) << " "; fp << std::setw(15) << get_OmegaMNu(a) << " "; fp << std::setw(15) << get_OmegaNu_exact(a) << " "; fp << std::setw(15) << get_OmegaLambda(a) << " "; fp << "\n"; } } double get_h() const { return h; } double get_As() const { return As; } double get_ns() const { return ns; } double get_TCMB_kelvin() const { return TCMB_kelvin; } double get_Neff() const { return Neff; } double get_kpivot_mpc() const { return kpivot_mpc; } std::string get_name() { return name; } void set_As(double _As) { As = _As; } void set_ns(double _ns) { ns = _ns; } void set_kpivot_mpc(double _kpivot_mpc) { kpivot_mpc = _kpivot_mpc; } virtual ~Cosmology() = default; protected: //======================================================================== // Parameters all models have (Baryons, CDM, neutrinos, Cosmological constant) //======================================================================== const double H0_hmpc = 1.0 / 2997.92458; double h; // Hubble parameter (little h) double OmegaMNu; // Massive neutrinos (in the matter era) double Omegab; // Baryons double OmegaM; // Total matter (in the matter era) double OmegaCDM; // Cold dark matter double OmegaLambda; // Dark energy double OmegaR; // Photons double OmegaNu; // Neutrinos (density set by Neff) double OmegaRtot; // Total relativistic (in the radiation era) double OmegaK; // Curvature. Derived from Sum Omega == 1 double Neff; // Effecive number of non-photon relativistic species (3.046) double TCMB_kelvin; // Temperature of the CMB today in Kelvin double Tnu_kelvin; // Temperature of the neutrinos today in Kelvin. Derived from Neff and TCMB double Mnu_eV; // Sum of the neutrino masses in eV. Derived from OmegaMNu and h const double N_nu{3}; // Number of neutrinos (3) std::string name; // For neutrinos in the background const double twoeta3{3.0 / 2.0 * riemann_zeta3}; const double sixeta4{7.0 / 120.0 * M_PI * M_PI * M_PI * M_PI}; const double sixzeta4{6.0 * riemann_zeta4}; const double nu_sound_speed_factor{std::sqrt(25.0 * riemann_zeta5 / riemann_zeta3 / 3.0)}; Spline neutrino_boltzmann_integral_spline; Constants units; //======================================================================== // Primordial power-spectrum //======================================================================== double As; double ns; double kpivot_mpc; //======================================================================== // Ranges for splines of growth-factors //======================================================================== const int npts_loga = 200; const double alow = 1.0 / 1000.0; const double ahigh = 100.0; }; #endif
3c32d1149ac59a2a3c5f956bfe316975dfff4d35
d1074706bf55522e1b8d4a21b5a67e3c16f86a19
/UI/back_end/Instruction.cpp
19e96285d4e61071aa6b060b8fa00a3f4f692847
[]
no_license
PhucNguyenSolver/ARMv8
5f59c6ffaf26cf8026570e39ef30fbe731055df6
ba3869d09de25854d045e79988e48121d223f0ab
refs/heads/main
2023-05-14T15:11:26.654672
2021-05-30T04:40:00
2021-05-30T04:40:00
367,106,376
0
0
null
2021-05-18T03:17:25
2021-05-13T16:18:34
C++
UTF-8
C++
false
false
22,948
cpp
Instruction.cpp
#include <algorithm> #include <vector> #include <bitset> #include <chrono> #include <climits> #include <iostream> #include <sstream> #include <thread> #include "Utils.h" #include "Instruction.h" inline bool validRegisterName(string registerName) { int index = Hardware::indexOf(registerName); return index != -1; } inline void my_assert(bool cond, string errorMessage = "exception") { if (!cond) throw errorMessage.c_str(); } inline long sys_rand() { return ((long)rand() << 32) | rand(); } Instruction::Instruction(string s) { this->s = s; } Instruction::Instruction(Hardware *hardware, string s) : hardware(hardware) { this->s = s; } /*-----------------------------*/ Instruction::IType Instruction::instructionType(string s) // TODO: add defined instruction to sets { static vector<string> CBSet{"CBZ", "CBNZ", "B.NE", "B.EQ", "B.LT", "B.LE", "B.GT", "B.GE", "B.HS"}; static vector<string> RSet{"ADD", "AND", "SUB", "EOR", "LSL", "LSR", "ORR", "AND", "BR", "FADDS", "FCMPS", "FDIVS", "FMULS", "FSUBS"}; static vector<string> ISet{"ADDI", "ANDI", "SUBI", "ADDIS", "ANDIS", "SUBIS", "EORI", "ORRI"}; static vector<string> DSet{"LDUR", "LDURB", "LDURH", "LDURSW", "LDXR", "STUR", "STURB", "LDURH", "LDURSW", "LDXR"}; // 10 types static vector<string> BSet{"B", "BL"}; static vector<string> PISet{"CMP", "CMPI", "LDA", "MOV"}; string name = Parsing::parseTokens(s)[0]; if (find(RSet.begin(), RSet.end(), name) != RSet.end()) return IType::R; else if (find(ISet.begin(), ISet.end(), name) != ISet.end()) return IType::I; else if (find(DSet.begin(), DSet.end(), name) != DSet.end()) return IType::D; else if (find(BSet.begin(), BSet.end(), name) != BSet.end()) return IType::B; else if (find(CBSet.begin(), CBSet.end(), name) != CBSet.end()) return IType::CB; else if (find(PISet.begin(), PISet.end(), name) != PISet.end()) return IType::PI; else if (name == "syscall") return IType::Syscall; else { string errorMessage = "undefined instruction here [" + name + "]"; throw errorMessage.c_str(); } } /*-----------------------------*/ void RInstruction::setFlags(long res, long a, long b) { if (res < 0) hardware->flags.setN(true); else if (res == 0) hardware->flags.setZ(true); if (hardware->flags.checkOverflow(a, b)) hardware->flags.setC(true); if (hardware->flags.checkFlagCarry(a, b)) hardware->flags.setV(true); } // RInstruction::RInstruction(string s) : Instruction(s) {} // RInstruction::RInstruction(Hardware *hardware, string s) : Instruction(hardware, s) {} /*-----------------------------*/ void IInstruction::setFlags(long res, long a, long b) { if (res < 0) hardware->flags.setN(true); else if (res == 0) hardware->flags.setZ(true); if (hardware->flags.checkOverflow(a, b)) hardware->flags.setC(true); if (hardware->flags.checkFlagCarry(a, b)) hardware->flags.setV(true); } /*-----------------------------*/ void DInstruction::Store(char *des, char *source, int n, int size) { for (int i = 0; i < n; i++) *(des + i) = *(source + size - n + i); } /*-----------------------------*/ void RInstruction::execute() { // Old version below may throw exception on invalid register vector<string> insWord = Parsing::parseTokens(s); if (!insWord[0].compare("ADD") || !insWord[0].compare("ADDS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) + hardware->GetRegister(insWord[3])); if (!insWord[0].compare("ADDS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), hardware->GetRegister(insWord[3])); } else if (!insWord[0].compare("AND") || !insWord[0].compare("ANDS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) & hardware->GetRegister(insWord[3])); if (!insWord[0].compare("ANDS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), hardware->GetRegister(insWord[3])); } else if (!insWord[0].compare("EOR")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) ^ hardware->GetRegister(insWord[3])); else if (!insWord[0].compare("LSL")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) << stoi(insWord[3])); else if (!insWord[0].compare("LSR")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) >> stoi(insWord[3])); else if (!insWord[0].compare("ORR")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) | hardware->GetRegister(insWord[3])); else if (!insWord[0].compare("AND")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) & hardware->GetRegister(insWord[3])); else if (!insWord[0].compare("SUB") || !insWord[0].compare("SUBS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) - hardware->GetRegister(insWord[3])); if (!insWord[0].compare("SUBS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), hardware->GetRegister(insWord[3])); } else if (!insWord[0].compare("BR")) hardware->PC = hardware->GetRegister(insWord[1]); //update float instructions else if (!insWord[0].compare("FADDS")) hardware->setFloatRegister(insWord[1], hardware->getFloatRegister(insWord[2]) + hardware->getFloatRegister(insWord[3])); else if (!insWord[0].compare("FSUBS")) hardware->setFloatRegister(insWord[1], hardware->getFloatRegister(insWord[2]) - hardware->getFloatRegister(insWord[3])); else if (!insWord[0].compare("FMULS")) hardware->setFloatRegister(insWord[1], hardware->getFloatRegister(insWord[2]) * hardware->getFloatRegister(insWord[3])); else if (!insWord[0].compare("FDIVS")) hardware->setFloatRegister(insWord[1], hardware->getFloatRegister(insWord[2]) / hardware->getFloatRegister(insWord[3])); } void IInstruction::execute() { vector<string> insWord = Parsing::parseTokens(s); if (!insWord[0].compare("ADDI") || !insWord[0].compare("ADDIS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) + stoi(insWord[3])); if (!insWord[0].compare("ADDIS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), stoi(insWord[3])); } else if (!insWord[0].compare("ANDI") || !insWord[0].compare("ANDIS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) & stoi(insWord[3])); if (!insWord[0].compare("ANDIS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), stoi(insWord[3])); } else if (!insWord[0].compare("EORI")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) ^ stoi(insWord[3])); else if (!insWord[0].compare("ORRI")) hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) | stoi(insWord[3])); else if (!insWord[0].compare("SUBI") || !insWord[0].compare("SUBIS")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2]) - stoi(insWord[3])); if (!insWord[0].compare("SUBIS")) setFlags(hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2]), stoi(insWord[3])); } } void BInstruction::execute() { vector<string> insWord = Parsing::parseTokens(s); if (!insWord[0].compare("B")) { hardware->PC = PreProcess::label[insWord[1]]; cout << "PC is: " << hardware->PC << '\n'; } else if (!insWord[0].compare("BL")) { hardware->SetRegister("X30", hardware->PC); hardware->PC = PreProcess::label[insWord[1]]; } } // TODO: test LDUR - offset in byte void CBInstruction::execute() { vector<string> insWord = Parsing::parseTokens(s); string command = insWord[0]; if (command == "CBZ") { if (hardware->GetRegister(insWord[1]) == 0) hardware->PC = PreProcess::label[insWord[2]]; } else if (command == "CBNZ") { if (hardware->GetRegister(insWord[1]) != 0) hardware->PC = PreProcess::label[insWord[2]]; } else if ((command == "B.NE" && hardware->flags.ne()) || (command == "B.EQ" && hardware->flags.eq()) || (command == "B.LT" && hardware->flags.lt()) || (command == "B.LE" && hardware->flags.le()) || (command == "B.GT" && hardware->flags.gt()) || (command == "B.GE" && hardware->flags.ge()) || (command == "B.HS" && hardware->flags.hs())) hardware->PC = PreProcess::label[insWord[1]]; } /*-----------------------------*/ void DInstruction::toggle(char *start, int n) { for (int i = 0; i < n / 2; i++) { std::swap(start[i], start[n - i - 1]); } } void DInstruction::Load(char *des, char *source, int n, bool wide_sign, int size) { int sign = *(source)&0x80; for (int i = 0; i < n; i++) *(des + size - n + i) = *(source + i); for (int i = 0; i < size - n; i++) *(des + i) = *(des + i) & 0x00; if (wide_sign) { if (sign != 0) for (int i = 0; i < size - n; i++) *(des + i) = *(des + i) | 0xff; } this->toggle(des, size); } void DInstruction::execute() { vector<string> insWord = Parsing::parseTokens(s); if (!insWord[0].compare("LDUR")) { if (hardware->_data.find(insWord[2]) != hardware->_data.end()) { int value = hardware->_data[insWord[2]]; hardware->SetRegister(insWord[1], value); return; } long tempregister; int size = sizeof(tempregister); int index; index = hardware->GetRegister(insWord[2]) + stoi(insWord[3]); this->Load((char *)(&tempregister), hardware->_mem->mem + index, size, false, size); hardware->SetRegister(insWord[1], tempregister); } else if (!insWord[0].compare("LDURB")) { long tempregister; int size = sizeof(tempregister); int index = hardware->GetRegister(insWord[2]) + stoi(insWord[3]); this->Load((char *)(&tempregister), hardware->_mem->mem + index, 1, false, size); hardware->SetRegister(insWord[1], tempregister); } else if (!insWord[0].compare("LDURH")) { long tempregister; int size = sizeof(tempregister); int index = hardware->GetRegister(insWord[2]) + stoi(insWord[3]); this->Load((char *)(&tempregister), hardware->_mem->mem + index, 2, false, size); hardware->SetRegister(insWord[1], tempregister); } else if (!insWord[0].compare("LDURSW")) { long tempregister; int size = sizeof(tempregister); int index = hardware->GetRegister(insWord[2]) + stoi(insWord[3]); this->Load((char *)(&tempregister), hardware->_mem->mem + index, 4, true, size); hardware->SetRegister(insWord[1], tempregister); } else if (!insWord[0].compare("LDXR")) cout << 0; else if (!insWord[0].compare("STUR")) { long tempregister = hardware->GetRegister(insWord[1]); int size = sizeof(tempregister); this->toggle((char *)(&tempregister), size); int index = hardware->GetRegister(insWord[2]); int offset = stoi(insWord[3]); //cout << "index: " << index << endl // << "ofsset: " << offset << endl; this->Store(hardware->_mem->mem + index + offset, (char *)(&tempregister), size, size); } else if (!insWord[0].compare("STURB")) { long tempregister = hardware->GetRegister(insWord[1]); int size = sizeof(tempregister); this->toggle((char *)(&tempregister), size); int index = hardware->GetRegister(insWord[2]); int offset = stoi(insWord[3]); this->Store(hardware->_mem->mem + index + offset, (char *)(&tempregister), 1, size); } else if (!insWord[0].compare("STURH")) { long tempregister = hardware->GetRegister(insWord[1]); int size = sizeof(tempregister); this->toggle((char *)(&tempregister), size); int index = hardware->GetRegister(insWord[2]); int offset = stoi(insWord[3]); this->Store(hardware->_mem->mem + index + offset, (char *)(&tempregister), 2, size); } else if (!insWord[0].compare("STURW")) { long tempregister = hardware->GetRegister(insWord[1]); int size = sizeof(tempregister); this->toggle((char *)(&tempregister), size); int index = hardware->GetRegister(insWord[2]); int offset = stoi(insWord[3]); this->Store(hardware->_mem->mem + index + offset, (char *)(&tempregister), 4, size); } else if (!insWord[0].compare("STUXR")) // TODO: STUXR cout << 0; else cout << 0; } /*-----------------------------*/ RInstruction ::RInstruction(Hardware *hardware, string s) : Instruction(hardware, s) { // ----- catch error vector<string> tokensList = Parsing::parseTokens(s); string command = tokensList[0]; string errorMessage = "invalid register "; if (command == "BR") { my_assert(tokensList.size() == 2, "invalid number of arguments"); my_assert(validRegisterName(tokensList[1])); } else { my_assert(tokensList.size() == 4, "invalid number of arguments"); my_assert(validRegisterName(tokensList[1]), errorMessage + tokensList[1]); my_assert(validRegisterName(tokensList[2]), errorMessage + tokensList[2]); my_assert(validRegisterName(tokensList[3]), errorMessage + tokensList[3]); } } IInstruction ::IInstruction(Hardware *hardware, string s) : Instruction(hardware, s) { // ----- catch error // ----- format I: R R num vector<string> tokensList = Parsing::parseTokens(s); string errorMessage = "invalid register "; my_assert(tokensList.size() == 4, "invalid number of arguments"); my_assert(validRegisterName(tokensList[1]), errorMessage + tokensList[1]); my_assert(validRegisterName(tokensList[2]), errorMessage + tokensList[2]); try { int number = stoi(tokensList[3]); } catch(...) { string errorMessage = (string) "invalid arguments ["; errorMessage += tokensList[3]; errorMessage += (string) "] a number expexcted"; throw errorMessage.c_str(); } } BInstruction ::BInstruction(Hardware *hardware, string s) : Instruction(hardware, s) { vector<string> tokensList = Parsing::parseTokens(s); my_assert(tokensList.size() == 2, "invalid number of arguments"); if (PreProcess::label.find(tokensList[1]) == PreProcess::label.end()) throw "label not found"; } CBInstruction ::CBInstruction(Hardware *hardware, string s) : Instruction(hardware, s) { vector<string> tokensList = Parsing::parseTokens(s); string command = tokensList[0]; if (command == "CBZ" || command == "CBNZ") { my_assert(tokensList.size() == 3, "invalid number of arguments"); if (PreProcess::label.find(tokensList[2]) == PreProcess::label.end()) throw "label not found"; } else { my_assert(tokensList.size() == 2, "invalid number of arguments"); if (PreProcess::label.find(tokensList[1]) == PreProcess::label.end()) throw "label not found"; } } DInstruction ::DInstruction(Hardware *hardware, string s) : Instruction(hardware, s) {} PIInstruction ::PIInstruction(Hardware *hardware, string s) : DInstruction(hardware, s) {} SyscallInstruction::SyscallInstruction(Hardware *hardware, string s) : Instruction(hardware, s) {} RInstruction ::RInstruction(string s) : Instruction(s) {} IInstruction ::IInstruction(string s) : Instruction(s) {} DInstruction ::DInstruction(string s) : Instruction(s) {} BInstruction ::BInstruction(string s) : Instruction(s) {} CBInstruction ::CBInstruction(string s) : Instruction(s) {} PIInstruction ::PIInstruction(string s) : DInstruction(s) {} SyscallInstruction::SyscallInstruction(string s) : Instruction(s) {} void PIInstruction::setFlags(long res, long a, long b) { if (res < 0) hardware->flags.setN(true); else if (res == 0) hardware->flags.setZ(true); if (hardware->flags.checkOverflow(a, b)) hardware->flags.setC(true); if (hardware->flags.checkFlagCarry(a, b)) hardware->flags.setV(true); } void PIInstruction::execute() { vector<string> insWord = Parsing::parseTokens(s); if (!insWord[0].compare("CMP")) { long tempregister; tempregister = hardware->GetRegister(insWord[1]) - hardware->GetRegister(insWord[2]); if (!insWord[0].compare("SUBS")) setFlags(tempregister, hardware->GetRegister(insWord[1]), hardware->GetRegister(insWord[2])); } else if (!insWord[0].compare("CMPI")) { long tempregister; tempregister = hardware->GetRegister(insWord[1]) - stoi(insWord[2]); if (!insWord[0].compare("SUBS")) setFlags(tempregister, hardware->GetRegister(insWord[1]), stoi(insWord[2])); } else if (!insWord[0].compare("LDA")) { long tempregister; int size = sizeof(tempregister); int index; if (hardware->_data.find(insWord[2]) != hardware->_data.end()) index = hardware->_data[insWord[2]]; else index = hardware->GetRegister(insWord[2]) + stoi(insWord[3]); this->Load((char *)(&tempregister), hardware->_mem->mem + index, size, false, size); hardware->SetRegister(insWord[1], tempregister); } else if (!insWord[0].compare("MOV")) { hardware->SetRegister(insWord[1], hardware->GetRegister(insWord[2])); } } /*-----------------------------*/ void SyscallInstruction::execute() { using namespace std; long value = hardware->GetRegister("X0"); switch (value) { case 1: // print integer { long print_value = hardware->GetRegister("X1"); MainWindow::buffer << print_value; MainWindow::printOutput(); break; } case 2: // print float { MainWindow::buffer << "float print"; MainWindow::printOutput(); break; } case 3: // print double { MainWindow::buffer << "double print"; MainWindow::printOutput(); break; } case 4: // print string { int index = (int)hardware->GetRegister("X1"); string print_value = ""; print_value = hardware->_mem->getString(index); MainWindow::buffer << print_value << endl; MainWindow::printOutput(); break; } case 5: // read integer { long read_value; string msg = "Enter an integer value (syscall 5)"; read_value = (MainWindow::getInputWithMessage(msg)).toLong(); // read_value = (MainWindow::getInput()).toLong(); hardware->SetRegister("X0", read_value); break; } case 6: // read float { cout << "read float"; break; } case 7: // read double { cout << "read double"; break; } case 8: // read string { string read_value; string msg = "Enter a string of maximum length oo (syscall 8)"; read_value = (MainWindow::getInputWithMessage(msg)).toStdString(); // read_value = (MainWindow::getInput()).toStdString(); MainWindow::buffer << read_value; MainWindow::printOutput(); hardware->SetRegister("X2", read_value.length()); string raw = (string) ".asciz" + (string) " \"" + read_value + (string) "\" "; hardware->SetRegister("X1", hardware->_mem->getTop()); hardware->_mem->loadVariable(raw); break; } case 10: // terminate execution { break; exit(0); } case 11: // print character { long print_value = hardware->GetRegister("X1"); MainWindow::buffer << print_value; MainWindow::printOutput(); break; } case 12: // read character { char read_value; string msg = "Enter a character value (syscall 12)"; read_value = (MainWindow::getInputWithMessage(msg)).toStdString().c_str()[0]; // read_value = (MainWindow::getInput()).toStdString().c_str()[0]; hardware->SetRegister("X0", (long)read_value); break; } case 30: // system time { chrono::milliseconds ms = chrono::duration_cast<chrono::milliseconds>( chrono::system_clock::now().time_since_epoch()); unsigned long msCount = ms.count(); long msb = msCount >> 32; long lsb = msCount << 32 >> 32; // cout << msb << " | "<< lsb << endl; hardware->SetRegister("X0", lsb); hardware->SetRegister("X1", msb); break; } case 32: // sleep { long miliseconds = hardware->GetRegister("X0"); std::this_thread::sleep_for(chrono::milliseconds(miliseconds)); break; } case 34: // print int2hex { long n = hardware->GetRegister("X0"); char cstr[128]; sprintf(cstr, "%#010x", n); string out = cstr; MainWindow::buffer << out; MainWindow::printOutput(); // cout << out; break; } case 35: // print int2bin { long n = hardware->GetRegister("X0"); bitset<32> a(n); string out = a.to_string(); MainWindow::buffer << out; MainWindow::printOutput(); // cout << out; break; } case 36: // print int2unsigned { long n = hardware->GetRegister("X0"); unsigned long *cast = (unsigned long *)(&n); string out = to_string((unsigned long)(*cast)); MainWindow::buffer << out; MainWindow::printOutput(); // cout << out; break; } case 40: // set seed { long seed = hardware->GetRegister("X0"); srand(seed); break; } case 41: // random int { long out = sys_rand(); hardware->SetRegister("X0", out); break; } case 42: // random int range { unsigned long upperBound = hardware->GetRegister("X1"); long out = sys_rand() % upperBound; hardware->SetRegister("X0", out); break; } case 43: // random float { float out = (float)rand() / RAND_MAX; hardware->setFloatRegister("F0", out); // TODO: check this break; } case 44: // random double { float out = (double)sys_rand() / (double)LLONG_MAX; hardware->setFloatRegister("F0", out); // TODO: check this } default: { string errorMessage = (string)"unknown syscall" + to_string(value); throw errorMessage.c_str(); } } }
e880d0a61b9aa4ace2b8e19b4908a96e43341ee7
a077943855cf1ac32ab4c2ff2311fb6966cbaee5
/ApData/Sql/Models/ItemCategory.hpp
d3e054d3b58df8538e607c0188c05d6e04282605
[]
no_license
GeorgeKaraszi/Aphelion
58da7bae17872e0a54edafa4e9ed76e4dacf28c3
127a356155103383ac8a84deb7e52b5857eb0690
refs/heads/master
2023-04-28T12:09:16.870017
2021-05-02T22:32:14
2021-05-02T22:32:14
305,194,039
3
0
null
null
null
null
UTF-8
C++
false
false
1,447
hpp
ItemCategory.hpp
#ifndef APDATA_SQL_MODELS_ITEMCATEGORY_HPP #define APDATA_SQL_MODELS_ITEMCATEGORY_HPP #include "AModel.hpp" namespace ApData::Sql::Models { namespace Data { struct alignas(64) ItemCategory { int id { -1 }; int item_category_id { -1 }; std::string name; }; } class ItemCategory : public AModel<Data::ItemCategory, 3> { using AModel::AModel; public: ItemCategory(const ItemCategory&) = default; explicit ItemCategory(ApData::Sql::Database &database) : AModel(database, "item_categories") {} protected: std::string TableSchema() override { return R"( CREATE TABLE item_categories( id INTEGER PRIMARY KEY, item_category_id INTEGER, name TEXT ); CREATE UNIQUE INDEX idx_item_category_id ON item_categories(item_category_id); )"; } std::string RecordInsertQuery() override { boost::replace_all(Data.name, "'", "''"); return fmt::format( "INSERT INTO item_categories(item_category_id, name) VALUES ({}, '{}')", Data.item_category_id, Data.name ); } std::string ExistsConditional() override { auto name = Data.name; boost::replace_all(name, "'", "''"); return fmt::format("name = '{}'", name); } public: Data::ItemCategory Data; }; } #endif //APDATA_SQL_MODELS_ITEMCATEGORY_HPP
f345889628b24f978a3db66d05d008b9ce4b2157
2fa275ac6a17d15b9ad28e09a5295e2ae7bcd8b3
/Codeforces/310/C.cpp
90e34243824dd40377ee56bb164ad14f0e81fe62
[]
no_license
arnabgho/competitive_programming
bcd46cbcafad06dce80efaae28048de149b0fe5d
13af2a371d7d973f3fed244daf04a1c6252db53b
refs/heads/master
2021-01-17T13:38:17.464779
2016-06-27T22:41:32
2016-06-27T22:41:32
33,666,144
0
0
null
null
null
null
UTF-8
C++
false
false
626
cpp
C.cpp
#include <bits/stdc++.h> #define _ ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; int getStreak(std::vector<int> v){ int n=1; for (int i = 0; i+1 <v.size() ; ++i) { if(v[i+1]==v[i]+1) n++; else break; } return n; } int main() { int n,k; cin>>n>>k; int nComp=0; int ans=0; for (int i = 0; i < k; ++i) { int m; std::vector<int> v; cin>>m; for (int i = 0; i < m; ++i) { int x; cin>>x; v.push_back(x); } if(v[0]==1){ int streak=getStreak(v); nComp+=m-streak+1; ans+=m-streak; } else{ nComp+=m; ans+=m-1; } } cout<<ans+nComp-1<<endl; return 0; }
84c94378cacafa651af85dff983b79f621fbf38a
aaee58f6aaf5d857968c93d65dcc01071129baea
/reference/cpp/Utility.cpp
eaa15ddc81ef0e08b4972cb55a74325ecf42c751
[]
no_license
Wilhansen/PHOBDDIP
4293e77451a389e784f6c6e237f68e525daf7ad7
0c2cac8a1744c329a884664cf77e8ff40bd4a466
refs/heads/master
2020-12-30T14:57:29.969978
2017-06-29T09:23:48
2017-06-29T09:23:48
91,101,609
0
0
null
null
null
null
UTF-8
C++
false
false
8,470
cpp
Utility.cpp
#include "Utility.hpp" #include <stdexcept> #include <sstream> #include <cstring> using namespace std; SecureMemory::SecureMemory(size_t size) : m_size(size) { m_data = new uint8_t[size]; sodium_mlock(m_data, m_size); } SecureMemory::~SecureMemory() { if ( m_data == 0 ) return; sodium_memzero(m_data, m_size); sodium_munlock(m_data, m_size); delete [] m_data; } KeyPair KeyPair::generate() { KeyPair kp = {SecureMemory(crypto_sign_ed25519_SECRETKEYBYTES), SecureMemory(crypto_sign_ed25519_PUBLICKEYBYTES)}; crypto_sign_keypair(kp.public_key.data(), kp.secret_key.data()); return kp; } ServerCrypto::ServerCrypto(const char *keydir) : m_keydir(keydir), server_sk(crypto_kx_SECRETKEYBYTES), sign_sk(crypto_sign_ed25519_SECRETKEYBYTES) { if (!m_keydir.empty()) { if (m_keydir[m_keydir.size() - 1] != '/' ) { m_keydir += '/'; } } sign_pk = readfile((m_keydir + SERVER_PUBLIC_KEY_FILE).c_str()); if ( sign_pk.empty() ) { throw runtime_error("Cannot read " SERVER_PUBLIC_KEY_FILE "."); } if ( sign_pk.size() != crypto_sign_ed25519_PUBLICKEYBYTES ) { throw runtime_error("Wrong size for " SERVER_PUBLIC_KEY_FILE "."); } if ( FILE *fp = fopen((m_keydir + SERVER_PRIVATE_KEY_FILE).c_str(), "rb") ) { const auto len = fread(sign_sk.data(), 1, sign_sk.size(), fp); fclose(fp); if ( len != sign_sk.size() ) { throw runtime_error("Wrong size for " SERVER_PRIVATE_KEY_FILE "."); } } else { throw runtime_error("Cannot open " SERVER_PRIVATE_KEY_FILE "."); } //derive the encryption pk/sk from the signature sk server_pk.resize(crypto_kx_PUBLICKEYBYTES); if ( crypto_sign_ed25519_pk_to_curve25519(server_pk.data(), sign_pk.data()) != 0 ) { throw runtime_error("Invalid server public key provided."); } if ( crypto_sign_ed25519_sk_to_curve25519(server_sk.data(), sign_sk.data()) != 0 ) { throw runtime_error("Invalid server private key provided."); } } namespace { string client_keyfile(const uint64_t client_id) { char buffer[64] = { 0 }; sprintf(buffer, "%016llX.pub", client_id); return string(buffer); } } //-----------------ServerCrypto------------------- ServerCrypto::Result ServerCrypto::load_keys(const uint64_t client_id, SessionKeyPair &dst) { const auto client_keypath = m_keydir + client_keyfile(client_id); const auto client_sign_pk = readfile(client_keypath.c_str()); if ( client_sign_pk.empty() ) { return Result::KEY_NOT_FOUND; } if ( client_sign_pk.size() != crypto_sign_ed25519_PUBLICKEYBYTES ) { return Result::WRONG_CLIENT_KEY_SIZE; } vector<uint8_t> client_pk(crypto_kx_PUBLICKEYBYTES); crypto_sign_ed25519_pk_to_curve25519(client_pk.data(), client_sign_pk.data()); SecureMemory reception_key(crypto_kx_SESSIONKEYBYTES), transmisson_key(crypto_kx_SESSIONKEYBYTES); if ( crypto_kx_server_session_keys(reception_key.data(), transmisson_key.data(), server_pk.data(), server_sk.data(), client_pk.data()) != 0 ) { return Result::WRONG_KEY; } dst.reception_key = move(reception_key); dst.transmisson_key = move(transmisson_key); return Result::OK; } ServerCrypto::Result ServerCrypto::decrypt_payload(const uint64_t client_id, const ClientMessageHeader &header, void *payload) { SessionKeyPair kp; Result r; if ( (r = load_keys(client_id, kp)) != Result::OK ) { return r; } if ( crypto_aead_chacha20poly1305_ietf_decrypt_detached((uint8_t*)payload, NULL, (uint8_t*)payload, header.payload_size, header.payload_ad.mac, (const uint8_t*)&header, sizeof(ClientMessageHeader) - sizeof(PayloadAuthenticationData), header.payload_ad.nonce, kp.reception_key.data()) != 0 ) { return Result::INVALID_PAYLOAD; } else { return Result::OK; } } ServerCrypto::Result ServerCrypto::encrypt_payload(const uint64_t client_id, ServerMessageHeader &header, const void *payload, void *destination) { SessionKeyPair kp; Result r; if ( (r = load_keys(client_id, kp)) != Result::OK ) { return r; } ng.next(header.payload_ad.nonce); crypto_aead_chacha20poly1305_ietf_encrypt_detached((uint8_t*)destination, header.payload_ad.mac, NULL, (const uint8_t*)payload, header.payload_size, (const uint8_t*)&header, sizeof(ServerMessageHeader) - sizeof(PayloadAuthenticationData), NULL, header.payload_ad.nonce, kp.transmisson_key.data()); return Result::OK; } void ServerCrypto::sign_payload(ServerMessageHeader &header_and_payload, uint8_t destination[crypto_sign_BYTES]) { sodium_memzero(&header_and_payload.payload_ad, sizeof(header_and_payload.payload_ad)); crypto_sign_detached(destination, NULL, (const uint8_t*)&header_and_payload, sizeof(ServerMessageHeader) + header_and_payload.payload_size, sign_sk.data()); } //-----------------ClientCrypto------------------- ClientCrypto::ClientCrypto(const uint64_t client_id, const char *pk_path, const char *sk_path, const char *server_key_path, const char *master_key_path) : client_id(client_id), client_rx(crypto_kx_SESSIONKEYBYTES), client_tx(crypto_kx_SESSIONKEYBYTES), sign_sk(crypto_sign_ed25519_SECRETKEYBYTES) { server_sign_pk = readfile(server_key_path); sign_pk = readfile(pk_path); master_sign_pk = readfile(master_key_path); if ( FILE *fp = fopen(sk_path, "rb") ) { const auto len = fread(sign_sk.data(), 1, sign_sk.size(), fp); fclose(fp); if ( len != sign_sk.size() ) { throw runtime_error(string("Wrong size for ") + sk_path); } } else { throw runtime_error(string("Cannot open ") + sk_path); } derive_keys(); } ClientCrypto::Result ClientCrypto::decrypt_payload(const ServerMessageHeader &header, void *payload) { if ( crypto_aead_chacha20poly1305_ietf_decrypt_detached((uint8_t*)payload, NULL, (uint8_t*)payload, header.payload_size, header.payload_ad.mac, (const uint8_t*)&header, sizeof(ServerMessageHeader) - sizeof(PayloadAuthenticationData), header.payload_ad.nonce, client_rx.data()) != 0 ) { return Result::INVALID_PAYLOAD; } else { return Result::OK; } } ClientCrypto::Result ClientCrypto::encrypt_payload(ClientMessageHeader &header, const void *payload, void *destination) { ng.next(header.payload_ad.nonce); crypto_aead_chacha20poly1305_ietf_encrypt_detached((uint8_t*)destination, header.payload_ad.mac, NULL, (const uint8_t*)payload, header.payload_size, (const uint8_t*)&header, sizeof(ClientMessageHeader) - sizeof(PayloadAuthenticationData), NULL, header.payload_ad.nonce, client_tx.data()); return Result::OK; } void ClientCrypto::sign_payload(ClientMessageHeader &header, uint8_t destination[crypto_sign_BYTES]) { sodium_memzero(&header.payload_ad, sizeof(header.payload_ad)); crypto_sign_detached(destination, NULL, (const uint8_t*)&header, sizeof(ClientMessageHeader) + header.payload_size, sign_sk.data()); } bool ClientCrypto::verify_signed_server_payload(const ServerMessageHeader &header, const uint8_t signature[crypto_sign_BYTES]) { const PayloadAuthenticationData zero = { 0 }; if ( memcmp(&zero, &header.payload_ad, sizeof(PayloadAuthenticationData)) != 0 ) { return false; } return crypto_sign_verify_detached(signature, (const uint8_t*)&header, sizeof(ServerMessageHeader) + header.payload_size, server_sign_pk.data()) == 0; } bool ClientCrypto::verify_signed_master_payload(const ServerMessageHeader &header, const uint8_t signature[crypto_sign_BYTES]) { const PayloadAuthenticationData zero = { 0 }; if ( memcmp(&zero, &header.payload_ad, sizeof(PayloadAuthenticationData)) != 0 ) { return false; } return crypto_sign_verify_detached(signature, (const uint8_t*)&header, sizeof(ServerMessageHeader) + header.payload_size, master_sign_pk.data()) == 0; } void ClientCrypto::replace_server_key(const std::vector<uint8_t> &server_sign_pk) { this->server_sign_pk = server_sign_pk; derive_keys(); } void ClientCrypto::derive_keys() { vector<uint8_t> client_pk(crypto_kx_PUBLICKEYBYTES), server_pk(crypto_kx_PUBLICKEYBYTES); SecureMemory client_sk(crypto_kx_SECRETKEYBYTES); if ( crypto_sign_ed25519_pk_to_curve25519(client_pk.data(), sign_pk.data()) != 0 ) { throw runtime_error("Invalid client public key provided."); } if ( crypto_sign_ed25519_sk_to_curve25519(client_sk.data(), sign_sk.data()) != 0 ) { throw runtime_error("Invalid client private key provided."); } if ( crypto_sign_ed25519_pk_to_curve25519(server_pk.data(), server_sign_pk.data()) != 0 ) { throw runtime_error("Invalid server public key provided."); } crypto_kx_client_session_keys(client_rx.data(), client_tx.data(), client_pk.data(), client_sk.data(), server_pk.data()); }
615b185e2f799cdd43f6191176939634924c8d8d
a8965144be70ebc38d8f20d41438d41ef2f137ce
/listings/isdebug.cpp
f022b750cf00ec7f31f50232556c0d3cfbbab07f
[ "Apache-2.0" ]
permissive
tesuji/AnalyzeAgobotReport
92ccd332e5956f6d7261bb1cde249dd133fc5541
e8594d1fbcdeadcd637de80f10b5f7922cdc11ab
refs/heads/master
2021-09-18T08:00:17.431068
2018-07-11T17:06:03
2018-07-11T17:06:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,594
cpp
isdebug.cpp
__inline bool IsSICELoaded() { _asm { mov ah, 0x43 int 0x68 cmp ax, 0x0F386 // Will be set by all system debuggers. jz out_ xor ax, ax mov es, ax mov bx, word ptr es:[0x68*4] mov es, word ptr es:[0x68*4+2] mov eax, 0x0F43FC80 cmp eax, dword ptr es:[ebx] jnz out_ jmp normal_ normal_: xor eax, eax leave ret out_: mov eax, 0x1 leave ret } return false; } __inline bool IsODBGLoaded() { char *caption="DAEMON"; _asm { push 0x00 push caption mov eax, fs:[30h] // pointer to PEB movzx eax, byte ptr[eax+0x2] or al,al jz normal_ jmp out_ normal_: xor eax, eax leave ret out_: mov eax, 0x1 leave ret } } __inline BOOL IsSoftIceNTLoaded() { HANDLE hFile=CreateFile( "\\\\.\\NTICE", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile!=INVALID_HANDLE_VALUE) { CloseHandle(hFile); return TRUE; } return FALSE; } __inline bool IsBPX(void *address) { _asm { mov esi, address // load function address mov al, [esi] // load the opcode cmp al, 0xCC // check if the opcode is CCh je BPXed // yes, there is a breakpoint // jump to return TRUE xor eax, eax // FALSE, jmp NOBPX // no breakpoint BPXed: mov eax, 1 // breakpoint found NOBPX: } }
7cf34b50064cac9530f5655ba0c742b0ad43037a
51a5257cb59c15a32ee7fe5448588006e083feff
/Network/ANN/activation_functions.h
b81258e3ed028a4931fed11deeedc884a97d3bbe
[]
no_license
haukri/MasterProject
9610632dd4f1d53bce7ce76f7852079d19f4b356
3196d8fe187f1298f3afa0ecdc9edf0929745989
refs/heads/master
2020-08-29T17:05:41.226935
2020-06-14T14:45:54
2020-06-14T14:45:54
218,101,891
2
0
null
null
null
null
UTF-8
C++
false
false
282
h
activation_functions.h
#ifndef ACTIVATION_FUNCTIONS #define ACTIVATION_FUNCTIONS namespace activation_functions { double tanh_transfer(double x); double tanh_transfer_derivative(double x); double sigmoid_transfer(double x); double sigmoid_transfer_derivative(double x); } #endif
8ddf24be2ab803bd9b524835f3a0eccdb1e8eb92
057a475216e9beed41983481aafcaf109bbf58da
/src/Functions/addressToLine.h
5c1611fe173d819171fe08149a60f8e1d676201d
[ "Apache-2.0" ]
permissive
ClickHouse/ClickHouse
fece5204263a5b4d693854b6039699265f1bb27f
6649328db809d51a694c358571539bc5820464be
refs/heads/master
2023-08-31T18:48:36.615225
2023-08-31T17:51:24
2023-08-31T17:51:24
60,246,359
23,878
5,449
Apache-2.0
2023-09-14T20:10:52
2016-06-02T08:28:18
C++
UTF-8
C++
false
false
4,263
h
addressToLine.h
#pragma once #if defined(__ELF__) && !defined(OS_FREEBSD) #include <Common/Dwarf.h> #include <Common/SymbolIndex.h> #include <Common/HashTable/HashMap.h> #include <Common/Arena.h> #include <Columns/ColumnString.h> #include <Columns/ColumnArray.h> #include <Columns/ColumnsNumber.h> #include <DataTypes/DataTypeString.h> #include <DataTypes/DataTypeArray.h> #include <Functions/IFunction.h> #include <Functions/FunctionFactory.h> #include <IO/WriteBufferFromArena.h> #include <IO/WriteHelpers.h> #include <Access/Common/AccessFlags.h> #include <Interpreters/Context.h> #include <mutex> #include <filesystem> #include <unordered_map> namespace DB { namespace ErrorCodes { extern const int ILLEGAL_COLUMN; extern const int ILLEGAL_TYPE_OF_ARGUMENT; extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; } template <typename ResultT, Dwarf::LocationInfoMode locationInfoMode> class FunctionAddressToLineBase : public IFunction { public: size_t getNumberOfArguments() const override { return 1; } bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; } DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override { if (arguments.size() != 1) throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} needs exactly one argument; passed {}.", getName(), arguments.size()); const auto & type = arguments[0].type; if (!WhichDataType(type.get()).isUInt64()) throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "The only argument for function {} must be UInt64. " "Found {} instead.", getName(), type->getName()); return getDataType(); } bool useDefaultImplementationForConstants() const override { return true; } ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override { const ColumnPtr & column = arguments[0].column; const ColumnUInt64 * column_concrete = checkAndGetColumn<ColumnUInt64>(column.get()); if (!column_concrete) throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of argument of function {}", column->getName(), getName()); const typename ColumnVector<UInt64>::Container & data = column_concrete->getData(); return getResultColumn(data, input_rows_count); } protected: virtual DataTypePtr getDataType() const = 0; virtual ColumnPtr getResultColumn(const typename ColumnVector<UInt64>::Container & data, size_t input_rows_count) const = 0; virtual void setResult(ResultT & result, const Dwarf::LocationInfo & location, const std::vector<Dwarf::SymbolizedFrame> & frames) const = 0; struct Cache { std::mutex mutex; Arena arena; using Map = HashMap<uintptr_t, ResultT>; Map map; std::unordered_map<std::string, Dwarf> dwarfs; }; mutable Cache cache; ResultT impl(uintptr_t addr) const { const SymbolIndex & symbol_index = SymbolIndex::instance(); if (const auto * object = symbol_index.findObject(reinterpret_cast<const void *>(addr))) { auto dwarf_it = cache.dwarfs.try_emplace(object->name, object->elf).first; if (!std::filesystem::exists(object->name)) return {}; Dwarf::LocationInfo location; std::vector<Dwarf::SymbolizedFrame> frames; // NOTE: not used in FAST mode. ResultT result; if (dwarf_it->second.findAddress(addr - uintptr_t(object->address_begin), location, locationInfoMode, frames)) { setResult(result, location, frames); return result; } else return {object->name}; } else return {}; } ResultT implCached(uintptr_t addr) const { typename Cache::Map::LookupResult it; bool inserted; std::lock_guard lock(cache.mutex); cache.map.emplace(addr, it, inserted); if (inserted) it->getMapped() = impl(addr); return it->getMapped(); } }; } #endif