[FFmpeg-cvslog] h264chroma: remove duplicate 9/10 bit functions.

Ronald S. Bultje git at videolan.org
Mon Feb 11 23:07:18 CET 2013


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Mon Feb 11 13:52:38 2013 -0800| [972771dcf27d4988a5d83afade989f7f9b938ee4] | committer: Michael Niedermayer

h264chroma: remove duplicate 9/10 bit functions.

Also use the resulting 16bpp functions for anything >8 and <=16, not just
9 and 10. This fixes 12 and 14bpp H264 support.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=972771dcf27d4988a5d83afade989f7f9b938ee4
---

 libavcodec/h264chroma.c          |   18 ++++--------------
 libavcodec/x86/h264chroma_init.c |    6 +++---
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/libavcodec/h264chroma.c b/libavcodec/h264chroma.c
index 31004a5..3b780a0 100644
--- a/libavcodec/h264chroma.c
+++ b/libavcodec/h264chroma.c
@@ -23,11 +23,7 @@
 #include "h264chroma_template.c"
 #undef BIT_DEPTH
 
-#define BIT_DEPTH 9
-#include "h264chroma_template.c"
-#undef BIT_DEPTH
-
-#define BIT_DEPTH 10
+#define BIT_DEPTH 16
 #include "h264chroma_template.c"
 #undef BIT_DEPTH
 
@@ -41,16 +37,10 @@
 
 void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
 {
-    switch (bit_depth) {
-    case 10:
-        SET_CHROMA(10);
-        break;
-    case 9:
-        SET_CHROMA(9);
-        break;
-    default:
+    if (bit_depth > 8 && bit_depth <= 16) {
+        SET_CHROMA(16);
+    } else {
         SET_CHROMA(8);
-        break;
     }
 
     if (ARCH_ARM)
diff --git a/libavcodec/x86/h264chroma_init.c b/libavcodec/x86/h264chroma_init.c
index 6fc9a43..b5c078f 100644
--- a/libavcodec/x86/h264chroma_init.c
+++ b/libavcodec/x86/h264chroma_init.c
@@ -89,14 +89,14 @@ void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
         c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_mmxext;
     }
 
-    if (EXTERNAL_MMXEXT(mm_flags) && bit_depth == 10) {
+    if (EXTERNAL_MMXEXT(mm_flags) && bit_depth > 8 && bit_depth <= 10) {
         c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_10_mmxext;
         c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_10_mmxext;
         c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_10_mmxext;
         c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_10_mmxext;
     }
 
-    if (EXTERNAL_SSE2(mm_flags) && bit_depth == 10) {
+    if (EXTERNAL_SSE2(mm_flags) && bit_depth > 8 && bit_depth <= 10) {
         c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_sse2;
         c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_sse2;
     }
@@ -108,7 +108,7 @@ void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
         c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_ssse3;
     }
 
-    if (EXTERNAL_AVX(mm_flags) && bit_depth == 10) {
+    if (EXTERNAL_AVX(mm_flags) && bit_depth > 8 && bit_depth <= 10) {
         // AVX implies !cache64.
         // TODO: Port cache(32|64) detection from x264.
         c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx;



More information about the ffmpeg-cvslog mailing list