3 Replies Latest reply on Apr 22, 2017 7:03 AM by Eddie Lotter

    Changing the Color of Pixels

    jhood135

      I'm incredibly new in the world of coding with Premiere, so my apologies if I'm not using the right terms...

       

      I'm trying to write a plugin that will scan every pixel in a clip. I want it to act almost like a FCP Broadcast Safe filter, making the pixels that are too bright darker. I assumed that using an If-Else structure would be the best way to do this, however I don't know what to declare in the If statement. I'm using the Simple_Video_Filter example from the SDK package. Here's the section of the code I'm working on (again, apologies for how bad it is...)

       

                          for(int vert = 0; vert < height; ++vert)

                          {

                              for(int horiz = 0; horiz < width; ++horiz)

                              {

                                  // Save off alpha

                                  alpha = *srcpix & 0xff000000;

                                  // Separate colors

                                  redSource = (*srcpix & 0x00ff0000) >> 16;

                                  greenSource = (*srcpix & 0x0000ff00) >> 8;

                                  blueSource = *srcpix & 0x000000ff;

       

                                  if (redSource == 0x00ff0000) {

                                      redSource = *srcpix & 0x000000ff;

                                      OutputDebugString(TEXT("Red detected."));

                                  }

                                  else {

                                      OutputDebugString(TEXT("No Red."));

                                  }

                                

                                  *dstpix = (alpha | (redSource << 16) | (greenSource << 8) | blueSource);

                                  ++dstpix;

                                  ++srcpix;

                              }

                              srcpix += (rowbytes / 4) - width;

                              dstpix += (rowbytes / 4) - width;

                          } // else

      On a colour matte with the value of FF0000, it still prints out "No Red."

       

      Can someone please advise, or at least point me in the right direction?

       

      Thanks.

      -Josh