]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ljpegenc.c
x86: dsputil: Separate ff_add_hfyu_median_prediction_cmov from dsputil_mmx
[ffmpeg] / libavcodec / ljpegenc.c
index a73ef45500bcc30475c7f57c35513d5c75bcb451..4b132399db14bad32477e1e9df9bbf431067b1a2 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include "avcodec.h"
-#include "dsputil.h"
 #include "internal.h"
 #include "mpegvideo.h"
 #include "mjpeg.h"
@@ -51,7 +50,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
     const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
     int ret, max_pkt_size = FF_MIN_BUFFER_SIZE;
 
-    if (avctx->pix_fmt == PIX_FMT_BGRA)
+    if (avctx->pix_fmt == AV_PIX_FMT_BGRA)
         max_pkt_size += width * height * 3 * 4;
     else {
         max_pkt_size += mb_width * mb_height * 3 * 4
@@ -64,7 +63,10 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
 
     init_put_bits(&s->pb, pkt->data, pkt->size);
 
-    *p = *pict;
+    av_frame_unref(p);
+    ret = av_frame_ref(p, pict);
+    if (ret < 0)
+        return ret;
     p->pict_type= AV_PICTURE_TYPE_I;
     p->key_frame= 1;
 
@@ -72,7 +74,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
 
     s->header_bits= put_bits_count(&s->pb);
 
-    if(avctx->pix_fmt == PIX_FMT_BGRA){
+    if(avctx->pix_fmt == AV_PIX_FMT_BGRA){
         int x, y, i;
         const int linesize= p->linesize[0];
         uint16_t (*buffer)[4]= (void *) s->rd_scratchpad;
@@ -174,7 +176,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
                                 int pred;
 
                                 ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
                                 PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
 
                                 if(i==0)
@@ -206,11 +207,11 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
 
 AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
     .name           = "ljpeg",
+    .long_name      = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_LJPEG,
+    .id             = AV_CODEC_ID_LJPEG,
     .priv_data_size = sizeof(MpegEncContext),
     .init           = ff_MPV_encode_init,
     .encode2        = encode_picture_lossless,
     .close          = ff_MPV_encode_end,
-    .long_name      = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
 };