Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #53499 > unrolled thread

harder case for optimization

Started byfir <profesor.fir@gmail.com>
First post2014-11-27 00:42 -0800
Last post2014-12-05 02:12 -0800
Articles 10 on this page of 70 — 11 participants

Back to article view | Back to comp.lang.c


Contents

  harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-27 00:42 -0800
    Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-27 11:34 +0000
      Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-27 13:29 +0100
      Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-27 05:58 -0800
        Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-27 06:36 -0800
      Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-27 12:26 -0800
    Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-27 22:07 +0000
      Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-27 14:49 -0800
        Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 00:05 +0000
      Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 00:46 +0100
        Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 00:55 +0000
          Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 07:20 +0100
            Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-28 00:41 -0800
              Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 01:54 -0800
                Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-28 02:19 -0800
                  Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 04:05 -0800
                    Closed captioning (Was: harder case for something or other) gazelle@shell.xmission.com (Kenny McCormack) - 2014-11-28 12:15 +0000
                    Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 06:11 -0800
                Re: harder case for optimization gazelle@shell.xmission.com (Kenny McCormack) - 2014-11-28 12:18 +0000
                  Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 04:42 -0800
                    Re: harder case for optimization gazelle@shell.xmission.com (Kenny McCormack) - 2014-11-28 16:37 +0000
                      Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 08:48 -0800
                        Re: harder case for optimization Kaz Kylheku <kaz@kylheku.com> - 2014-11-28 16:51 +0000
                          Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 10:38 -0800
              Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 11:34 +0100
            Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 11:21 +0000
              Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 04:23 -0800
              Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 13:58 +0100
                Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 13:46 +0000
                  Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 16:25 +0100
                    Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 08:18 -0800
                      Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 20:17 +0100
                    Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-28 08:54 -0800
                      Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 20:22 +0100
                        Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-28 11:29 -0800
                        Re: harder case for optimization Kaz Kylheku <kaz@kylheku.com> - 2014-11-28 19:51 +0000
                          Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 20:58 +0100
                          Re: harder case for optimization Melzzzzz <mel@zzzzz.com> - 2014-11-28 21:03 +0100
                            Re: harder case for optimization Kaz Kylheku <kaz@kylheku.com> - 2014-11-28 20:11 +0000
                              Re: harder case for optimization Melzzzzz <mel@zzzzz.com> - 2014-11-28 21:31 +0100
                        Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 20:06 +0000
                    Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 17:14 +0000
                      Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 20:54 +0100
                        Re: harder case for optimization "BartC" <bc@freeuk.com> - 2014-11-28 20:16 +0000
                          Re: harder case for optimization David Brown <david.brown@hesbynett.no> - 2014-11-28 21:56 +0100
          Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-27 23:37 -0800
            Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-27 23:54 -0800
            Re: harder case for optimization BartC <bc@freeuk.com> - 2014-11-28 11:01 +0000
              Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-28 23:52 -0800
                Re: harder case for optimization Morris Dovey <mrdovey@iedu.com> - 2014-11-29 02:03 -0600
                  Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 00:38 -0800
    Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 03:12 -0800
      Re: harder case for optimization BartC <bc@freeuk.com> - 2014-11-29 12:09 +0000
        Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 04:18 -0800
        Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 05:22 -0800
          Re: harder case for optimization BartC <bc@freeuk.com> - 2014-11-29 16:58 +0000
            Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 09:35 -0800
            Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-29 10:55 -0800
              Re: harder case for optimization BartC <bc@freeuk.com> - 2014-11-29 21:00 +0000
                Re: harder case for optimization Ian Collins <ian-news@hotmail.com> - 2014-11-30 11:25 +1300
                  Re: harder case for optimization BartC <bc@freeuk.com> - 2014-11-29 22:56 +0000
                    Re: harder case for optimization Ian Collins <ian-news@hotmail.com> - 2014-11-30 12:00 +1300
                      Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 16:01 -0800
                    Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 16:21 -0800
                      Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 16:52 -0800
                        Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-11-29 17:14 -0800
              Re: harder case for optimization glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-11-30 00:20 +0000
                Re: harder case for optimization Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-11-29 16:43 -0800
          Re: harder case for optimization Kaz Kylheku <kaz@kylheku.com> - 2014-11-29 17:29 +0000
    Re: harder case for optimization fir <profesor.fir@gmail.com> - 2014-12-05 02:12 -0800

