Mercurial > libavcodec.hg
comparison mjpeg.c @ 2453:f67b63ed036d libavcodec
avoid buf_size == 0 checks in every decoder
author | michael |
---|---|
date | Sun, 23 Jan 2005 18:09:06 +0000 |
parents | ba01b8552bd4 |
children | e25782262d7d |
comparison
equal
deleted
inserted
replaced
2452:73a66a4a6ab4 | 2453:f67b63ed036d |
---|---|
1823 { | 1823 { |
1824 MJpegDecodeContext *s = avctx->priv_data; | 1824 MJpegDecodeContext *s = avctx->priv_data; |
1825 uint8_t *buf_end, *buf_ptr; | 1825 uint8_t *buf_end, *buf_ptr; |
1826 int start_code; | 1826 int start_code; |
1827 AVFrame *picture = data; | 1827 AVFrame *picture = data; |
1828 | |
1829 /* no supplementary picture */ | |
1830 if (buf_size == 0) | |
1831 return 0; | |
1832 | 1828 |
1833 buf_ptr = buf; | 1829 buf_ptr = buf; |
1834 buf_end = buf + buf_size; | 1830 buf_end = buf + buf_size; |
1835 while (buf_ptr < buf_end) { | 1831 while (buf_ptr < buf_end) { |
1836 /* find start next marker */ | 1832 /* find start next marker */ |
2000 AVFrame *picture = data; | 1996 AVFrame *picture = data; |
2001 GetBitContext hgb; /* for the header */ | 1997 GetBitContext hgb; /* for the header */ |
2002 uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs; | 1998 uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs; |
2003 uint32_t field_size, sod_offs; | 1999 uint32_t field_size, sod_offs; |
2004 | 2000 |
2005 /* no supplementary picture */ | |
2006 if (buf_size == 0) | |
2007 return 0; | |
2008 | |
2009 buf_ptr = buf; | 2001 buf_ptr = buf; |
2010 buf_end = buf + buf_size; | 2002 buf_end = buf + buf_size; |
2011 | 2003 |
2012 read_header: | 2004 read_header: |
2013 /* reset on every SOI */ | 2005 /* reset on every SOI */ |
2112 MJpegDecodeContext *s = avctx->priv_data; | 2104 MJpegDecodeContext *s = avctx->priv_data; |
2113 #endif | 2105 #endif |
2114 const int qscale = 5; | 2106 const int qscale = 5; |
2115 uint8_t *buf_ptr, *buf_end, *recoded; | 2107 uint8_t *buf_ptr, *buf_end, *recoded; |
2116 int i = 0, j = 0; | 2108 int i = 0, j = 0; |
2117 | |
2118 /* no supplementary picture */ | |
2119 if (buf_size == 0) | |
2120 return 0; | |
2121 | 2109 |
2122 if (!avctx->width || !avctx->height) | 2110 if (!avctx->width || !avctx->height) |
2123 return -1; | 2111 return -1; |
2124 | 2112 |
2125 buf_ptr = buf; | 2113 buf_ptr = buf; |