[FFmpeg-devel] [PATCH]Fix 1bit bmp decoding

Michael Niedermayer michaelni at gmx.at
Thu Nov 10 20:12:42 CET 2011


On Thu, Nov 10, 2011 at 06:10:04PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached fixes ticket #632 for me, it does not break the output of
> ffmpeg -i tests/lena.pnm -pix_fmt monob out.bmp
> but I don't know if 1-bit bmp without palette exists / how it can be created.
> 
> Please comment, Carl Eugen

>  bmp.c |   22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> a86b7387b0e8439d7177dafba9004482cf1b7431  patch1bitbmp.diff
> diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
> index 0b38724..22973aa 100644
> --- a/libavcodec/bmp.c
> +++ b/libavcodec/bmp.c
> @@ -171,17 +171,15 @@ static int bmp_decode_frame(AVCodecContext *avctx,
>          else
>              avctx->pix_fmt = PIX_FMT_GRAY8;
>          break;
> +    case 1:
>      case 4:
>          if(hsize - ihsize - 14 > 0){
>              avctx->pix_fmt = PIX_FMT_PAL8;
>          }else{
> -            av_log(avctx, AV_LOG_ERROR, "Unknown palette for 16-colour BMP\n");
> +            av_log(avctx, AV_LOG_ERROR, "Unknown palette for %d-colour BMP\n", 1<<depth);
>              return -1;
>          }
>          break;
> -    case 1:
> -        avctx->pix_fmt = PIX_FMT_MONOBLACK;

can the palette be analyzed and MONOWHITE / BLACK be used ?
if so, it would be simpler

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111110/425bac10/attachment.asc>


More information about the ffmpeg-devel mailing list