changeset 12490:e1a4ceb96a07 libavcodec

Add R10k decoder. Original patch by Zhou Zongyi, zhouzy A os pku edu cn, resubmitted by James Darnley, james.darnley gmail, changes by me.
author cehoyos
date Mon, 13 Sep 2010 22:08:51 +0000
parents 8cd356429e9f
children 990f8a5fc8af
files Makefile allcodecs.c avcodec.h r210dec.c
diffstat 4 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Sep 13 22:03:29 2010 +0000
+++ b/Makefile	Mon Sep 13 22:08:51 2010 +0000
@@ -289,6 +289,7 @@
 OBJS-$(CONFIG_QPEG_DECODER)            += qpeg.o
 OBJS-$(CONFIG_QTRLE_DECODER)           += qtrle.o
 OBJS-$(CONFIG_QTRLE_ENCODER)           += qtrleenc.o
+OBJS-$(CONFIG_R10K_DECODER)            += r210dec.o
 OBJS-$(CONFIG_R210_DECODER)            += r210dec.o
 OBJS-$(CONFIG_RA_144_DECODER)          += ra144dec.o ra144.o celp_filters.o
 OBJS-$(CONFIG_RA_144_ENCODER)          += ra144enc.o ra144.o celp_filters.o
--- a/allcodecs.c	Mon Sep 13 22:03:29 2010 +0000
+++ b/allcodecs.c	Mon Sep 13 22:08:51 2010 +0000
@@ -163,6 +163,7 @@
     REGISTER_DECODER (QDRAW, qdraw);
     REGISTER_DECODER (QPEG, qpeg);
     REGISTER_ENCDEC  (QTRLE, qtrle);
+    REGISTER_DECODER (R10K,  r10k);
     REGISTER_DECODER (R210,  r210);
     REGISTER_ENCDEC  (RAWVIDEO, rawvideo);
     REGISTER_DECODER (RL2, rl2);
--- a/avcodec.h	Mon Sep 13 22:03:29 2010 +0000
+++ b/avcodec.h	Mon Sep 13 22:08:51 2010 +0000
@@ -31,7 +31,7 @@
 #include "libavutil/cpu.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 88
+#define LIBAVCODEC_VERSION_MINOR 89
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -227,6 +227,7 @@
     CODEC_ID_ANSI,
     CODEC_ID_A64_MULTI,
     CODEC_ID_A64_MULTI5,
+    CODEC_ID_R10K,
 
     /* various PCM "codecs" */
     CODEC_ID_PCM_S16LE= 0x10000,
--- a/r210dec.c	Mon Sep 13 22:03:29 2010 +0000
+++ b/r210dec.c	Mon Sep 13 22:08:51 2010 +0000
@@ -63,9 +63,15 @@
         for (w = 0; w < avctx->width; w++) {
             uint32_t pixel = av_be2ne32(*src++);
             uint16_t r, g, b;
+            if (avctx->codec_id==CODEC_ID_R210) {
             b =  pixel <<  6;
             g = (pixel >>  4) & 0xffc0;
             r = (pixel >> 14) & 0xffc0;
+            } else {
+                b =  pixel <<  4;
+                g = (pixel >>  6) & 0xffc0;
+                r = (pixel >> 16) & 0xffc0;
+            }
             *dst++ = r | (r >> 10);
             *dst++ = g | (g >> 10);
             *dst++ = b | (b >> 10);
@@ -90,6 +96,7 @@
     return 0;
 }
 
+#if CONFIG_R210_DECODER
 AVCodec r210_decoder = {
     "r210",
     AVMEDIA_TYPE_VIDEO,
@@ -102,3 +109,18 @@
     CODEC_CAP_DR1,
     .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
 };
+#endif
+#if CONFIG_R10K_DECODER
+AVCodec r10k_decoder = {
+    "r10k",
+    AVMEDIA_TYPE_VIDEO,
+    CODEC_ID_R10K,
+    0,
+    decode_init,
+    NULL,
+    decode_close,
+    decode_frame,
+    CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
+};
+#endif