X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=chroma_subsampler.h;h=8e9ff4e0116c0ad31b9d317e92fd6121eb4bfc1a;hb=fa54f2630c56a1df0046923d6a77b1bd58abf240;hp=811f901697fc1ae9374962195e924d1a2fceacfa;hpb=aad435ecc01e9e2fb3bc44274887213f9484cf10;p=nageru diff --git a/chroma_subsampler.h b/chroma_subsampler.h index 811f901..8e9ff4e 100644 --- a/chroma_subsampler.h +++ b/chroma_subsampler.h @@ -17,13 +17,24 @@ public: // Subsamples chroma (packed Cb and Cr) 2x2 to yield chroma suitable for // NV12 (semiplanar 4:2:0). Chroma positioning is left/center (H.264 convention). // width and height are the dimensions (in pixels) of the input texture. - void subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex); + // + // You can get two equal copies if you'd like; just set dst2_tex to a texture + // number and it will receive an exact copy of what goes into dst_tex. + void subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex, GLuint dst2_tex = 0); // Subsamples and interleaves luma and chroma to give 4:2:2 packed Y'CbCr (UYVY). // Chroma positioning is left (H.264 convention). // width and height are the dimensions (in pixels) of the input textures. void create_uyvy(GLuint y_tex, GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex); + // Subsamples and interleaves luma and chroma to give 10-bit 4:2:2 + // packed Y'CbCr (v210); see v210converter.h for more information on + // the format. Luma and chroma are assumed to be 10-bit data packed + // into 16-bit textures. Chroma positioning is left (H.264 convention). + // width and height are the dimensions (in pixels) of the input textures; + // Requires compute shaders; check v210Converter::has_hardware_support(). + void create_v210(GLuint y_tex, GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex); + private: movit::ResourcePool *resource_pool; @@ -31,11 +42,18 @@ private: GLuint cbcr_program_num; // Owned by . GLuint cbcr_texture_sampler_uniform; - GLuint cbcr_position_attribute_index, cbcr_texcoord_attribute_index; + GLint cbcr_position_attribute_index, cbcr_texcoord_attribute_index; + GLuint cbcr_chroma_offset_0_location, cbcr_chroma_offset_1_location; GLuint uyvy_program_num; // Owned by . GLuint uyvy_y_texture_sampler_uniform, uyvy_cbcr_texture_sampler_uniform; - GLuint uyvy_position_attribute_index, uyvy_texcoord_attribute_index; + GLint uyvy_position_attribute_index, uyvy_texcoord_attribute_index; + GLuint uyvy_luma_offset_0_location, uyvy_luma_offset_1_location; + GLuint uyvy_chroma_offset_0_location, uyvy_chroma_offset_1_location; + + GLuint v210_program_num; // Compute shader, so owned by ourselves. Can be 0. + GLuint v210_in_y_pos, v210_in_cbcr_pos, v210_outbuf_pos; + GLuint v210_inv_width_pos, v210_inv_height_pos; }; #endif // !defined(_CHROMA_SUBSAMPLER_H)