MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / expand_buf

Function expand_buf

libhb/encx264.c:815–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

813}
814
815static hb_buffer_t * expand_buf(int bit_depth, hb_buffer_t *in, int input_pix_fmt)
816{
817 hb_buffer_t *buf;
818 const int shift = bit_depth - 8;
819 int output_pix_fmt;
820
821 switch (input_pix_fmt)
822 {
823 case AV_PIX_FMT_YUV420P:
824 output_pix_fmt = AV_PIX_FMT_YUV420P16;
825 break;
826 case AV_PIX_FMT_YUV422P:
827 output_pix_fmt = AV_PIX_FMT_YUV422P16;
828 break;
829 case AV_PIX_FMT_YUV444P:
830 default:
831 output_pix_fmt = AV_PIX_FMT_YUV444P16;
832 break;
833 }
834
835 buf = hb_frame_buffer_init(output_pix_fmt, in->f.width, in->f.height);
836 for (int pp = 0; pp < 3; pp++)
837 {
838 uint8_t *src = in->plane[pp].data;
839 uint16_t *dst = (uint16_t*)buf->plane[pp].data;
840 for (int yy = 0; yy < in->plane[pp].height; yy++)
841 {
842 for (int xx = 0; xx < in->plane[pp].width; xx++)
843 {
844 dst[xx] = (uint16_t)src[xx] << shift;
845 }
846 src += in->plane[pp].stride;
847 dst += buf->plane[pp].stride / 2;
848 }
849 }
850 return buf;
851}
852
853static hb_buffer_t *x264_encode( hb_work_object_t *w, hb_buffer_t *in )
854{

Callers 1

x264_encodeFunction · 0.85

Calls 1

hb_frame_buffer_initFunction · 0.85

Tested by

no test coverage detected