FFmpeg
Loading...
Searching...
No Matches
frame.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "channel_layout.h"
20#include "avassert.h"
21#include "buffer.h"
22#include "dict.h"
23#include "frame.h"
24#include "imgutils.h"
25#include "mem.h"
26#include "refstruct.h"
27#include "samplefmt.h"
28#include "side_data.h"
29#include "hwcontext.h"
30
32{
33 memset(frame, 0, sizeof(*frame));
34
35 frame->pts =
36 frame->pkt_dts = AV_NOPTS_VALUE;
37 frame->best_effort_timestamp = AV_NOPTS_VALUE;
38 frame->duration = 0;
39 frame->time_base = (AVRational){ 0, 1 };
40 frame->sample_aspect_ratio = (AVRational){ 0, 1 };
41 frame->format = -1; /* unknown */
42 frame->extended_data = frame->data;
43 frame->color_primaries = AVCOL_PRI_UNSPECIFIED;
44 frame->color_trc = AVCOL_TRC_UNSPECIFIED;
45 frame->colorspace = AVCOL_SPC_UNSPECIFIED;
46 frame->color_range = AVCOL_RANGE_UNSPECIFIED;
47 frame->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
48 frame->alpha_mode = AVALPHA_MODE_UNSPECIFIED;
49 frame->flags = 0;
50}
51
53{
54 AVFrame *frame = av_malloc(sizeof(*frame));
55
56 if (!frame)
57 return NULL;
58
60
61 return frame;
62}
63
65{
66 if (!frame || !*frame)
67 return;
68
71}
72
73#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : 32)
74
76{
78 int ret, padded_height;
79 int plane_padding;
80 ptrdiff_t linesizes[4];
81 size_t total_size, sizes[4];
82
83 if (!desc)
84 return AVERROR(EINVAL);
85
86 if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0)
87 return ret;
88
89 if (align <= 0)
90 align = ALIGN;
91 plane_padding = FFMAX(ALIGN, align);
92
93 if (!frame->linesize[0]) {
94 for (int i = 1; i <= align; i += i) {
95 ret = av_image_fill_linesizes(frame->linesize, frame->format,
96 FFALIGN(frame->width, i));
97 if (ret < 0)
98 return ret;
99 if (!(frame->linesize[0] & (align-1)))
100 break;
101 }
102
103 for (int i = 0; i < 4 && frame->linesize[i]; i++)
104 frame->linesize[i] = FFALIGN(frame->linesize[i], align);
105 }
106
107 for (int i = 0; i < 4; i++)
108 linesizes[i] = frame->linesize[i];
109
110 padded_height = FFALIGN(frame->height, 32);
111 if ((ret = av_image_fill_plane_sizes(sizes, frame->format,
112 padded_height, linesizes)) < 0)
113 return ret;
114
115 total_size = 4 * plane_padding + 4 * align;
116 for (int i = 0; i < 4; i++) {
117 if (sizes[i] > SIZE_MAX - total_size)
118 return AVERROR(EINVAL);
119 total_size += sizes[i];
120 }
121
122 frame->buf[0] = av_buffer_alloc(total_size);
123 if (!frame->buf[0]) {
124 ret = AVERROR(ENOMEM);
125 goto fail;
126 }
127
128 if ((ret = av_image_fill_pointers(frame->data, frame->format, padded_height,
129 frame->buf[0]->data, frame->linesize)) < 0)
130 goto fail;
131
132 for (int i = 1; i < 4; i++) {
133 if (frame->data[i])
134 frame->data[i] += i * plane_padding;
135 frame->data[i] = (uint8_t *)FFALIGN((uintptr_t)frame->data[i], align);
136 }
137
138 frame->extended_data = frame->data;
139
140 return 0;
141fail:
143 return ret;
144}
145
147{
148 int planar = av_sample_fmt_is_planar(frame->format);
149 int channels, planes;
150 size_t size;
151 int ret;
152
153 channels = frame->ch_layout.nb_channels;
154 planes = planar ? channels : 1;
155 if (!frame->linesize[0]) {
156 ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
157 frame->nb_samples, frame->format,
158 align);
159 if (ret < 0)
160 return ret;
161 }
162
163 if (align <= 0)
164 align = ALIGN;
165
167 frame->extended_data = av_calloc(planes,
168 sizeof(*frame->extended_data));
169 frame->extended_buf = av_calloc(planes - AV_NUM_DATA_POINTERS,
170 sizeof(*frame->extended_buf));
171 if (!frame->extended_data || !frame->extended_buf) {
172 av_freep(&frame->extended_data);
173 av_freep(&frame->extended_buf);
174 return AVERROR(ENOMEM);
175 }
176 frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;
177 } else
178 frame->extended_data = frame->data;
179
180 if (frame->linesize[0] > SIZE_MAX - align)
181 return AVERROR(EINVAL);
182 size = frame->linesize[0] + (size_t)align;
183
184 for (int i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
185 frame->buf[i] = av_buffer_alloc(size);
186 if (!frame->buf[i]) {
188 return AVERROR(ENOMEM);
189 }
190 frame->extended_data[i] = frame->data[i] =
191 (uint8_t *)FFALIGN((uintptr_t)frame->buf[i]->data, align);
192 }
193 for (int i = 0; i < planes - AV_NUM_DATA_POINTERS; i++) {
194 frame->extended_buf[i] = av_buffer_alloc(size);
195 if (!frame->extended_buf[i]) {
197 return AVERROR(ENOMEM);
198 }
199 frame->extended_data[i + AV_NUM_DATA_POINTERS] =
200 (uint8_t *)FFALIGN((uintptr_t)frame->extended_buf[i]->data, align);
201 }
202 return 0;
203
204}
205
207{
208 if (frame->format < 0)
209 return AVERROR(EINVAL);
210
211 if (frame->width > 0 && frame->height > 0)
213 else if (frame->nb_samples > 0 &&
214 (av_channel_layout_check(&frame->ch_layout)))
216
217 return AVERROR(EINVAL);
218}
219
220static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
221{
222 dst->pict_type = src->pict_type;
223 dst->sample_aspect_ratio = src->sample_aspect_ratio;
224 dst->crop_top = src->crop_top;
225 dst->crop_bottom = src->crop_bottom;
226 dst->crop_left = src->crop_left;
227 dst->crop_right = src->crop_right;
228 dst->pts = src->pts;
229 dst->duration = src->duration;
230 dst->repeat_pict = src->repeat_pict;
231 dst->sample_rate = src->sample_rate;
232 dst->opaque = src->opaque;
233 dst->pkt_dts = src->pkt_dts;
234 dst->time_base = src->time_base;
235 dst->quality = src->quality;
236 dst->best_effort_timestamp = src->best_effort_timestamp;
237 dst->flags = src->flags;
238 dst->decode_error_flags = src->decode_error_flags;
239 dst->color_primaries = src->color_primaries;
240 dst->color_trc = src->color_trc;
241 dst->colorspace = src->colorspace;
242 dst->color_range = src->color_range;
243 dst->chroma_location = src->chroma_location;
244 dst->alpha_mode = src->alpha_mode;
245
246 av_dict_copy(&dst->metadata, src->metadata, 0);
247
248 for (int i = 0; i < src->nb_side_data; i++) {
249 const AVFrameSideData *sd_src = src->side_data[i];
250 AVFrameSideData *sd_dst;
251 if ( sd_src->type == AV_FRAME_DATA_PANSCAN
252 && (src->width != dst->width || src->height != dst->height))
253 continue;
254 if (force_copy) {
255 sd_dst = av_frame_new_side_data(dst, sd_src->type,
256 sd_src->size);
257 if (!sd_dst) {
258 av_frame_side_data_free(&dst->side_data, &dst->nb_side_data);
259 return AVERROR(ENOMEM);
260 }
261 memcpy(sd_dst->data, sd_src->data, sd_src->size);
262 } else {
263 AVBufferRef *ref = av_buffer_ref(sd_src->buf);
264 sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
265 if (!sd_dst) {
267 av_frame_side_data_free(&dst->side_data, &dst->nb_side_data);
268 return AVERROR(ENOMEM);
269 }
270 }
271 av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
272 }
273
274 av_refstruct_replace(&dst->private_ref, src->private_ref);
275 return av_buffer_replace(&dst->opaque_ref, src->opaque_ref);
276}
277
279{
280 int ret = 0;
281
282 av_assert1(dst->width == 0 && dst->height == 0);
283 av_assert1(dst->ch_layout.nb_channels == 0 &&
284 dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);
285
286 dst->format = src->format;
287 dst->width = src->width;
288 dst->height = src->height;
289 dst->nb_samples = src->nb_samples;
290
291 ret = frame_copy_props(dst, src, 0);
292 if (ret < 0)
293 goto fail;
294
295 ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
296 if (ret < 0)
297 goto fail;
298
299 /* duplicate the frame data if it's not refcounted */
300 if (!src->buf[0]) {
301 ret = av_frame_get_buffer(dst, 0);
302 if (ret < 0)
303 goto fail;
304
305 ret = av_frame_copy(dst, src);
306 if (ret < 0)
307 goto fail;
308
309 return 0;
310 }
311
312 /* ref the buffers */
313 for (int i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
314 if (!src->buf[i])
315 continue;
316 dst->buf[i] = av_buffer_ref(src->buf[i]);
317 if (!dst->buf[i]) {
318 ret = AVERROR(ENOMEM);
319 goto fail;
320 }
321 }
322
323 if (src->extended_buf) {
324 dst->extended_buf = av_calloc(src->nb_extended_buf,
325 sizeof(*dst->extended_buf));
326 if (!dst->extended_buf) {
327 ret = AVERROR(ENOMEM);
328 goto fail;
329 }
330 dst->nb_extended_buf = src->nb_extended_buf;
331
332 for (int i = 0; i < src->nb_extended_buf; i++) {
333 dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);
334 if (!dst->extended_buf[i]) {
335 ret = AVERROR(ENOMEM);
336 goto fail;
337 }
338 }
339 }
340
341 if (src->hw_frames_ctx) {
342 dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
343 if (!dst->hw_frames_ctx) {
344 ret = AVERROR(ENOMEM);
345 goto fail;
346 }
347 }
348
349 /* duplicate extended data */
350 if (src->extended_data != src->data) {
351 int ch = dst->ch_layout.nb_channels;
352
353 if (ch <= 0 || ch > SIZE_MAX / sizeof(*dst->extended_data)) {
354 ret = AVERROR(EINVAL);
355 goto fail;
356 }
357
358 dst->extended_data = av_memdup(src->extended_data, sizeof(*dst->extended_data) * ch);
359 if (!dst->extended_data) {
360 ret = AVERROR(ENOMEM);
361 goto fail;
362 }
363 } else
364 dst->extended_data = dst->data;
365
366 memcpy(dst->data, src->data, sizeof(src->data));
367 memcpy(dst->linesize, src->linesize, sizeof(src->linesize));
368
369 return 0;
370
371fail:
373 return ret;
374}
375
377{
378 int ret = 0;
379
380 if (dst == src)
381 return AVERROR(EINVAL);
382
383 if (!src->buf[0]) {
385
386 /* duplicate the frame data if it's not refcounted */
387 if ( src->data[0] || src->data[1]
388 || src->data[2] || src->data[3])
389 return av_frame_ref(dst, src);
390
391 ret = frame_copy_props(dst, src, 0);
392 if (ret < 0)
393 goto fail;
394 }
395
396 dst->format = src->format;
397 dst->width = src->width;
398 dst->height = src->height;
399 dst->nb_samples = src->nb_samples;
400
401 ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
402 if (ret < 0)
403 goto fail;
404
405 av_frame_side_data_free(&dst->side_data, &dst->nb_side_data);
406 av_dict_free(&dst->metadata);
407 ret = frame_copy_props(dst, src, 0);
408 if (ret < 0)
409 goto fail;
410
411 /* replace the buffers */
412 for (int i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
413 ret = av_buffer_replace(&dst->buf[i], src->buf[i]);
414 if (ret < 0)
415 goto fail;
416 }
417
418 if (src->extended_buf) {
419 if (dst->nb_extended_buf != src->nb_extended_buf) {
420 int nb_extended_buf = FFMIN(dst->nb_extended_buf, src->nb_extended_buf);
421 void *tmp;
422
423 for (int i = nb_extended_buf; i < dst->nb_extended_buf; i++)
424 av_buffer_unref(&dst->extended_buf[i]);
425
426 tmp = av_realloc_array(dst->extended_buf, src->nb_extended_buf,
427 sizeof(*dst->extended_buf));
428 if (!tmp) {
429 ret = AVERROR(ENOMEM);
430 goto fail;
431 }
432 dst->extended_buf = tmp;
433 dst->nb_extended_buf = src->nb_extended_buf;
434
435 memset(&dst->extended_buf[nb_extended_buf], 0,
436 (src->nb_extended_buf - nb_extended_buf) * sizeof(*dst->extended_buf));
437 }
438
439 for (int i = 0; i < src->nb_extended_buf; i++) {
440 ret = av_buffer_replace(&dst->extended_buf[i], src->extended_buf[i]);
441 if (ret < 0)
442 goto fail;
443 }
444 } else if (dst->extended_buf) {
445 for (int i = 0; i < dst->nb_extended_buf; i++)
446 av_buffer_unref(&dst->extended_buf[i]);
447 av_freep(&dst->extended_buf);
448 }
449
450 ret = av_buffer_replace(&dst->hw_frames_ctx, src->hw_frames_ctx);
451 if (ret < 0)
452 goto fail;
453
454 if (dst->extended_data != dst->data)
455 av_freep(&dst->extended_data);
456
457 if (src->extended_data != src->data) {
458 int ch = dst->ch_layout.nb_channels;
459
460 if (ch <= 0 || ch > SIZE_MAX / sizeof(*dst->extended_data)) {
461 ret = AVERROR(EINVAL);
462 goto fail;
463 }
464
465 dst->extended_data = av_memdup(src->extended_data, sizeof(*dst->extended_data) * ch);
466 if (!dst->extended_data) {
467 ret = AVERROR(ENOMEM);
468 goto fail;
469 }
470 } else
471 dst->extended_data = dst->data;
472
473 memcpy(dst->data, src->data, sizeof(src->data));
474 memcpy(dst->linesize, src->linesize, sizeof(src->linesize));
475
476 return 0;
477
478fail:
480 return ret;
481}
482
484{
485 AVFrame *ret = av_frame_alloc();
486
487 if (!ret)
488 return NULL;
489
490 if (av_frame_ref(ret, src) < 0)
491 av_frame_free(&ret);
492
493 return ret;
494}
495
497{
498 if (!frame)
499 return;
500
501 av_frame_side_data_free(&frame->side_data, &frame->nb_side_data);
502
503 for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
504 av_buffer_unref(&frame->buf[i]);
505 for (int i = 0; i < frame->nb_extended_buf; i++)
506 av_buffer_unref(&frame->extended_buf[i]);
507 av_freep(&frame->extended_buf);
508 av_dict_free(&frame->metadata);
509
510 av_buffer_unref(&frame->hw_frames_ctx);
511
512 av_buffer_unref(&frame->opaque_ref);
513 av_refstruct_unref(&frame->private_ref);
514
515 if (frame->extended_data != frame->data)
516 av_freep(&frame->extended_data);
517
518 av_channel_layout_uninit(&frame->ch_layout);
519
521}
522
524{
525 av_assert1(dst->width == 0 && dst->height == 0);
526 av_assert1(dst->ch_layout.nb_channels == 0 &&
527 dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);
528
529 *dst = *src;
530 if (src->extended_data == src->data)
531 dst->extended_data = dst->data;
533}
534
536{
537 int ret = 1;
538
539 /* assume non-refcounted frames are not writable */
540 if (!frame->buf[0])
541 return 0;
542
543 for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
544 if (frame->buf[i])
545 ret &= !!av_buffer_is_writable(frame->buf[i]);
546 for (int i = 0; i < frame->nb_extended_buf; i++)
547 ret &= !!av_buffer_is_writable(frame->extended_buf[i]);
548
549 return ret;
550}
551
553{
554 AVFrame tmp;
555 int ret;
556
558 return 0;
559
560 memset(&tmp, 0, sizeof(tmp));
561 tmp.format = frame->format;
562 tmp.width = frame->width;
563 tmp.height = frame->height;
564 tmp.nb_samples = frame->nb_samples;
565 ret = av_channel_layout_copy(&tmp.ch_layout, &frame->ch_layout);
566 if (ret < 0) {
568 return ret;
569 }
570
571 if (frame->hw_frames_ctx)
572 ret = av_hwframe_get_buffer(frame->hw_frames_ctx, &tmp, 0);
573 else
574 ret = av_frame_get_buffer(&tmp, 0);
575 if (ret < 0)
576 return ret;
577
578 ret = av_frame_copy(&tmp, frame);
579 if (ret < 0) {
581 return ret;
582 }
583
585 if (ret < 0) {
587 return ret;
588 }
589
591
592 *frame = tmp;
593 if (tmp.data == tmp.extended_data)
594 frame->extended_data = frame->data;
595
596 return 0;
597}
598
600{
601 return frame_copy_props(dst, src, 1);
602}
603
605{
606 uintptr_t data;
607 int planes;
608
609 if (frame->nb_samples) {
610 int channels = frame->ch_layout.nb_channels;
611 if (!channels)
612 return NULL;
614 } else
615 planes = 4;
616
617 if (plane < 0 || plane >= planes || !frame->extended_data[plane])
618 return NULL;
619 data = (uintptr_t)frame->extended_data[plane];
620
621 for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) {
622 AVBufferRef *buf = frame->buf[i];
623 uintptr_t buf_begin = (uintptr_t)buf->data;
624
625 if (data >= buf_begin && data < buf_begin + buf->size)
626 return buf;
627 }
628 for (int i = 0; i < frame->nb_extended_buf; i++) {
629 AVBufferRef *buf = frame->extended_buf[i];
630 uintptr_t buf_begin = (uintptr_t)buf->data;
631
632 if (data >= buf_begin && data < buf_begin + buf->size)
633 return buf;
634 }
635 return NULL;
636}
637
640 AVBufferRef *buf)
641{
642 return
644 &frame->side_data, &frame->nb_side_data, type, buf);
645}
646
649 size_t size)
650{
651 AVFrameSideData *ret;
654 if (!ret)
655 av_buffer_unref(&buf);
656 return ret;
657}
658
661{
663 frame->side_data, frame->nb_side_data,
664 type
665 );
666}
667
669{
670 int planes;
671
672 if (dst->width < src->width ||
673 dst->height < src->height)
674 return AVERROR(EINVAL);
675
676 if (src->hw_frames_ctx || dst->hw_frames_ctx)
677 return av_hwframe_transfer_data(dst, src, 0);
678
680 for (int i = 0; i < planes; i++)
681 if (!dst->data[i] || !src->data[i])
682 return AVERROR(EINVAL);
683
684 av_image_copy2(dst->data, dst->linesize,
685 src->data, src->linesize,
686 dst->format, src->width, src->height);
687
688 return 0;
689}
690
692{
693 int planar = av_sample_fmt_is_planar(dst->format);
694 int channels = dst->ch_layout.nb_channels;
695 int planes = planar ? channels : 1;
696
697 if (dst->nb_samples != src->nb_samples ||
698 av_channel_layout_compare(&dst->ch_layout, &src->ch_layout))
699 return AVERROR(EINVAL);
700
701 for (int i = 0; i < planes; i++)
702 if (!dst->extended_data[i] || !src->extended_data[i])
703 return AVERROR(EINVAL);
704
705 av_samples_copy(dst->extended_data, src->extended_data, 0, 0,
706 dst->nb_samples, channels, dst->format);
707
708 return 0;
709}
710
712{
713 if (dst->format != src->format || dst->format < 0)
714 return AVERROR(EINVAL);
715
716 if (dst->width > 0 && dst->height > 0)
717 return frame_copy_video(dst, src);
718 else if (dst->nb_samples > 0 &&
719 (av_channel_layout_check(&dst->ch_layout)))
720 return frame_copy_audio(dst, src);
721
722 return AVERROR(EINVAL);
723}
724
729
730static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame,
732{
733 for (int i = 0; frame->data[i]; i++) {
735 int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
736 int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
737
738 if (desc->flags & AV_PIX_FMT_FLAG_PAL && i == 1) {
739 offsets[i] = 0;
740 break;
741 }
742
743 /* find any component descriptor for this plane */
744 for (int j = 0; j < desc->nb_components; j++) {
745 if (desc->comp[j].plane == i) {
746 comp = &desc->comp[j];
747 break;
748 }
749 }
750 if (!comp)
751 return AVERROR_BUG;
752
753 offsets[i] = (frame->crop_top >> shift_y) * frame->linesize[i] +
754 (frame->crop_left >> shift_x) * comp->step;
755 }
756
757 return 0;
758}
759
761{
763 size_t offsets[4];
764 int ret;
765
766 if (!(frame->width > 0 && frame->height > 0))
767 return AVERROR(EINVAL);
768
769 if (frame->crop_left >= INT_MAX - frame->crop_right ||
770 frame->crop_top >= INT_MAX - frame->crop_bottom ||
771 (frame->crop_left + frame->crop_right) >= frame->width ||
772 (frame->crop_top + frame->crop_bottom) >= frame->height)
773 return AVERROR(ERANGE);
774
775 desc = av_pix_fmt_desc_get(frame->format);
776 if (!desc)
777 return AVERROR_BUG;
778
779 /* Apply just the right/bottom cropping for hwaccel formats. Bitstream
780 * formats cannot be easily handled here either (and corresponding decoders
781 * should not export any cropping anyway), so do the same for those as well.
782 * */
784 frame->width -= frame->crop_right;
785 frame->height -= frame->crop_bottom;
786 frame->crop_right = 0;
787 frame->crop_bottom = 0;
788 return 0;
789 }
790
791 /* calculate the offsets for each plane */
793 if (ret < 0)
794 return ret;
795
796 /* adjust the offsets to avoid breaking alignment */
798 int log2_crop_align = frame->crop_left ? ff_ctz(frame->crop_left) : INT_MAX;
799 int min_log2_align = INT_MAX;
800
801 for (int i = 0; frame->data[i]; i++) {
802 int log2_align = offsets[i] ? ff_ctz(offsets[i]) : INT_MAX;
803 min_log2_align = FFMIN(log2_align, min_log2_align);
804 }
805
806 /* we assume, and it should always be true, that the data alignment is
807 * related to the cropping alignment by a constant power-of-2 factor */
808 if (log2_crop_align < min_log2_align)
809 return AVERROR_BUG;
810
811 if (min_log2_align < 5 && log2_crop_align != INT_MAX) {
812 frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
814 if (ret < 0)
815 return ret;
816 }
817 }
818
819 for (int i = 0; frame->data[i]; i++)
820 frame->data[i] += offsets[i];
821
822 frame->width -= (frame->crop_left + frame->crop_right);
823 frame->height -= (frame->crop_top + frame->crop_bottom);
824 frame->crop_left = 0;
825 frame->crop_right = 0;
826 frame->crop_top = 0;
827 frame->crop_bottom = 0;
828
829 return 0;
830}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
channels
Definition aptx.h:31
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi > >8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi > >24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi > >56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition avassert.h:58
static const uint8_t *BS_FUNC align(BSCTX *bc)
Skip bits to a byte boundary.
refcounted data buffer API
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
#define NULL
Definition coverity.c:32
static AVFrame * frame
Public dictionary API.
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition eamad.c:79
static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame, const AVPixFmtDescriptor *desc)
Definition frame.c:730
static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
Definition frame.c:220
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
Definition frame.c:668
static int get_video_buffer(AVFrame *frame, int align)
Definition frame.c:75
static void get_frame_defaults(AVFrame *frame)
Definition frame.c:31
static int get_audio_buffer(AVFrame *frame, int align)
Definition frame.c:146
static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
Definition frame.c:691
reference-counted frame API
#define AV_NUM_DATA_POINTERS
Definition frame.h:473
#define fail
Definition test.h:479
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int av_buffer_is_writable(const AVBufferRef *buf)
Definition buffer.c:147
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition buffer.c:139
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
Definition buffer.c:233
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition buffer.c:103
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
Definition buffer.c:77
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition dict.c:233
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition dict.c:247
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR(e)
Definition error.h:45
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition frame.c:496
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:659
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
Definition frame.c:725
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
Free all side data entries and their contents, then zeroes out the values which the pointers are poin...
Definition side_data.c:139
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
Definition frame.c:376
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition frame.c:535
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
Definition frame.c:206
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition frame.c:523
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition frame.c:278
void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type from an array.
Definition side_data.c:108
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
Definition frame.c:647
AVFrameSideData * av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
Add a new side data to a frame from an existing AVBufferRef.
Definition frame.c:638
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition frame.c:552
AVFrameSideDataType
Definition frame.h:49
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.
Definition frame.c:760
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
Definition frame.c:711
static const AVFrameSideData * av_frame_side_data_get(AVFrameSideData *const *sd, const int nb_sd, enum AVFrameSideDataType type)
Wrapper around av_frame_side_data_get_c() to workaround the limitation that for any type T the conver...
Definition frame.h:1196
AVBufferRef * av_frame_get_plane_buffer(const AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
Definition frame.c:604
@ AV_FRAME_CROP_UNALIGNED
Apply the maximum possible cropping, even if it requires setting the AVFrame.data[] entries to unalig...
Definition frame.h:1047
@ AV_FRAME_DATA_PANSCAN
The data is the AVPanScan struct defined in libavcodec.
Definition frame.h:53
#define ff_ctz
Definition intmath.h:105
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition mem.c:217
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition mem.c:302
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...
Definition imgutils.c:318
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.
Definition imgutils.c:145
int av_image_fill_plane_sizes(size_t sizes[4], enum AVPixelFormat pix_fmt, int height, const ptrdiff_t linesizes[4])
Fill plane sizes for an image with pixel format pix_fmt and height height.
Definition imgutils.c:111
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition imgutils.h:184
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.
Definition imgutils.c:89
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition samplefmt.c:114
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
Definition samplefmt.c:121
int av_samples_copy(uint8_t *const *dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
Definition samplefmt.c:222
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define ALIGN
Definition hashtable.c:32
static const int offsets[]
Definition hevc_pel.c:34
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags)
Copy data to or from a hw surface.
Definition hwcontext.c:448
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
Definition hwcontext.c:506
cl_device_type type
static const int sizes[][2]
Definition img2dec.c:62
misc image utilities
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
#define FFALIGN(x, a)
Definition macros.h:78
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
Memory handling functions.
const char data[16]
Definition mxf.c:149
#define av_malloc(s)
Definition ops_static.c:52
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3500
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition pixdesc.h:124
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition pixdesc.h:128
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition pixdesc.h:120
@ AVCHROMA_LOC_UNSPECIFIED
Definition pixfmt.h:803
@ AVCOL_RANGE_UNSPECIFIED
Definition pixfmt.h:749
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
Definition pixfmt.h:817
@ AVCOL_PRI_UNSPECIFIED
Definition pixfmt.h:645
@ AVCOL_TRC_UNSPECIFIED
Definition pixfmt.h:675
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:709
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition refstruct.c:120
void av_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
Definition refstruct.c:160
AVFrameSideData * ff_frame_side_data_add_from_buf(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, AVBufferRef *buf)
Definition side_data.c:179
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
Definition buffer.h:82
uint8_t * data
The data buffer.
Definition buffer.h:90
Structure to hold side data for an AVFrame.
Definition frame.h:327
enum AVFrameSideDataType type
Definition frame.h:328
AVDictionary * metadata
Definition frame.h:331
size_t size
Definition frame.h:330
uint8_t * data
Definition frame.h:329
AVBufferRef * buf
Definition frame.h:332
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
Rational number (pair of numerator and denominator).
Definition rational.h:58
#define av_freep(p)
static uint8_t tmp[40]
Definition aes_ctr.c:52
#define src
Definition vp8dsp.c:248
static int ref[MAX_W *MAX_W]
int size