Page 4 of 4 — ← Prev page 1 2 3 [4]


#53665

FromBartC <bc@freeuk.com>
Date2014-11-29 22:56 +0000
Message-ID<tasew.11938$mp2.11360@fx01.am4>
In reply to#53663
On 29/11/2014 22:25, Ian Collins wrote:
> BartC wrote:
>>
>> I'm not sure if anyone knows exactly what fir is doing.
>
> Having a bit of a laugh at the expense of those who still converse with
> him?
>

No. I'm not having a laugh at anyone.

But I'll rephrase it and say /I/ don't know exactly what he's trying to do.


[A version of this might have got sent to your email rather than the 
group. Using a new newsreader...]

[toc] | [prev] | [next] | [standalone]


#53666

FromIan Collins <ian-news@hotmail.com>
Date2014-11-30 12:00 +1300
Message-ID<cdv1ggF2f5kU3@mid.individual.net>
In reply to#53665
BartC wrote:
> On 29/11/2014 22:25, Ian Collins wrote:
>> BartC wrote:
>>>
>>> I'm not sure if anyone knows exactly what fir is doing.
>>
>> Having a bit of a laugh at the expense of those who still converse with
>> him?
>>
>
> No. I'm not having a laugh at anyone.

Not you Bart, fir!  His aim appears to be to end up in as many 
kill-files as possible.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#53667

Fromfir <profesor.fir@gmail.com>
Date2014-11-29 16:01 -0800
Message-ID<5524d0ae-da55-4539-9b43-99a9cb70e567@googlegroups.com>
In reply to#53666
W dniu niedziela, 30 listopada 2014 00:00:41 UTC+1 użytkownik Ian Collins napisał:
> BartC wrote:
> > On 29/11/2014 22:25, Ian Collins wrote:
> >> BartC wrote:
> >>>
> >>> I'm not sure if anyone knows exactly what fir is doing.
> >>
> >> Having a bit of a laugh at the expense of those who still converse with
> >> him?
> >>
> >
> > No. I'm not having a laugh at anyone.
> 
> Not you Bart, fir!  His aim appears to be to end up in as many 
> kill-files as possible.
> 
Heh, im often 'diverse' with primitive minds and i feel pride of it

[toc] | [prev] | [next] | [standalone]


#53669

Fromfir <profesor.fir@gmail.com>
Date2014-11-29 16:21 -0800
Message-ID<61501629-be85-4cea-8eb3-54a227b41204@googlegroups.com>
In reply to#53665
W dniu sobota, 29 listopada 2014 23:56:34 UTC+1 użytkownik Bart napisał:
> On 29/11/2014 22:25, Ian Collins wrote:
> > BartC wrote:
> >>
> >> I'm not sure if anyone knows exactly what fir is doing.
> >
> > Having a bit of a laugh at the expense of those who still converse with
> > him?
> >
> 
> No. I'm not having a laugh at anyone.
> 
> But I'll rephrase it and say /I/ don't know exactly what he's trying to do.
> 
> 
> [A version of this might have got sent to your email rather than the 
> group. Using a new newsreader...]

dont understand your troubles - what im doing? said many times, im working on yet unfinished (about half-finished) 'cpu engine' (named DRIS), May be uneficcient but it is for ground learning etc [i consider myself roughly moderately experienced, two fields of my experience is c and oldschool graphics recipes, that is my field of work and research]

[toc] | [prev] | [next] | [standalone]


#53671

