this routine gets a buffer for an uncompressed picture with pixel format pix_fmt and dimensions width x height.
| 837 | // this routine gets a buffer for an uncompressed picture |
| 838 | // with pixel format pix_fmt and dimensions width x height. |
| 839 | hb_buffer_t * hb_frame_buffer_init( int pix_fmt, int width, int height ) |
| 840 | { |
| 841 | const AVPixFmtDescriptor * desc = av_pix_fmt_desc_get(pix_fmt); |
| 842 | hb_buffer_t * buf; |
| 843 | uint8_t has_plane[4] = {0,}; |
| 844 | int ii, pp, max_plane = 0; |
| 845 | |
| 846 | if (desc == NULL) |
| 847 | { |
| 848 | return NULL; |
| 849 | } |
| 850 | |
| 851 | int size = 0; |
| 852 | for (ii = 0; ii < desc->nb_components; ii++) |
| 853 | { |
| 854 | pp = desc->comp[ii].plane; |
| 855 | if (pp > max_plane) |
| 856 | { |
| 857 | max_plane = pp; |
| 858 | } |
| 859 | if (!has_plane[pp]) |
| 860 | { |
| 861 | has_plane[pp] = 1; |
| 862 | size += hb_image_stride( pix_fmt, width, pp ) * |
| 863 | hb_image_height( pix_fmt, height, pp ); |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | buf = hb_buffer_init_internal(size); |
| 868 | |
| 869 | if( buf == NULL ) |
| 870 | return NULL; |
| 871 | |
| 872 | buf->f.max_plane = max_plane; |
| 873 | buf->s.type = FRAME_BUF; |
| 874 | buf->f.width = width; |
| 875 | buf->f.height = height; |
| 876 | buf->f.fmt = pix_fmt; |
| 877 | |
| 878 | hb_buffer_init_planes(buf); |
| 879 | |
| 880 | return buf; |
| 881 | } |
| 882 | |
| 883 | void hb_frame_buffer_blank_stride(hb_buffer_t * buf) |
| 884 | { |
no test coverage detected