]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvenc.c
avfilter/vf_ssim: remove unnecessary check
[ffmpeg] / libavcodec / dvenc.c
index 0dc290642ebc76a232237b1aa3ff7f4e73195b79..458f39b558d97135163902d6a8697129f40b7e63 100644 (file)
@@ -318,9 +318,8 @@ static const int dv100_qstep_inv[16] = {
         65536,  65536,  32768,  21845,  16384,  13107,  10923,  9362,  8192,  4096,  3641,  3277,  2979,  2731,  2341,  1260,
 };
 
-/* DV100 weights are pre-zigzagged, inverted and multiplied by 2^(dv100_weight_shift)
+/* DV100 weights are pre-zigzagged, inverted and multiplied by 2^16
    (in DV100 the AC components are divided by the spec weights) */
-static const int dv100_weight_shift = 16;
 static const int dv_weight_1080[2][64] = {
     { 8192, 65536, 65536, 61681, 61681, 61681, 58254, 58254,
       58254, 58254, 58254, 58254, 55188, 58254, 58254, 55188,
@@ -977,16 +976,8 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
     }
 
     for (j = 0; j < 5 * s->sys->bpm; j++) {
-        int pos;
-        int size = pbs[j].size_in_bits >> 3;
         flush_put_bits(&pbs[j]);
-        pos = put_bits_count(&pbs[j]) >> 3;
-        if (pos > size) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "bitstream written beyond buffer size\n");
-            return -1;
-        }
-        memset(pbs[j].buf + pos, 0xff, size - pos);
+        memset(put_bits_ptr(&pbs[j]), 0xff, put_bytes_left(&pbs[j], 0));
     }
 
     if (DV_PROFILE_IS_HD(s->sys))
@@ -1178,12 +1169,6 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
 
     c->pix_fmt                = s->sys->pix_fmt;
     s->frame                  = frame;
-#if FF_API_CODED_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
-    c->coded_frame->key_frame = 1;
-    c->coded_frame->pict_type = AV_PICTURE_TYPE_I;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     s->buf = pkt->data;
 
     dv_format_frame(s, pkt->data);
@@ -1213,7 +1198,7 @@ static const AVClass dvvideo_encode_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVCodec ff_dvvideo_encoder = {
+const AVCodec ff_dvvideo_encoder = {
     .name           = "dvvideo",
     .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
     .type           = AVMEDIA_TYPE_VIDEO,