flat assembler
Message board for the users of flat assembler.

 Index > Heap > ..
Author
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
19 Aug 2012, 05:31
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.
19 Aug 2012, 20:08
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
19 Aug 2012, 23:52
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.
20 Aug 2012, 13:41
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
20 Aug 2012, 19:51
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.
20 Aug 2012, 21:02
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
21 Aug 2012, 01:40
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17473
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.    ```
21 Aug 2012, 01:49
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.
21 Aug 2012, 08:20
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum