summaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddata.h
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-04-14 16:09:07 +0200
committerPaul B Mahol <onemda@gmail.com>2017-04-14 16:09:07 +0200
commit5dedb2afd64e27ad08308487e185f7e3a5bea1b9 (patch)
treef434c549995c0bd63aa7e0e401df4f13168114c9 /libavcodec/dnxhddata.h
parent34c2eea3d8ec85de4f4e5a9085c174e4b09387b9 (diff)
avcodec/dnxhd*: add ff_dnxhd_get_hr_frame_size()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/dnxhddata.h')
-rw-r--r--libavcodec/dnxhddata.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 89262a13c1..c96c5e8f65 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -91,6 +91,19 @@ static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf
return ff_dnxhd_check_header_prefix(prefix);
}
+static av_always_inline int ff_dnxhd_get_hr_frame_size(int cid, int w, int h)
+{
+ int result, i = ff_dnxhd_get_cid_table(cid);
+
+ if (i < 0)
+ return i;
+
+ result = ((h + 15) / 16) * ((w + 15) / 16) * (int64_t)ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
+ result = (result + 2048) / 4096 * 4096;
+
+ return FFMAX(result, 8192);
+}
+
int avpriv_dnxhd_get_frame_size(int cid);
int avpriv_dnxhd_get_interlaced(int cid);
#if LIBAVCODEC_VERSION_MAJOR < 58