diff options
author | Rodeo <[email protected]> | 2014-01-02 14:32:46 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2014-01-02 14:32:46 +0000 |
commit | c0fce1aeb05b413f2cc8c97698e2ff5ee6f338d9 (patch) | |
tree | e3efe5bdc01e8c39e23882fec943079365ddbbf5 | |
parent | 59f27d3ab84dfa5753007f38c143f4cb69898a66 (diff) |
qsv: add some frame type helper functions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5950 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/enc_qsv.c | 14 | ||||
-rw-r--r-- | libhb/qsv_common.c | 58 | ||||
-rw-r--r-- | libhb/qsv_common.h | 3 |
3 files changed, 64 insertions, 11 deletions
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index a906e6dc2..6f17f2b79 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -1406,18 +1406,10 @@ int encqsvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // see nal_encode buf = hb_video_buffer_init( job->width, job->height ); buf->size = 0; - buf->s.frametype = 0; - // maping of FrameType(s) - if(task->bs->FrameType & MFX_FRAMETYPE_IDR ) buf->s.frametype = HB_FRAME_IDR; - else - if(task->bs->FrameType & MFX_FRAMETYPE_I ) buf->s.frametype = HB_FRAME_I; - else - if(task->bs->FrameType & MFX_FRAMETYPE_P ) buf->s.frametype = HB_FRAME_P; - else - if(task->bs->FrameType & MFX_FRAMETYPE_B ) buf->s.frametype = HB_FRAME_B; - - if(task->bs->FrameType & MFX_FRAMETYPE_REF ) buf->s.flags = HB_FRAME_REF; + // map Media SDK's FrameType to our internal representation + buf->s.frametype = hb_qsv_frametype_xlat(task->bs->FrameType, + &buf->s.flags); parse_nalus(task->bs->Data + task->bs->DataOffset,task->bs->DataLength, buf, pv->frames_out); 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; diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h index 8a3b8c79b..c79cd2aa1 100644 --- a/libhb/qsv_common.h +++ b/libhb/qsv_common.h @@ -128,6 +128,9 @@ int hb_qsv_param_default_preset(hb_qsv_param_t *param, mfxVideoParam *videoParam int hb_qsv_param_default (hb_qsv_param_t *param, mfxVideoParam *videoParam); int hb_qsv_param_parse (hb_qsv_param_t *param, const char *key, const char *value, int vcodec); +const char* hb_qsv_frametype_name(uint16_t qsv_frametype); +uint8_t hb_qsv_frametype_xlat(uint16_t qsv_frametype, uint16_t *out_flags); + mfxIMPL hb_qsv_impl_get_preferred(); const char* hb_qsv_impl_get_name(int impl); |