]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegvideo.c
kill one vector constant value load by the right combination of vec_splatX/vec_sl
[ffmpeg] / libavcodec / mpegvideo.c
index 28b84e3d57925779bf7cce39a2c45b8d8026c602..8e4e4a20905dfcc9e8a3059e8918cdfe03012bf6 100644 (file)
 #include "faandct.h"
 #include <limits.h>
 
-#ifdef USE_FASTMEMCPY
-#include "libvo/fastmemcpy.h"
-#endif
-
 //#undef NDEBUG
 //#include <assert.h>
 
@@ -299,6 +295,9 @@ int DCT_common_init(MpegEncContext *s)
 #ifdef ARCH_POWERPC
     MPV_common_init_ppc(s);
 #endif
+#ifdef ARCH_BFIN
+    MPV_common_init_bfin(s);
+#endif
 
 #ifdef CONFIG_ENCODERS
     s->fast_dct_quantize= s->dct_quantize;
@@ -376,7 +375,7 @@ static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *sr
  * The pixels are allocated/set by calling get_buffer() if shared=0
  */
 static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
-    const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) doesnt sig11
+    const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) does not sig11
     const int mb_array_size= s->mb_stride*s->mb_height;
     const int b8_array_size= s->b8_stride*s->mb_height*2;
     const int b4_array_size= s->b4_stride*s->mb_height*4;
@@ -445,11 +444,12 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
         CHECKED_ALLOCZ(pic->pan_scan , 1 * sizeof(AVPanScan))
     }
 
-    //it might be nicer if the application would keep track of these but it would require a API change
+    /* It might be nicer if the application would keep track of these
+     * but it would require an API change. */
     memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1);
     s->prev_pict_types[0]= s->pict_type;
     if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == B_TYPE)
-        pic->age= INT_MAX; // skipped MBs in b frames are quite rare in mpeg1/2 and its a bit tricky to skip them anyway
+        pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
 
     return 0;
 fail: //for the CHECKED_ALLOCZ macro
@@ -496,7 +496,7 @@ static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
     CHECKED_ALLOCZ(s->allocated_edge_emu_buffer, (s->width+64)*2*21*2); //(width + edge + align)*interlaced*MBsize*tolerance
     s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
 
-     //FIXME should be linesize instead of s->width*2 but that isnt known before get_buffer()
+     //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer()
     CHECKED_ALLOCZ(s->me.scratchpad,  (s->width+64)*4*16*2*sizeof(uint8_t))
     s->rd_scratchpad=   s->me.scratchpad;
     s->b_scratchpad=    s->me.scratchpad;
@@ -1020,7 +1020,7 @@ int MPV_encode_init(AVCodecContext *avctx)
     }
 
     if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){
-        av_log(avctx, AV_LOG_INFO, "bitrate below min bitrate\n");
+        av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n");
         return -1;
     }
 
@@ -1029,6 +1029,16 @@ int MPV_encode_init(AVCodecContext *avctx)
         return -1;
     }
 
+    if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){
+        av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n");
+        return -1;
+    }
+
+    if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){
+        av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n");
+        return -1;
+    }
+
     if(   s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate
        && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)
        && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){
@@ -1627,7 +1637,7 @@ alloc:
     s->error_resilience= avctx->error_resilience;
 
     /* set dequantizer, we can't do it during init as it might change for mpeg4
-       and we can't do it in the header decode as init isnt called for mpeg4 there yet */
+       and we can't do it in the header decode as init is not called for mpeg4 there yet */
     if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){
         s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
         s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;