PhoenixHardware  0.2.0
Tools to get hardware information
Loading...
Searching...
No Matches
phoenix_transpose_impl.h File Reference
#include <algorithm>
#include "phoenix_transpose.h"
+ Include dependency graph for phoenix_transpose_impl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T, typename U>
void phoenix_transpose_block (T *__restrict__ ptabOutput, const U *__restrict__ ptabInput, size_t nbRowOut, size_t nbColOut, size_t nbBlockRowOut, size_t nbBlockColOut, size_t outputPadding)
 Transpose and convert the table of U into a table of T.
 
template<typename T, typename U>
void phoenix_transpose_block_copy (T *__restrict__ ptabOutput, const U *__restrict__ ptabInput, size_t nbRowOut, size_t nbColOut, size_t nbBlockRowOut, size_t nbBlockColOut, size_t outputPadding, bool isTransposed)
 Convert the table of U into a table of T.
 
template<typename T, typename U>
void phoenix_transpose_copy (T *__restrict__ ptabOutput, const U *__restrict__ ptabInput, size_t nbRowOut, size_t nbColOut, size_t outputPadding, bool isTransposed)
 Convert the table of U into a table of T.
 

Function Documentation

◆ phoenix_transpose_block()

template<typename T, typename U>
void phoenix_transpose_block ( T *__restrict__ ptabOutput,
const U *__restrict__ ptabInput,
size_t nbRowOut,
size_t nbColOut,
size_t nbBlockRowOut,
size_t nbBlockColOut,
size_t outputPadding )

Transpose and convert the table of U into a table of T.

Parameters
[out]ptabOutput: output table
ptabInput: table of input
nbRowOut: number of rows of the output table
nbColOut: number of columns of the output table
nbBlockRowOut: block size on slice
nbBlockColOut: block size on pixel
outputPadding: padding of the output matrix

Definition at line 53 of file phoenix_transpose_impl.h.

55{
56 T* tabOutput = phoenix_assume_aligned(ptabOutput);
57 const U* tabInput = phoenix_assume_aligned(ptabInput);
58// T* tabOutput = ptabOutput;
59// const U* tabInput = ptabInput;
60// std::cerr << "phoenix_transpose_block : nbRowOut = " << nbRowOut << ", nbColOut = " << nbColOut << ", nbBlockRowOut = " << nbBlockRowOut << ", nbBlockColOut = " << nbBlockColOut << std::endl;
61 size_t outputRowSize(nbColOut + outputPadding);
62 for(size_t i(0lu); i < nbColOut; i += nbBlockColOut){
63 for(size_t j(0lu); j < nbRowOut; j += nbBlockRowOut){
64 // transpose the block beginning at [i,j]
65 for(size_t k(i); k < std::min(i + nbBlockColOut, nbColOut); ++k){
66 for(size_t l(j); l < std::min(j + nbBlockRowOut, nbRowOut); ++l){
67// std::cerr << "phoenix_transpose_block : (i = "<<i<<", j = "<<j<<") tabOutput["<<k<<" + "<<l<<"*"<<outputRowSize<<"] = tabInput["<<l<<" + "<<k<<"*"<<nbRowOut<<"]" << std::endl;
68 tabOutput[l*outputRowSize + k] = tabInput[k*nbRowOut + l];
69 }
70 }
71 }
72 }
73}
const T * phoenix_assume_aligned(const T *tabValue)
Call __builtin_assume_aligned with proper argument by respect to the table type.

References phoenix_assume_aligned().

Referenced by phoenix_transpose_block_copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ phoenix_transpose_block_copy()

template<typename T, typename U>
void phoenix_transpose_block_copy ( T *__restrict__ ptabOutput,
const U *__restrict__ ptabInput,
size_t nbRowOut,
size_t nbColOut,
size_t nbBlockRowOut,
size_t nbBlockColOut,
size_t outputPadding,
bool isTransposed )

Convert the table of U into a table of T.

Parameters
[out]ptabOutput: output table
ptabInput: table of input
nbRowOut: number of rows of the output table
nbColOut: number of columns of the output table
nbBlockRowOut: block size on slice
nbBlockColOut: block size on pixel
outputPadding: padding of the output matrix
isTransposed: true if the input matrix of short has to be has to be transposed, false if not

Definition at line 86 of file phoenix_transpose_impl.h.

88{
89 if(!isTransposed){
90 T* tabOutput = phoenix_assume_aligned(ptabOutput);
91 const U* tabInput = phoenix_assume_aligned(ptabInput);
92 size_t outputRowSize(nbColOut + outputPadding);
93 for(size_t i(0lu); i < nbColOut; i += nbBlockColOut){
94 for(size_t j(0lu); j < nbRowOut; j += nbBlockRowOut){
95 // transpose the block beginning at [i,j]
96 for(size_t k(i); k < std::min(i + nbBlockColOut, nbColOut); ++k){
97 for(size_t l(j); l < std::min(j + nbBlockRowOut, nbRowOut); ++l){
98 tabOutput[l*outputRowSize + k] = tabInput[l*nbRowOut + k];
99 }
100 }
101 }
102 }
103 }else{ //The bad slices rejection from real data have to be done here !!!!!
104 phoenix_transpose_block(ptabOutput, ptabInput,
105 nbRowOut, nbColOut, nbBlockRowOut, nbBlockColOut, outputPadding);
106 }
107}
void phoenix_transpose_block(T *__restrict__ ptabOutput, const U *__restrict__ ptabInput, size_t nbRowOut, size_t nbColOut, size_t nbBlockRowOut, size_t nbBlockColOut, size_t outputPadding)
Transpose and convert the table of U into a table of T.

References phoenix_assume_aligned(), and phoenix_transpose_block().

+ Here is the call graph for this function:

◆ phoenix_transpose_copy()

template<typename T, typename U>
void phoenix_transpose_copy ( T *__restrict__ ptabOutput,
const U *__restrict__ ptabInput,
size_t nbRowOut,
size_t nbColOut,
size_t outputPadding,
bool isTransposed )

Convert the table of U into a table of T.

Parameters
[out]ptabOutput: output table
ptabInput: table of input
nbRowOut: number of rows of the output table
nbColOut: number of columns of the output table
outputPadding: padding of the output matrix
isTransposed: true if the input matrix of short has to be has to be transposed, false if not

Definition at line 22 of file phoenix_transpose_impl.h.

24{
25 T* tabOutput = phoenix_assume_aligned(ptabOutput);
26 const U* tabInput = phoenix_assume_aligned(ptabInput);
27 size_t outputRowSize(nbColOut + outputPadding);
28 if(!isTransposed){
29 for(size_t i(0lu); i < nbRowOut; ++i){
30 for(size_t j(0lu); j < nbColOut; ++j){
31 tabOutput[i*outputRowSize + j] = tabInput[i*nbColOut + j];
32 }
33 }
34 }else{ //The bad slices rejection from real data have to be done here !!!!!
35 for(size_t j(0lu); j < nbColOut; ++j){
36 for(size_t i(0lu); i < nbRowOut; ++i){
37 tabOutput[i*outputRowSize + j] = tabInput[i + j*nbRowOut];
38 }
39 }
40 }
41}

References phoenix_assume_aligned().

+ Here is the call graph for this function: