Skip navigation
Currently Being Moderated

pixelFormatSupported

Oct 21, 2011 3:43 PM

Tags: #transition_api #pixel_format

Hey guys,

 

Trying to get into the pixelFormats here.

 

I'm adjusting the SDK's Cross Dissolve in order to find out if it's possible to write a transition that only supports PrPixelFormat_BGRA_4444_32f.

This way I can get into making quality plugins without having to write seperated code for different PixelFormats.

 

"Starting in CS4, plug-ins no longer need to support 8-bit BGRA at a minimum."

- I say: let PP handle the nessesary conversions. Let me focus on just the BGRA4444_32f

 

So I'm banishing some lines of code:

 

static prMALError GetPixelFormatsSupported(EffectHandle theData)

{

          prMALError result = esNoErr;

 

  switch((*theData)->pixelFormatIndex)

          {

/*                    case 0:

                              (*theData)->pixelFormatSupported =  PrPixelFormat_BGRA_4444_8u;

                              break;

 

                    case 1:

                              (*theData)->pixelFormatSupported =  PrPixelFormat_VUYA_4444_8u;

                              break;

*/

  // These pixel formats are only available in Premiere Pro 2.0 and later

                    case 2:

                              if ((*theData)->version >= 9)

                              {

                                        (*theData)->pixelFormatSupportedPrPixelFormat_BGRA_4444_32f;

                              }

  else

                              {

                                        result = esBadFormatIndex;

                              }

  break;

 

/*                    case 3:

                              (*theData)->pixelFormatSupported =  PrPixelFormat_VUYA_4444_32f;

                              break;

*/

  default:

                              result = esBadFormatIndex;

          }

 

          return result;

}


So we are down to the one and only PrPixelFormat_BGRA_4444_32f

I wanted to see what happens.

 

But I didn't got the feeling it wasn't working, because it still showed the YUV sign in the effects tab.

 

So I messed around with this: Banished some other lines of code so it would only support 8u.

Well, at some point all the signs (32-bits and YUV) where gone in the Effects tab.

 

Now I want them back. But I can't...

 

I keep reloading the plug-in by restarting PP - nothing

I'm holding shift at the start of PP to refresh all the plugins. - nothing.

Redownloaded the fresh SDK pack, recompiled the cross dissolve with nothing changed - nothing.

 

started to get frustrated...

 

told the plugin not to cache itself, but to reload each time pp is started by adding:

        case esCacheOnLoad:

            result = esDoNotCacheOnLoad;

            break;

to the selector switch: PREMPLUGENTRY DllExport xEffect (short                               selector,   EffectHandle           theData)

 

looked at the ~/library/adobe/premiere pro/5.5/plugin loading.log   and found:

Loading /Library/Application Support/Adobe/Common/Plug-ins/CS5.5/MediaCore/Cross_Dissolve.bundle

The registry tells us not to cache so the plugin will be loaded from disk.

Loading from disk...

This plugin was recognized by loader 3dbe9220-aa71-4c9d-9342-4c239a83a825.

- So this is OK. - but then again it doesn't change anything with the recogition for being 32-bits enabled

 

So the SDK Cross Dissolve transition listed in the Effects tab still isn't showing me the 32bits sign, even with a freshly compiled original that should support both 32-bits color and YUV.

 

What am I missing here?

 

Cheers,

Jaap

 
Replies
  • Currently Being Moderated
    Oct 24, 2011 10:32 AM   in reply to Jaap H

    The list of supported pixelformats is stored as an array so you have to start with an index of 0.

     

    Simply commenting out the handling cases won’t work – it’ll just fall through for those cases.

     

    You need to modify the PixelFormats[] array that is originally created so that Premiere knows what PixelFormats are supported.

     

     

     

    That means that you’ll end up with a

     

     

     

    PixelFormats[] = ; only

     

     

     

    Once you’ve done that change you can change the handling function too…

     

     

     

     

     

    static prMALError GetPixelFormatsSupported(EffectHandle theData)

     

    {

     

              prMALError result = esNoErr;

     

     

     

    if( (theData)->pixelFormatIndex == 0 && (theData)->version >= 9)

     

    {

     

    (*theData)->pixelFormatSupported =  PrPixelFormat_BGRA_4444_32f;

     

                }

     

                else

     

    {

     

                             result = esBadFormatIndex;

     

                }

     

                return result;

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2011 1:44 PM   in reply to Jaap H

    Unfortunately plugin development isn’t as easy as we all would like but at least it is open for us to develop on.

     

     

     

    I suspect that the Editing Mode you’re in has a Player that doesn’t support BGRA_4444_32f and does (because of legacy) support BGRA_4444_8u thus the preview window requires BGRA_8u support to work.

     

     

     

    If you do want to support BGRA_4444_8u then you should be able to make common code by converting the 8u to 32f and then continuing your plugin as 32f. (Likewise you should do a YUV_32f to BGRA_32f –although if you don’t know a lot about rec601 and rec709 colorspaces I HIGHLY recommend that you DO NOT start doing this).

     

     

     

    Here’s a quick mock up off the top of my head…

     

     

     

    float The32fFrame = (float)TheFrame;

     

    int do_32f_to_8u = 0;

     

     

     

    switch((*theData)->pixelFormatSupported)

     

                {

     

    case PrPixelFormat_BGRA_4444_8u:

     

    // Flag to un-convert at the end

     

    do_32f_to_8u = 1;

     

    The32fFrame= malloc(heightrowstride4);

     

     

     

    // Convert 0..255 (_8u) buffer to 0.0…1.0 (_32f)

     

    // Change this to SSE|2|3|4 intrinsics for a 4x or 8x speedup!

     

    for(int h=0;h<height;h++)                     // Height

     

    for(int w=0;w<width;w++)         // Width

     

    for(int p=0;w<4;p++)    // Plane

     

                            The32fFrame[4hrowstride+ 4*w + p] =

     

    (float)TheFrame[4h rowstride + 4*w + p]/(float)255.0);

     

    // Now fall through and process as BGRA_32f

     

    case PrPixelFormat_BGRA_4444_32f:

     

     

     

    // IMPLEMENT YOUR FILTER/TRANSITION HERE

     

     

     

    break;

     

                default:

     

                            return WHATEVER THE ERROR CODE IS FOR UNSUPPORTED;

     

    }

     

     

     

    //Run a loop that un-does the floating point conversion if necessary.

     

    if(do_32f_to_8u)

     

    // Change 32f back to 8u

     

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

     

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

     

    for(int p=0;w<4;p++)

     

    TheFrame[4h rowstride + 4*w + p] =

     

    (unsigned int)((float)255.0 * The32fFrame[4h rowstride + 4*w + p]);

     

                free(The32fFrame);

     

    return prNOERR;

     

     

     

     

     

    ·         Where “rowstride” is the actual stride of the row, not the frame width.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2011 1:47 PM   in reply to Jaap H

    Oops a mistake

     

     

     

    The32fFrame= malloc(heightrowstride4);

     

     

     

    Should be

     

     

     

    The32fFrame= malloc(heightrowstride4*sizeof(float));

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2011 1:50 PM   in reply to Jaap H

    This too…

     

    for(int h=0;h<height;h++)                     // Height

     

    for(int w=0;w<width;w++)         // Width

     

    for(int p=0;w<4;p++)    // Plane

     

    new version with “w” to “p” fix…

     

     

     

    for(int h=0;h<height;h++)                     // Height

     

    for(int w=0;w<width;w++)         // Width

     

    for(int p=0;p<4;p++)    // Plane

     
    |
    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