News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Fast transposing matrix procedure for any size

Started by RuiLoureiro, June 26, 2018, 07:41:14 PM

Previous topic - Next topic

daydreamer

Quote from: zedd151 on July 15, 2018, 09:24:12 PM
Quote from: Siekmanski on July 15, 2018, 09:21:59 PM
Transposing or rotation, that's the question.  :biggrin:

I'd think if it's only 90 degrees, it's transposition. More than 90 degrees means more 'movement', hence rotation.   :P

The .bmp example was a nice little exercise with visual results.   :icon14:
Not sure about that, I seen very fast image rotating demo code, because once its initalized with fsincos angle they just reuse those values
And rotation math kinda newx=oldx*cos-oldy*sin, newy=oldx*sin+oldy*cos, probably notthe correct formula but you get the idea how much slower each pixel it is, is replaced with lot faster x=x+constant1, y=y+constant2 looping thru all pixels, probably in fixed point format
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

FORTRANS

Hi,

Quote from: zedd151 on July 15, 2018, 09:24:12 PM
Quote from: Siekmanski on July 15, 2018, 09:21:59 PM
Transposing or rotation, that's the question.  :biggrin:

I'd think if it's only 90 degrees, it's transposition. More than 90 degrees means more 'movement', hence rotation.

   Transposing an array is a reflection about a diagonal axis.
Rotations and reflections, in the simplest cases, are not the
same thing.  Rotation preserves handedness.  Reflection
inverts it.

Cheers,

Steve N.

zedd151


Siekmanski

Matrix transposition is changing the rows to columns and vice versa.
A diagonal is a straight line that joins two opposite corners of a four-sided flat shape.
If you mirror it along the diagonal of a square it is ok.
But a matrix transposition can also be done on a rectangle, then it can't be mirrored along the diagonal.

This is why I made the comment "Transposing or rotation, that's the question."
AW's example is not about matrix transposition but, X-Y axis flipping or -90 degree rotation, else the text would be mirrored in the resulting bitmap image.
Creative coders use backward thinking techniques as a strategy.

aw27

Thank you everybody for the comments. :eusa_clap:

I consider a transposition of a matrix of triplets as opposed to the matrices of dwords we have been doing so far.
The need for the flip has to do with the bitmap being bottom-up. Had I started transposing from the bottom there will be no need for the flip.
This technique can be easily extended to any other bit format,16,8,4,1

Well, I know that it is also called -90 degrees image rotation, but I was looking at this from another perspective.


Siekmanski

My response was only to make clear that matrix transposition is about switching rows and columns.
With a matrix transposition, your result should look like this,

Creative coders use backward thinking techniques as a strategy.

aw27


If I understand well, your suggestion would involve a 4 step process:
1- convert to 32-bit pixel format using slow GDI++
2- Transpose
3- Flip
4- Convert back to 24-bit pixel format using slow GDI++

I am doing it in 2 stages:
1- Transpose
2- Flip

Sure, I should have called it precisely Transpose AND Flip, however I explained clearly what was being done. So, I don't know what we are disagreeing about.  :biggrin:


Siekmanski

 :biggrin:
QuoteSo, I don't know what we are disagreeing about.  :biggrin:

I don't know either.  :biggrin:

As always, there are many ways to get to the result you want.  :t

Another way,

1- load bmp
2- change 8 GPU 32 bit values ( or 4 x 64 bit values )
3- save bmp

And get the same result without flipping and transposing.
Creative coders use backward thinking techniques as a strategy.

RuiLoureiro

Hi all
        It seems that aw wants to do rotation by 90º ... but the image was called transpImg24.zip. That's all.

aw27

Quote from: Siekmanski on July 16, 2018, 07:05:00 AM
1- load bmp
2- change 8 GPU 32 bit values ( or 4 x 64 bit values )
3- save bmp
I don't think we should put in movement all the DirectX machine simply to rotate a bitmap, unless we are playing a game. It is overkill.

@Ruy,
You are the expert in transposing my ideas to your head and produce a lot of masturbation with them as if they were your own.  :badgrin:

RuiLoureiro

aw,
"Scientific" arguments

1) It seems that the matrix transposition is your idea in the same way any mathematical
   exercise/issue is also your property, following your arguments;
   2) Following your arguments, no one can write anything about matematics because
   the rules are always the same and there are thousands and thousands of the same
   thing already written by someone before everywhere, so the ideas are of someone else.
   The students are also prohibited from using what the teacher teaches...

What is your scientific background ? ( coffee talk ? slang language ? )
Who are interested in your poor ( incorrect ) "ideas" ? I am not.
Noone can choose his family, but we may choose our friends. I have no
doubts about you also. And i have no time to lose with you. I have not
your education. I have not your level. Choose another target.


aw27

@Ruy,
You were the one who came with the provocations.  :P
You did not learn yet that when we use works from others we must quote the source. You did not, and started doing silly comparisions against the source of your knowledge which I never cared to optimize. Probably, you want to make a bet in that I can produce a faster code that your senseless masturbations around my own code?
And people is evaluated from what they do, not for what school titles they have. The value of most doctors is close to zero.
I have presumably more university degrees than you but never mentioned it here.
The fact that you and some other people are not interest in advanced ideas simply means that you are paralyzed in time and not able to cope with new things. Probably everything stopped for you when you purchased the Pentium 4 in the last century.

@JJ
I prefer to show some pictures of your flagship product. After more than 10 years, the main menu continues to disappear and when not the submenu covers part of it. Have you ever heard about user experience? Can't you do something with better quality?

jj2007

Quote from: AW on July 16, 2018, 10:34:12 PM
@Ruy,
You were the one who came with the provocations.  :P
Strange that you see provocations from a member as peaceful as Rui. Btw misspelling his name repeatedly is a provocation.

Quote from: AW on July 16, 2018, 10:34:12 PM@JJ
I prefer to show some pictures of your flagship product. ... Can't you do something with better quality?
It works fine on the machines I own (XP, W7 and Win10). I have no control over your machine - your problem.

You have (hopefully) control over what you write:
Quote from: AW on July 16, 2018, 03:01:02 PMYou are the expert in transposing my ideas to your head and produce a lot of masturbation with them as if they were your own.
You are emotionally challenged, José, but sometimes a good therapy can help.

aw27

Quote
It works fine on the machines I own (XP, W7 and Win10). I have no control over your machine - your problem.
It is not a question of A's computer or B's computer. Main menus always work fine and I have never seen a behaviour like this anywhere. Stop blaming and  finding excuses and learn how to make a menu (if you want of course).  :badgrin:

BTW, you appear to like to try to establish alliances with all kinds of strange people or scammers. What happen to Ascend or Lone Wolf, the guy that had developed many DirectX games and was showing all the time the M-16 rifle picture?  :lol: