[Ffmpeg-devel] one slice at the time rendering w/o callback

Ivo ivop
Mon Nov 21 01:31:40 CET 2005

On Saturday 19 November 2005 16:53, Michael Niedermayer wrote:
> On Sat, Nov 19, 2005 at 02:00:56AM +0200, Ivo wrote:
> > The new avcodec_decode_slice will call the pre-function, decode one
> > slice and only call the post-function if all slices are done. Its API
> > will be similar to decode_video, but with an extra argument called
> > got_slice (like got_picture). got_slice will be set if a slice was
> > succesfully decoded and got_picture will only be set if all slices are
> > decoded. The caller can check that to see if all slices are done. At
> > the last call for a particular frame, it will return the bytes consumed
> > like decode_video does.
> one problem is one of terminology, there are 2 things which are
> called slices
> 1. a "chunk" of the bitstream which when decoded could cover anything
> from a single 16x16 macroblock to the whole frame in raster scan order
> normaly (h264 allows arbitrary order, and field pictures in mpeg2/h264
> would be made of slices which contain only even or odd lines) but then
> again these rare cases can be dealt with by simply decoding all slices
> and pretending that the image is made of a single slice, still i wanted
> to mention them ...
> 2. a rectangle of pixels from the left to the right border of a picture

How about a function that can cover both? I was thinking of:

int avcodec_decode_slice(AVCodecContext *avctx,
                         uint8_t *buf, int bufsize,
                         int *got_slice_ptr,
                         int *got_picture_ptr,
                         const AVFrame **src, int *offset[4],
                         int *x, int *y,
                         int *width, int *height,
                         int *type);

being some sort of a hybrid between avcodec_decode_video and the 
draw_horiz_band callback, plus extra functionality to support slices of 
arbitrary width and height. For h263 the caller just gets horizontal bands 
and for h264/mpeg2 the caller might receive single macroblocks. And *type 
is the same as type in draw_horiz_callback (top, bottom, frame).


More information about the ffmpeg-devel mailing list