47 #define OFFSET(x) offsetof(FSPPContext, x) 48 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 51 {
"qp",
"force a constant quantizer parameter",
OFFSET(qp),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 64, FLAGS },
60 { 0, 48, 12, 60, 3, 51, 15, 63, },
61 { 32, 16, 44, 28, 35, 19, 47, 31, },
62 { 8, 56, 4, 52, 11, 59, 7, 55, },
63 { 40, 24, 36, 20, 43, 27, 39, 23, },
64 { 2, 50, 14, 62, 1, 49, 13, 61, },
65 { 34, 18, 46, 30, 33, 17, 45, 29, },
66 { 10, 58, 6, 54, 9, 57, 5, 53, },
67 { 42, 26, 38, 22, 41, 25, 37, 21, },
74 71, 296, 295, 237, 71, 40, 38, 19,
75 245, 193, 185, 121, 102, 73, 53, 27,
76 158, 129, 141, 107, 97, 73, 50, 26,
77 102, 116, 109, 98, 82, 66, 45, 23,
78 71, 94, 95, 81, 70, 56, 38, 20,
79 56, 77, 74, 66, 56, 44, 30, 15,
80 38, 53, 50, 45, 38, 30, 21, 11,
81 20, 27, 26, 23, 20, 15, 11, 5
86 ptrdiff_t dst_stride, ptrdiff_t src_stride,
87 ptrdiff_t
width, ptrdiff_t
height, ptrdiff_t log2_scale)
91 temp = (src[x + pos] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \ 92 src[x + pos] = src[x + pos - 8 * src_stride] = 0; \ 93 if (temp & 0x100) temp = ~(temp >> 31); \ 96 for (y = 0; y <
height; y++) {
98 for (x = 0; x <
width; x += 8) {
116 ptrdiff_t dst_stride, ptrdiff_t src_stride,
117 ptrdiff_t
width, ptrdiff_t
height, ptrdiff_t log2_scale)
120 #define STORE2(pos) \ 121 temp = (src[x + pos] + src[x + pos + 16 * src_stride] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \ 122 src[x + pos + 16 * src_stride] = 0; \ 123 if (temp & 0x100) temp = ~(temp >> 31); \ 126 for (y = 0; y <
height; y++) {
128 for (x = 0; x <
width; x += 8) {
144 static void mul_thrmat_c(int16_t *thr_adr_noq, int16_t *thr_adr,
int q)
147 for (a = 0; a < 64; a++)
148 thr_adr[a] = q * thr_adr_noq[a];
152 int dst_stride,
int src_stride,
154 uint8_t *qp_store,
int qp_stride,
int is_luma)
156 int x, x0, y, es, qy, t;
160 const int qpsh = 4 - p->
hsub * !is_luma;
161 const int qpsv = 4 - p->
vsub * !is_luma;
164 int16_t *
block = (int16_t *)block_align;
165 int16_t *block3 = (int16_t *)(block_align + 4 * 8 *
BLOCKSZ);
167 memset(block3, 0, 4 * 8 *
BLOCKSZ);
169 if (!src || !dst)
return;
171 for (y = 0; y <
height; y++) {
173 memcpy(p->
src + index, src + y * src_stride, width);
174 for (x = 0; x < 8; x++) {
175 p->
src[index - x - 1] = p->
src[index + x ];
176 p->
src[index + width + x ] = p->
src[index + width - x - 1];
180 for (y = 0; y < 8; y++) {
181 memcpy(p->
src + ( 7 - y ) * stride, p->
src + ( y + 8 ) * stride, stride);
182 memcpy(p->
src + (height + 8 + y) * stride, p->
src + (height - y + 7) * stride, stride);
186 for (y = 8; y < 24; y++)
187 memset(p->
temp + 8 + y * stride, 0, width *
sizeof(int16_t));
189 for (y = step; y < height + 8; y +=
step) {
190 const int y1 = y - 8 +
step;
193 if (qy > height - 1) qy = height - 1;
196 qy = (qy >> qpsv) * qp_stride;
197 p->
row_fdct(block, p->
src + y * stride + 2 - (y&1), stride, 2);
199 for (x0 = 0; x0 < width + 8 - 8 * (
BLOCKSZ - 1); x0 += 8 * (
BLOCKSZ - 1)) {
200 p->
row_fdct(block + 8 * 8, p->
src + y * stride + 8 + x0 + 2 - (y&1), stride, 2 * (
BLOCKSZ - 1));
205 for (x = 0; x < 8 * (
BLOCKSZ - 1); x += 8) {
210 t = qp_store[qy + (t >> qpsh)];
216 p->
row_idct(block3 + 0 * 8, p->
temp + (y & 15) * stride + x0 + 2 - (y & 1), stride, 2 * (
BLOCKSZ - 1));
217 memmove(block, block + (
BLOCKSZ - 1) * 64, 8 * 8 *
sizeof(int16_t));
218 memmove(block3, block3 + (
BLOCKSZ - 1) * 64, 6 * 8 *
sizeof(int16_t));
223 p->
row_fdct(block + 8 * 8, p->
src + y * stride + 8 + x0 + 2 - (y & 1), stride, (es - 4) >> 2);
227 p->
row_idct(block3 + 0 * 8, p->
temp + (y & 15) * stride + x0 + 2 - (y & 1), stride, es >> 2);
229 if (!(y1 & 7) && y1) {
232 dst_stride, stride, width, 8, 5 - p->
log2_count);
235 dst_stride, stride, width, 8, 5 - p->
log2_count);
241 p->
store_slice(dst + ((y - 8) & ~7) * dst_stride, p->
temp + 8 + 8 * stride,
242 dst_stride, stride, width, y&7, 5 - p->
log2_count);
244 p->
store_slice2(dst + ((y - 8) & ~7) * dst_stride, p->
temp + 8 + 0 * stride,
245 dst_stride, stride, width, y&7, 5 - p->
log2_count);
251 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
264 for (; cnt > 0; cnt -= 2) {
265 threshold = (int16_t *)thr_adr;
266 for (ctr =
DCTSIZE; ctr > 0; ctr--) {
301 tmp10 = (tmp0 + tmp2) >> 2;
302 tmp11 = (tmp0 - tmp2) >> 2;
304 tmp13 = (tmp1 + tmp3) >>2;
307 tmp0 = tmp10 + tmp13;
308 tmp3 = tmp10 - tmp13;
309 tmp1 = tmp11 + tmp12;
310 tmp2 = tmp11 - tmp12;
340 z10 = (tmp6 - tmp5) << 1;
342 z12 = (tmp4 - tmp7) << 1;
344 tmp7 = (z11 + z13) >> 2;
354 wsptr[
DCTSIZE * 0] += (tmp0 + tmp7);
355 wsptr[
DCTSIZE * 1] += (tmp1 + tmp6);
356 wsptr[
DCTSIZE * 2] += (tmp2 + tmp5);
357 wsptr[
DCTSIZE * 3] += (tmp3 - tmp4);
358 wsptr[
DCTSIZE * 4] += (tmp3 + tmp4);
359 wsptr[
DCTSIZE * 5] += (tmp2 - tmp5);
360 wsptr[
DCTSIZE * 6] = (tmp1 - tmp6);
361 wsptr[
DCTSIZE * 7] = (tmp0 - tmp7);
372 static void row_idct_c(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride,
int cnt)
374 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
383 for (; cnt > 0; cnt--) {
386 tmp10 = wsptr[2] + wsptr[3];
387 tmp11 = wsptr[2] - wsptr[3];
389 tmp13 = wsptr[0] + wsptr[1];
392 tmp0 = tmp10 + tmp13;
393 tmp3 = tmp10 - tmp13;
394 tmp1 = tmp11 + tmp12;
395 tmp2 = tmp11 - tmp12;
403 z13 = wsptr[4] + wsptr[5];
404 z10 = wsptr[4] - wsptr[5];
405 z11 = wsptr[6] + wsptr[7];
406 z12 = wsptr[6] - wsptr[7];
415 tmp6 = (tmp12 << 3) - tmp7;
416 tmp5 = (tmp11 << 3) - tmp6;
417 tmp4 = (tmp10 << 3) + tmp5;
420 outptr[0 * output_stride] +=
DESCALE(tmp0 + tmp7, 3);
421 outptr[1 * output_stride] +=
DESCALE(tmp1 + tmp6, 3);
422 outptr[2 * output_stride] +=
DESCALE(tmp2 + tmp5, 3);
423 outptr[3 * output_stride] +=
DESCALE(tmp3 - tmp4, 3);
424 outptr[4 * output_stride] +=
DESCALE(tmp3 + tmp4, 3);
425 outptr[5 * output_stride] +=
DESCALE(tmp2 - tmp5, 3);
426 outptr[6 * output_stride] +=
DESCALE(tmp1 - tmp6, 3);
427 outptr[7 * output_stride] +=
DESCALE(tmp0 - tmp7, 3);
436 int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
445 for (; cnt > 0; cnt--) {
446 tmp0 = pixels[line_size * 0] + pixels[line_size * 7];
447 tmp7 = pixels[line_size * 0] - pixels[line_size * 7];
448 tmp1 = pixels[line_size * 1] + pixels[line_size * 6];
449 tmp6 = pixels[line_size * 1] - pixels[line_size * 6];
450 tmp2 = pixels[line_size * 2] + pixels[line_size * 5];
451 tmp5 = pixels[line_size * 2] - pixels[line_size * 5];
452 tmp3 = pixels[line_size * 3] + pixels[line_size * 4];
453 tmp4 = pixels[line_size * 3] - pixels[line_size * 4];
464 dataptr[2] = tmp10 + tmp11;
465 dataptr[3] = tmp10 - tmp11;
468 dataptr[0] = tmp13 + z1;
469 dataptr[1] = tmp13 - z1;
473 tmp10 = (tmp4 + tmp5) << 2;
474 tmp11 = (tmp5 + tmp6) << 2;
475 tmp12 = (tmp6 + tmp7) << 2;
485 dataptr[4] = z13 + z2;
486 dataptr[5] = z13 - z2;
487 dataptr[6] = z11 + z4;
488 dataptr[7] = z11 - z4;
517 const int h =
FFALIGN(inlink->
h + 16, 16);
551 int8_t *qp_table =
NULL;
554 int custom_threshold_m[64];
558 for (i = 0; i < 64; i++)
561 for (i = 0; i < 8; i++) {
563 |(((uint64_t)custom_threshold_m[i * 8 + 6]) << 16)
564 |(((uint64_t)custom_threshold_m[i * 8 + 0]) << 32)
565 |(((uint64_t)custom_threshold_m[i * 8 + 4]) << 48);
568 |(((uint64_t)custom_threshold_m[i * 8 + 3]) << 16)
569 |(((uint64_t)custom_threshold_m[i * 8 + 1]) << 32)
570 |(((uint64_t)custom_threshold_m[i * 8 + 7]) << 48);
600 if (qp_table || fspp->
qp) {
607 const int aligned_w =
FFALIGN(inlink->
w, 8);
608 const int aligned_h =
FFALIGN(inlink->
h, 8);
622 inlink->
w, inlink->
h, qp_table, qp_stride, 1);
624 cw, ch, qp_table, qp_stride, 0);
626 cw, ch, qp_table, qp_stride, 0);
635 inlink->
w, inlink->
h);
679 .priv_class = &fspp_class,
static const int16_t FIX_1_414213562_A
static void column_fidct_c(int16_t *thr_adr, int16_t *data, int16_t *output, int cnt)
void(* mul_thrmat)(int16_t *thr_adr_noq, int16_t *thr_adr, int q)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
uint64_t threshold_mtx_noq[8 *2]
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static void store_slice2_c(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
int h
agreed upon image height
void(* row_idct)(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride, int cnt)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
uint64_t threshold_mtx[8 *2]
static const short custom_threshold[64]
int is_disabled
the enabled state from the last expression evaluation
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma)
#define THRESHOLD(r, x, t)
const char * name
Pad name.
#define MULTIPLY16H(x, k)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the block
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
static void row_fdct_c(int16_t *data, const uint8_t *pixels, ptrdiff_t line_size, int cnt)
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
A filter pad used for either input or output.
A link between two filters.
static const AVFilterPad fspp_inputs[]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h, int *qscale_type)
Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16 macroblock, stored in raster order - from AVVideoEncParams side data.
static const AVOption fspp_options[]
void ff_fspp_init_x86(FSPPContext *fspp)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const uint8_t dither[8][8]
void * priv
private data for use by the filter
AVFILTER_DEFINE_CLASS(fspp)
simple assert() macros that are a bit more flexible than ISO C assert().
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
enum AVPictureType pict_type
Picture type of the frame.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
static int config_input(AVFilterLink *inlink)
void(* column_fidct)(int16_t *thr_adr, int16_t *data, int16_t *output, int cnt)
static const AVFilterPad outputs[]
int format
agreed upon media format
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
void(* store_slice)(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static av_cold void uninit(AVFilterContext *ctx)
static void store_slice_c(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
const char * name
Filter name.
static int query_formats(AVFilterContext *ctx)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
AVFilterLink ** outputs
array of pointers to output links
static int ff_norm_qscale(int qscale, int type)
Normalize the qscale factor FIXME the H264 qscale is a log based scale, mpeg1/2 is not...
static enum AVPixelFormat pix_fmts[]
static void row_idct_c(int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride, int cnt)
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void(* row_fdct)(int16_t *data, const uint8_t *pixels, ptrdiff_t line_size, int cnt)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void mul_thrmat_c(int16_t *thr_adr_noq, int16_t *thr_adr, int q)
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
void(* store_slice2)(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
AVFilterContext * dst
dest filter
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
static const AVFilterPad fspp_outputs[]
#define av_malloc_array(a, b)
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.
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
AVPixelFormat
Pixel format.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
#define AV_CEIL_RSHIFT(a, b)