コード例 #1
0
ファイル: yuv_to_rgb.cpp プロジェクト: project-cabal/cabal
void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
	// Sanity checks
	assert(dst && dst->getPixels());
	assert(dst->getFormat().bytesPerPixel == 2 || dst->getFormat().bytesPerPixel == 4);
	assert(ySrc && uSrc && vSrc);

	const YUVToRGBLookup *lookup = getLookup(dst->getFormat(), scale);

	// Use a templated function to avoid an if check on every pixel
	if (dst->getFormat().bytesPerPixel == 2)
		convertYUV444ToRGB<uint16>((byte *)dst->getPixels(), dst->getPitch(), lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
	else
		convertYUV444ToRGB<uint32>((byte *)dst->getPixels(), dst->getPitch(), lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch);
}
コード例 #2
0
ファイル: yuva_to_rgba.cpp プロジェクト: YakBizzarro/residual
void YUVAToRGBAManager::convert420(Graphics::Surface *dst, YUVAToRGBAManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, const byte *aSrc, int yWidth, int yHeight, int yPitch, int uvPitch) {
	// Sanity checks
	assert(dst && dst->pixels);
	assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4);
	assert(ySrc && uSrc && vSrc);
	assert((yWidth & 1) == 0);
	assert((yHeight & 1) == 0);

	const YUVAToRGBALookup *lookup = getLookup(dst->format, scale);

	// Use a templated function to avoid an if check on every pixel
	if (dst->format.bytesPerPixel == 2)
		convertYUVA420ToRGBA<uint16>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, aSrc, yWidth, yHeight, yPitch, uvPitch);
	else
		convertYUVA420ToRGBA<uint32>((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, aSrc, yWidth, yHeight, yPitch, uvPitch);
}
コード例 #3
0
ファイル: pamunlookup.c プロジェクト: gguillotte/netpbm-code
int
main(int argc, const char ** const argv) {

    struct CmdlineInfo cmdline;
    struct pam inpam;
    FILE * ifP;
    struct pam lookuppam;
    tuple ** lookup;

    tuplehash lookupHash;
    
    pm_proginit(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFileName);

    pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));

    getLookup(cmdline.lookupfile, &lookup, &lookuppam);

    if (inpam.depth != lookuppam.depth)
        pm_error("The lookup image has depth %u, but the input image "
                 "has depth %u.  They must be the same",
                 lookuppam.depth, inpam.depth);
    if (!streq(inpam.tuple_type, lookuppam.tuple_type))
        pm_error("The lookup image has tupel type '%s', "
                 "but the input image "
                 "has tuple type '%s'.  They must be the same",
                 lookuppam.tuple_type, inpam.tuple_type);

    makeReverseLookupHash(&lookuppam, lookup, &lookupHash);

    doUnlookup(&inpam, lookupHash, lookuppam.width-1, stdout);

    pm_close(ifP);

    pnm_destroytuplehash(lookupHash);
    pnm_freepamarray(lookup, &lookuppam);
    
    return 0;
}