Fromfir <profesor.fir@gmail.com>
Date2014-11-29 16:52 -0800
Message-ID<8f160e8f-1b61-443a-be9b-3bd44752bfa9@googlegroups.com>
In reply to#53669
W dniu niedziela, 30 listopada 2014 01:21:58 UTC+1 użytkownik fir napisał:
> W dniu sobota, 29 listopada 2014 23:56:34 UTC+1 użytkownik Bart napisał:
> > On 29/11/2014 22:25, Ian Collins wrote:
> > > BartC wrote:
> > >>
> > >> I'm not sure if anyone knows exactly what fir is doing.
> > >
> > > Having a bit of a laugh at the expense of those who still converse with
> > > him?
> > >
> > 
> > No. I'm not having a laugh at anyone.
> > 
> > But I'll rephrase it and say /I/ don't know exactly what he's trying to do.
> > 
> > 
> > [A version of this might have got sent to your email rather than the 
> > group. Using a new newsreader...]
> 
> dont understand your troubles - what im doing? said many times, im working on yet unfinished (about half-finished) 'cpu engine' (named DRIS), May be uneficcient but it is for ground learning etc [i consider myself roughly moderately experienced, two fields of my experience is c and oldschool graphics recipes, that is my field of work and research]

ps. i may be little aggreviated (maybe this is wrong word, but i often dislike some kind of general or pseudogeneral discussions or disputes with not a clear points and conclusions, as i feel it is something like a waste of time, not sure  , Maybe im mistaken here, but usually prefer strictly technical discussion, (or when im tired as recently i prefer no discussion at all till i become fresher and inhale some more oxygene) some 'general' talks with people might be my weak point.. this is not against you as you seem to be sympathetic user but when discussion goes 'general' or to long and not going to clear points, i may be slightly daggreviated/disgrunted (hard to explain as im not sure if i am correct in my attitude)

[toc] | [prev] | [next] | [standalone]


#53672

Fromfir <profesor.fir@gmail.com>
Date2014-11-29 17:14 -0800
Message-ID<7dcdb64a-dd17-4f67-b13a-96ed82329fa4@googlegroups.com>
In reply to#53671
W dniu niedziela, 30 listopada 2014 01:53:02 UTC+1 użytkownik fir napisał:
> daggreviated/disgrunted (hard to explain as im not sure if i am correct in my attitude)

(i may be not sure if this is good or wrong 
but im very rarely share this kind of discussions with no 100% clear points..
it does not feel bad (more good tham bad to be honest) but 1) i am not accustomed to it 2) im a bit afraid if this is no waste of time

dont matter, but if i will stay a bit more on this group (not sure as i had no plan to stay already so long here) forgive me if i will not 100% participate in all such kind of more general disputes 

[toc] | [prev] | [next] | [standalone]


#53668

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2014-11-30 00:20 +0000
Message-ID<m5dns9$c1r$1@speranza.aioe.org>
In reply to#53661
Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
> On Saturday, November 29, 2014 4:59:01 PM UTC, Bart wrote:

(snip)

>> But the advantage is that most of the work needed in rendering such 
>> objects can be taken care of with libraries such as OpenGL (and 
>> DirectX), which can also make use of special graphics hardware.
 
> Whilst those are, in a sense, vector graphics, that's not how the
> term is usually used.

> Vector graphics are contrasted with bitmapped graphics. In bitmapped
> graphics, the colour value at each pixel is stored. That means that
> any image can be represented, but the image cannot be scaled or
> otherwise manipulated without progressive loss of information.

It isn't so obvious that you don't lose, or have already lost, it
in the vector case.

> Vector graphics describe lines and regions by equations, so they
> scale to machine arithmetic resolution. There's also usually some
> system for imposing hierarchy, so you can do a manipulation like
> "move the bird a bit to the left" without damaging the rest of
> the image.

Vector graphics were more common in the early days of computer
graphics when memory was proportionally more expensive.

The IBM 2250:

https://en.wikipedia.org/wiki/IBM_2250

was not unusual at the time. The screen is addressed with a 1024x1024
coordinate system, but with, I believe, 4K of memory to store data.

