VLC  4.0.0-dev
Macros | Functions
picture.c File Reference
Include dependency graph for picture.c:

Macros

#define PICTURE_SW_SIZE_MAX   (UINT32_C(1) << 28) /* 256MB: 8K * 8K * 4*/
 

Functions

static void PictureDestroyContext (picture_t *p_picture)
 
static void picture_DestroyDummy (picture_t *p_picture)
 Destroys a picture allocated by picture_NewFromResource() but without a custom destruction callback. More...
 
static void picture_DestroyFromFormat (picture_t *pic)
 Destroys a picture allocated with picture_NewFromFormat(). More...
 
void * picture_Allocate (int *restrict fdp, size_t size)
 
void picture_Deallocate (int fd, void *base, size_t size)
 
void picture_Reset (picture_t *p_picture)
 This function will reset a picture information (properties and quantizers). More...
 
static int LCM (int a, int b)
 
int picture_Setup (picture_t *p_picture, const video_format_t *restrict fmt)
 
static picture_priv_tpicture_NewPrivate (const video_format_t *restrict p_fmt, size_t extra)
 
picture_tpicture_NewFromResource (const video_format_t *p_fmt, const picture_resource_t *p_resource)
 This function will create a new picture using the provided resource. More...
 
picture_tpicture_NewFromFormat (const video_format_t *restrict fmt)
 
picture_tpicture_New (vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den)
 This function will create a new picture. More...
 
void picture_Destroy (picture_t *picture)
 Destroys a picture without references. More...
 
void plane_CopyPixels (plane_t *p_dst, const plane_t *p_src)
 
void picture_CopyProperties (picture_t *p_dst, const picture_t *p_src)
 This function will copy all picture dynamic properties. More...
 
void picture_CopyPixels (picture_t *p_dst, const picture_t *p_src)
 This function will copy the picture pixels. More...
 
void picture_Copy (picture_t *p_dst, const picture_t *p_src)
 This function will copy both picture dynamic properties and pixels. More...
 
static void picture_DestroyClone (picture_t *clone)
 
picture_tpicture_Clone (picture_t *picture)
 Perform a shallow picture copy. More...
 
int picture_Export (vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height, bool b_crop)
 This function will export a picture to an encoded bitstream. More...
 

Macro Definition Documentation

◆ PICTURE_SW_SIZE_MAX

#define PICTURE_SW_SIZE_MAX   (UINT32_C(1) << 28) /* 256MB: 8K * 8K * 4*/

Referenced by picture_NewFromFormat().

Function Documentation

◆ LCM()

static int LCM ( int  a,
int  b 
)
static

References GCD().

Referenced by picture_Setup().

◆ picture_Allocate()

void* picture_Allocate ( int *restrict  fdp,
size_t  size 
)

References aligned_alloc().

Referenced by picture_NewFromFormat().

◆ picture_Clone()

picture_t* picture_Clone ( picture_t pic)

Perform a shallow picture copy.

This function makes a shallow copy of an existing picture. The same planes and resources will be used, and the cloned picture reference count will be incremented.

Returns
A clone picture on success, NULL on error.

References picture_t::context, picture_context_t::copy, picture_t::format, plane_t::i_lines, picture_resource_t::i_lines, plane_t::i_pitch, picture_resource_t::i_pitch, picture_t::i_planes, likely, picture_t::p, picture_resource_t::p, plane_t::p_pixels, picture_resource_t::p_pixels, picture_t::p_sys, picture_resource_t::p_sys, picture_DestroyClone(), picture_Hold(), and picture_NewFromResource().

Referenced by picture_Release(), and vout_snapshot_Set().

◆ picture_Copy()

void picture_Copy ( picture_t p_dst,
const picture_t p_src 
)

This function will copy both picture dynamic properties and pixels.

You have to notice that sometime a simple picture_Hold may do what you want without the copy overhead. Provided for convenience.

Parameters
p_dstpointer to the destination picture.
p_srcpointer to the source picture.

References picture_CopyPixels(), and picture_CopyProperties().

Referenced by picture_Release(), ThreadDisplayRenderPicture(), and vout_ConvertForDisplay().

◆ picture_CopyPixels()

void picture_CopyPixels ( picture_t p_dst,
const picture_t p_src 
)

This function will copy the picture pixels.

You can safely copy between pictures that do not have the same size, only the compatible(smaller) part will be copied.

References picture_t::context, picture_context_t::copy, picture_t::i_planes, picture_t::p, and plane_CopyPixels().

