]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libschroedingerenc.c
Simplify AVUI decoding, one skip value is enough.
[ffmpeg] / libavcodec / libschroedingerenc.c
index a7f876029b0a4c76689605aab9d6e8dada1337b4..0cea5a71942d2219555b47f67a9c219035e4900f 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "avcodec.h"
 #include "internal.h"
-#include "libdirac_libschro.h"
 #include "libschroedinger.h"
 #include "bytestream.h"
 
@@ -65,7 +64,7 @@ typedef struct SchroEncoderParams {
     int enc_buf_size;
 
     /** queue storing encoded frames */
-    DiracSchroQueue enc_frame_queue;
+    FFSchroQueue enc_frame_queue;
 
     /** end of sequence signalled */
     int eos_signalled;
@@ -80,7 +79,7 @@ typedef struct SchroEncoderParams {
 /**
 * Works out Schro-compatible chroma format.
 */
-static int SetSchroChromaFormat(AVCodecContext *avccontext)
+static int set_chroma_format(AVCodecContext *avccontext)
 {
     int num_formats = sizeof(schro_pixel_format_map) /
                       sizeof(schro_pixel_format_map[0]);
@@ -129,7 +128,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
     p_schro_params->format->width  = avccontext->width;
     p_schro_params->format->height = avccontext->height;
 
-    if (SetSchroChromaFormat(avccontext) == -1)
+    if (set_chroma_format(avccontext) == -1)
         return -1;
 
     if (avccontext->color_primaries == AVCOL_PRI_BT709) {
@@ -236,7 +235,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
     schro_encoder_start(p_schro_params->encoder);
 
     /* Initialize the encoded frame queue. */
-    ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue);
+    ff_schro_queue_init(&p_schro_params->enc_frame_queue);
     return 0;
 }
 
@@ -259,9 +258,9 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
     return in_frame;
 }
 
-static void SchroedingerFreeFrame(void *data)
+static void libschroedinger_free_frame(void *data)
 {
-    DiracSchroEncodedFrame *enc_frame = data;
+    FFSchroEncodedFrame *enc_frame = data;
 
     av_freep(&enc_frame->p_encbuf);
     av_free(enc_frame);
@@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
     int enc_size = 0;
     SchroEncoderParams *p_schro_params = avccontext->priv_data;
     SchroEncoder *encoder = p_schro_params->encoder;
-    struct DiracSchroEncodedFrame *p_frame_output = NULL;
+    struct FFSchroEncodedFrame *p_frame_output = NULL;
     int go = 1;
     SchroBuffer *enc_buf;
     int presentation_frame;
@@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
             }
 
             /* Create output frame. */
-            p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
+            p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame));
             /* Set output data. */
             p_frame_output->size     = p_schro_params->enc_buf_size;
             p_frame_output->p_encbuf = p_schro_params->enc_buf;
@@ -345,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
              * through 17 represesent the frame number. */
             p_frame_output->frame_num = AV_RB32(enc_buf->data + 13);
 
-            ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue,
-                                           p_frame_output);
+            ff_schro_queue_push_back(&p_schro_params->enc_frame_queue,
+                                     p_frame_output);
             p_schro_params->enc_buf_size = 0;
             p_schro_params->enc_buf      = NULL;
 
@@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
         p_schro_params->eos_pulled)
         last_frame_in_sequence = 1;
 
-    p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue);
+    p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue);
 
     if (!p_frame_output)
         return 0;
@@ -410,7 +409,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
 
 error:
     /* free frame */
-    SchroedingerFreeFrame(p_frame_output);
+    libschroedinger_free_frame(p_frame_output);
     return ret;
 }
 
@@ -423,8 +422,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext)
     schro_encoder_free(p_schro_params->encoder);
 
     /* Free data in the output frame queue. */
-    ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue,
-                              SchroedingerFreeFrame);
+    ff_schro_queue_free(&p_schro_params->enc_frame_queue,
+                        libschroedinger_free_frame);
 
 
     /* Free the encoder buffer. */
@@ -446,7 +445,9 @@ AVCodec ff_libschroedinger_encoder = {
     .init           = libschroedinger_encode_init,
     .encode2        = libschroedinger_encode_frame,
     .close          = libschroedinger_encode_close,
-   .capabilities = CODEC_CAP_DELAY,
-   .pix_fmts     = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
-   .long_name    = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
+    .capabilities   = CODEC_CAP_DELAY,
+    .pix_fmts       = (const enum PixelFormat[]){
+        PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE
+    },
+    .long_name      = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
 };