37 return ret >= 0 ?
"0" :
40 ret ==
AVERROR(ENOMEM) ?
"ENOMEM" :
"unexpected error";
62 f->nb_samples = nb_samples;
65 for (
int p = 0; p <
planes; p++)
67 f->extended_data[p][
i] =
i * 5 + p * 13;
74 int planes = planar ?
f->ch_layout.nb_channels : 1;
76 (planar ? 1 :
f->ch_layout.nb_channels);
79 for (
int p = 0; p <
planes; p++)
86 printf(
"%s: %d ch, %d samples, nb_extended_buf %d, extended_data %s, sum %08"PRIx32
"\n",
87 name,
f->ch_layout.nb_channels,
f->nb_samples,
f->nb_extended_buf,
88 f->extended_data ==
f->data ?
"data" :
"own",
audio_sum(
f));
129 static const struct {
132 size_t left, right, top, bottom;
155 f->crop_right =
tests[
i].right;
157 f->crop_bottom =
tests[
i].bottom;
159 printf(
"crop %s %s%s: %s, %dx%d, crop fields %s, offsets",
162 !(
f->crop_left |
f->crop_right |
f->crop_top |
f->crop_bottom) ?
"cleared" :
163 f->crop_left ==
tests[
i].left &&
f->crop_right ==
tests[
i].right &&
164 f->crop_top ==
tests[
i].top &&
f->crop_bottom ==
tests[
i].bottom ?
"kept" :
"changed");
165 for (
int p = 0; p < 4 &&
data[p]; p++) {
166 ptrdiff_t off =
f->data[p] -
data[p];
169 printf(
" %td+%td", off /
f->linesize[p], off %
f->linesize[p]);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Public header for Adler-32 hash function implementation.
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
__device__ int printf(const char *,...)
reference-counted frame API
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_apply_cropping(AVFrame *frame, int flags)
Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields.
@ AV_FRAME_CROP_UNALIGNED
Apply the maximum possible cropping, even if it requires setting the AVFrame.data[] entries to unalig...
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_S16
signed 16 bits
static const struct @257111027162314367033347246032313251342043035002 planes[]
Utility Preprocessor macros.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
#define FF_ARRAY_ELEMS(a)
This structure describes decoded (raw) audio or video data.
static uint32_t audio_sum(const AVFrame *f)
static void print_audio(const char *name, const AVFrame *f)
static AVFrame * audio(enum AVSampleFormat fmt, int channels, int nb_samples)
static AVFrame * video(enum AVPixelFormat fmt, int w, int h)
static const char * err(int ret)
static void test_cropping(void)
static void test_replace(void)