当前位置: 首页>>代码示例>>C++>>正文


C++ LibRaw::adjust_sizes_info_only方法代码示例

本文整理汇总了C++中LibRaw::adjust_sizes_info_only方法的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw::adjust_sizes_info_only方法的具体用法?C++ LibRaw::adjust_sizes_info_only怎么用?C++ LibRaw::adjust_sizes_info_only使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibRaw的用法示例。


在下文中一共展示了LibRaw::adjust_sizes_info_only方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rawFileIdentify

bool KDcraw::rawFileIdentify(DcrawInfoContainer& identify, const QString& path)
{
    QFileInfo fileInfo(path);
    QString   rawFilesExt(rawFiles());
    QString ext          = fileInfo.suffix().toUpper();
    identify.isDecodable = false;

    if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
        return false;

    LibRaw raw;

    int ret = raw.open_file((const char*)(QFile::encodeName(path)).constData());

    if (ret != LIBRAW_SUCCESS)
    {
        qCDebug(LIBKDCRAW_LOG) << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
        raw.recycle();
        return false;
    }

    ret = raw.adjust_sizes_info_only();

    if (ret != LIBRAW_SUCCESS)
    {
        qCDebug(LIBKDCRAW_LOG) << "LibRaw: failed to run adjust_sizes_info_only: " << libraw_strerror(ret);
        raw.recycle();
        return false;
    }

    Private::fillIndentifyInfo(&raw, identify);
    raw.recycle();
    return true;
}
开发者ID:ChrisJong,项目名称:krita,代码行数:34,代码来源:kdcraw.cpp

示例2: getRegionOfDefinition

bool RawReaderPlugin::getRegionOfDefinition(const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod)
{
    updateInfos(args.time);

    RawReaderProcessParams<Scalar> params = getProcessParams(args.time);

    LibRaw rawProcessor;
    libraw_image_sizes_t& sizes = rawProcessor.imgdata.sizes;
    // libraw_output_params_t& out = rawProcessor.imgdata.params;
    //	out.half_size  = 1;

    if(rawProcessor.open_file(params._filepath.c_str()))
    {
        BOOST_THROW_EXCEPTION(exception::FileNotExist() << exception::user("RAW: Unable to open file")
                              << exception::filename(params._filepath));
    }
    if(rawProcessor.adjust_sizes_info_only())
    {
        BOOST_THROW_EXCEPTION(exception::File() << exception::user("RAW: Cannot decode infos")
                              << exception::filename(params._filepath));
    }

    //	point2<ptrdiff_t> dims( sizes.raw_width, sizes.raw_height );
    point2<ptrdiff_t> dims(sizes.width, sizes.height);
    // TUTTLE_LOG_VAR( TUTTLE_INFO, dims );
    rod.x1 = 0;
    rod.x2 = dims.x * this->_clipDst->getPixelAspectRatio();
    rod.y1 = 0;
    rod.y2 = dims.y;
    return true;
}
开发者ID:tuttleofx,项目名称:TuttleOFX,代码行数:31,代码来源:RawReaderPlugin.cpp

示例3: libraw_adjust_sizes_info_only

 // DCRAW
 int  libraw_adjust_sizes_info_only(libraw_data_t* lr)
 {
     if(!lr) return EINVAL;
     LibRaw *ip = (LibRaw*) lr->parent_class;
     return ip->adjust_sizes_info_only();
 }
开发者ID:2php,项目名称:ogre-android,代码行数:7,代码来源:libraw_c_api.cpp

示例4: if

