Closed LuoZijun closed 5 years ago
hmm, yeah, good idea, thanks! That might make the function slightly harder to call outside of the ffmpeg context, since you will have to create the pointer/linesize arrays, but that will probably be more readable like that, there are definitely too many arguments to these functions.
Oh, my mean is like that struct , alloc this struct data by ffmpeg or your self, that't not a problem.
// rgb24_yuv420_std(width, height, rgb, rgb_stride, y, u, v, y_stride, uv_stride, yuv_type);
int width = 1440;
int height=900;
uint8_t rgb_pixels = [[u8; width*height], 0x00, 0x00, 0x00];
uint8_t rgb_linesize = [width*3, 0x00, 0x00, 0x00];
uint8_t yuv_pixels = [ *[Y data], *[U data], *[V data] ];
uint8_t yuv_linesize = [width*3, 0x00, 0x00, 0x00];
rgb24_yuv420_std(width, height, rgb_pixels, rgb_linesize,
yuv_pixels[0], yuv_pixels[1], yuv_pixels[2],
yuv_linesize[0], yuv_linesize[1], YCBCR_601);
at last, this not an code problem, just one suggestion :)
for now:
can we make this function call (and other same function ) is easy ? just like
ffmpeg
AVFrame::linesize
struct, so maybe we can call this function like this: