On Wed, Feb 15, 2012 at 10:29:13AM -0500, Justin Ruggles wrote:
> On 02/15/2012 05:12 AM, Kostya Shishkov wrote:
> 
> > On Wed, Feb 15, 2012 at 02:06:01AM -0800, Mashiat Sarker Shakkhar wrote:
> >> ----- Original Message -----
> >>
> >>> From: Aneesh Dogra <[email protected]>
> >>> To: [email protected]
> >>> Cc: 
> >>> Sent: Wednesday, February 15, 2012 2:54 AM
> >>> Subject: [libav-devel] [PATCH] Sun Rasterfile Encoder
> >>>
> >>> ---
> >>> Changelog               |    1 +
> >>> libavcodec/Makefile     |    1 +
> >>> libavcodec/allcodecs.c  |    2 +-
> >>> libavcodec/sunrastenc.c |  246 
> >>> +++++++++++++++++++++++++++++++++++++++++++++++
> >>> libavformat/img2.c      |    3 +-
> >>> 5 files changed, 251 insertions(+), 2 deletions(-)
> >> [...]
> >>> +    switch (avctx->pix_fmt) {
> >>> +        case PIX_FMT_MONOWHITE:                  // Monochrome
> >>> +            s->depth  = 1;
> >>> +            s->length = ((avctx->width + 7) >> 3) * avctx->height +
> >>> +                        (((avctx->width / 8) + (avctx->width % 8 ? 1 : 
> >>> 0)) % 2 ?
> >>> +                         avctx->height : 0);
> >>
> >>
> >> Nit: I propose
> >> s->length = ((width + 7 >> 3) + 1 >> 1) * height * 2;
> > 
> > nit: which can be simplified to ((width + 15) >> 4) * height;
> 
> 
> But that's not quite right as far as the actual size. I think this is
> though:
> 
> (FFALIGN(width, 16) >> 3) * height
> 
> Even the comments in the decoder say "width is aligned to 16 bits".

Actually I was able to figure out that much from encoder source and even
posted it on IRC (except that it was height * (FFALIGN(width * bpp, 16) >> 3))
to cover all depths).
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to