Skip navigation
Currently Being Moderated

Input to output (pixel by pixel) problems

Jun 19, 2012 3:37 AM

Tags: #output #input #pixel #pixels

I'm at the start of creating a simple plugin. My aim is to put everything from input to output but pixel by pixel. I'm using a CCU example for that, but this causes problems.

 

Here's my code:

    PF_EffectWorld *inputP = &params[0]->u.ld;

    PF_Pixel8 *inputPix = (PF_Pixel8 *)inputP->data;

    PF_Pixel8 *outPix = (PF_Pixel8 *)output->data;

   

    for (int i=0; i<output->height; i++)

    {

        for (int j=0; j<output->width; j++)   

        {

            *outPix++ = *inputPix++;

        }

    }

 

My original footage looks like this:

01.png

 

And after using my code it looks like this:

02.png

 

After adding the bold line everything works (why do I have to use that line?):

for (int i=0; i<output->height; i++)

    {

        for (int j=0; j<output->width; j++)   

        {

            *outPix++ = *inputPix++;

        }

       

        for(int k=0;k<4;k++) inputPix++;

    }

 

But when I'm trying to use the plugin again on the same footage it looks like this:

03.png

 

Am I missing something? What causes that? When I use the callback funcion everything works fine, but I have to do that using the above way 'cause I have to have access to every pixel of the footage.

Thanks in advance, David

 
Replies
  • Currently Being Moderated
    Jun 19, 2012 4:32 AM   in reply to DaveProx

    It is called gutter or row padding, each row may contain more pixel than the actual width. You can check for this with the rowBytes value of inputP.

    The CCU example already compensates for this, so look there for more information:

     

     

    in_gutterL        =     (inputP->rowbytes / sizeof(PF_Pixel8)) - inputP->width,

    out_gutterL        =    (outputP->rowbytes / sizeof(PF_Pixel8)) - outputP->width;

     

    ...

     

    // At the end of each row, account for the gutter

    // (this number can vary by platform and for other reasons)

    if (yL >= 0 && yL < inputP->height){

        bop_inP    += in_gutterL;

    }

    bop_outP += out_gutterL;

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points