]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h261enc.c
configure: Suppress "potentially uninitialized variable" warnings from MSVC
[ffmpeg] / libavcodec / h261enc.c
index ccc1fd279c1d32aef2c8056c156e880cadf9f0c7..f24e590f92d299666e0c914c37141bb3a6c3eec8 100644 (file)
  * H.261 encoder.
  */
 
+#include "libavutil/attributes.h"
 #include "avcodec.h"
+#include "mpegutils.h"
 #include "mpegvideo.h"
 #include "h263.h"
 #include "h261.h"
-#include "h261data.h"
 
 int ff_h261_get_picture_format(int width, int height)
 {
@@ -129,7 +130,7 @@ static void h261_encode_motion(H261Context *h, int val)
     int sign, code;
     if (val == 0) {
         code = 0;
-        put_bits(&s->pb, h261_mv_tab[code][1], h261_mv_tab[code][0]);
+        put_bits(&s->pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
     } else {
         if (val > 15)
             val -= 32;
@@ -137,7 +138,7 @@ static void h261_encode_motion(H261Context *h, int val)
             val += 32;
         sign = val < 0;
         code = sign ? -val : val;
-        put_bits(&s->pb, h261_mv_tab[code][1], h261_mv_tab[code][0]);
+        put_bits(&s->pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
         put_bits(&s->pb, 1, sign);
     }
 }
@@ -163,7 +164,7 @@ static void h261_encode_block(H261Context *h, int16_t *block, int n)
     int level, run, i, j, last_index, last_non_zero, sign, slevel, code;
     RLTable *rl;
 
-    rl = &h261_rl_tcoeff;
+    rl = &ff_h261_rl_tcoeff;
     if (s->mb_intra) {
         /* DC coef */
         level = block[0];
@@ -253,8 +254,9 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
     }
 
     /* MB is not skipped, encode MBA */
-    put_bits(&s->pb, h261_mba_bits[(h->current_mba - h->previous_mba) - 1],
-             h261_mba_code[(h->current_mba - h->previous_mba) - 1]);
+    put_bits(&s->pb,
+             ff_h261_mba_bits[(h->current_mba - h->previous_mba) - 1],
+             ff_h261_mba_code[(h->current_mba - h->previous_mba) - 1]);
 
     /* calculate MTYPE */
     if (!s->mb_intra) {
@@ -272,9 +274,11 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
     if (s->dquant)
         h->mtype++;
 
-    put_bits(&s->pb, h261_mtype_bits[h->mtype], h261_mtype_code[h->mtype]);
+    put_bits(&s->pb,
+             ff_h261_mtype_bits[h->mtype],
+             ff_h261_mtype_code[h->mtype]);
 
-    h->mtype = h261_mtype_map[h->mtype];
+    h->mtype = ff_h261_mtype_map[h->mtype];
 
     if (IS_QUANT(h->mtype)) {
         ff_set_qscale(s, s->qscale + s->dquant);
@@ -294,7 +298,9 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
 
     if (HAS_CBP(h->mtype)) {
         assert(cbp > 0);
-        put_bits(&s->pb, h261_cbp_tab[cbp - 1][1], h261_cbp_tab[cbp - 1][0]);
+        put_bits(&s->pb,
+                 ff_h261_cbp_tab[cbp - 1][1],
+                 ff_h261_cbp_tab[cbp - 1][0]);
     }
     for (i = 0; i < 6; i++)
         /* encode each block */
@@ -307,14 +313,9 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
     }
 }
 
-void ff_h261_encode_init(MpegEncContext *s)
+av_cold void ff_h261_encode_init(MpegEncContext *s)
 {
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-        ff_init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store);
-    }
+    ff_h261_common_init();
 
     s->min_qcoeff       = -127;
     s->max_qcoeff       = 127;
@@ -326,14 +327,14 @@ FF_MPV_GENERIC_CLASS(h261)
 
 AVCodec ff_h261_encoder = {
     .name           = "h261",
+    .long_name      = NULL_IF_CONFIG_SMALL("H.261"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H261,
     .priv_data_size = sizeof(H261Context),
-    .init           = ff_MPV_encode_init,
-    .encode2        = ff_MPV_encode_picture,
-    .close          = ff_MPV_encode_end,
+    .init           = ff_mpv_encode_init,
+    .encode2        = ff_mpv_encode_picture,
+    .close          = ff_mpv_encode_end,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
                                                      AV_PIX_FMT_NONE },
-    .long_name      = NULL_IF_CONFIG_SMALL("H.261"),
     .priv_class     = &h261_class,
 };