* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
+#include "bytestream.h"
#include "pnm.h"
-static int common_init(AVCodecContext *avctx){
+static av_cold int common_init(AVCodecContext *avctx){
PNMContext *s = avctx->priv_data;
avcodec_get_frame_defaults((AVFrame*)&s->picture);
static int pnm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
PNMContext * const s = avctx->priv_data;
AVFrame *picture = data;
for(i=0;i<h;i++) {
for(j=0;j<w;j++) {
v = ((uint32_t *)ptr)[j];
- *s->bytestream++ = v >> 16;
- *s->bytestream++ = v >> 8;
- *s->bytestream++ = v;
+ bytestream_put_be24(&s->bytestream, v);
*s->bytestream++ = v >> 24;
}
ptr += linesize;
pnm_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
+ .long_name= NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
};
#endif // CONFIG_PGM_ENCODER
pnm_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+ .long_name= NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
};
#endif // CONFIG_PGMYUV_ENCODER
pnm_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
+ .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
};
#endif // CONFIG_PPM_ENCODER
pnm_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_MONOWHITE, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+ .long_name= NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
};
#endif // CONFIG_PBM_ENCODER
pam_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+ .long_name= NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
};
#endif // CONFIG_PAM_ENCODER