X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ycbcr_input.cpp;h=8d58c7de8ab10c6d09adf68fa0bc8ef467f8be51;hb=0bd42ece563848c10733dba085ea3672f92d2558;hp=a73518d4ad2797f274f2dad2cac6ebf6a281a0ff;hpb=fdfef2b631a081892b65c4411f17d2b7c57f3ee4;p=movit diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index a73518d..8d58c7d 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -17,6 +17,9 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, width(width), height(height) { + pbos[0] = pbos[1] = pbos[2] = 0; + texture_num[0] = texture_num[1] = texture_num[2] = 0; + pitch[0] = pitch[1] = pitch[2] = width; assert(width % ycbcr_format.chroma_subsampling_x == 0); @@ -32,8 +35,23 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, register_int("needs_mipmaps", &needs_mipmaps); } +YCbCrInput::~YCbCrInput() +{ + if (pbos[0] != 0) { + glDeleteBuffers(3, pbos); + check_error(); + } + if (texture_num[0] != 0) { + glDeleteTextures(3, texture_num); + check_error(); + } +} + void YCbCrInput::finalize() { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + check_error(); + // Create PBOs to hold the textures holding the input image, and then the texture itself. glGenBuffers(3, pbos); check_error();