From 428a0dc87431c6b9bdab8d4e174811a6a79dc236 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Fri, 24 Oct 2014 17:44:35 +0200 Subject: [PATCH] [vtb] - fix the removed clamp for retina displays (need to fix the stride for some movies as it was done before) --- .../Video/DVDVideoCodecVideoToolBox.cpp | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp index efbfc3807a3ab..e4e01ca6941cd 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp @@ -1512,37 +1512,38 @@ CDVDVideoCodecVideoToolBox::CreateVTSession(int width, int height, CMFormatDescr OSStatus status; #if defined(TARGET_DARWIN_IOS) - // allow rendering without scaledown for all - // retina devices (which have enough power to handle it) - double scale = 0.0; - if (!CDarwinUtils::DeviceHasRetina(scale)) - { - // decoding, scaling and rendering above 1920 x 800 runs into - // some bandwidth limit. detect and scale down to reduce - // the bandwidth requirements. - int width_clamp = 1280; - if ((width * height) > (1920 * 800)) - width_clamp = 960; - - int new_width = CheckNP2(width); - if (width != new_width) - { - // force picture width to power of two and scale up height - // we do this because no GL_UNPACK_ROW_LENGTH in OpenGLES - // and the CVPixelBufferPixel gets created using some - // strange alignment when width is non-standard. - double w_scaler = (double)new_width / width; - width = new_width; - height = height * w_scaler; - } - // scale output pictures down to 720p size for display - if (width > width_clamp) - { - double w_scaler = (float)width_clamp / width; - width = width_clamp; - height = height * w_scaler; - } - } + double scale = 0.0; + + // decoding, scaling and rendering above 1920 x 800 runs into + // some bandwidth limit. detect and scale down to reduce + // the bandwidth requirements. + int width_clamp = 1280; + if ((width * height) > (1920 * 800)) + width_clamp = 960; + + // allow rendering without scaledown for all + // retina devices (which have enough power to handle it) + if (CDarwinUtils::DeviceHasRetina(scale)) + width_clamp = 1920; + + int new_width = CheckNP2(width); + if (width != new_width) + { + // force picture width to power of two and scale up height + // we do this because no GL_UNPACK_ROW_LENGTH in OpenGLES + // and the CVPixelBufferPixel gets created using some + // strange alignment when width is non-standard. + double w_scaler = (double)new_width / width; + width = new_width; + height = height * w_scaler; + } + // scale output pictures down to 720p size for display + if (width > width_clamp) + { + double w_scaler = (float)width_clamp / width; + width = width_clamp; + height = height * w_scaler; + } #endif destinationPixelBufferAttributes = CFDictionaryCreateMutable( NULL, // CFAllocatorRef allocator