Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Minimal Smart Render

Community Expert ,
Aug 25, 2009 Aug 25, 2009

I'm trying to get a grip on smart render and prerender, and what I'd like to do to start with is just set up the most basic condition, where smart render doesn't actaully do anything to the image. In that case, does prerender still need to checkout the layer and smart render needs to copy input to output? What would that code look like? All the examples are more complicated than that.

Dan

TOPICS
SDK
3.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 27, 2009 Aug 27, 2009

this is almost the bare minimum code to use with smart render.

it actually doesn't use any of the smart render.

it would just allow you to render 16 and 32 bit, with the minimal hassle.

just don't froget to set the correct flags in the global setup.

//////////////////////////////////////////////////////////////////////////////////////////////////////

static PF_Err
PreRender(
PF_InData   *in_data,
PF_OutData   *out_data,
PF_PreRenderExtra  *extra)
{
PF_Err err = PF_Err_NONE;
PF_RenderRequest req = extra

...
Translate
Community Expert ,
Aug 27, 2009 Aug 27, 2009

this is almost the bare minimum code to use with smart render.

it actually doesn't use any of the smart render.

it would just allow you to render 16 and 32 bit, with the minimal hassle.

just don't froget to set the correct flags in the global setup.

//////////////////////////////////////////////////////////////////////////////////////////////////////

static PF_Err
PreRender(
PF_InData   *in_data,
PF_OutData   *out_data,
PF_PreRenderExtra  *extra)
{
PF_Err err = PF_Err_NONE;
PF_RenderRequest req = extra->input->output_request;
PF_CheckoutResult in_result;

req.channel_mask = PF_ChannelMask_ARGB;

ERR(extra->cb->checkout_layer( in_data->effect_ref,
     EFFECT_INPUT,
     EFFECT_INPUT,
     &req,
     in_data->current_time,
     in_data->time_step,
     in_data->time_scale,
     &in_result));


UnionLRect(&in_result.result_rect,  &extra->output->result_rect);
UnionLRect(&in_result.max_result_rect,  &extra->output->max_result_rect);

return err;
}

static PF_Err
SmartRender(
PF_InData    *in_data,
PF_OutData    *out_data,
PF_SmartRenderExtra  *extra)

{

PF_Err   err  = PF_Err_NONE,
     err2  = PF_Err_NONE;
AEGP_SuiteHandler suites(in_data->pica_basicP);
    
PF_EffectWorld *input_worldP = NULL,
     *output_worldP  = NULL;


// checkout input & output buffers.
ERR(extra->cb->checkout_layer_pixels( in_data->effect_ref, SHIFT_INPUT, &input_worldP));
ERR(extra->cb->checkout_output( in_data->effect_ref, &output_worldP));

if(input_worldP && output_worldP)
{
  // checkout the required params
  PF_ParamDef paramWhatever;
  AEFX_CLR_STRUCT(paramWhatever);
  ERR(PF_CHECKOUT_PARAM( in_data,
     EFFECT_PARAM,
     in_data->current_time,
     in_data->time_step,
     in_data->time_scale,
     &paramWhatever));

       
  //process the image according to the correct bit depth
  switch (extra->input->bitdepth)
  {
  case 8:
   ...process 8 bit...
   break;
  case 16:
   ...process 16 bit...
   break;
  case 32:
   ...process 32 bit...
   break;
  }


  // Always check in, no matter what the error condition!
  ERR2(PF_CHECKIN_PARAM(in_data, &paramWhatever));
}
return err;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////

p.s.

this code might (and probably does) contain errors.

but with a few tweaks you should be up and running in no time.

🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2009 Aug 27, 2009

Thank you - I really appreciate that. I'm still confused on one point though. In your "//process the image according to the correct bit depth" section - if I don't want my plug-in to affect the image in any way, do I still need code to copy input to output, and if so, does that look different according to the bit depth?

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2009 Aug 27, 2009

if you don't need to process anything, then skip the "process according to bit depth" part

and use:

ERR(PF_COPY(inputP, outputP, NULL, NULL));

this command is not dependant on color depth.

it just copies a chunk of memory from A to B.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2009 Aug 27, 2009

Thank you so much!

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 13, 2025 Jan 13, 2025
LATEST

 

Refreshing this thread after 15+ years 😄

 

My question is, if I want to use transform_world, I'm guessing I will do actual transformation in smart_render, but should I do matrix calculation in pre_render? Also, when I'm doing transform_world, how would I combine that with iterate functions so I can achieve 8,16,32 bit color... 

So, in a nutshell. You basically have plugin where user chooses custom layer in UI dropdown, I checkout that layer in pre_render, and then I want to do world_transform, but to also have 8,16 and 32 bit color. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines