flat assembler
Message board for the users of flat assembler.

Index > Heap > ..

Author
Thread Post new topic Reply to topic
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:10; edited 1 time in total
Post 19 Aug 2012, 05:31
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
a convolution filter is a signal multiplier or modulator.
take the convolution signal A and the signal to filter B
you will multiply each sample from A by each sample from B, and add the discrete results to compose the output signal.
then, to combine multiple filters, you just have to do a convolution of both filters.

for example, if signal A is just a single sample of value 1, the convolution with B will give B cause each sample from B will be multiplied by 1, and added to recompose B.
the same if you take B as a single sample signal of value 1, the convolution will give A.

basically, you can do convolution with anything. for example, convolute the 5th symphony of beetoven with a BASSDRUM sample will probably give as a result a strange drum symphony.
and you can cascade convolutions.
Post 19 Aug 2012, 20:08
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:10; edited 1 time in total
Post 19 Aug 2012, 23:52
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
Code:
int A[N];
int B[M];
int C[M+N];
convol(&A,&B,&C);

void convol(A*int,B*int,C*int) {
for (int i = 0;i<N;i++) for (int j = 0;j<M;j++) C[i+j] +=A[i]*B[j];
}
    

something like that.
Post 20 Aug 2012, 13:41
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:12; edited 1 time in total
Post 20 Aug 2012, 19:51
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
hem... brightness and contrast is more something like a color curve than a filter. it is a translation.
something like a lut in 8 bits is really enough, but maths is better and more scalable.
take each value on the original signal, and make them correspond a value on the curve.
for example, to make an image brigthter, you just have to divide the value per 2, and add the mid resolution, something like
Code:
ImageA rb 4*N
Result rb 4*N
...
brighter:
;esi=ImageA
;edi=ImageB
mov ecx,N-1
@@:
mov eax,[esi+ecx*4]
ror eax,1
or eax,80808080h
mov [edi+ecx*4],eax
dec ecx
jnl @b
ret
    

and you get an image brighter.

to get more brightness, you should elevate the color values.
to get more contrast, you should flatten the color curve at the extremums, and increase the edge in the middle.

in audio, this kind of effect is named distorsion.
Post 20 Aug 2012, 21:02
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 12:10; edited 1 time in total
Post 21 Aug 2012, 01:40
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
Instead of using ror directly, you might want to mask off the lower bit before shifting:
Code:
and eax,0xfefefefe
shr eax,1 ;or ROR also works here.    
Post 21 Aug 2012, 01:49
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
FFT is not only for audio.

given the time domain, a multiplication becomes a convolution in frequency domain, and vice versa.
then, if you make a convolution in time domain, it would be faster to first extract the FFT in frequency domain, then, multiply, and then, do the reverse FFT.

here, i ror without masking because finally, the LSb of each byte is set to 1 with the or. then, no matter the state it have prior the rotation. a shr is good too.
Post 21 Aug 2012, 08:20
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.