(void) autoRelease;
throw_no_ogl();
#else
- impl_ = new Impl(abufId, autoRelease);
+ impl_.reset(new Impl(abufId, autoRelease));
rows_ = arows;
cols_ = acols;
type_ = atype;
(void) autoRelease;
throw_no_ogl();
#else
- impl_ = new Impl(abufId, autoRelease);
+ impl_.reset(new Impl(abufId, autoRelease));
rows_ = asize.height;
cols_ = asize.width;
type_ = atype;
Mat mat = arr.getMat();
CV_Assert( mat.isContinuous() );
const GLsizeiptr asize = mat.rows * mat.cols * mat.elemSize();
- impl_ = new Impl(asize, mat.data, target, autoRelease);
+ impl_.reset(new Impl(asize, mat.data, target, autoRelease));
rows_ = mat.rows;
cols_ = mat.cols;
type_ = mat.type();
if (rows_ != arows || cols_ != acols || type_ != atype)
{
const GLsizeiptr asize = arows * acols * CV_ELEM_SIZE(atype);
- impl_ = new Impl(asize, 0, target, autoRelease);
+ impl_.reset(new Impl(asize, 0, target, autoRelease));
rows_ = arows;
cols_ = acols;
type_ = atype;
void cv::ogl::Buffer::release()
{
#ifdef HAVE_OPENGL
- if (*impl_.refcount == 1)
- impl_->setAutoRelease(true);
impl_ = Impl::empty();
rows_ = 0;
cols_ = 0;
(void) autoRelease;
throw_no_ogl();
#else
- impl_ = new Impl(atexId, autoRelease);
+ impl_.reset(new Impl(atexId, autoRelease));
rows_ = arows;
cols_ = acols;
format_ = aformat;
(void) autoRelease;
throw_no_ogl();
#else
- impl_ = new Impl(atexId, autoRelease);
+ impl_.reset(new Impl(atexId, autoRelease));
rows_ = asize.height;
cols_ = asize.width;
format_ = aformat;
{
ogl::Buffer buf = arr.getOGlBuffer();
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
- impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease);
+ impl_.reset(new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease));
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
break;
}
GpuMat dmat = arr.getGpuMat();
ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER);
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
- impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease);
+ impl_.reset(new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease));
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
#endif
Mat mat = arr.getMat();
CV_Assert( mat.isContinuous() );
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
- impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], mat.data, autoRelease);
+ impl_.reset(new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], mat.data, autoRelease));
break;
}
}
if (rows_ != arows || cols_ != acols || format_ != aformat)
{
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
- impl_ = new Impl(aformat, acols, arows, aformat, gl::FLOAT, 0, autoRelease);
+ impl_.reset(new Impl(aformat, acols, arows, aformat, gl::FLOAT, 0, autoRelease));
rows_ = arows;
cols_ = acols;
format_ = aformat;
void cv::ogl::Texture2D::release()
{
#ifdef HAVE_OPENGL
- if (*impl_.refcount == 1)
- impl_->setAutoRelease(true);
impl_ = Impl::empty();
rows_ = 0;
cols_ = 0;
cuSafeCall( cuCtxGetCurrent(&ctx) );
cuSafeCall( cuvidCtxLockCreate(&lock_, ctx) );
- frameQueue_ = new detail::FrameQueue;
- videoDecoder_ = new detail::VideoDecoder(videoSource_->format(), lock_);
- videoParser_ = new detail::VideoParser(videoDecoder_, frameQueue_);
+ frameQueue_.reset(new FrameQueue);
+ videoDecoder_.reset(new VideoDecoder(videoSource_->format(), lock_));
+ videoParser_.reset(new VideoParser(videoDecoder_, frameQueue_));
videoSource_->setVideoParser(videoParser_);
videoSource_->start();
try
{
- videoSource = new detail::CuvidVideoSource(filename);
+ videoSource.reset(new CuvidVideoSource(filename));
}
catch (...)
{
Ptr<RawVideoSource> source(new detail::FFmpegVideoSource(filename));
- videoSource = new detail::RawVideoSourceWrapper(source);
+ videoSource.reset(new RawVideoSourceWrapper(source));
}
- return new VideoReaderImpl(videoSource);
+ return makePtr<VideoReaderImpl>(videoSource);
}
Ptr<VideoReader> cv::gpucodec::createVideoReader(const Ptr<RawVideoSource>& source)
{
Ptr<detail::VideoSource> videoSource(new detail::RawVideoSourceWrapper(source));
- return new VideoReaderImpl(videoSource);
+ return makePtr<VideoReaderImpl>(videoSource);
}
#endif // HAVE_NVCUVID
Ptr<VideoWriter> cv::gpucodec::createVideoWriter(const Ptr<EncoderCallBack>& encoderCallback, Size frameSize, double fps, SurfaceFormat format)
{
- return new VideoWriterImpl(encoderCallback, frameSize, fps, format);
+ return makePtr<VideoWriterImpl>(encoderCallback, frameSize, fps, format);
}
Ptr<VideoWriter> cv::gpucodec::createVideoWriter(const Ptr<EncoderCallBack>& encoderCallback, Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{
- return new VideoWriterImpl(encoderCallback, frameSize, fps, params, format);
+ return makePtr<VideoWriterImpl>(encoderCallback, frameSize, fps, params, format);
}
#endif // !defined HAVE_CUDA || !defined WIN32