]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dv.c
remove non portable get/put_be64_double()
[ffmpeg] / libavcodec / dv.c
index 5f1eaaa3b4b47f378a6deb90f29c953f1e7e7c99..bc750bcbc6abb60b61a827e58c4ce73ce2e66665 100644 (file)
@@ -144,7 +144,7 @@ static int dvvideo_init(AVCodecContext *avctx)
         /* NOTE: as a trick, we use the fact the no codes are unused
            to accelerate the parsing of partial codes */
         init_vlc(&dv_vlc, TEX_VLC_BITS, j, 
-                 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2);
+                 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0);
 
         dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM));
        if (!dv_rl_vlc) {
@@ -171,8 +171,12 @@ static int dvvideo_init(AVCodecContext *avctx)
        free_vlc(&dv_vlc);
 
        for (i = 0; i < NB_DV_VLC - 1; i++) {
-           if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE || dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
+           if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
               continue;
+#ifdef DV_CODEC_TINY_TARGET
+           if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
+              continue;
+#endif
           
           if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
               continue;
@@ -235,12 +239,6 @@ static int dvvideo_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int dvvideo_end(AVCodecContext *avctx)
-{
-    avcodec_default_free_buffers(avctx);    
-    return 0;
-}
-
 // #define VLC_DEBUG
 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
 
@@ -265,6 +263,7 @@ static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
 
 #ifndef ALT_BITSTREAM_READER
 #warning only works with ALT_BITSTREAM_READER
+static int re_index; //Hack to make it compile
 #endif
 
 static inline int get_bits_left(GetBitContext *s)
@@ -396,8 +395,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
            init_get_bits(&gb, buf_ptr, last_index);
             
             /* get the dc */
-            dc = get_bits(&gb, 9);
-            dc = (dc << (32 - 9)) >> (32 - 9);
+            dc = get_sbits(&gb, 9);
             dct_mode = get_bits1(&gb);
             mb->dct_mode = dct_mode;
             mb->scan_table = s->dv_zigzag[dct_mode];
@@ -891,11 +889,6 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
 {
     DVVideoContext *s = avctx->priv_data;
   
-    *data_size=0;
-    /* special case for last picture */
-    if(buf_size==0)
-        return 0;
-    
     s->sys = dv_frame_profile(buf);
     if (!s->sys || buf_size < s->sys->frame_size)
         return -1; /* NOTE: we only accept several full frames */
@@ -935,7 +928,9 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
     s->sys = dv_codec_profile(c);
     if (!s->sys)
        return -1;
-    
+    if(buf_size < s->sys->frame_size)
+        return -1;
+
     c->pix_fmt = s->sys->pix_fmt;
     s->picture = *((AVFrame *)data);
 
@@ -947,6 +942,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
     return s->sys->frame_size;
 }
 
+#ifdef CONFIG_DVVIDEO_ENCODER
 AVCodec dvvideo_encoder = {
     "dvvideo",
     CODEC_TYPE_VIDEO,
@@ -954,11 +950,12 @@ AVCodec dvvideo_encoder = {
     sizeof(DVVideoContext),
     dvvideo_init,
     dvvideo_encode_frame,
-    dvvideo_end,
+    NULL,
     NULL,
     CODEC_CAP_DR1,
     NULL
 };
+#endif // CONFIG_DVVIDEO_ENCODER
 
 AVCodec dvvideo_decoder = {
     "dvvideo",
@@ -967,7 +964,7 @@ AVCodec dvvideo_decoder = {
     sizeof(DVVideoContext),
     dvvideo_init,
     NULL,
-    dvvideo_end,
+    NULL,
     dvvideo_decode_frame,
     CODEC_CAP_DR1,
     NULL