summaryrefslogtreecommitdiffstats
path: root/libhb/qsv_common.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2014-01-02 14:32:46 +0000
committerRodeo <[email protected]>2014-01-02 14:32:46 +0000
commitc0fce1aeb05b413f2cc8c97698e2ff5ee6f338d9 (patch)
treee3efe5bdc01e8c39e23882fec943079365ddbbf5 /libhb/qsv_common.c
parent59f27d3ab84dfa5753007f38c143f4cb69898a66 (diff)
qsv: add some frame type helper functions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5950 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/qsv_common.c')
-rw-r--r--libhb/qsv_common.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index 3dcaa25ed..195845200 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -957,6 +957,64 @@ int hb_qsv_param_default(hb_qsv_param_t *param, mfxVideoParam *videoParam)
return 0;
}
+const char* hb_qsv_frametype_name(uint16_t qsv_frametype)
+{
+ if (qsv_frametype & MFX_FRAMETYPE_IDR)
+ {
+ return qsv_frametype & MFX_FRAMETYPE_REF ? "IDR (ref)" : "IDR";
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_I)
+ {
+ return qsv_frametype & MFX_FRAMETYPE_REF ? "I (ref)" : "I";
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_P)
+ {
+ return qsv_frametype & MFX_FRAMETYPE_REF ? "P (ref)" : "P";
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_B)
+ {
+ return qsv_frametype & MFX_FRAMETYPE_REF ? "B (ref)" : "B";
+ }
+ else
+ {
+ return "unknown";
+ }
+}
+
+uint8_t hb_qsv_frametype_xlat(uint16_t qsv_frametype, uint16_t *out_flags)
+{
+ uint16_t flags = 0;
+ uint8_t frametype = 0;
+
+ if (qsv_frametype & MFX_FRAMETYPE_IDR)
+ {
+ frametype = HB_FRAME_IDR;
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_I)
+ {
+ frametype = HB_FRAME_I;
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_P)
+ {
+ frametype = HB_FRAME_P;
+ }
+ else if (qsv_frametype & MFX_FRAMETYPE_B)
+ {
+ frametype = HB_FRAME_B;
+ }
+
+ if (qsv_frametype & MFX_FRAMETYPE_REF)
+ {
+ flags |= HB_FRAME_REF;
+ }
+
+ if (out_flags != NULL)
+ {
+ *out_flags = flags;
+ }
+ return frametype;
+}
+
mfxIMPL hb_qsv_impl_get_preferred()
{
return preferred_implementation;