Commit 7c664910 authored by François Grisez's avatar François Grisez
Browse files

VideoToobloxH264Decoder: performance improvements

* Enable asynchronous decoding
* Enable real-time mode
* Optimize ms_yuv_buf_copy()
parent ab4f94e2
......@@ -712,6 +712,12 @@ static bool_t h264_dec_init_decoder(VTH264DecCtx *ctx) {
}
if (hardware_acceleration != NULL) CFRelease(hardware_acceleration);
#endif
status = VTSessionSetProperty(ctx->session, kVTDecompressionPropertyKey_RealTime, kCFBooleanTrue);
if (status != noErr) {
vth264dec_warning("could not be able to switch to real-time mode: %s", os_status_to_string(status));
}
return TRUE;
}
}
......@@ -877,7 +883,7 @@ static void h264_dec_process(MSFilter *f) {
ctx->format_desc, 1, 1, &timing_info,
0, NULL, &sample);
status = VTDecompressionSessionDecodeFrame(ctx->session, sample, 0, NULL, NULL);
status = VTDecompressionSessionDecodeFrame(ctx->session, sample, kVTDecodeFrame_EnableAsynchronousDecompression, NULL, NULL);
CFRelease(sample);
if(status != noErr) {
vth264dec_error("error while passing encoded frames to the decoder: %s", os_status_to_string(status));
......
......@@ -177,11 +177,16 @@ static void plane_copy(const uint8_t *src_plane, size_t src_row_stride, size_t s
const uint8_t *r_ptr = src_plane + (src_roi->y * src_row_stride + src_roi->x * src_pix_stride);
uint8_t *w_ptr = dst_plane + (dst_roi->y * dst_row_stride + dst_roi->x * dst_pix_stride);
int i;
for(i=0; i<src_roi->h; i++) {
row_copy(r_ptr, w_ptr, src_roi->w, src_pix_stride, dst_pix_stride);
r_ptr += src_row_stride;
w_ptr += dst_row_stride;
if (src_row_stride == dst_row_stride && src_pix_stride == 1 && dst_pix_stride == 1 && src_roi == dst_roi) {
memcpy(w_ptr, r_ptr, dst_row_stride * dst_roi->h);
} else {
int i;
for(i=0; i<src_roi->h; i++) {
row_copy(r_ptr, w_ptr, src_roi->w, src_pix_stride, dst_pix_stride);
r_ptr += src_row_stride;
w_ptr += dst_row_stride;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment