Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zzha zzha
OpenXG-RAN
Commits
c38a4859
Commit
c38a4859
authored
Apr 11, 2019
by
Khalid Ahmed
Committed by
Thomas Schlichter
Jun 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding signal_energy_amp_shift function
parent
2628b741
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
5 deletions
+57
-5
openair1/PHY/TOOLS/signal_energy.c
openair1/PHY/TOOLS/signal_energy.c
+49
-4
openair1/PHY/TOOLS/tools_defs.h
openair1/PHY/TOOLS/tools_defs.h
+7
-0
openair1/SIMULATION/NR_PHY/ulsim.c
openair1/SIMULATION/NR_PHY/ulsim.c
+1
-1
No files found.
openair1/PHY/TOOLS/signal_energy.c
View file @
c38a4859
...
...
@@ -20,7 +20,7 @@
*/
#include "tools_defs.h"
#include "PHY/impl_defs_top.h"
#include "PHY/sse_intrin.h"
// Compute Energy of a complex signal vector, removing the DC component!
...
...
@@ -84,7 +84,7 @@ int32_t signal_energy(int32_t *input,uint32_t length)
mm1
=
in
[
i
];
mm2
=
mm1
;
mm1
=
_m_pmaddwd
(
mm1
,
mm1
);
mm1
=
_m_psradi
(
mm1
,
9
);
//
shift);// shift any 32 bits blocs of the word by the value shift
mm1
=
_m_psradi
(
mm1
,
shift
);
// shift any 32 bits blocs of the word by the value shift
mm0
=
_m_paddd
(
mm0
,
mm1
);
// add the two 64 bits words 4 bytes by 4 bytes
// mm2 = _m_psrawi(mm2,shift_DC);
mm3
=
_m_paddw
(
mm3
,
mm2
);
// add the two 64 bits words 2 bytes by 2 bytes
...
...
@@ -95,7 +95,7 @@ int32_t signal_energy(int32_t *input,uint32_t length)
mm0
=
_m_paddd
(
mm0
,
mm1
);
temp
=
_m_to_int
(
mm0
);
temp
/=
length
;
//
temp<<=shift; // this is the average of x^2
temp
<<=
shift
;
// this is the average of x^2
// now remove the DC component
...
...
@@ -104,7 +104,6 @@ int32_t signal_energy(int32_t *input,uint32_t length)
mm2
=
_m_psrlqi
(
mm3
,
32
);
mm2
=
_m_paddw
(
mm2
,
mm3
);
mm2
=
_m_pmaddwd
(
mm2
,
mm2
);
mm2
=
_m_psradi
(
mm2
,
9
);
// fixed point representation of elements
temp2
=
_m_to_int
(
mm2
);
temp2
/=
(
length
*
length
);
// temp2<<=(2*shift_DC);
...
...
@@ -116,6 +115,52 @@ int32_t signal_energy(int32_t *input,uint32_t length)
return
((
temp
>
0
)
?
temp
:
1
);
}
int32_t
signal_energy_amp_shift
(
int32_t
*
input
,
uint32_t
length
)
{
int32_t
i
;
int32_t
temp
,
temp2
;
register
__m64
mm0
,
mm1
,
mm2
,
mm3
;
__m64
*
in
=
(
__m64
*
)
input
;
mm0
=
_mm_setzero_si64
();
mm3
=
_mm_setzero_si64
();
for
(
i
=
0
;
i
<
length
>>
1
;
i
++
)
{
mm1
=
in
[
i
];
mm2
=
mm1
;
mm1
=
_m_pmaddwd
(
mm1
,
mm1
);
mm1
=
_m_psradi
(
mm1
,
AMP_SHIFT
);
// shift any 32 bits blocs of the word by the value shift_p9
mm0
=
_m_paddd
(
mm0
,
mm1
);
// add the two 64 bits words 4 bytes by 4 bytes
mm3
=
_m_paddw
(
mm3
,
mm2
);
// add the two 64 bits words 2 bytes by 2 bytes
}
mm1
=
mm0
;
mm0
=
_m_psrlqi
(
mm0
,
32
);
mm0
=
_m_paddd
(
mm0
,
mm1
);
temp
=
_m_to_int
(
mm0
);
temp
/=
length
;
// this is the average of x^2
// now remove the DC component
mm2
=
_m_psrlqi
(
mm3
,
32
);
mm2
=
_m_paddw
(
mm2
,
mm3
);
mm2
=
_m_pmaddwd
(
mm2
,
mm2
);
mm2
=
_m_psradi
(
mm2
,
AMP_SHIFT
);
// fixed point representation of elements
temp2
=
_m_to_int
(
mm2
);
temp2
/=
(
length
*
length
);
temp
-=
temp2
;
_mm_empty
();
_m_empty
();
return
((
temp
>
0
)
?
temp
:
1
);
}
int32_t
signal_energy_nodc
(
int32_t
*
input
,
uint32_t
length
)
{
...
...
openair1/PHY/TOOLS/tools_defs.h
View file @
c38a4859
...
...
@@ -295,6 +295,13 @@ void mmxcopy(void *dest,void *src,int size);
*/
int32_t
signal_energy
(
int32_t
*
,
uint32_t
);
/*!\fn int32_t signal_energy_fixed_p9(int *input, uint32_t length);
\brief Computes the signal energy per subcarrier
\ the input signal has a fixed point representation of AMP_SHIFT bits
\ the ouput energy has a fixed point representation of AMP_SHIFT bits
*/
int32_t
signal_energy_amp_shift
(
int32_t
*
input
,
uint32_t
length
);
#ifdef LOCALIZATION
/*!\fn int32_t signal_energy(int *,uint32_t);
\brief Computes the signal energy per subcarrier
...
...
openair1/SIMULATION/NR_PHY/ulsim.c
View file @
c38a4859
...
...
@@ -716,7 +716,7 @@ int main(int argc, char **argv) {
}
}
txlev
=
(
double
)
signal_energy
(
&
txdata
[
0
][
tx_offset
+
5
*
frame_parms
->
ofdm_symbol_size
+
4
*
frame_parms
->
nb_prefix_samples
+
frame_parms
->
nb_prefix_samples0
],
txlev
=
(
double
)
signal_energy
_amp_shift
(
&
txdata
[
0
][
tx_offset
+
5
*
frame_parms
->
ofdm_symbol_size
+
4
*
frame_parms
->
nb_prefix_samples
+
frame_parms
->
nb_prefix_samples0
],
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
txlev
=
txlev
/
512
.
0
;
// output of signal_energy is fixed point representation
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment