7 Replies Latest reply: Oct 27, 2011 2:01 PM by Jaap H RSS

    pixelFormatSupported

    Jaap H Community Member

      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

        • 1. Re: pixelFormatSupported
          Jaap H Community Member

          Getting a step closer:

           

          It seems that deleting the:

          ~/library/preferences/com.adobe...5.5.plist

          wil get PP to update the 32-bits color and YUV icons behind the plugins in the effects tab

           

          Now the code above with only the PrPixelFormat_BGRA_4444_32f as being supported by the plugin doesn't work.

          A) PP doesn't show a 32-bits color icon.

          B) it acts as if the plugin would still support PrPixelFormat_BGRA_4444_8u (or YUV_8u) and doesn't launch the RenderDissolve32f  function.

           

          "Starting in CS4, plug-ins no longer need to support 8-bit BGRA at a minimum. If required, Premiere can make intermediate format conversions in the render pipeline, although these inter- mediate conversions will be avoided if possible."

           

          But It seems PP still requiers me to have my transitions to be 8-bit BGRA supported. True?

           

          Is it time for me to get into ScaleConvert()?

           

          Cheers,

          Jaap

          • 2. Re: pixelFormatSupported
            Rallymax

            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;

             

             

            • 3. Re: pixelFormatSupported
              Jaap H Community Member

              Thank you Rallymax,

               

              You have been very helpfull.

              This solved my issue.

               

              I keep testing and trying things to improve my skills.

               

              Now stangely the SDK guide says plugins no longer need to support BGRA8 at minimum.

              But for a transition to work properly, I found it still needs to handle BGRA8 in order to show the transition in the effect-control-window.

              Otherwise PP gives a serious error.

               

              Anyone knows if this is correct?

               

              Cheers.

              • 4. Re: pixelFormatSupported
                Rallymax Community Member

                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.

                • 5. Re: pixelFormatSupported
                  Rallymax Community Member

                  Oops a mistake

                   

                   

                   

                  The32fFrame= malloc(heightrowstride4);

                   

                   

                   

                  Should be

                   

                   

                   

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

                  • 6. Re: pixelFormatSupported
                    Rallymax Community Member

                    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

                    • 7. Re: pixelFormatSupported
                      Jaap H Community Member

                      Thanks Rallymax,

                       

                      This is clear to me.

                      And a fast way to get the 8bits compatibility.

                       

                      Cheers.