Referenced by picture_Copy(), and picture_Release().

◆ picture_CopyProperties()

void picture_CopyProperties ( picture_t p_dst,
const picture_t p_src 
)

This function will copy all picture dynamic properties.

References picture_t::b_force, picture_t::b_progressive, picture_t::b_still, picture_t::b_top_field_first, picture_t::date, and picture_t::i_nb_fields.

Referenced by picture_Copy(), and picture_Release().

◆ picture_Deallocate()

void picture_Deallocate ( int  fd,
void *  base,
size_t  size 
)

◆ picture_Destroy()

void picture_Destroy ( picture_t picture)

Destroys a picture without references.

This function destroys a picture with zero references left. Never call this function directly. Use picture_Release() instead.

References container_of, picture_priv_t::destroy, picture_priv_t::gc, PictureDestroyContext(), and picture_t::refs.

Referenced by picture_Release().

◆ picture_DestroyClone()

static void picture_DestroyClone ( picture_t clone)
static

References picture_Release().

Referenced by picture_Clone().

◆ picture_DestroyDummy()

static void picture_DestroyDummy ( picture_t p_picture)
static

Destroys a picture allocated by picture_NewFromResource() but without a custom destruction callback.

Referenced by picture_NewFromResource().

◆ picture_DestroyFromFormat()

static void picture_DestroyFromFormat ( picture_t pic)
static

◆ picture_Export()

int picture_Export ( vlc_object_t p_obj,
block_t **  pp_image,
video_format_t p_fmt,
picture_t p_picture,
vlc_fourcc_t  i_format,
int  i_override_width,
int  i_override_height,
bool  b_crop 
)

This function will export a picture to an encoded bitstream.

pp_image will contain the encoded bitstream in psz_format format.

p_fmt can be NULL otherwise it will be set with the format used for the picture before encoding.

i_override_width/height allow to override the width and/or the height of the picture to be encoded:

  • if strictly lower than 0, the original dimension will be used.
  • if equal to 0, it will be deduced from the other dimension which must be different to 0.
  • if strictly higher than 0, it will either override the dimension if b_crop is false, or crop the picture to the provided size if b_crop is true. If at most one of them is > 0 then the picture aspect ratio will be kept.

References picture_t::date, picture_t::format, video_format_t::i_chroma, block_t::i_dts, video_format_t::i_height, block_t::i_pts, video_format_t::i_sar_den, video_format_t::i_sar_num, video_format_t::i_visible_height, video_format_t::i_visible_width, video_format_t::i_width, video_format_t::i_x_offset, video_format_t::i_y_offset, image_HandlerCreate, image_HandlerDelete(), image_Write, VLC_EGENERIC, VLC_ENOMEM, and VLC_SUCCESS.

Referenced by picture_Release(), and vout_GetSnapshot().

◆ picture_New()

picture_t* picture_New ( vlc_fourcc_t  i_chroma,
int  i_width,
int  i_height,
int  i_sar_num,
int  i_sar_den 
)

This function will create a new picture.

The picture created will implement a default release management compatible with picture_Hold and picture_Release. This default management will release p_sys, gc.p_sys fields if non NULL.

References picture_NewFromFormat(), video_format_Init(), and video_format_Setup().

◆ picture_NewFromFormat()

picture_t* picture_NewFromFormat ( const video_format_t *restrict  fmt)

◆ picture_NewFromResource()

picture_t* picture_NewFromResource ( const video_format_t ,
const picture_resource_t  
)

◆ picture_NewPrivate()

static picture_priv_t* picture_NewPrivate ( const video_format_t *restrict  p_fmt,
size_t  extra 
)
static

◆ picture_Reset()

void picture_Reset ( picture_t )

This function will reset a picture information (properties and quantizers).

It is sometimes useful for reusing pictures (like from a pool).

References picture_t::b_force, picture_t::b_progressive, picture_t::b_still, picture_t::b_top_field_first, picture_t::date, picture_t::i_nb_fields, PictureDestroyContext(), and VLC_TICK_INVALID.

Referenced by ModuleThread_NewVideoBuffer(), picture_Release(), vout_GetPicture(), and VoutVideoFilterInteractiveNewPicture().

◆ picture_Setup()

int picture_Setup ( picture_t p_picture,
const video_format_t *restrict  fmt 
)

◆ PictureDestroyContext()

static void PictureDestroyContext ( picture_t p_picture)
static

◆ plane_CopyPixels()

void plane_CopyPixels ( plane_t p_dst,
const plane_t p_src 
)