MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_image_get_buffer_size

Function av_image_get_buffer_size

libavutil/imgutils.c:466–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466int av_image_get_buffer_size(enum AVPixelFormat pix_fmt,
467 int width, int height, int align)
468{
469 int ret, i;
470 int linesize[4];
471 ptrdiff_t aligned_linesize[4];
472 size_t sizes[4];
473 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
474 if (!desc)
475 return AVERROR(EINVAL);
476
477 ret = av_image_check_size(width, height, 0, NULL);
478 if (ret < 0)
479 return ret;
480
481 ret = av_image_fill_linesizes(linesize, pix_fmt, width);
482 if (ret < 0)
483 return ret;
484
485 for (i = 0; i < 4; i++)
486 aligned_linesize[i] = FFALIGN(linesize[i], align);
487
488 ret = av_image_fill_plane_sizes(sizes, pix_fmt, height, aligned_linesize);
489 if (ret < 0)
490 return ret;
491
492 ret = 0;
493 for (i = 0; i < 4; i++) {
494 if (sizes[i] > INT_MAX - ret)
495 return AVERROR(EINVAL);
496 ret += sizes[i];
497 }
498 return ret;
499}
500
501int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
502 const uint8_t * const src_data[4],

Callers 15

v4l2_read_headerFunction · 0.85
write_headerFunction · 0.85
dc1394_read_commonFunction · 0.85
image_availableFunction · 0.85
frm_read_packetFunction · 0.85
yuv4_read_headerFunction · 0.85
ser_read_headerFunction · 0.85
rawvideo_read_headerFunction · 0.85
msp_read_headerFunction · 0.85
cuda_frames_initFunction · 0.85
av_image_copy_to_bufferFunction · 0.85
qsv_decode_init_contextFunction · 0.85

Calls 4

av_pix_fmt_desc_getFunction · 0.85
av_image_check_sizeFunction · 0.85
av_image_fill_linesizesFunction · 0.85

Tested by 3

video_decodeFunction · 0.68
compute_crc_of_packetsFunction · 0.68
video_decode_exampleFunction · 0.68