With (x,y) coordinates of ends of line segments, or characters
generated with a hardware character generator, it could display
reasonably (for the time) complex graphics.

As costs came down, using various serial storage systems, like
dynamic shift registers, allowed for raster graphics at affordable
prices, and then finally DRAM.

Vector graphics can draw diagonal lines that are smooth, compared to
the raster resolution that would be needed. But once the coordinates
are set, you can't do so much with them.

(snip of 3D examples)

-- glen

[toc] | [prev] | [next] | [standalone]


#53670

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2014-11-29 16:43 -0800
Message-ID<97236abb-6566-4677-aa08-f1fbe0aa1397@googlegroups.com>
In reply to#53668
On Sunday, November 30, 2014 12:20:39 AM UTC, glen herrmannsfeldt wrote:
> Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
> 
> > Vector graphics are contrasted with bitmapped graphics. In bitmapped
> > graphics, the colour value at each pixel is stored. That means that
> > any image can be represented, but the image cannot be scaled or
> > otherwise manipulated without progressive loss of information.
> 
> It isn't so obvious that you don't lose, or have already lost, it
> in the vector case.
> 
The question is what the real information is.
Typically modern vector art is a human artist's representation of
something, in a deliberately stylised way. If he wanted realism, 
he'd take a photograph.
But are his mouse strokes the real information, or is there a 
an ideal stroke in the Platonic world of forms which he is trying to
express? For instance, should the programmer who is manipulating 
the information straighten out nearly straight lines, circularise
circles, join regions of colour to prevent stitching, keep unit-
width lines one pixel, clamp rectangles to the golden ratio. If
an image is to be rescaled to change aspect ratio, should embedded
text also change aspect?

In general, however, manipulating vectors doesn't destroy information,
because transform followed by inverse transform will restore
the image - apart from a few floating point precision issues. That's
not true with rasters. If I expand the image by a non-integral 
factor, then shrink it, I'll lose effective resolution.

[toc] | [prev] | [next] | [standalone]


#53659

FromKaz Kylheku <kaz@kylheku.com>
Date2014-11-29 17:29 +0000
Message-ID<20141129092148.611@kylheku.com>
In reply to#53652
On 2014-11-29, fir <profesor.fir@gmail.com> wrote:
> from my experyence cpu graphycs for medyum (say 1024x786) or larger
> resolutyons ys not quyte obtaynable or just not obtaynable - y cannot make
> even any sympler thyngs work fluyd when symple clear_frame() takes 8-10-20 ms

Really. I played Quake for a while on a HP9000/715 workstation at about that
resolution.  Ported it to the machine myself.  The framerate wasn't great, but
it was playable.

Oh, this was in 1996. I don't remember which model of 715 that machine was
but the highest one, the 715/100XC, ran at 100 Mhz, with 1Kb on-chip L1
data cache, and 1Kb off-chip combined I/D L1 cache.

People watch movies on their PC's with software decoders for formats like H.264.
Computing that many pixels in some way and pushing them to the frame buffer
at a decent rate is certainly possible.

[toc] | [prev] | [next] | [standalone]


#53917

Fromfir <profesor.fir@gmail.com>
Date2014-12-05 02:12 -0800
Message-ID<d7cfec6b-7139-42ac-bddc-9388b09f9a9e@googlegroups.com>
In reply to#53499
W dniu czwartek, 27 listopada 2014 09:42:35 UTC+1 użytkownik fir napisał:
> I need to optymise something, but this 
> case needs a bit more thinking, maybe 
> some wil provide some hints
> 
> (...)

> the question is how to optymise it,
> right now for 640x480 it takes about 13 ms
> i would be happy to bring it down to 3-6 ms
> with possible only very slight degradation of quality
> 

all in all afer changing tile size to 12x12 and partially simplifying and unwinding the x-loop in tile i managed to put it down to 2 ms (for dome i was not working yet on plate part, also this partial tiles need to be repaired so it is a bit of work, also there could be potentiall thinking for rounding errors as the image seems like a one column or skew line pixel more 'narrow' or something like this, but roghly the same outcome of 2 ms instead of 13 ms )

