Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rowbytes are assumed #3

Closed
GoogleCodeExporter opened this issue Oct 12, 2015 · 4 comments
Closed

rowbytes are assumed #3

GoogleCodeExporter opened this issue Oct 12, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. wish that rowbytes could be explicitly specified
2. become disappointed
3. open a new issue on the project page

What is the expected output? 
that the rows align properly

What do you see instead?
they severely misalign if your rowbytes != columns * pixelsize

What version of the product are you using? On what operating system?
latest, darwin

Please provide any additional information below.
i fiddled for a bit trying to pass in source and dest rowbytes, but got a bit 
lost.  i could probably figure it out, but perhaps someone with better domain 
knowledge could do a better job?

the point here is to avoid 2 extra bitmap copies.  currently, i have my pic in 
a bitmap, my code goes like this:

1) copy from bitmap to pixel vector (squeezes out extra space at the end of 
rows)
2) perform upconvert
3) copy from output pixel vector to output bitmap
4) blit bitmap

i'd sure like to skip steps 1 and 3!

Original issue reported on code.google.com by anbaricf...@gmail.com on 20 Sep 2011 at 10:26

@GoogleCodeExporter
Copy link
Author

figured it out:

at the top of hq4x do this:

HQX_API void HQX_CALLCONV hq4x_32_rb( uint32_t * sp, uint32_t srb, uint32_t * 
dp, uint32_t drb, int Xres, int Yres )
{
    int         i, j, k;
    int         prevline, nextline;
    uint32_t        w[10];
    int         dpL = (drb >> 2);
    uint8_t     *sRowP = (uint8_t *)sp;
    uint8_t     *dRowP = (uint8_t *)dp;

    for (j=0; j<Yres; j++) {
        if (j>0)      prevline = -(int)(srb >> 2); else prevline = 0;
        if (j<Yres-1) nextline =  (srb >> 2); else nextline = 0;
---------------
at the bottom:
---------------
            sp++;
            dp += 4;
        }

    sRowP += srb;
    sp = (uint32_t *)sRowP;

    dRowP += drb * 4;
    dp = (uint32_t *)dRowP;
    }


Original comment by anbaricf...@gmail.com on 21 Sep 2011 at 6:49

@GoogleCodeExporter
Copy link
Author

for backward compatibility:

HQX_API void HQX_CALLCONV hq4x_32( uint32_t * sp, uint32_t * dp, int Xres, int 
Yres )
{
    uint32_t        rowBytesL = Xres * 4;

    hq4x_32_rb(sp, rowBytesL, dp, rowBytesL * 4, Xres, Yres);
}

Original comment by anbaricf...@gmail.com on 21 Sep 2011 at 6:50

@GoogleCodeExporter
Copy link
Author

I'll incorporate this when I get the chance.

Original comment by grom...@gmail.com on 1 Dec 2011 at 11:08

@GoogleCodeExporter
Copy link
Author

Have integrated this change for all versions of the scale function.

Original comment by grom...@gmail.com on 5 Dec 2011 at 12:40

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant