]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/magicyuvenc.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / magicyuvenc.c
index 9b79ac69b6cfb4eab8847b0e79e1c4635c46a7ad..7edaf1b45ef308ee85d73a82415f9d807b856b3b 100644 (file)
@@ -280,9 +280,9 @@ typedef struct PackageMergerList {
 
 static int compare_by_prob(const void *a, const void *b)
 {
-    PTable a_val = *(PTable *)a;
-    PTable b_val = *(PTable *)b;
-    return a_val.prob - b_val.prob;
+    const PTable *a2 = a;
+    const PTable *b2 = b;
+    return a2->prob - b2->prob;
 }
 
 static void magy_huffman_compute_bits(PTable *prob_table, HuffEntry *distincts,
@@ -400,11 +400,9 @@ static int encode_slice(uint8_t *src, uint8_t *dst, int dst_size,
     if (count)
         put_bits(&pb, 32 - count, 0);
 
-    count = put_bits_count(&pb);
-
     flush_put_bits(&pb);
 
-    return count >> 3;
+    return put_bytes_output(&pb);
 }
 
 static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
@@ -499,7 +497,7 @@ static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                      AV_CEIL_RSHIFT(frame->height, s->vshift[i]),
                      &s->pb, s->he[i]);
     }
-    s->tables_size = (put_bits_count(&s->pb) + 7) >> 3;
+    s->tables_size = put_bytes_count(&s->pb, 1);
     bytestream2_skip_p(&pb, s->tables_size);
 
     for (i = 0; i < s->planes; i++) {
@@ -558,7 +556,7 @@ static const AVClass magicyuv_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVCodec ff_magicyuv_encoder = {
+const AVCodec ff_magicyuv_encoder = {
     .name             = "magicyuv",
     .long_name        = NULL_IF_CONFIG_SMALL("MagicYUV video"),
     .type             = AVMEDIA_TYPE_VIDEO,