but all in all im satisfied (though this is for lowres 640x480 for highres i would be not satisfied), 2 ms is sufficiently ok, (though need yet to do this final work and i feel a bit lazy to finish it but cant be done)


inline void CalcTileForDome(
          int i, int j, int n, float inm,
          float3 dir00, float3 dir01,
          float3 dir10, float3 dir11)
{
    dir00.z*=-1;
    dir01.z*=-1;
    dir10.z*=-1;
    dir11.z*=-1;


     for(int l = 0; l < n; l++)
     {
      float3 dir_left, dir_right;

      dir_left.x = lerp( dir00.x, dir10.x, l*inm );
      dir_left.y = lerp( dir00.y, dir10.y, l*inm );
      dir_left.z = lerp( dir00.z, dir10.z, l*inm );

      dir_right.x = lerp( dir01.x, dir11.x, l*inm );
      dir_right.y = lerp( dir01.y, dir11.y, l*inm );
      dir_right.z = lerp( dir01.z, dir11.z, l*inm );


      //////////////

     if(j_pressed)
     {
     float dir_rl_x = (dir_right.x - dir_left.x)*inm;
     float dir_rl_y = (dir_right.y - dir_left.y)*inm;
     float dir_rl_z = (dir_right.z - dir_left.z)*inm;

     float dx = 511.5 * (dir_left.x + dir_rl_x) ;
     float dy = 511.5 * (dir_left.y + dir_rl_y) ;

     float ddx = dir_rl_x * 511.5;
     float ddy = dir_rl_y * 511.5;


     int idx = CastToInt(dx*64);
     int idy = CastToInt(dy*64);

     int iddx = CastToInt(ddx*64);
     int iddy = CastToInt(ddy*64);

     for(int k=0; k<=n-4; k+=4)
     {

      int xc0 = 512 + ((idx + k*iddx)>>6);
      int yc0 = 512 + ((idy + k*iddy)>>6);

      int xc1 = 512 + ((idx + (k+1)*iddx)>>6);
      int yc1 = 512 + ((idy + (k+1)*iddy)>>6);

      int xc2 = 512 + ((idx + (k+2)*iddx)>>6);
      int yc2 = 512 + ((idy + (k+2)*iddy)>>6);

      int xc3 = 512 + ((idx + (k+3)*iddx)>>6);
      int yc3 = 512 + ((idy + (k+3)*iddy)>>6);

      unsigned color0 =  working_buffer[yc0*working_buffer_size_x + xc0];
      unsigned color1 =  working_buffer[yc1*working_buffer_size_x + xc1];
      unsigned color2 =  working_buffer[yc2*working_buffer_size_x + xc2];
      unsigned color3 =  working_buffer[yc3*working_buffer_size_x + xc3];

      SetPixelUnsafe( i+k ,   j+l , color0);
      SetPixelUnsafe( i+k+1 , j+l , color1);
      SetPixelUnsafe( i+k+2 , j+l , color2);
      SetPixelUnsafe( i+k+3 , j+l , color3);

     }



     }
     else  //against old method ->
     {
     for(int k=0; k<n; k++)
     {
     float3 dir;


        dir.x = lerp( dir_left.x, dir_right.x, k*inm );
        dir.y = lerp( dir_left.y, dir_right.y, k*inm );
        dir.z = lerp( dir_left.z, dir_right.z, k*inm );


       int xc = 512 + CastToInt ( dir.x*511.5 );
       int yc = 512 + CastToInt ( dir.y*511.5 );
       int color=  working_buffer[yc*working_buffer_size_x + xc];

       SetPixelUnsafe( i+k , j+l , color);
     }

     }

     //////////////////////////////////////
  }


}

[toc] | [prev] | [standalone]


Page 4 of 4 — ← Prev page 1 2 3 [4]

Back to top | Article view | comp.lang.c


csiph-web