diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 6f3c363..6cf839e 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -230,6 +230,15 @@ static inline void decode_coeff(DCTELEM *dst, int coef, int esc, GetBitContext *
 }
 
 /**
+ * Decode a single coefficient.
+ */
+static inline void decode_subblock1(DCTELEM *dst, int code, GetBitContext *gb, VLC *vlc)
+{
+  int coeff = modulo_three_table[code][0];
+  decode_coeff(dst, coeff, 3, gb, vlc);
+}
+
+/**
  * Decode 2x2 subblock of coefficients.
  */
 static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc)
@@ -262,16 +271,22 @@ static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2,
  *  o--o
  */
 
-static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc)
+static inline int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc)
 {
-    int code, pattern;
+    int code, pattern, has_ac = 1;
 
     code = get_vlc2(gb, rvlc->first_pattern[fc].table, 9, 2);
 
     pattern = code & 0x7;
 
     code >>= 3;
-    decode_subblock(dst, code, 0, gb, &rvlc->coefficient);
+    if (!code || code==27 || code==54 || code==81) {   
+      decode_subblock1(dst, code, gb, &rvlc->coefficient);
+      if (!pattern)
+        return 0;
+      has_ac = 0;
+    } else
+      decode_subblock(dst, code, 0, gb, &rvlc->coefficient);
 
     if(pattern & 4){
         code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
@@ -285,7 +300,7 @@ static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *r
         code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
         decode_subblock(dst + 8*2+2, code, 0, gb, &rvlc->coefficient);
     }
-
+    return pattern || has_ac;
 }
 
 /**
