]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/jpeglsenc.c
h264: check for luma and chroma bit dept being equal
[ffmpeg] / libavcodec / jpeglsenc.c
index 805c48e507033aa55975a1b639981c9bcd6072ad..f6d88016a11da356ec6b011104eb09ccb2262fc3 100644 (file)
@@ -30,7 +30,6 @@
 #include "golomb.h"
 #include "internal.h"
 #include "mathops.h"
-#include "dsputil.h"
 #include "mjpeg.h"
 #include "jpegls.h"
 
@@ -244,7 +243,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     p->pict_type= AV_PICTURE_TYPE_I;
     p->key_frame= 1;
 
-    if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16)
+    if(avctx->pix_fmt == AV_PIX_FMT_GRAY8 || avctx->pix_fmt == AV_PIX_FMT_GRAY16)
         comps = 1;
     else
         comps = 3;
@@ -264,7 +263,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     put_marker(&pb, SOI);
     put_marker(&pb, SOF48);
     put_bits(&pb, 16, 8 + comps * 3); // header size depends on components
-    put_bits(&pb,  8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); // bpp
+    put_bits(&pb,  8, (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8); // bpp
     put_bits(&pb, 16, avctx->height);
     put_bits(&pb, 16, avctx->width);
     put_bits(&pb,  8, comps);         // components
@@ -288,7 +287,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     state = av_mallocz(sizeof(JLSState));
     /* initialize JPEG-LS state from JPEG parameters */
     state->near = near;
-    state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8;
+    state->bpp = (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8;
     ff_jpegls_reset_coding_parameters(state, 0);
     ff_jpegls_init_state(state);
 
@@ -297,7 +296,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     zero = av_mallocz(p->linesize[0]);
     last = zero;
     cur = p->data[0];
-    if(avctx->pix_fmt == PIX_FMT_GRAY8){
+    if(avctx->pix_fmt == AV_PIX_FMT_GRAY8){
         int t = 0;
 
         for(i = 0; i < avctx->height; i++) {
@@ -306,7 +305,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
             last = cur;
             cur += p->linesize[0];
         }
-    }else if(avctx->pix_fmt == PIX_FMT_GRAY16){
+    }else if(avctx->pix_fmt == AV_PIX_FMT_GRAY16){
         int t = 0;
 
         for(i = 0; i < avctx->height; i++) {
@@ -315,7 +314,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
             last = cur;
             cur += p->linesize[0];
         }
-    }else if(avctx->pix_fmt == PIX_FMT_RGB24){
+    }else if(avctx->pix_fmt == AV_PIX_FMT_RGB24){
         int j, width;
         int Rc[3] = {0, 0, 0};
 
@@ -328,7 +327,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
             last = cur;
             cur += s->picture.linesize[0];
         }
-    }else if(avctx->pix_fmt == PIX_FMT_BGR24){
+    }else if(avctx->pix_fmt == AV_PIX_FMT_BGR24){
         int j, width;
         int Rc[3] = {0, 0, 0};
 
@@ -385,7 +384,7 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
     c->avctx = ctx;
     ctx->coded_frame = &c->picture;
 
-    if(ctx->pix_fmt != PIX_FMT_GRAY8 && ctx->pix_fmt != PIX_FMT_GRAY16 && ctx->pix_fmt != PIX_FMT_RGB24 && ctx->pix_fmt != PIX_FMT_BGR24){
+    if(ctx->pix_fmt != AV_PIX_FMT_GRAY8 && ctx->pix_fmt != AV_PIX_FMT_GRAY16 && ctx->pix_fmt != AV_PIX_FMT_RGB24 && ctx->pix_fmt != AV_PIX_FMT_BGR24){
         av_log(ctx, AV_LOG_ERROR, "Only grayscale and RGB24/BGR24 images are supported\n");
         return -1;
     }
@@ -395,13 +394,13 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
 AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
     .name           = "jpegls",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_JPEGLS,
+    .id             = AV_CODEC_ID_JPEGLS,
     .priv_data_size = sizeof(JpeglsContext),
     .init           = encode_init_ls,
     .encode2        = encode_picture_ls,
-    .pix_fmts       = (const enum PixelFormat[]){
-        PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16,
-        PIX_FMT_NONE
+    .pix_fmts       = (const enum AVPixelFormat[]){
+        AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
+        AV_PIX_FMT_NONE
     },
     .long_name      = NULL_IF_CONFIG_SMALL("JPEG-LS"),
 };