bool
RawInput::open (const std::string &name, ImageSpec &newspec,
                const ImageSpec &config)
{
    int ret;

    // open the image
    if ( (ret = m_processor.open_file(name.c_str()) ) != LIBRAW_SUCCESS) {
        error ("Could not open file \"%s\", %s", name.c_str(), libraw_strerror(ret));
        return false;
    }

    if ( (ret = m_processor.unpack() ) != LIBRAW_SUCCESS) {
        error ("Could not unpack \"%s\", %s",name.c_str(), libraw_strerror(ret));
        return false;
    }

    // Forcing the Libraw to adjust sizes based on the capture device orientation
    m_processor.adjust_sizes_info_only();

    // Set file information
    m_spec = ImageSpec(m_processor.imgdata.sizes.iwidth,
                       m_processor.imgdata.sizes.iheight,
                       3, // LibRaw should only give us 3 channels
                       TypeDesc::UINT16);

    // Output 16 bit images
    m_processor.imgdata.params.output_bps = 16;

    // Set the gamma curve to Linear
    m_spec.attribute("oiio:ColorSpace","Linear");
    m_processor.imgdata.params.gamm[0] = 1.0;
    m_processor.imgdata.params.gamm[1] = 1.0;

    // Check to see if the user has explicitly set the output colorspace primaries
    std::string cs = config.get_string_attribute ("raw:ColorSpace", "sRGB");
    if (cs.size()) {
        static const char *colorspaces[] = { "raw",
                                             "sRGB",
                                             "Adobe",
                                             "Wide",
                                             "ProPhoto",
                                             "XYZ", NULL
                                           };

        size_t c;
        for (c=0; c < sizeof(colorspaces) / sizeof(colorspaces[0]); c++)
            if (cs == colorspaces[c])
                break;
        if (cs == colorspaces[c])
            m_processor.imgdata.params.output_color = c;
        else {
            error("raw:ColorSpace set to unknown value");
            return false;
        }
        // Set the attribute in the output spec
        m_spec.attribute("raw:ColorSpace", cs);
    } else {
        // By default we use sRGB primaries for simplicity
        m_processor.imgdata.params.output_color = 1;
        m_spec.attribute("raw:ColorSpace", "sRGB");
    }

    // Exposure adjustment
    float exposure = config.get_float_attribute ("raw:Exposure", -1.0f);
    if (exposure >= 0.0f) {
        if (exposure < 0.25f || exposure > 8.0f) {
            error("raw:Exposure invalid value. range 0.25f - 8.0f");
            return false;
        }
        m_processor.imgdata.params.exp_correc = 1; // enable exposure correction
        m_processor.imgdata.params.exp_shift = exposure; // set exposure correction
        // Set the attribute in the output spec
        m_spec.attribute ("raw:Exposure", exposure);
    }

    // Interpolation quality
    // note: LibRaw must be compiled with demosaic pack GPL2 to use
    // demosaic algorithms 5-9. It must be compiled with demosaic pack GPL3 for
    // algorithm 10. If either of these packs are not includeded, it will silently use option 3 - AHD
    std::string demosaic = config.get_string_attribute ("raw:Demosaic");
    if (demosaic.size()) {
        static const char *demosaic_algs[] = { "linear",
                                               "VNG",
                                               "PPG",
                                               "AHD",
                                               "DCB",
                                               "Modified AHD",
                                               "AFD",
                                               "VCD",
                                               "Mixed",
                                               "LMMSE",
                                               "AMaZE",
                                               // Future demosaicing algorithms should go here
                                               NULL
                                             };
        size_t d;
        for (d=0; d < sizeof(demosaic_algs) / sizeof(demosaic_algs[0]); d++)
            if (demosaic == demosaic_algs[d])
                break;
//.........这里部分代码省略.........
开发者ID:HughMacdonald,项目名称:gafferDependencies,代码行数:101,代码来源:rawinput.cpp

示例5: main


//.........这里部分代码省略.........
                case 'a': 
                    OUT.use_auto_wb = 1;  
                    break;
                case 'H':
                    OUT.highlight   = atoi(argv[arg++]);  
                    break;
                case 'q':
                    OUT.user_qual   = atoi(argv[arg++]);  
                    break;
                case 'h':  
                    OUT.half_size = 1;		
                    OUT.four_color_rgb    = 1;  
                    shrink = 1;
                    break;
                case 'm':
                    OUT.med_passes  = atoi(argv[arg++]);  
                    break;
                case 'n':  
                    OUT.threshold   = (float)atof(argv[arg++]);  
                    break;
                case 's':  
                    OUT.shot_select = abs(atoi(argv[arg++])); 
                    break;
                case 'B':  
                  for(c=0; c<4;c++) OUT.cropbox[c]  = atoi(argv[arg++]); 
                  break;
                case 'R':  
                    rep = abs(atoi(argv[arg++])); 
                    if(rep<1) rep = 1;
                    break;
				case 'c':
					OUT.use_rawspeed = 0;
					break;
                default:
                    fprintf (stderr,"Unknown option \"-%c\".\n", opt);
                    return 1;
                }
        }
    for ( ; arg < argc; arg++)
        {
            printf("Processing file %s\n",argv[arg]);
			timerstart();
			if( (ret = RawProcessor.open_file(argv[arg])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open_file %s: %s\n",argv[arg],libraw_strerror(ret));
                    continue; // no recycle b/c open file will recycle itself
                }
            
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",argv[arg],libraw_strerror(ret));
                    continue;
                }
			float qsec = timerend();
			printf("\n%.1f msec for unpack\n",qsec);
            float mpix,rmpix;
            timerstart();
            for(c=0; c < rep; c++)
                {
                    if( (ret = RawProcessor.dcraw_process() ) != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot postprocess %s: %s\n",argv[arg],libraw_strerror(ret));
                            break;
                        }
                    libraw_processed_image_t *p = RawProcessor.dcraw_make_mem_image();
                    if(p)
                        RawProcessor.dcraw_clear_mem(p);
                    RawProcessor.free_image();
                }
            float msec = timerend()/(float)rep;

            if( (ret = RawProcessor.adjust_sizes_info_only() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot adjust sizes for %s: %s\n",argv[arg],libraw_strerror(ret));
                    break;
                }
            rmpix = (S.iwidth*S.iheight)/1000000.0f;

            if(c==rep) // no failure
                {
                    unsigned int crop[4];
                    for(int i=0;i<4;i++) crop[i] = (OUT.cropbox[i])>>shrink;
                    if(crop[0]+crop[2]>S.iwidth) crop[2] = S.iwidth-crop[0];
                    if(crop[1]+crop[3]>S.iheight) crop[3] = S.iheight-crop[1];

                    mpix = float(crop[2]*crop[3])/1000000.0f;
                    float mpixsec = mpix*1000.0f/msec;

                    printf(
                        "Performance: %.2f Mpix/sec\n"
                        "File: %s, Frame: %d %.1f total Mpix, %.1f msec\n"
                        "Params:      WB=%s Highlight=%d Qual=%d HalfSize=%s Median=%d Wavelet=%.0f\n"
                        "Crop:        %u-%u:%ux%u, active Mpix: %.2f, %.1f frames/sec\n",
                        mpixsec
                        ,argv[arg],OUT.shot_select,rmpix,msec,
                        OUT.use_auto_wb?"auto":"default",OUT.highlight,OUT.user_qual,OUT.half_size?"YES":"No",
                        OUT.med_passes,OUT.threshold,
                        crop[0],crop[1],crop[2],crop[3],mpix,1000.0f/msec);
                }
        }
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的LibRaw::adjust_sizes_info_only方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。