Changeset 876

Show
Ignore:
Timestamp:
05/08/08 15:33:27 (7 months ago)
Author:
astrange
Message:

Add VP6A, and some associated fixes for it and ZMBV. Might not work until the decoder is fixed in ffmpeg, but closes #237.

Files:

Legend:

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

    r868 r876  
    341341#endif 
    342342 
     343void 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; 
     347         
     348        for (y = 0; y < height; y++) { 
     349                for (x = 0; x < width; x++) { 
     350                        o[x*4] = u[x/2]; 
     351                        o[x*4+1] = yc[x]; 
     352                        o[x*4+2] = v[x/2]; 
     353                        o[x*4+3] = a[x]; 
     354                } 
     355                 
     356                o += outRB; 
     357                yc += rY; 
     358                a += rA; 
     359                if (y & 1) { 
     360                        u += rU; 
     361                        v += rV; 
     362                } 
     363        } 
     364} 
     365 
    343366void BGR24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture) 
    344367{ 
  • trunk/ColorConversions.h

    r868 r876  
    2323extern void FastY420(UInt8 *baseAddr, AVFrame *picture); 
    2424extern void Y420toY422(UInt8* baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame * picture); 
     25extern void YA420toV408(UInt8* o, unsigned outRB, unsigned width, unsigned height, AVFrame * picture); 
    2526extern void RGB32toRGB32(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture); 
    2627extern void RGB24toRGB24(UInt8 *baseAddr, unsigned rowBytes, unsigned width, unsigned height, AVFrame *picture); 
  • trunk/FFusionCodec.c

    r869 r876  
    676676                                codecID = CODEC_ID_ZMBV; 
    677677                                break; 
    678  
     678                                 
     679                        case 'VP6A': 
     680                                codecID = CODEC_ID_VP6A; 
     681                                break; 
    679682                                 
    680683            default: 
     
    830833                case PIX_FMT_RGB24: 
    831834                        pos[index++] = k24RGBPixelFormat; 
     835                        break; 
     836                case PIX_FMT_YUVA420P: 
     837                        pos[index++] = k4444YpCbCrA8PixelFormat; 
    832838                        break; 
    833839                case PIX_FMT_YUV420P: 
     
    13161322                Y422toY422((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    13171323        } 
     1324        else if (myDrp->pixelFormat == k4444YpCbCrA8PixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUVA420P) 
     1325        { 
     1326                YA420toV408((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
     1327        } 
    13181328        else 
    13191329        { 
     
    15921602                                break; 
    15931603                                 
     1604                        case 'VP6A': 
     1605                                err = GetComponentResource((Component)glob->self, codecInfoResourceType, kVP6ACodecInfoResID, (Handle *)&tempCodecInfo); 
     1606                                break; 
    15941607                                 
    15951608            default:    // should never happen but we have to handle the case 
     
    16791692            got_picture = 0; 
    16801693            len = 1; 
    1681                         Codecprintf(NULL, "Error while decoding frame\n"); 
     1694                        Codecprintf(glob->fileLog, "Error while decoding frame\n"); 
    16821695             
    16831696            return noErr; 
  • trunk/FFusionCodec.h

    r869 r876  
    5353#define kTSCCCodecInfoResID                     305 
    5454#define kZMBVCodecInfoResID                     307 
     55#define kVP6ACodecInfoResID                     309 
    5556 
    5657#define kFFusionCodecManufacturer       'Peri' 
  • trunk/FFusionCodec.r

    r869 r876  
    5555#define kFLV1Name               "Sorenson H.263" 
    5656#define kFlashSVName    "Flash Screen Video" 
    57 #define kVP6Name                "TrueMotion VP6" 
     57#define kVP6Name                "On2 VP6" 
     58#define kVP6AName               "On2 VP6+Alpha" 
    5859#define kI263Name               "Intel H.263" 
    5960#define kVP3Name                "On2 VP3" 
     
    9192#define kTSCCNameResID          305 
    9293#define kZMBVNameResID          307 
     94#define kVP6ANameResID          309 
    9395 
    9496// Codec infos Resource ID 
     
    116118#define kTSCCInfoResID          306 
    117119#define kZMBVInfoResID          308 
     120#define kVP6AInfoResID          310 
    118121 
    119122// These flags specify information about the capabilities of the component 
     
    679682}; 
    680683 
     684//--------------------------------------------------------------------------- 
     685// ZMBV Description Resources 
     686//--------------------------------------------------------------------------- 
     687 
     688resource 'cdci' (kVP6ACodecInfoResID) { 
     689        kVP6AName,                              // Type 
     690        1,                                      // Version 
     691        1,                                      // Revision level 
     692        kFFusionCodecManufacturer,                      // Manufacturer 
     693        kFFusionDecompressionFlags,             // Decompression Flags 
     694        0,                                      // Compression Flags 
     695        kFFusionFormatFlags,                    // Format Flags 
     696        128,                                    // Compression Accuracy 
     697        128,                                    // Decomression Accuracy 
     698        200,                                    // Compression Speed 
     699        200,                                    // Decompression Speed 
     700        128,                                    // Compression Level 
     701        0,                                      // Reserved 
     702        1,                                      // Minimum Height 
     703        1,                                      // Minimum Width 
     704        0,                                      // Decompression Pipeline Latency 
     705        0,                                      // Compression Pipeline Latency 
     706        0                                       // Private Data 
     707}; 
    681708 
    682709//--------------------------------------------------------------------------- 
     
    31913218// ZMBV Components 
    31923219//--------------------------------------------------------------------------- 
     3220resource 'thng' (338) { 
     3221        decompressorComponentType,              // Type 
     3222        'VP6A',                                 // SubType 
     3223        kFFusionCodecManufacturer,                      // Manufacturer 
     3224        0,                                      // - use componentHasMultiplePlatforms 
     3225        0, 
     3226        0, 
     3227        0, 
     3228        'STR ',                                 // Name Type 
     3229        kVP6ANameResID,                        // Name ID 
     3230        'STR ',                                 // Info Type 
     3231        kVP6AInfoResID,                        // Info ID 
     3232        0,                                      // Icon Type 
     3233        0,                                      // Icon ID 
     3234        kFFusionCodecVersion,                   // Version 
     3235        componentHasMultiplePlatforms +         // Registration Flags  
     3236        componentDoAutoVersion,                 // Registration Flags 
     3237        0,                                      // Resource ID of Icon Family 
     3238        { 
     3239                kFFusionDecompressionFlags,  
     3240                'dlle',                         // Entry point found by symbol name 'dlle' resource 
     3241                256,                            // ID of 'dlle' resource 
     3242                platformPowerPCNativeEntryPoint, 
     3243                kFFusionDecompressionFlags, 
     3244                'dlle', 
     3245                256, 
     3246                platformIA32NativeEntryPoint, 
     3247        }; 
     3248}; 
     3249 
     3250//--------------------------------------------------------------------------- 
     3251// ZMBV Components 
     3252//--------------------------------------------------------------------------- 
    31933253resource 'thng' (337) { 
    31943254        decompressorComponentType,              // Type 
     
    32213281}; 
    32223282 
    3223  
    32243283//--------------------------------------------------------------------------- 
    32253284// Component Name Resources 
     
    33143373}; 
    33153374 
     3375resource 'STR ' (kVP6ANameResID) { 
     3376        "On2 VP6A (Perian)" 
     3377}; 
     3378 
    33163379//--------------------------------------------------------------------------- 
    33173380// Component Name Resources 
     
    33633426 
    33643427resource 'STR ' (kVP6InfoResID) { 
    3365         "Decompresses video stored in TrueMotion VP6 format." 
     3428        "Decompresses video stored in On2 VP6 format." 
    33663429}; 
    33673430 
     
    34063469}; 
    34073470 
     3471resource 'STR ' (kVP6AInfoResID) { 
     3472        "Decompresses video stored in On2 VP6A format." 
     3473}; 
     3474 
    34083475//--------------------------------------------------------------------------- 
    34093476// Code Entry Point for Mach-O 
  • trunk/ff_MovieImport.c

    r832 r876  
    121121                REGISTER_DECODER(dvdsub); 
    122122                REGISTER_DECODER(tscc); 
     123                REGISTER_DECODER(vp6a); 
     124                REGISTER_DECODER(zmbv); 
    123125                 
    124126                av_log_set_callback(FFMpegCodecprintf); 
  • trunk/ff_private.c

    r857 r876  
    122122        av_reduce(&base->num, &base->den, base->num, base->den, INT_MAX); 
    123123         
     124        if (base->num == 1) return; // XXX is this good enough? 
     125         
    124126        double fTimebase = av_q2d(*base), nearest_ntsc = floor(fTimebase * 1001. + .5) / 1001.; 
    125127        const double small_interval = 1./120.; 
     
    185187        // 12 is invalid in mov 
    186188        // XXX it might be better to set this based entirely on pix_fmt 
    187         if ((*imgHdl)->depth == 12) (*imgHdl)->depth = 24; 
     189        if ((*imgHdl)->depth == 12 || (*imgHdl)->depth == 0) (*imgHdl)->depth = codec->pix_fmt == PIX_FMT_YUVA420P ? 32 : 24; 
    188190         
    189191        /* Create the strf image description extension (see AVI's BITMAPINFOHEADER) */ 
     
    326328                case CODEC_ID_FLASHSV: 
    327329                        return 'FSV1'; 
     330                case CODEC_ID_VP6A: 
     331                        return 'VP6A'; 
    328332        } 
    329333        return 0;