29 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
97
views
Ostensibly incorrect synthesis by SynplifyPro, result differs from Icarus Verilog & Verilator
I stumbled upon perplexing hardware behavior in the following simple circuit, provided here verbatim:
/// Given an WIN-bit signed input, truncates the most significant bits to produce a WOUT-bit ...
3
votes
4
answers
375
views
How to clip to max an integer overflow using numpy or opencv
I have an array of the form a = np.array([1], dtype='uint8').
Now if I add 255 to a it will overflow and be np.array([0]).
Is there a built-in way to "clip" to value to 255?
NumPy has the ...
1
vote
1
answer
225
views
Saturate 16-bit signed integer to 12-bits signed
I'm working with an SDR that has a 12-bit signed ADC/DAC that stores in 16-bit IQ samples. I want to ensure that after all the DSP is done the samples saturate at 12 bits instead of getting truncated ...
-1
votes
4
answers
606
views
Add two vectors (uint64_t type) with saturation for each int8_t element
I was recently faced with a given problem:
There are 8 elements in the vector, each is represented by int8_t.
Implement an algorithm in x86_64 that will add two vectors (uint64_t type).
Adding ...
6
votes
4
answers
886
views
Multiply by 2 with signed saturation in 6 operations in C?
The problem for signed 2's complement 32-bit integers:
satMul2 - multiplies by 2, saturating to Tmin or Tmax if overflow.
Examples: satMul2(0x30000000) = 0x60000000
satMul2(0x40000000) = ...
2
votes
2
answers
927
views
cuda SIMD instruction for per-byte multiplication with unsigned saturation
CUDA has a nice set of SIMD instructions for integers that allow efficient SIMD computations. Among those, there are some that compute addition and subtraction per byte or per half-word (like __vadd2 ...
0
votes
2
answers
477
views
Do you know any saturation function? To make number fit to given range? [duplicate]
Looking for a saturating function in Rust.
Here I called it fit_to_range(range).
let input:i64= something;
let saturated:64= input.fit_to_range(7..=4000);
assert!((7..=4000).contains(saturated));...
1
vote
0
answers
219
views
ColorMatrix Saturation and OpenCV Saturation result are different
Below is the C# Logic for changing saturation of image.
Referred from here
Note: We are using this saturation matrix
R G B A W
R [sr+s sr sr 0 0]
G [ sg sg+s sg 0 0]
B [ sb ...
6
votes
2
answers
963
views
Cast type with range limit
Is there an elegant way to cast a bigger datatype to a smaller one without causing the result to overflow?
E.g. casting 260 to uint8_t should result in 255 instead of 4.
A possible solution would be:
#...
2
votes
0
answers
272
views
Using CSS filter to increase Saturation on webpage and Streaming video container
I'm using a super simple CSS filter to increase Saturation on a webpage (and it's video's) via Stylus extension,
html {
filter: Saturation (125%)
}
it works on the webpage without issue but then the ...
2
votes
1
answer
935
views
What is the most efficient way to handle integer multiplication overflow with saturation with ARM Neon intrinsics?
I have the following multiplication between 2 16 bit vectors:
int16x8_t dx;
int16x8_t dy;
int16x8_t dxdy = vmulq_s16(dx, dy);
In case dx and dy are both large enough, the result will overflow.
I ...
0
votes
1
answer
108
views
GCC complier :strange behavior when doing float operation , float value saturating to 65536 where float is of 4 bytes
[I tried to compute a float multiplication, I observed the value was getting saturated to 65536 and was not updating.
the issue is only with the below code.]1
Result for the above code
I tried this ...
1
vote
2
answers
1k
views
Fast saturating integer conversion?
I'm wondering if there is any fast bit twiddling trick to do a saturating conversion from a 64-bit unsigned value to a 32-bit unsigned value (it would be nice if it is generalized to other widths but ...
1
vote
2
answers
818
views
How to handle addition and subtraction beyond Integers MAX_VALUE and MIN_VALUE?
The following is the piece of code I am trying to implement:
if (n1 > 0 && n2 > 0 && result >= Integer.MAX_VALUE) {
result = Integer.MAX_VALUE;
}
else if (n1 > 0 &&...
2
votes
1
answer
260
views
In CSS, is filter: saturate(100) any slower than saturate(2)?
For CSS filters, would there be any difference is the browser's speed to process saturate(2) as compared to any of the following:
saturate(100)
saturate(1000)
saturate(9999)
saturate(56.789)
saturate(...