[x264-devel] commit: Fix constrained intra pred mode selection (Anton Mitrofanov )

git at videolan.org git at videolan.org
Fri Nov 19 23:50:09 CET 2010


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Nov 17 07:27:09 2010 -0800| [fb3ef61ccbfe748761cdaaec6ccf8b3d03fa241e] | committer: Jason Garrett-Glaser 

Fix constrained intra pred mode selection

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=fb3ef61ccbfe748761cdaaec6ccf8b3d03fa241e
---

 encoder/analyse.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/encoder/analyse.c b/encoder/analyse.c
index a997425..de47159 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -550,30 +550,35 @@ static const int8_t i4x4_mode_available[2][5][10] =
         {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_HD, I_PRED_4x4_HU, -1},
     }
 };
+
 static ALWAYS_INLINE const int8_t *predict_16x16_mode_available( int i_neighbour )
 {
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
-    return i16x16_mode_available[(idx&MB_TOPLEFT)?4:idx];
+    idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT);
+    return i16x16_mode_available[idx];
 }
 
 static ALWAYS_INLINE const int8_t *predict_8x8chroma_mode_available( int i_neighbour )
 {
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
-    return i8x8chroma_mode_available[(idx&MB_TOPLEFT)?4:idx];
+    idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT);
+    return i8x8chroma_mode_available[idx];
 }
 
 static ALWAYS_INLINE const int8_t *predict_8x8_mode_available( int force_intra, int i_neighbour, int i )
 {
     int avoid_topright = force_intra && (i&1);
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
-    return i4x4_mode_available[avoid_topright][(idx&MB_TOPLEFT)?4:idx];
+    idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT);
+    return i4x4_mode_available[avoid_topright][idx];
 }
 
 static ALWAYS_INLINE const int8_t *predict_4x4_mode_available( int force_intra, int i_neighbour, int i )
 {
     int avoid_topright = force_intra && ((i&5) == 5);
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
-    return i4x4_mode_available[avoid_topright][(idx&MB_TOPLEFT)?4:idx];
+    idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT);
+    return i4x4_mode_available[avoid_topright][idx];
 }
 
 /* For trellis=2, we need to do this for both sizes of DCT, for trellis=1 we only need to use it on the chosen mode. */



More information about the x264-devel mailing list