summaryrefslogtreecommitdiff
path: root/libs/ffvpx/libavutil/frame.c
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-06-07 20:20:19 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-06-07 20:20:19 -0500
commit878ab758d5d4c1ef7badf2bc20ebc7c67dc2165b (patch)
tree3683d6df35e3618c0e7b456de7c749ca4c8c21a6 /libs/ffvpx/libavutil/frame.c
parenta621951327b0c19c0c24dfd9fd973f7bd13ae68f (diff)
parentcfb9884423faf741de03c5fcc72bf9ac8c6ada4d (diff)
downloadaura-central-878ab758d5d4c1ef7badf2bc20ebc7c67dc2165b.tar.gz
Merge branch 'TRUNK' into ARE-5.0
Diffstat (limited to 'libs/ffvpx/libavutil/frame.c')
-rw-r--r--libs/ffvpx/libavutil/frame.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/libs/ffvpx/libavutil/frame.c b/libs/ffvpx/libavutil/frame.c
index 00215ac29..dcf1fc3d1 100644
--- a/libs/ffvpx/libavutil/frame.c
+++ b/libs/ffvpx/libavutil/frame.c
@@ -211,7 +211,8 @@ void av_frame_free(AVFrame **frame)
static int get_video_buffer(AVFrame *frame, int align)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
- int ret, i;
+ int ret, i, padded_height;
+ int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);
if (!desc)
return AVERROR(EINVAL);
@@ -236,23 +237,24 @@ static int get_video_buffer(AVFrame *frame, int align)
frame->linesize[i] = FFALIGN(frame->linesize[i], align);
}
- for (i = 0; i < 4 && frame->linesize[i]; i++) {
- int h = FFALIGN(frame->height, 32);
- if (i == 1 || i == 2)
- h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
-
- frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1);
- if (!frame->buf[i])
- goto fail;
+ padded_height = FFALIGN(frame->height, 32);
+ if ((ret = av_image_fill_pointers(frame->data, frame->format, padded_height,
+ NULL, frame->linesize)) < 0)
+ return ret;
- frame->data[i] = frame->buf[i]->data;
+ frame->buf[0] = av_buffer_alloc(ret + 4*plane_padding);
+ if (!frame->buf[0]) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
}
- if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL) {
- av_buffer_unref(&frame->buf[1]);
- frame->buf[1] = av_buffer_alloc(AVPALETTE_SIZE);
- if (!frame->buf[1])
- goto fail;
- frame->data[1] = frame->buf[1]->data;
+
+ if ((ret = av_image_fill_pointers(frame->data, frame->format, padded_height,
+ frame->buf[0]->data, frame->linesize)) < 0)
+ goto fail;
+
+ for (i = 1; i < 4; i++) {
+ if (frame->data[i])
+ frame->data[i] += i * plane_padding;
}
frame->extended_data = frame->data;
@@ -260,7 +262,7 @@ static int get_video_buffer(AVFrame *frame, int align)
return 0;
fail:
av_frame_unref(frame);
- return AVERROR(ENOMEM);
+ return ret;
}
static int get_audio_buffer(AVFrame *frame, int align)
@@ -819,7 +821,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
switch(type) {
case AV_FRAME_DATA_PANSCAN: return "AVPanScan";
case AV_FRAME_DATA_A53_CC: return "ATSC A53 Part 4 Closed Captions";
- case AV_FRAME_DATA_STEREO3D: return "Stereoscopic 3d metadata";
+ case AV_FRAME_DATA_STEREO3D: return "Stereo 3D";
case AV_FRAME_DATA_MATRIXENCODING: return "AVMatrixEncoding";
case AV_FRAME_DATA_DOWNMIX_INFO: return "Metadata relevant to a downmix procedure";
case AV_FRAME_DATA_REPLAYGAIN: return "AVReplayGain";
@@ -831,9 +833,15 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";
+ case AV_FRAME_DATA_S12M_TIMECODE: return "SMPTE 12-1 timecode";
+ case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
+#if FF_API_FRAME_QP
case AV_FRAME_DATA_QP_TABLE_PROPERTIES: return "QP table properties";
case AV_FRAME_DATA_QP_TABLE_DATA: return "QP table data";
+#endif
+ case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
+ case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
}
return NULL;
}