aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch')
-rw-r--r--meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch b/meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch
new file mode 100644
index 00000000..3a4a63d8
--- /dev/null
+++ b/meta-amdfalconx86/recipes-graphics/mesa/mesa/0024-gallium-util-get-h264-level-based-on-number-of-max-r.patch
@@ -0,0 +1,76 @@
+From 4e9dbaaafed23588945a09617796baa91194dc57 Mon Sep 17 00:00:00 2001
+From: Leo Liu <leo.liu@amd.com>
+Date: Thu, 12 Mar 2015 14:01:52 -0400
+Subject: [PATCH 24/29] gallium/util: get h264 level based on number of max
+ references and resolution
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+v2: add commments for limitation of max references numbers,
+and what the caculation is based
+
+Signed-off-by: Leo Liu <leo.liu@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Arindam Nath <arindam.nath@amd.com>
+---
+ src/gallium/auxiliary/util/u_video.h | 36 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h
+index 45b2d6e..b4743d1 100644
+--- a/src/gallium/auxiliary/util/u_video.h
++++ b/src/gallium/auxiliary/util/u_video.h
+@@ -38,6 +38,7 @@ extern "C" {
+ /* u_reduce_video_profile() needs these */
+ #include "pipe/p_compiler.h"
+ #include "util/u_debug.h"
++#include "util/u_math.h"
+
+ static INLINE enum pipe_video_format
+ u_reduce_video_profile(enum pipe_video_profile profile)
+@@ -146,6 +147,41 @@ u_copy_swap422_packed(void *const *destination_data,
+ }
+ }
+
++static INLINE uint32_t
++u_get_h264_level(uint32_t width, uint32_t height, uint32_t *max_reference)
++{
++ uint32_t max_dpb_mbs;
++
++ width = align(width, 16);
++ height = align(height, 16);
++
++ /* Max references will be used for caculation of number of DPB buffers
++ in the UVD driver, limitation of max references is 16. Some client
++ like mpv application for VA-API, it requires references more than that,
++ so we have to set max of references to 16 here. */
++ *max_reference = MIN2(*max_reference, 16);
++ max_dpb_mbs = (width / 16) * (height / 16) * *max_reference;
++
++ /* The calculation is based on "Decoded picture buffering" section
++ from http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC */
++ if (max_dpb_mbs <= 8100)
++ return 30;
++ else if (max_dpb_mbs <= 18000)
++ return 31;
++ else if (max_dpb_mbs <= 20480)
++ return 32;
++ else if (max_dpb_mbs <= 32768)
++ return 41;
++ else if (max_dpb_mbs <= 34816)
++ return 42;
++ else if (max_dpb_mbs <= 110400)
++ return 50;
++ else if (max_dpb_mbs <= 184320)
++ return 51;
++ else
++ return 52;
++}
++
+ #ifdef __cplusplus
+ }
+ #endif
+--
+1.9.1
+