diff options
author | maxd <[email protected]> | 2017-01-31 10:35:37 +0100 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2017-02-02 14:37:31 -0500 |
commit | 6aa1b40aead1653b39c93195aed4e920b6b0fcc9 (patch) | |
tree | 10bd16cb58e1055f9c528ccee36ca763bacf5f37 /libhb/enc_qsv.c | |
parent | 56aca27e29c3e20dd67c8539dc5be9e4d1fc50b3 (diff) |
qsv: Allocate planes contiguously.
Better performance and less prone to crashing.
Fixes #540 and closes #558.
Diffstat (limited to 'libhb/enc_qsv.c')
-rw-r--r-- | libhb/enc_qsv.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index a29833123..2009edc63 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -309,8 +309,8 @@ static int qsv_hevc_make_header(hb_work_object_t *w, mfxSession session) mfxU16 Height = pv->param.videoParam->mfx.FrameInfo.Height; mfxU16 Width = pv->param.videoParam->mfx.FrameInfo.Width; frameSurface1.Info = pv->param.videoParam->mfx.FrameInfo; - frameSurface1.Data.VU = av_mallocz(Width * Height / 2); - frameSurface1.Data.Y = av_mallocz(Width * Height); + frameSurface1.Data.Y = av_mallocz(Width * Height * 3 / 2); + frameSurface1.Data.VU = frameSurface1.Data.Y + Width * Height; frameSurface1.Data.Pitch = Width; /* Encode a single blank frame */ @@ -437,7 +437,6 @@ static int qsv_hevc_make_header(hb_work_object_t *w, mfxSession session) end: hb_buffer_close(&bitstream_buf); - av_free(frameSurface1.Data.VU); av_free(frameSurface1.Data.Y); return ret; } @@ -596,8 +595,8 @@ int qsv_enc_init(hb_work_private_t *pv) mfxFrameInfo info = pv->param.videoParam->mfx.FrameInfo; surface->Info = info; surface->Data.Pitch = info.Width; - surface->Data.Y = av_mallocz(info.Width * info.Height); - surface->Data.VU = av_mallocz(info.Width * info.Height / 2); + surface->Data.Y = av_mallocz(info.Width * info.Height * 3 / 2); + surface->Data.VU = surface->Data.Y + info.Width * info.Height; qsv_encode->p_surfaces[i] = surface; } } @@ -1458,7 +1457,6 @@ void encqsvClose(hb_work_object_t *w) { if (pv->is_sys_mem) { - av_freep(&qsv_enc_space->p_surfaces[i]->Data.VU); av_freep(&qsv_enc_space->p_surfaces[i]->Data.Y); } av_freep(&qsv_enc_space->p_surfaces[i]); |