]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/svq3.c
Eliminate pointless '#if 1' statements without matching '#else'.
[ffmpeg] / libavcodec / svq3.c
index 6d10fc5ae59b405d4b86805ec95d34f4e46dede0..827a408d31eff913def3bf58498874a01b2f812a 100644 (file)
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2003 The FFmpeg Project
+ * Copyright (c) 2003 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,7 +37,7 @@
  *
  * You will know you have these parameters passed correctly when the decoder
  * correctly decodes this file:
- *  http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
+ *  http://samples.libav.org/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
  */
 #include "internal.h"
 #include "dsputil.h"
@@ -125,20 +125,18 @@ static const uint32_t svq3_dequant_coeff[32] = {
     61694, 68745, 77615, 89113,100253,109366,126635,141533
 };
 
-
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp)
-{
+void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp){
     const int qmul = svq3_dequant_coeff[qp];
 #define stride 16
     int i;
     int temp[16];
-    static const int x_offset[4] = {0, 1*stride, 4* stride,  5*stride};
+    static const uint8_t x_offset[4]={0, 1*stride, 4*stride, 5*stride};
 
-    for (i = 0; i < 4; i++){
-        const int z0= 13*(input[4*i+0] +    input[4*i+1]);
-        const int z1= 13*(input[4*i+0] -    input[4*i+1]);
-        const int z2=  7* input[4*i+2] - 17*input[4*i+3];
-        const int z3= 17* input[4*i+2] +  7*input[4*i+3];
+    for(i=0; i<4; i++){
+        const int z0 = 13*(input[4*i+0] +    input[4*i+2]);
+        const int z1 = 13*(input[4*i+0] -    input[4*i+2]);
+        const int z2 =  7* input[4*i+1] - 17*input[4*i+3];
+        const int z3 = 17* input[4*i+1] +  7*input[4*i+3];
 
         temp[4*i+0] = z0+z3;
         temp[4*i+1] = z1+z2;
@@ -146,16 +144,16 @@ void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp)
         temp[4*i+3] = z0-z3;
     }
 
-    for (i = 0; i < 4; i++){
-        const int offset = x_offset[i];
-        const int z0 = 13*(temp[4*0+i] +    temp[4*2+i]);
-        const int z1 = 13*(temp[4*0+i] -    temp[4*2+i]);
-        const int z2 =  7* temp[4*1+i] - 17*temp[4*3+i];
-        const int z3 = 17* temp[4*1+i] +  7*temp[4*3+i];
+    for(i=0; i<4; i++){
+        const int offset= x_offset[i];
+        const int z0= 13*(temp[4*0+i] +    temp[4*2+i]);
+        const int z1= 13*(temp[4*0+i] -    temp[4*2+i]);
+        const int z2=  7* temp[4*1+i] - 17*temp[4*3+i];
+        const int z3= 17* temp[4*1+i] +  7*temp[4*3+i];
 
-        output[stride*+offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
-        output[stride*+offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
-        output[stride*+offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
+        output[stride* 0+offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
+        output[stride* 2+offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
+        output[stride* 8+offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
         output[stride*10+offset] = ((z0 - z3)*qmul + 0x80000) >> 20;
     }
 }
@@ -285,7 +283,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
     src  = pic->data[0] + mx + my*s->linesize;
 
     if (emu) {
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
                             mx, my, s->h_edge_pos, s->v_edge_pos);
         src = s->edge_emu_buffer;
     }
@@ -306,7 +304,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
             src  = pic->data[i] + mx + my*s->uvlinesize;
 
             if (emu) {
-                ff_emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
+                s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
                                     mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
                 src = s->edge_emu_buffer;
             }
@@ -646,7 +644,9 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
         }
     }
     if (IS_INTRA16x16(mb_type)) {
-        if (svq3_decode_block(&s->gb, h->mb, 0, 0)){
+        AV_ZERO128(h->mb_luma_dc+0);
+        AV_ZERO128(h->mb_luma_dc+8);
+        if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){
             av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
             return -1;
         }
@@ -945,19 +945,13 @@ static int svq3_decode_frame(AVCodecContext *avctx,
                s->adaptive_quant, s->qscale, h->slice_num);
     }
 
-    /* for hurry_up == 5 */
+    /* for skipping the frame */
     s->current_picture.pict_type = s->pict_type;
     s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
 
     /* Skip B-frames if we do not have reference frames. */
     if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
         return 0;
-    /* Skip B-frames if we are in a hurry. */
-    if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
-        return 0;
-    /* Skip everything if we are in a hurry >= 5. */
-    if (avctx->hurry_up >= 5)
-        return 0;
     if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
         ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
         || avctx->skip_frame >= AVDISCARD_ALL)
@@ -1062,7 +1056,7 @@ static int svq3_decode_frame(AVCodecContext *avctx,
 }
 
 
-AVCodec svq3_decoder = {
+AVCodec ff_svq3_decoder = {
     "svq3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SVQ3,