MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_video_buffer_realloc

Function hb_video_buffer_realloc

libhb/fifo.c:963–998  ·  view source on GitHub ↗

this routine reallocs a buffer for an uncompressed video frame with dimensions width x height.

Source from the content-addressed store, hash-verified

961// this routine reallocs a buffer for an uncompressed video frame
962// with dimensions width x height.
963void hb_video_buffer_realloc( hb_buffer_t * buf, int width, int height )
964{
965 const AVPixFmtDescriptor * desc = av_pix_fmt_desc_get(buf->f.fmt);
966 uint8_t has_plane[4] = {0,};
967 int ii, pp;
968
969 if (desc == NULL)
970 {
971 return;
972 }
973
974 buf->f.max_plane = 0;
975 int size = 0;
976 for (ii = 0; ii < desc->nb_components; ii++)
977 {
978 pp = desc->comp[ii].plane;
979 if (pp > buf->f.max_plane)
980 {
981 buf->f.max_plane = pp;
982 }
983 if (!has_plane[pp])
984 {
985 has_plane[pp] = 1;
986 size += hb_image_stride(buf->f.fmt, width, pp) *
987 hb_image_height(buf->f.fmt, height, pp );
988 }
989 }
990
991 hb_buffer_realloc(buf, size );
992
993 buf->f.width = width;
994 buf->f.height = height;
995 buf->size = size;
996
997 hb_buffer_init_planes(buf);
998}
999
1000// this routine 'moves' data from src to dst by interchanging 'data',
1001// 'size' & 'alloc' between them and copying the rest of the fields

Callers

nothing calls this directly

Calls 4

hb_image_strideFunction · 0.85
hb_image_heightFunction · 0.85
hb_buffer_reallocFunction · 0.85
hb_buffer_init_planesFunction · 0.85

Tested by

no test coverage detected