Go to the documentation of this file.
39 memset(max_pixsteps, 0, 4*
sizeof(max_pixsteps[0]));
40 if (max_pixstep_comps)
41 memset(max_pixstep_comps, 0, 4*
sizeof(max_pixstep_comps[0]));
43 for (
i = 0;
i < 4;
i++) {
45 if (
comp->step > max_pixsteps[
comp->plane]) {
46 max_pixsteps[
comp->plane] =
comp->step;
47 if (max_pixstep_comps)
48 max_pixstep_comps[
comp->plane] =
i;
55 int max_step,
int max_step_comp,
58 int s, shifted_w, linesize;
65 s = (max_step_comp == 1 || max_step_comp == 2) ?
desc->log2_chroma_w : 0;
66 shifted_w = ((
width + (1 <<
s) - 1)) >>
s;
67 if (shifted_w && max_step > INT_MAX / shifted_w)
69 linesize = max_step * shifted_w;
72 linesize = (linesize + 7) >> 3;
96 memset(linesizes, 0, 4*
sizeof(linesizes[0]));
102 for (
i = 0;
i < 4;
i++) {
112 uint8_t *ptr,
const int linesizes[4])
114 int i, total_size,
size[4] = { 0 }, has_plane[4] = { 0 };
117 memset(
data , 0,
sizeof(
data[0])*4);
123 if (linesizes[0] > (INT_MAX - 1024) /
height)
130 return size[0] + 256 * 4;
133 for (
i = 0;
i < 4;
i++)
134 has_plane[
desc->comp[
i].plane] = 1;
136 total_size =
size[0];
137 for (
i = 1;
i < 4 && has_plane[
i];
i++) {
138 int h,
s = (
i == 1 ||
i == 2) ?
desc->log2_chroma_h : 0;
141 if (linesizes[
i] > INT_MAX /
h)
144 if (total_size > INT_MAX -
size[
i])
146 total_size +=
size[
i];
156 for (
i = 0;
i < 256;
i++) {
186 pal[
i] =
b + (
g << 8) + (
r << 16) + (0xFF
U << 24);
207 for (
i = 0;
i < 4;
i++)
208 linesizes[
i] =
FFALIGN(linesizes[
i], align);
231 memset(
pointers[0] + linesizes[0] *
h, 0,
249 .log_level_offset_offset = offsetof(
ImgUtils, log_offset),
250 .parent_log_context_offset = offsetof(
ImgUtils, log_ctx),
257 .log_offset = log_offset,
265 if ((
int)
w<=0 || (
int)h<=0 || stride >= INT_MAX ||
stride*(uint64_t)(
h+128) >= INT_MAX) {
270 if (max_pixels < INT64_MAX) {
271 if (
w*(int64_t)
h > max_pixels) {
273 "Picture size %ux%u exceeds specified max pixel count %"PRId64
", see the documentation if you wish to increase it\n",
291 if (sar.
den <= 0 || sar.
num < 0)
310 ptrdiff_t bytewidth,
int height)
317 memcpy(dst,
src, bytewidth);
325 ptrdiff_t bytewidth,
int height)
340 int bytewidth,
int height)
346 const uint8_t *src_data[4],
const ptrdiff_t src_linesizes[4],
349 ptrdiff_t, ptrdiff_t,
int))
359 src_data[0], src_linesizes[0],
363 memcpy(dst_data[1], src_data[1], 4*256);
365 int i, planes_nb = 0;
367 for (
i = 0;
i <
desc->nb_components;
i++)
368 planes_nb =
FFMAX(planes_nb,
desc->comp[
i].plane + 1);
370 for (
i = 0;
i < planes_nb;
i++) {
377 if (
i == 1 ||
i == 2) {
381 src_data[
i], src_linesizes[
i],
388 const uint8_t *src_data[4],
const int src_linesizes[4],
391 ptrdiff_t dst_linesizes1[4], src_linesizes1[4];
394 for (
i = 0;
i < 4;
i++) {
395 dst_linesizes1[
i] = dst_linesizes[
i];
396 src_linesizes1[
i] = src_linesizes[
i];
404 const uint8_t *src_data[4],
const ptrdiff_t src_linesizes[4],
425 for (
i = 0;
i < 4;
i++)
426 dst_linesize[
i] =
FFALIGN(dst_linesize[
i], align);
454 const uint8_t *
const src_data[4],
455 const int src_linesize[4],
459 int i, j, nb_planes = 0, linesize[4];
467 for (
i = 0;
i <
desc->nb_components;
i++)
468 nb_planes =
FFMAX(
desc->comp[
i].plane, nb_planes);
475 for (
i = 0;
i < nb_planes;
i++) {
476 int h,
shift = (
i == 1 ||
i == 2) ?
desc->log2_chroma_h : 0;
480 for (j = 0; j <
h; j++) {
481 memcpy(dst,
src, linesize[
i]);
483 src += src_linesize[
i];
488 uint32_t *
d32 = (uint32_t *)dst;
490 for (
i = 0;
i<256;
i++)
511 for (
i = 0;
i < clear_size;
i++) {
512 if (clear[
i] != clear[0]) {
520 if (clear_size == 1) {
521 memset(dst, clear[0], dst_size);
523 if (clear_size > dst_size)
524 clear_size = dst_size;
525 memcpy(dst, clear, clear_size);
532 #define MAX_BLOCK_SIZE 32
543 int clear_block_size[4] = {0};
544 ptrdiff_t plane_line_bytes[4] = {0};
559 if (nb_planes != 1 || !(rgb || mono) || bytewidth < 1)
569 memset(
data, fill, bytewidth);
570 data += dst_linesize[0];
575 for (
c = 0;
c <
desc->nb_components;
c++) {
587 for (
c = 0;
c <
desc->nb_components;
c++) {
590 int w = clear_block_size[
comp.plane] /
comp.step;
592 const int c_linesize[4] = {0};
599 if (!rgb &&
comp.depth < 8)
604 if (
c == 0 && limited) {
606 }
else if ((
c == 1 ||
c == 2) && !rgb) {
613 for (
x = 0;
x <
w;
x++)
616 for (
x = 0;
x < 4;
x++)
617 c_data[
x] = &clear_block[
x][0];
622 for (plane = 0; plane < nb_planes; plane++) {
624 if (plane_line_bytes[plane] < 0)
631 for (plane = 0; plane < nb_planes; plane++) {
632 size_t bytewidth = plane_line_bytes[plane];
634 int chroma_div = plane == 1 || plane == 2 ?
desc->log2_chroma_h : 0;
635 int plane_h = ((
height + ( 1 << chroma_div) - 1)) >> chroma_div;
637 for (; plane_h > 0; plane_h--) {
638 memset_bytes(
data, bytewidth, &clear_block[plane][0], clear_block_size[plane]);
639 data += dst_linesize[plane];
AVPixelFormat
Pixel format.
static int image_get_linesize(int width, int plane, int max_step, int max_step_comp, const AVPixFmtDescriptor *desc)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
static void image_copy(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height, void(*copy_plane)(uint8_t *, ptrdiff_t, const uint8_t *, ptrdiff_t, ptrdiff_t, int))
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, uint8_t *ptr, const int linesizes[4])
Fill plane data pointers for an image with pixel format pix_fmt and height height.
static void copy_plane(AVCodecContext *avctx, AVFrame *src, AVFrame *dst)
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
int ff_image_copy_plane_uc_from_x86(uint8_t *dst, ptrdiff_t dst_linesize, const uint8_t *src, ptrdiff_t src_linesize, ptrdiff_t bytewidth, int height)
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
#define AV_CEIL_RSHIFT(a, b)
static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize, const uint8_t *src, ptrdiff_t src_linesize, ptrdiff_t bytewidth, int height)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Undefined Behavior In the C some operations are like signed integer dereferencing freed pointers
static enum AVPixelFormat pix_fmt
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], enum AVPixelFormat pix_fmt, enum AVColorRange range, int width, int height)
Overwrite the image data with black.
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear, size_t clear_size)
int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], const uint8_t *src, enum AVPixelFormat pix_fmt, int width, int height, int align)
Setup the data pointers and linesizes based on the specified image parameters and the provided array.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
@ AV_ROUND_ZERO
Round toward zero.
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters.
static const AVClass imgutils_class
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane.
void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image data located in uncacheable (e.g.
#define i(width, name, range_min, range_max)
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
static int shift(int a, int b)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int av_image_copy_to_buffer(uint8_t *dst, int dst_size, const uint8_t *const src_data[4], const int src_linesize[4], enum AVPixelFormat pix_fmt, int width, int height, int align)
Copy image data from an image into a buffer.
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
Check if the given sample aspect ratio of an image is valid.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
AVColorRange
MPEG vs JPEG YUV range.
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
static void image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, const uint8_t *src, ptrdiff_t src_linesize, ptrdiff_t bytewidth, int height)