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

Michael Niedermayer michaelni
Mon Nov 21 13:35:09 CET 2005


Hi

On Mon, Nov 21, 2005 at 02:31:40AM +0200, Ivo wrote:
> 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).

hmm, this looks a little messy
type should be an enum
x,y,width,height could _maybe_ be changed to int [4] but maybe its a bad idea
and the got_slice_ptr & got_picture_ptr could be unified together with some
error/status flag/info, as lavc will try to output something for damaged parts
too and so wont return -1

all the stuff could also be put in a DecodedSlice structure, so that
int avcodec_decode_slice(AVCodecContext *avctx,
                          uint8_t *buf, int bufsize,
                          DecodedSlice *ret);

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list