Changeset 1027

Show
Ignore:
Timestamp:
02/19/09 01:29:04 (1 year ago)
Author:
astrange
Message:

Color conversions:
- Simplify API and move bits out of FFusion
- Fix up & enable SSE2 Y420toY422 asm; compiled code surrounding it is still awful

Build system:
- Fix problems with Xcode GUI vs xcodebuild finding different SVN paths
- Don't revert/repatch ffmpeg unless it's actually being built
- Update cflags for Perian itself
- Remove some patches that aren't needed anymore
- Turn off more h264 decoder features we don't use

Subtitles:
- Push font weights through the parser (not supported in rendering yet)
- Drop shapes in the parser (a hack but too difficult in the renderer)
- More correct font sizes for \fn & \fs tags
- Slightly faster font lookup

Maybe some more too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ColorConversions.c

    r887 r1027  
    1616 *  You should have received a copy of the GNU Lesser General Public 
    1717 *  License along with this library; if not, write to the Free Software 
    18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA */ 
    19  
    20 #include "ColorConversions.h" 
     18 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA 
     19 */ 
     20 
    2121#include <QuickTime/QuickTime.h> 
    2222#include <Accelerate/Accelerate.h> 
    23 #include <sys/types.h> 
    24 #include <sys/sysctl.h> 
    25  
    26 #ifndef GOOD_COMPILER 
    27 #define noinline __attribute__((noinline)) 
    28 #else 
    29 #define noinline 
    30 #endif 
     23#include "ColorConversions.h" 
     24#include "Codecprintf.h" 
     25#include "CommonUtils.h" 
     26 
     27/* 
     28 Converts (without resampling) from ffmpeg pixel formats to the ones QT accepts 
     29  
     30 Todo: 
     31 - rewrite everything in asm (or C with all loop optimization opportunities removed) 
     32 - add a version with bilinear resampling 
     33 - rewrite the PPC-only code to just use int instead of all the crazy types 
     34 - handle YUV 4:2:0 with odd width 
     35 */ 
    3136 
    3237#define unlikely(x) __builtin_expect(x, 0) 
    33  
    34 //----------------------------------------------------------------- 
    35 // FastY420 
    36 //----------------------------------------------------------------- 
    37 // Returns y420 data directly to QuickTime which then converts 
    38 // in RGB for display 
    39 //----------------------------------------------------------------- 
    40  
    41 void FastY420(UInt8 *baseAddr, AVFrame *picture) 
    42 
    43     PlanarPixmapInfoYUV420 *planar; 
    44          
     38#define likely(x) __builtin_expect(x, 1) 
     39 
     40static FASTCALL void FastY420(AVFrame *picture, UInt8 *baseAddr, int outRowBytes, unsigned outWidth, unsigned outHeight) 
     41
     42    PlanarPixmapInfoYUV420 *planar = (PlanarPixmapInfoYUV420 *)baseAddr;         
    4543        /*From Docs: PixMap baseAddr points to a big-endian PlanarPixmapInfoYUV420 struct; see ImageCodec.i. */ 
    46     planar = (PlanarPixmapInfoYUV420 *) baseAddr; 
    4744     
    4845    // if ya can't set da poiners, set da offsets 
    49     planar->componentInfoY.offset = EndianU32_NtoB(picture->data[0] - baseAddr); 
    50     planar->componentInfoCb.offset =  EndianU32_NtoB(picture->data[1] - baseAddr); 
    51     planar->componentInfoCr.offset =  EndianU32_NtoB(picture->data[2] - baseAddr); 
     46    planar->componentInfoY.offset EndianU32_NtoB(picture->data[0] - baseAddr); 
     47    planar->componentInfoCb.offset =  EndianU32_NtoB(picture->data[1] - baseAddr); 
     48    planar->componentInfoCr.offset =  EndianU32_NtoB(picture->data[2] - baseAddr); 
    5249     
    5350    // for the 16/32 add look at EDGE in mpegvideo.c 
    54     planar->componentInfoY.rowBytes = EndianU32_NtoB(picture->linesize[0]); 
     51    planar->componentInfoY.rowBytes = EndianU32_NtoB(picture->linesize[0]); 
    5552    planar->componentInfoCb.rowBytes = EndianU32_NtoB(picture->linesize[1]); 
    5653    planar->componentInfoCr.rowBytes = EndianU32_NtoB(picture->linesize[2]); 
    5754} 
    5855 
    59 //----------------------------------------------------------------- 
    60 // FFusionSlowDecompress 
    61 //----------------------------------------------------------------- 
    62 // We have to return 2yuv values because 
    63 // QT version has no built-in y420 component. 
    64 // Since we do the conversion ourselves it is not really optimized.... 
    65 // The function should never be called since many people now 
    66 // have a decent OS/QT version. 
    67 //----------------------------------------------------------------- 
    68  
    69 static void noinline Y420toY422_lastrow(UInt8 *o, const UInt8 *yc, const UInt8 *uc, const UInt8 *vc, unsigned halfWidth) 
    70 
    71         unsigned x; 
     56//Handles the last row for Y420 videos with an odd number of luma rows 
     57//FIXME odd number of luma columns is not handled and they will be lost 
     58static void Y420toY422_lastrow(UInt8 *o, UInt8 *yc, UInt8 *uc, UInt8 *vc, unsigned halfWidth) 
     59
     60        int x; 
    7261        for(x=0; x < halfWidth; x++) 
    7362        { 
    74                 unsigned x4 = x*4, x2 = x*2; 
     63                int x4 = x*4, x2 = x*2; 
     64 
    7565                o[x4] = uc[x]; 
    7666                o[x4+1] = yc[x2]; 
     
    8272#define HandleLastRow(o, yc, uc, vc, halfWidth, height) if (unlikely(height & 1)) Y420toY422_lastrow(o, yc, uc, vc, halfWidth) 
    8373 
    84 #ifdef __BIG_ENDIAN__ 
     74//Y420 Planar to Y422 Packed 
     75//The only one anyone cares about, so implemented with SIMD 
     76 
     77#ifdef __ppc__ 
    8578//hand-unrolled code is a bad idea on modern CPUs. luckily, this does not run on modern CPUs, only G3s. 
    86 //also, big-endian only 
    87  
    88 static void Y420toY422_ppc_scalar(UInt8* baseAddr, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    89 
    90          unsigned             y = height / 2; 
    91          unsigned             halfWidth = width / 2, halfHalfWidth = width / 4; 
     79 
     80static FASTCALL void Y420toY422_ppc_scalar(AVFrame *picture, UInt8 *baseAddr, int outRB, unsigned width, unsigned height) 
     81
     82         unsigned        y = height / 2; 
     83         unsigned        halfWidth = width / 2, halfHalfWidth = width / 4; 
    9284         UInt8          *inY = picture->data[0], *inU = picture->data[1], *inV = picture->data[2]; 
    9385         int             rB = picture->linesize[0], rbU = picture->linesize[1], rbV = picture->linesize[2]; 
     
    129121         
    130122        HandleLastRow(baseAddr, inY, inU, inV, halfWidth, height); 
    131 
    132  
    133 static void Y420toY422_ppc_altivec(UInt8 * o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture
     123
     124 
     125static FASTCALL void Y420toY422_ppc_altivec(AVFrame * picture, UInt8 * o, int outRB, unsigned width, unsigned height
    134126{ 
    135127        UInt8                   *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; 
     
    182174        HandleLastRow(o, yc, uc, vc, width / 2, height); 
    183175} 
    184  
    185 void Y420toY422(UInt8 * o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    186 { 
    187         static void (*y420_function)(UInt8* baseAddr, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) = NULL; 
    188         if (!y420_function) { 
    189                 int sels[2] = { CTL_HW, HW_VECTORUNIT }; // from http://developer.apple.com/hardwaredrivers/ve/g3_compatibility.html 
    190                 int vType = 0; //0 == scalar only 
    191                 size_t length = sizeof(vType); 
    192                 int error = sysctl(sels, 2, &vType, &length, NULL, 0); 
    193                 if( 0 == error && vType ) y420_function = Y420toY422_ppc_altivec; 
    194                 else  
    195                 y420_function = Y420toY422_ppc_scalar; 
    196         } 
    197          
    198         y420_function(o, outRB, width, height, picture); 
    199 } 
    200176#else 
    201177#include <emmintrin.h> 
    202178 
    203 static void Y420toY422_sse2(UInt8 *  o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture
     179static FASTCALL void Y420toY422_sse2(AVFrame * picture, UInt8 *o, int outRB, unsigned width, unsigned height
    204180{ 
    205181        UInt8   *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; 
    206         unsigned      rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2]; 
    207         unsigned       y,x, vWidth = width / 32, halfheight = height / 2; 
    208         unsigned       halfwidth = width / 2;  
     182        int           rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2]; 
     183        int            y, x, halfwidth = width / 2 , halfheight = height / 2; 
     184        int            vWidth = width / 32;  
    209185         
    210186        for (y = 0; y < halfheight; y++) { 
     
    213189                __m128i * uv = (__m128i*)uc,* vv  = (__m128i*)vc; 
    214190                 
    215 #if 0 
     191#ifdef __i386__ 
     192                int vWidth_ = vWidth; 
     193 
    216194                asm volatile( 
    217195                        "\n0:                   \n\t" 
     
    253231                        "movntdq        %%xmm6, 48(%1)  \n\t" /*ov2[x4+3]*/ 
    254232                        "addl           $64,    %1              \n\t" 
    255                         "dec          %6                              \n\t" 
     233                        "decl         %6                              \n\t" 
    256234                        "jnz            0b                              \n\t" 
    257235                        : "+r" (ov), "+r" (ov2), 
    258                         "+r" (yv), "+r" (yv2), "+r" (uv), "+r" (vv) 
    259                         : "r" (vWidth) 
     236                        "+r" (yv), "+r" (yv2), "+r" (uv), "+r" (vv), "+m"(vWidth_) 
     237                        : 
     238                        : "memory", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6" 
    260239                        ); 
    261240#else 
    262241                for (x = 0; x < vWidth; x++) { 
    263                         unsigned x2 = x*2, x4 = x*4; 
     242                        int x2 = x*2, x4 = x*4; 
    264243 
    265244                        __m128i tmp_y = yv[x2], tmp_y3 = yv[x2+1], 
     
    282261 
    283262                for (x=vWidth * 16; x < halfwidth; x++) { 
    284                         unsigned x4 = x*4, x2 = x*2; 
     263                        int x4 = x*4, x2 = x*2; 
    285264                        o2[x4] = o[x4] = uc[x]; 
    286265                        o[x4 + 1] = yc[x2]; 
     
    296275                vc += rV; 
    297276        } 
    298          
    299         _mm_sfence(); 
    300          
     277 
    301278        HandleLastRow(o, yc, uc, vc, halfwidth, height); 
    302279} 
    303280 
    304  
    305 static void noinline Y420toY422_x86_scalar(UInt8 * o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    306 
    307         UInt8          *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 
    308         unsigned       rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], halfheight = height / 2, halfwidth = width / 2; 
    309         unsigned      y, x; 
     281static FASTCALL void Y420toY422_x86_scalar(AVFrame * picture, UInt8 * o, int outRB, unsigned width, unsigned height) 
     282
     283        UInt8   *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 
     284        int            rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2]; 
     285        int            halfheight = height / 2, halfwidth = width / 2; 
     286        int           y, x; 
    310287         
    311288        for (y = 0; y < halfheight; y ++) { 
     
    313290                 
    314291                for (x = 0; x < halfwidth; x++) { 
    315                         unsigned x4 = x*4, x2 = x*2; 
     292                        int x4 = x*4, x2 = x*2; 
    316293                        o2[x4] = o[x4] = u[x]; 
    317294                        o[x4 + 1] = yc[x2]; 
     
    330307        HandleLastRow(o, yc, u, v, halfwidth, height); 
    331308} 
    332  
    333 void Y420toY422(UInt8 * o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    334 { 
    335         uintptr_t yc = (uintptr_t)picture->data[0]; 
    336  
    337         //make sure the ffmpeg picture buffers are aligned enough, they're only guaranteed to be 8-byte for some reason... 
    338         if (!unlikely((yc | picture->linesize[0]) % 16)) Y420toY422_sse2(o, outRB, width, height, picture);  
    339         else Y420toY422_x86_scalar(o, outRB, width, height, picture); 
    340 } 
    341309#endif 
    342310 
    343 void YA420toV408(UInt8* o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    344 
    345         UInt8          *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2], *a = picture->data[3]; 
    346         unsigned       rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], rA = picture->linesize[3], y, x; 
     311//Y420+Alpha Planar to V408 (YUV 4:4:4+Alpha 32-bit packed) 
     312//Could be fully unrolled to avoid x/2 
     313static FASTCALL void YA420toV408(AVFrame *picture, UInt8 *o, int outRB, unsigned width, unsigned height) 
     314
     315        UInt8   *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2], *a = picture->data[3]; 
     316        int             rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], rA = picture->linesize[3]; 
     317        unsigned y, x; 
    347318         
    348319        for (y = 0; y < height; y++) { 
     
    364335} 
    365336 
    366 void BGR24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture) 
    367 
    368         unsigned i, j; 
     337static FASTCALL void BGR24toRGB24(AVFrame *picture, UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     338
    369339        UInt8 *srcPtr = picture->data[0]; 
    370          
    371         for (i = 0; i < height; ++i) 
    372         { 
    373                 for (j = 0; j < width; j ++) 
     340        int srcRB = picture->linesize[0]; 
     341        int x, y; 
     342         
     343        for (y = 0; y < height; y++) 
     344        { 
     345                for (x = 0; x < width; x++) 
    374346                { 
    375                         unsigned j3 = j * 3; 
    376                         baseAddr[j3] = srcPtr[j3+2]; 
    377                         baseAddr[j3+1] = srcPtr[j3+1]; 
    378                         baseAddr[j3+2] = srcPtr[j3]; 
     347                        unsigned x3 = x * 3; 
     348                        baseAddr[x3] = srcPtr[x3+2]; 
     349                        baseAddr[x3+1] = srcPtr[x3+1]; 
     350                        baseAddr[x3+2] = srcPtr[x3]; 
    379351                } 
    380352                baseAddr += rowBytes; 
    381                 srcPtr += picture->linesize[0]
    382         } 
    383 } 
    384  
    385 void RGB32toRGB32(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture) 
    386 
    387         unsigned y; 
     353                srcPtr += srcRB
     354        } 
     355} 
     356 
     357//Native-endian XRGB32 to big-endian XRGB32 
     358static FASTCALL void RGB32toRGB32(AVFrame *picture, UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     359
    388360        UInt8 *srcPtr = picture->data[0]; 
    389          
     361        int srcRB = picture->linesize[0]; 
     362        int y; 
     363 
    390364        for (y = 0; y < height; y++) { 
    391365#ifdef __BIG_ENDIAN__ 
    392366                memcpy(baseAddr, srcPtr, width * 4); 
    393367#else 
    394                 unsigned x; 
    395368                UInt32 *oRow = (UInt32 *)baseAddr, *iRow = (UInt32 *)srcPtr; 
    396                 for (x = 0; x < width; x++) {oRow[x] = EndianU32_BtoN(iRow[x]);} 
     369                int x; 
     370                for (x = 0; x < width; x++) {oRow[x] = EndianU32_NtoB(iRow[x]);} 
    397371#endif 
    398372                 
    399373                baseAddr += rowBytes; 
    400                 srcPtr += picture->linesize[0]; 
    401         } 
    402 
    403  
    404 void RGB24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture) 
    405 
    406         unsigned y; 
     374                srcPtr += srcRB; 
     375        } 
     376
     377 
     378static FASTCALL void RGB24toRGB24(AVFrame *picture, UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     379
    407380        UInt8 *srcPtr = picture->data[0]; 
     381        int srcRB = picture->linesize[0]; 
     382        int y; 
    408383         
    409384        for (y = 0; y < height; y++) { 
     
    411386                 
    412387                baseAddr += rowBytes; 
    413                 srcPtr += picture->linesize[0]; 
    414         } 
    415 
    416  
    417 void Y422toY422(UInt8* o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture) 
    418 
    419         UInt8          *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 
    420         unsigned       rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], y, x, halfwidth = width / 2; 
     388                srcPtr += srcRB; 
     389        } 
     390
     391 
     392static FASTCALL void Y422toY422(AVFrame *picture, UInt8 *o, int outRB, unsigned width, unsigned height) 
     393
     394        UInt8   *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 
     395        int             rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2]; 
     396        int             x, y, halfwidth = width / 2; 
    421397         
    422398        for (y = 0; y < height; y++) { 
    423399                for (x = 0; x < halfwidth; x++) { 
    424                         unsigned x2 = x * 2, x4 = x * 4; 
     400                        int x2 = x * 2, x4 = x * 4; 
    425401                        o[x4] = u[x]; 
    426402                        o[x4 + 1] = yc[x2]; 
     
    435411        } 
    436412} 
     413 
     414static void ClearRGB(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height, int bytesPerPixel) 
     415{ 
     416        int y; 
     417         
     418        for (y = 0; y < height; y++) { 
     419                memset(baseAddr, 0, width * bytesPerPixel); 
     420                 
     421                baseAddr += rowBytes; 
     422        } 
     423} 
     424 
     425static FASTCALL void ClearRGB32(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     426{ 
     427        ClearRGB(baseAddr, rowBytes, width, height, 4); 
     428} 
     429 
     430static FASTCALL void ClearRGB24(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     431{ 
     432        ClearRGB(baseAddr, rowBytes, width, height, 3); 
     433} 
     434 
     435static FASTCALL void ClearV408(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     436{ 
     437        int x, y; 
     438         
     439        for (y = 0; y < height; y++) 
     440        { 
     441                for (x = 0; x < width; x++) 
     442                { 
     443                        unsigned x4 = x * 4; 
     444                        baseAddr[x4]   = 0x80; //zero chroma 
     445                        baseAddr[x4+1] = 0x10; //black 
     446                        baseAddr[x4+2] = 0x80;  
     447                        baseAddr[x4+3] = 0xEB; //opaque 
     448                } 
     449                baseAddr += rowBytes; 
     450        } 
     451} 
     452 
     453static FASTCALL void ClearY422(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     454{ 
     455        int x, y; 
     456         
     457        for (y = 0; y < height; y++) 
     458        { 
     459                for (x = 0; x < width; x++) 
     460                { 
     461                        unsigned x2 = x * 2; 
     462                        baseAddr[x2]   = 0x80; //zero chroma 
     463                        baseAddr[x2+1] = 0x10; //black 
     464                } 
     465                baseAddr += rowBytes; 
     466        } 
     467} 
     468 
     469static FASTCALL void ClearNone(UInt8 *baseAddr, int rowBytes, unsigned width, unsigned height) 
     470{ 
     471} 
     472 
     473int ColorConversionFindFor(ColorConversionFuncs *funcs, enum PixelFormat ffPixFmt, AVFrame *ffPicture, OSType qtPixFmt) 
     474{        
     475        if (qtPixFmt == kYUV420CodecType && ffPixFmt == PIX_FMT_YUV420P) 
     476        { 
     477                funcs->clear = ClearNone; 
     478                funcs->convert = FastY420; 
     479        } 
     480        else if (qtPixFmt == k2vuyPixelFormat && ffPixFmt == PIX_FMT_YUV420P) 
     481        { 
     482                funcs->clear = ClearY422; 
     483 
     484#ifdef __ppc__ 
     485                if (IsAltivecSupported()) 
     486                        funcs->convert = Y420toY422_ppc_altivec; 
     487                else 
     488                        funcs->convert = Y420toY422_ppc_scalar; 
     489#else 
     490                //can't set this without the first real frame 
     491                if (ffPicture) { 
     492                        if (ffPicture->linesize[0] % 16) 
     493                                funcs->convert = Y420toY422_x86_scalar; 
     494                        else 
     495                                funcs->convert = Y420toY422_sse2; 
     496                } 
     497#endif           
     498        } 
     499        else if (qtPixFmt == k24RGBPixelFormat && ffPixFmt == PIX_FMT_BGR24) 
     500        { 
     501                funcs->clear = ClearRGB24; 
     502                funcs->convert = BGR24toRGB24; 
     503        } 
     504        else if (qtPixFmt == k32ARGBPixelFormat && ffPixFmt == PIX_FMT_RGB32) 
     505        { 
     506                funcs->clear = ClearRGB32; 
     507                funcs->convert = RGB32toRGB32; 
     508        } 
     509        else if (qtPixFmt == k24RGBPixelFormat && ffPixFmt == PIX_FMT_RGB24) 
     510        { 
     511                funcs->clear = ClearRGB24; 
     512                funcs->convert = RGB24toRGB24; 
     513        } 
     514        else if (qtPixFmt == k2vuyPixelFormat && ffPixFmt == PIX_FMT_YUV422P) 
     515        { 
     516                funcs->clear = ClearY422; 
     517                funcs->convert = Y422toY422; 
     518        } 
     519        else if (qtPixFmt == k4444YpCbCrA8PixelFormat && ffPixFmt == PIX_FMT_YUVA420P) 
     520        { 
     521                funcs->clear = ClearV408; 
     522                funcs->convert = YA420toV408; 
     523        } 
     524        else 
     525        { 
     526                return paramErr; 
     527        } 
     528         
     529        return noErr; 
     530} 
  • trunk/ColorConversions.h

    r887 r1027  
    1919 
    2020#include <Carbon/Carbon.h> 
    21 #include "avcodec.h" 
     21#include "libavcodec/avcodec.h" 
    2222 
    23 extern void FastY420(UInt8 *baseAddr, AVFrame *picture); 
    24 extern void Y420toY422(UInt8* baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame * picture); 
    25 extern void YA420toV408(UInt8* o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture); 
    26 extern void RGB32toRGB32(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture); 
    27 extern void RGB24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture); 
    28 extern void BGR24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture); 
    29 extern void Y422toY422(UInt8* o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture); 
     23#ifndef __i386__ 
     24#define FASTCALL 
     25#else 
     26#define FASTCALL __attribute__((fastcall)) 
     27#endif 
     28 
     29typedef void ColorConversionFunc(AVFrame *inPicture, UInt8 *outBaseAddr, int outRowBytes, unsigned outWidth, unsigned outHeight) FASTCALL; 
     30typedef ColorConversionFunc *ColorConversionFuncPtr; 
     31typedef void ColorClearFunc(UInt8 *outBaseAddr, int outRowBytes, unsigned outWidth, unsigned outHeight) FASTCALL; 
     32typedef ColorClearFunc *ColorClearFuncPtr; 
     33 
     34typedef struct ColorConversionFuncs { 
     35        ColorConversionFuncPtr convert; 
     36        ColorClearFuncPtr      clear; 
     37} ColorConversionFuncs; 
     38 
     39extern int ColorConversionFindFor(ColorConversionFuncs *funcs, enum PixelFormat ffPixFmt, AVFrame *ffPicture, OSType qtPixFmt); 
  • trunk/CommonUtils.c

    r1008 r1027  
    387387        return forced; 
    388388} 
     389 
     390int IsAltivecSupported() 
     391{ 
     392        static int altivec = -1; 
     393         
     394        if (altivec == -1) { 
     395                long response = 0; 
     396                int err = Gestalt(gestaltPowerPCProcessorFeatures, &response); 
     397                 
     398                altivec = !err && ((response & gestaltPowerPCHasVectorInstructions) != 0); 
     399        } 
     400         
     401        return altivec; 
     402} 
  • trunk/CommonUtils.h

    r1008 r1027  
    4141int IsFrameDroppingEnabled(); 
    4242int forcePerianToDecode(); 
     43         
     44int IsAltivecSupported(); 
    4345 
    4446#ifdef __cplusplus 
  • trunk/FFusionCodec.c

    r1008 r1027  
    132132        struct decode_glob      decode; 
    133133        struct decode_stats stats; 
     134        ColorConversionFuncs colorConv; 
    134135} FFusionGlobalsRecord, *FFusionGlobals; 
    135136 
     
    13491350    OSErr err = noErr; 
    13501351    FFusionDecompressRecord *myDrp = (FFusionDecompressRecord *)drp->userDecompressRecord; 
    1351         int i, j
     1352        AVFrame *picture
    13521353         
    13531354        glob->stats.type[drp->frameType].draw_calls++; 
     
    13551356        FFusionDebugPrint("%p DrawBand #%d. (%sdecoded)\n", glob, myDrp->frameNumber, not(myDrp->decoded)); 
    13561357         
    1357         if(!myDrp->decoded) 
     1358        if(!myDrp->decoded) { 
    13581359                err = FFusionCodecDecodeBand(glob, drp, 0); 
    1359          
    1360         AVFrame *picture; 
     1360 
     1361                if (err) goto err; 
     1362        } 
    13611363         
    13621364        if (myDrp->buffer) 
     
    13741376                else if(glob->lastDisplayedFrame.data[0] != NULL) 
    13751377                        //Display last frame 
    1376                         picture = &(glob->lastDisplayedFrame); 
    1377                 else 
    1378                 {  
    1379                         //Can't display anything so put up a black frame 
    1380                         Ptr addr = drp->baseAddr;  
    1381                         for(i=0; i<myDrp->height; i++)  
    1382                         {  
    1383                                 for(j=0; j<myDrp->width*2; j+=2)  
    1384                                 {  
    1385                                         addr[j] = 0x80;  
    1386                                         addr[j+1] = 0x10;  
    1387                                         addr[j+2] = 0x80;  
    1388                                         addr[j+3] = 0x10;  
    1389                                 }  
    1390                                 addr += drp->rowBytes;  
    1391                         }  
    1392                         return noErr;  
     1378                        picture = &glob->lastDisplayedFrame; 
     1379                else { 
     1380                        //Display black (no frame decoded yet) 
     1381 
     1382                        if (!glob->colorConv.clear) { 
     1383                                err = ColorConversionFindFor(&glob->colorConv, glob->avContext->pix_fmt, NULL, myDrp->pixelFormat); 
     1384                                 
     1385                                if (err) goto err; 
     1386                        } 
     1387                         
     1388                        glob->colorConv.clear((UInt8*)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height); 
     1389                        return noErr; 
    13931390                } 
    13941391        } 
    13951392        else 
    13961393        { 
    1397                 memcpy(&(glob->lastDisplayedFrame), picture, sizeof(AVFrame)); 
    1398         } 
    1399          
    1400         if (myDrp->pixelFormat == 'y420' && glob->avContext->pix_fmt == PIX_FMT_YUV420P) 
    1401         { 
    1402                 FastY420((UInt8 *)drp->baseAddr, picture); 
    1403         } 
    1404         else if (myDrp->pixelFormat == k2vuyPixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUV420P) 
    1405         { 
    1406                 Y420toY422((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1407         } 
    1408         else if (myDrp->pixelFormat == k24RGBPixelFormat && glob->avContext->pix_fmt == PIX_FMT_BGR24) 
    1409         { 
    1410                 BGR24toRGB24((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1411         } 
    1412         else if (myDrp->pixelFormat == k32ARGBPixelFormat && glob->avContext->pix_fmt == PIX_FMT_RGB32) 
    1413         { 
    1414                 RGB32toRGB32((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1415         } 
    1416         else if (myDrp->pixelFormat == k24RGBPixelFormat && glob->avContext->pix_fmt == PIX_FMT_RGB24) 
    1417         { 
    1418                 RGB24toRGB24((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1419         } 
    1420         else if (myDrp->pixelFormat == k2vuyPixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUV422P) 
    1421         { 
    1422                 Y422toY422((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1423         } 
    1424         else if (myDrp->pixelFormat == k4444YpCbCrA8PixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUVA420P) 
    1425         { 
    1426                 YA420toV408((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    1427         } 
    1428         else 
    1429         { 
    1430                 Codecprintf(glob->fileLog, "Unsupported conversion from PIX_FMT %d to %c%c%c%c (%08x) buffer\n", 
    1431                                         glob->avContext->pix_fmt, myDrp->pixelFormat >> 24 & 0xff, myDrp->pixelFormat >> 16 & 0xff,  
    1432                                         myDrp->pixelFormat >> 8 & 0xff, myDrp->pixelFormat & 0xff, myDrp->pixelFormat); 
    1433         } 
    1434          
     1394                if (myDrp->buffer) 
     1395                        glob->lastDisplayedFrame = *picture; 
     1396        } 
     1397         
     1398        if (!glob->colorConv.convert) { 
     1399                err = ColorConversionFindFor(&glob->colorConv, glob->avContext->pix_fmt, picture, myDrp->pixelFormat); 
     1400                 
     1401                if (err) { 
     1402                        Codecprintf(glob->fileLog, "Unsupported conversion from pixel format %d to %s (%08x) buffer\n", 
     1403                                                glob->avContext->pix_fmt, FourCCString(myDrp->pixelFormat), myDrp->pixelFormat); 
     1404                        goto err; 
     1405                } 
     1406        } 
     1407         
     1408        glob->colorConv.convert(picture, (UInt8*)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height); 
     1409         
     1410err: 
    14351411    return err; 
    14361412} 
  • trunk/Patches/ffmpeg-no-interlaced.diff

    r939 r1027  
    11Index: ffmpeg/libavcodec/h264.h 
    22=================================================================== 
    3 --- ffmpeg/libavcodec/h264.h    (revision 14508
     3--- ffmpeg/libavcodec/h264.h    (revision 17451
    44+++ ffmpeg/libavcodec/h264.h    (working copy) 
    5 @@ -55,7 +55,7 @@ 
     5@@ -55,10 +55,13 @@ 
    66  
    77 /* Compiling in interlaced support reduces the speed 
     
    1010+//#define ALLOW_INTERLACE 
    1111  
    12  #define ALLOW_NOCHROMA 
     12-#define ALLOW_NOCHROMA 
     13+//#define ALLOW_NOCHROMA 
    1314  
     15+#undef CODEC_FLAG2_CHUNKS 
     16+#define CODEC_FLAG2_CHUNKS 0 
     17+ 
     18 /** 
     19  * The maximum number of slices supported by the decoder. 
     20  * must be a power of 2 
  • trunk/Perian.xcodeproj/project.pbxproj

    r1018 r1027  
    5959                        buildConfigurationList = F5CFD2EA0B5012E800616865 /* Build configuration list for PBXAggregateTarget "A52Codec" */; 
    6060                        buildPhases = ( 
    61                                 3D79C0540DFBA1FF00EEFE22 /* ShellScript */, 
    6261                                F5CFD2E00B5012BC00616865 /* CopyFiles */, 
    6362                                F5CFD2E30B5012DB00616865 /* CopyFiles */, 
     
    15621561                        runOnlyForDeploymentPostprocessing = 0; 
    15631562                        shellPath = /bin/sh; 
    1564                         shellScript = "# Xcode auto-versioning script for Subversion\n# by Axel Andersson, modified by Daniel Jalkut to add\n# \"--revision HEAD\" to the svn info line, which allows\n# the latest revision to always be used.\n\n# further modified by Augie Fackler to be gross and sh-based in places\n# so that you can have svn installed anywhere\nPATH=$PATH:/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin\nffmpeg_rev=`cat \"$SYMROOT/Universal/buildid\"`\nREV=`svnversion -n ./`\necho $REV\n\necho | perl <<EOF\nuse strict;\ndie \"\\$0: Must be run from Xcode\" unless \\$ENV{\"BUILT_PRODUCTS_DIR\"};\n\nmy \\$INFO = \"\\$ENV{BUILT_PRODUCTS_DIR}/\\$ENV{WRAPPER_NAME}/Contents/Info.plist\";\n\nmy \\$version = \"$REV\";\n\n# (Match the last group of digits and optional letter M/S):\n\n# ugly yet functional (barely) regex by Daniel Jalkut:\n#$version =~ s/([\\d]*:)(\\d+[M|S]*).*/$2/;\n\n# better yet still functional regex via Kevin \"Regex Nerd\" Ballard\n(\\$version =~ m/\\d+[MS]*\\$/) && (\\$version = \\$&);\n\nopen(FH, \"\\$INFO\") or die \"\\$0: \\$INFO: $!\";\nmy \\$info = join(\"\", <FH>);\nclose(FH);\n\n#\\$info =~ s/([\\t ]+<key>CFBundleVersion<\\/key>\\n[\\t ]+<string>).*?(<\\/string>)/\\$1\\$version\\$2/;\n\\$info =~ s/SVNREVISION/\\$version/;\n\\$info =~ s/FFMPEGREVISION/$ffmpeg_rev/;\n\nopen(FH, \">\\$INFO\") or die \"\\$0: \\$INFO: \\$!\";\nprint FH \\$info;\nclose(FH);\nEOF\n"; 
    1565                 }; 
    1566                 3D79C0540DFBA1FF00EEFE22 /* ShellScript */ = { 
    1567                         isa = PBXShellScriptBuildPhase; 
    1568                         buildActionMask = 2147483647; 
    1569                         files = ( 
    1570                         ); 
    1571                         inputPaths = ( 
    1572                         ); 
    1573                         outputPaths = ( 
    1574                         ); 
    1575                         runOnlyForDeploymentPostprocessing = 0; 
    1576                         shellPath = /bin/sh; 
    1577                         shellScript = "pushd a52codec/build\nln -s Deployment+Debug Development || true\nln -s Development Deployment || true\nln -s Deployment Deployment+Debug || true\npopd"; 
     1563                        shellScript = "# Xcode auto-versioning script for Subversion\n# by Axel Andersson, modified by Daniel Jalkut to add\n# \"--revision HEAD\" to the svn info line, which allows\n# the latest revision to always be used.\n\n# further modified by Augie Fackler to be gross and sh-based in places\n# so that you can have svn installed anywhere\nPATH=/sw/bin:/opt/local/bin:/usr/local/bin:/usr/bin:$PATH\nffmpeg_rev=`cat \"$SYMROOT/Universal/buildid\"`\nREV=`svnversion -n ./`\necho $REV\n\necho | perl <<EOF\nuse strict;\ndie \"\\$0: Must be run from Xcode\" unless \\$ENV{\"BUILT_PRODUCTS_DIR\"};\n\nmy \\$INFO = \"\\$ENV{BUILT_PRODUCTS_DIR}/\\$ENV{WRAPPER_NAME}/Contents/Info.plist\";\n\nmy \\$version = \"$REV\";\n\n# (Match the last group of digits and optional letter M/S):\n\n# ugly yet functional (barely) regex by Daniel Jalkut:\n#$version =~ s/([\\d]*:)(\\d+[M|S]*).*/$2/;\n\n# better yet still functional regex via Kevin \"Regex Nerd\" Ballard\n(\\$version =~ m/\\d+[MS]*\\$/) && (\\$version = \\$&);\n\nopen(FH, \"\\$INFO\") or die \"\\$0: \\$INFO: $!\";\nmy \\$info = join(\"\", <FH>);\nclose(FH);\n\n#\\$info =~ s/([\\t ]+<key>CFBundleVersion<\\/key>\\n[\\t ]+<string>).*?(<\\/string>)/\\$1\\$version\\$2/;\n\\$info =~ s/SVNREVISION/\\$version/;\n\\$info =~ s/FFMPEGREVISION/$ffmpeg_rev/;\n\nopen(FH, \">\\$INFO\") or die \"\\$0: \\$INFO: \\$!\";\nprint FH \\$info;\nclose(FH);\nEOF\n"; 
    15781564                }; 
    15791565                F5121EB60EB3A54A0048EF67 /* ShellScript */ = { 
     
    21212107                                LIBRARY_SEARCH_PATHS = $SYMROOT/Universal; 
    21222108                                OTHER_CFLAGS = "$(OTHER_CFLAGS_$(CURRENT_ARCH))"; 
    2123                                 OTHER_CFLAGS_i386 = "-march=pentium-m -mtune=nocona $(OTHER_CFLAGS)"; 
    2124                                 OTHER_CFLAGS_ppc = "$(OTHER_CFLAGS)"; 
     2109                                OTHER_CFLAGS_i386 = "-march=pentium-m -frerun-cse-after-loop $(OTHER_CFLAGS)"; 
     2110                                OTHER_CFLAGS_ppc = "-mcpu=G3 -mtune=G5 -funroll-loops -mmultiple $(OTHER_CFLAGS)"; 
    21252111                                OTHER_LDFLAGS = ( 
    21262112                                        "-framework", 
  • trunk/Subtitles/SubATSUIRenderer.m

    r1013 r1027  
    2424        ATSUStyle style; 
    2525        CGColorRef primaryColor, outlineColor, shadowColor; 
    26         Float32 outlineRadius, shadowDist, scaleX, scaleY, primaryAlpha, outlineAlpha, angle
     26        Float32 outlineRadius, shadowDist, scaleX, scaleY, primaryAlpha, outlineAlpha, angle, platformSizeScale, fontSize
    2727        BOOL blurEdges; 
     28        ATSUFontID font; 
     29        ATSUVerticalCharacterType fontVertical; 
    2830} 
    2931-(SubATSUISpanEx*)initWithStyle:(ATSUStyle)style_ subStyle:(SubStyle*)sstyle colorSpace:(CGColorSpaceRef)cs; 
     
    7375-(SubATSUISpanEx*)initWithStyle:(ATSUStyle)style_ subStyle:(SubStyle*)sstyle colorSpace:(CGColorSpaceRef)cs 
    7476{ 
     77        ByteCount unused; 
     78         
    7579        if (self = [super init]) { 
    7680                ATSUCreateAndCopyStyle(style_, &style); 
     
    8690                scaleY = sstyle->scaleY / 100.; 
    8791                angle = sstyle->angle; 
     92                platformSizeScale = sstyle->platformSizeScale; 
     93                fontSize = sstyle->size; 
     94                ATSUGetAttribute(style, kATSUFontTag, sizeof(ATSUFontID), &font, &unused); 
     95                ATSUGetAttribute(style, kATSUVerticalCharacterTag, sizeof(ATSUVerticalCharacterType), &fontVertical, &unused); 
    8896        } 
    8997         
     
    106114        ret->scaleY = scaleY; 
    107115        ret->angle = angle; 
     116        ret->platformSizeScale = platformSizeScale; 
     117        ret->fontSize = fontSize; 
     118        ret->font = font; 
     119        ret->fontVertical = fontVertical; 
    108120         
    109121        return [ret autorelease]; 
     
    308320// XXX: Assumes ATSUFontID = ATSFontRef. This is true. 
    309321static ATSUFontID GetFontIDForSSAName(NSString *name) 
    310 
     322{                
     323        if (fontIDCache) { 
     324                NSNumber *idN = [fontIDCache objectForKey:[name lowercaseString]]; 
     325                 
     326                if (idN) return [idN intValue]; 
     327        } else 
     328                fontIDCache = [[NSMutableDictionary alloc] init]; 
     329         
    311330        ByteCount nlen = [name length]; 
    312331        unichar *uname = (unichar*)[name cStringUsingEncoding:NSUnicodeStringEncoding]; 
    313          
    314         if (!fontIDCache) fontIDCache = [[NSMutableDictionary alloc] init]; 
    315          
    316         NSNumber *idN = [fontIDCache objectForKey:[name lowercaseString]]; 
    317                  
    318         if (idN) return [idN intValue]; 
    319          
    320332        ATSUFontID font; 
    321333         
     
    366378        ATSStyleRenderingOptions opt = kATSStyleApplyAntiAliasing; 
    367379        Fixed size; 
    368         Boolean b = s->bold, i = s->italic, u = s->underline, st = s->strikeout; 
     380        Boolean b = s->weight > 0, i = s->italic, u = s->underline, st = s->strikeout; 
    369381        ATSUStyle style; 
    370382                 
     
    372384         
    373385        if (!s->platformSizeScale) s->platformSizeScale = GetWinFontSizeScale(fontRef); 
    374         size = FloatToFixed(s->size * s->platformSizeScale * screenScaleY); 
     386        size = FloatToFixed(s->size * s->platformSizeScale * screenScaleY); //FIXME several other values also change relative to PlayRes but aren't handled 
    375387         
    376388        ATSUCreateStyle(&style); 
     
    416428        SubATSUISpanEx *spanEx = ex; 
    417429        [spanEx release]; 
     430} 
     431 
     432static void UpdateFontNameSize(SubATSUISpanEx *spanEx, float screenScale) 
     433{ 
     434        Fixed fSize = FloatToFixed(spanEx->fontSize * spanEx->platformSizeScale * screenScale); 
     435        SetATSUStyleOther(spanEx->style, kATSUFontTag, sizeof(ATSUFontID), &spanEx->font); 
     436        SetATSUStyleOther(spanEx->style, kATSUVerticalCharacterTag, sizeof(ATSUVerticalCharacterType), &spanEx->fontVertical); 
     437        SetATSUStyleOther(spanEx->style, kATSUSizeTag, sizeof(Fixed), &fSize); 
    418438} 
    419439 
     
    443463        switch (tag) { 
    444464                case tag_b: 
    445                         bv(); 
     465                        bv(); // XXX font weight variations 
    446466                        SetATSUStyleFlag(spanEx->style, kATSUQDBoldfaceTag, bval != 0); 
    447467                        break;  
     
    470490                case tag_fn: 
    471491                        sv(); 
    472                         { 
    473                                 ATSUVerticalCharacterType vertical = ParseFontVerticality(&sval) ? kATSUStronglyVertical : kATSUStronglyHorizontal; 
    474                                 ATSUFontID font = GetFontIDForSSAName(sval); 
    475                                  
    476                                 if (font) { 
    477                                         SetATSUStyleFlag(spanEx->style, kATSUVerticalCharacterTag, vertical); 
    478                                         SetATSUStyleOther(spanEx->style, kATSUFontTag, sizeof(ATSUFontID), &font); 
    479                                 } 
    480                         } 
     492                        spanEx->fontVertical = ParseFontVerticality(&sval) ? kATSUStronglyVertical : kATSUStronglyHorizontal; 
     493                        spanEx->font = GetFontIDForSSAName(sval); 
     494                        UpdateFontNameSize(spanEx, screenScaleY); 
    481495                        break; 
    482496                case tag_fs: 
    483497                        fv(); 
    484                         fixval = FloatToFixed(fval * div->styleLine->platformSizeScale)
    485                         SetATSUStyleOther(spanEx->style, kATSUSizeTag, sizeof(Fixed), &fixval); 
     498                        spanEx->fontSize = fval
     499                        UpdateFontNameSize(spanEx, screenScaleY); 
    486500                        break; 
    487501                case tag_1c: 
     
    523537                        break; 
    524538                case tag_frz: 
     539                        fv(); 
    525540                        if (!isFirstSpan) div->render_complexity |= renderComplexTransforms; // this one's hard 
    526                         fv(); 
    527541                        spanEx->angle = fval; 
    528542                        break; 
     
    562576                case tag_be: 
    563577                        bv(); 
    564                         if (!isFirstSpan) div->render_complexity |= renderMultipleParts; 
     578                        if (!isFirstSpan) div->render_complexity |= renderMultipleParts; // XXX blur edges 
    565579                        spanEx->blurEdges = bval; 
    566580                        break; 
  • trunk/Subtitles/SubContext.h

    r923 r1027  
    2929        Float32 outlineRadius, shadowDist; 
    3030        unsigned marginL, marginR, marginV; 
    31         BOOL bold, italic, underline, strikeout; 
     31        Float32 weight; // 0/1 = not bold/bold, > 1 is a font weight 
     32        BOOL italic, underline, strikeout; 
    3233        UInt8 alignH, alignV, borderStyle; 
    3334        __strong void* ex; 
  • trunk/Subtitles/SubContext.m

    r923 r1027  
    6868        if ([*fontname characterAtIndex:0] == '@') { 
    6969                *fontname = [*fontname substringFromIndex:1]; 
    70                 return YES; 
     70                //return YES; // XXX vertical 
    7171        } 
    7272        return NO; 
     
    8989        sty->shadowDist = 2; 
    9090        sty->marginL = sty->marginR = sty->marginV = 20; 
    91         sty->bold = YES
     91        sty->weight = 1
    9292        sty->italic = sty->underline = sty->strikeout = NO; 
    9393        sty->alignH = kSubAlignmentCenter; 
     
    121121                cv(outlineColor, OutlineColour); 
    122122                cv(shadowColor, ShadowColour); 
    123                 bv(bold, Bold); 
     123                fv(weight, Bold); 
    124124                bv(italic, Italic); 
    125125                bv(underline, Underline); 
     
    138138                if (!scaleX) scaleX = 100; 
    139139                if (!scaleY) scaleY = 100; 
     140                if (weight == -1) weight = 1; 
    140141 
    141142                UInt8 align = [[s objectForKey:@"Alignment"] intValue]; 
  • trunk/Subtitles/SubParsing.h

    r887 r1027  
    2727        int posX, posY; 
    2828        UInt8 alignH, alignV, wrapStyle, render_complexity; 
    29         BOOL is_shape, positioned; 
     29        BOOL positioned; 
    3030         
    3131        unsigned layer; 
  • trunk/Subtitles/SubParsing.m.rl

    r1016 r1027  
    6565                alignH = kSubAlignmentMiddle; alignV = kSubAlignmentBottom; 
    6666                 
    67                 is_shape = positioned = NO; 
     67                positioned = NO; 
    6868                render_complexity = 0; 
    6969        } 
     
    9191  div->wrapStyle = wrapStyle; 
    9292   
    93     div->is_shape = NO; 
    9493        div->positioned = positioned; 
    9594        div->render_complexity = render_complexity; 
     
    272271                        unsigned curX, curY; 
    273272                        int intnum = 0; 
    274                         BOOL reached_end = NO, startNewLayout = NO, setAlignForDiv = NO
     273                        BOOL reached_end = NO, startNewLayout = NO, setAlignForDiv = NO, dropThisSpan = NO
    275274                         
    276275                        %%{ 
     
    300299                                action shadowa {tag(4a, intnum);} 
    301300                                action stylerevert {tag(r, strval);} 
     301                                action drawingmode {tag(p, floatnum); dropThisSpan = floatnum > 0;} 
    302302 
    303303                                action paramset {parambegin=p;} 
     
    390390                                                        |("fad" "e"? parens) 
    391391                                                        |"clip" parens 
    392                                                         |"p" floatnum 
     392                                                        |"p" floatnum %drawingmode 
    393393                                                        |"pbo" floatnum 
    394394                                           ); 
     
    420420                                } 
    421421                                 
    422                                 action enter_tag {                                       
    423                                         if (p > outputbegin) [div->text appendString:send()]; 
     422                                action enter_tag { 
     423                                        if (dropThisSpan) chars_deleted += p - outputbegin; 
     424                                        else if (p > outputbegin) [div->text appendString:send()]; 
    424425                                        if (p == pe) reached_end = YES; 
    425426                                         
     
    431432                                         
    432433                                        last_tag_start = p; 
     434                                        dropThisSpan = NO; 
    433435                                } 
    434436                                 
  • trunk/Subtitles/SubRenderer.h

    r743 r1027  
    1313 
    1414typedef enum {tag_b=0, tag_i, tag_u, tag_s, tag_bord, tag_shad, tag_be, tag_fn, tag_fs, tag_fscx, tag_fscy, tag_fsp, tag_frx, tag_fry, tag_frz, tag_1c, tag_2c, tag_3c, tag_4c,  
    15           tag_alpha, tag_1a, tag_2a, tag_3a, tag_4a, tag_r} SSATagType; 
     15          tag_alpha, tag_1a, tag_2a, tag_3a, tag_4a, tag_r, tag_p} SSATagType; 
    1616 
    1717#ifndef __OBJC_GC__ 
  • trunk/createStaticLibs.sh

    r1022 r1027  
    11#!/bin/sh -v 
    2 PATH=$PATH:/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin 
     2PATH=/usr/local/bin:/sw/bin:/opt/local/bin:/usr/bin:$PATH 
    33buildid_ffmpeg="r`svn info ffmpeg | grep -F Revision | awk '{print $2}'`" 
    44 
     
    7777fi 
    7878 
    79 if [ -e ffmpeg/patched ] ; then 
    80         (cd ffmpeg && svn revert -R . && rm patched) 
    81 fi 
    82  
    83 patch -p0 < Patches/ffmpeg-h264dsp-crash.diff 
    84 patch -p0 < Patches/ffmpeg-forceinline.diff 
    85 patch -p0 < Patches/ffmpeg-no-interlaced.diff 
    86 patch -p0 < Patches/ffmpeg-faltivec.diff 
    87 patch -p0 < Patches/ffmpeg-h264-nounrollcabac.diff 
    88 touch ffmpeg/patched 
    89  
    90 # if [ $no_pic -eq 0 ] ; then 
    91 # (cd ffmpeg; patch -p1 < ../Patches/ffmpeg-pic.diff) 
    92 # fi 
    93  
    94 touch patched 
    95  
    9679if [ "$buildid_ffmpeg" = "$oldbuildid_ffmpeg" ] ; then 
    9780    echo "Static ffmpeg libs are up-to-date ; not rebuilding" 
     
    9982    echo "Static ffmpeg libs are out-of-date ; rebuilding" 
    10083     
     84    if [ -e ffmpeg/patched ] ; then 
     85                cd ffmpeg && svn revert -R . && rm patched && cd .. 
     86        fi 
     87 
     88        patch -p0 < Patches/ffmpeg-forceinline.diff 
     89        patch -p0 < Patches/ffmpeg-no-interlaced.diff 
     90        patch -p0 < Patches/ffmpeg-faltivec.diff 
     91        patch -p0 < Patches/ffmpeg-h264-nounrollcabac.diff 
     92        touch ffmpeg/patched 
     93 
    10194    echo -n "Building " 
    10295    if [ $buildi386 -eq $buildppc ] ; then