summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-07 22:13:35 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-07 22:13:35 +0300
commite1cd86076fc830bf2d475539543cf3dacc287ca7 (patch)
tree3651783063fcca8af4645f61f4196276d6f7f6a9 /libmpcodecs
parent4c6e3ac01bb158ddaa5603dc93fc7efb91b367b1 (diff)
parent1292c8adc351b1bf461354cd632b39ec3303a8f2 (diff)
downloadmpv-e1cd86076fc830bf2d475539543cf3dacc287ca7.tar.bz2
mpv-e1cd86076fc830bf2d475539543cf3dacc287ca7.tar.xz
Merge svn changes up to r31141
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/img_format.c2
-rw-r--r--libmpcodecs/img_format.h10
-rw-r--r--libmpcodecs/vf_1bpp.c6
-rw-r--r--libmpcodecs/vf_expand.c4
-rw-r--r--libmpcodecs/vf_rgbtest.c8
-rw-r--r--libmpcodecs/vf_scale.c2
-rw-r--r--libmpcodecs/vf_screenshot.c1
-rw-r--r--libmpcodecs/vf_tile.c8
8 files changed, 38 insertions, 3 deletions
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 830180a55c..9becd772da 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -29,6 +29,7 @@ const char *vo_format_name(int format)
case IMGFMT_RGB4: return "RGB 4-bit";
case IMGFMT_RG4B: return "RGB 4-bit per byte";
case IMGFMT_RGB8: return "RGB 8-bit";
+ case IMGFMT_RGB12: return "RGB 12-bit";
case IMGFMT_RGB15: return "RGB 15-bit";
case IMGFMT_RGB16: return "RGB 16-bit";
case IMGFMT_RGB24: return "RGB 24-bit";
@@ -39,6 +40,7 @@ const char *vo_format_name(int format)
case IMGFMT_BGR4: return "BGR 4-bit";
case IMGFMT_BG4B: return "BGR 4-bit per byte";
case IMGFMT_BGR8: return "BGR 8-bit";
+ case IMGFMT_BGR12: return "BGR 12-bit";
case IMGFMT_BGR15: return "BGR 15-bit";
case IMGFMT_BGR16: return "BGR 16-bit";
case IMGFMT_BGR24: return "BGR 24-bit";
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 2c4db36a04..e5800828d0 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -29,6 +29,7 @@
#define IMGFMT_RGB4 (IMGFMT_RGB|4)
#define IMGFMT_RGB4_CHAR (IMGFMT_RGB|4|128) // RGB4 with 1 pixel per byte
#define IMGFMT_RGB8 (IMGFMT_RGB|8)
+#define IMGFMT_RGB12 (IMGFMT_RGB|12)
#define IMGFMT_RGB15 (IMGFMT_RGB|15)
#define IMGFMT_RGB16 (IMGFMT_RGB|16)
#define IMGFMT_RGB24 (IMGFMT_RGB|24)
@@ -42,6 +43,7 @@
#define IMGFMT_BGR4 (IMGFMT_BGR|4)
#define IMGFMT_BGR4_CHAR (IMGFMT_BGR|4|128) // BGR4 with 1 pixel per byte
#define IMGFMT_BGR8 (IMGFMT_BGR|8)
+#define IMGFMT_BGR12 (IMGFMT_BGR|12)
#define IMGFMT_BGR15 (IMGFMT_BGR|15)
#define IMGFMT_BGR16 (IMGFMT_BGR|16)
#define IMGFMT_BGR24 (IMGFMT_BGR|24)
@@ -53,10 +55,14 @@
#define IMGFMT_ARGB IMGFMT_BGR32
#define IMGFMT_RGBA (IMGFMT_BGR32|64)
#define IMGFMT_RGB48NE IMGFMT_RGB48BE
+#define IMGFMT_RGB12BE IMGFMT_RGB12
+#define IMGFMT_RGB12LE (IMGFMT_RGB12|64)
#define IMGFMT_RGB15BE IMGFMT_RGB15
#define IMGFMT_RGB15LE (IMGFMT_RGB15|64)
#define IMGFMT_RGB16BE IMGFMT_RGB16
#define IMGFMT_RGB16LE (IMGFMT_RGB16|64)
+#define IMGFMT_BGR12BE IMGFMT_BGR12
+#define IMGFMT_BGR12LE (IMGFMT_BGR12|64)
#define IMGFMT_BGR15BE IMGFMT_BGR15
#define IMGFMT_BGR15LE (IMGFMT_BGR15|64)
#define IMGFMT_BGR16BE IMGFMT_BGR16
@@ -67,10 +73,14 @@
#define IMGFMT_ARGB (IMGFMT_RGB32|64)
#define IMGFMT_RGBA IMGFMT_RGB32
#define IMGFMT_RGB48NE IMGFMT_RGB48LE
+#define IMGFMT_RGB12BE (IMGFMT_RGB12|64)
+#define IMGFMT_RGB12LE IMGFMT_RGB12
#define IMGFMT_RGB15BE (IMGFMT_RGB15|64)
#define IMGFMT_RGB15LE IMGFMT_RGB15
#define IMGFMT_RGB16BE (IMGFMT_RGB16|64)
#define IMGFMT_RGB16LE IMGFMT_RGB16
+#define IMGFMT_BGR12BE (IMGFMT_BGR12|64)
+#define IMGFMT_BGR12LE IMGFMT_BGR12
#define IMGFMT_BGR15BE (IMGFMT_BGR15|64)
#define IMGFMT_BGR15LE IMGFMT_BGR15
#define IMGFMT_BGR16BE (IMGFMT_BGR16|64)
diff --git a/libmpcodecs/vf_1bpp.c b/libmpcodecs/vf_1bpp.c
index ee8ecfbadc..915411e96f 100644
--- a/libmpcodecs/vf_1bpp.c
+++ b/libmpcodecs/vf_1bpp.c
@@ -45,6 +45,8 @@ static const unsigned int bgr_list[]={
IMGFMT_444P,
IMGFMT_YUY2,
+ IMGFMT_BGR12,
+ IMGFMT_RGB12,
IMGFMT_BGR15,
IMGFMT_RGB15,
IMGFMT_BGR16,
@@ -150,6 +152,10 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
case IMGFMT_YUY2:
convert(mpi,dmpi,0x8000,0x80ff,2);
break;
+ case IMGFMT_BGR12:
+ case IMGFMT_RGB12:
+ convert(mpi,dmpi,0,0x0fff,2);
+ break;
case IMGFMT_BGR15:
case IMGFMT_RGB15:
convert(mpi,dmpi,0,0x7fff,2);
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 669e512d4e..683ed633fe 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -147,6 +147,10 @@ static void draw_func(void *ctx, int x0,int y0, int w,int h,unsigned char* src,
vf->dmpi->stride[0]*y0+
(vf->dmpi->bpp>>3)*x0;
switch(vf->dmpi->imgfmt){
+ case IMGFMT_BGR12:
+ case IMGFMT_RGB12:
+ vo_draw_alpha_rgb12(w, h, src, srca, stride, dst, vf->dmpi->stride[0]);
+ break;
case IMGFMT_BGR15:
case IMGFMT_RGB15:
vo_draw_alpha_rgb15(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
diff --git a/libmpcodecs/vf_rgbtest.c b/libmpcodecs/vf_rgbtest.c
index b7fc3aa55a..02f2774a05 100644
--- a/libmpcodecs/vf_rgbtest.c
+++ b/libmpcodecs/vf_rgbtest.c
@@ -37,11 +37,13 @@ struct vf_priv_s {
static unsigned int getfmt(unsigned int outfmt){
switch(outfmt){
+ case IMGFMT_RGB12:
case IMGFMT_RGB15:
case IMGFMT_RGB16:
case IMGFMT_RGB24:
case IMGFMT_RGBA:
case IMGFMT_ARGB:
+ case IMGFMT_BGR12:
case IMGFMT_BGR15:
case IMGFMT_BGR16:
case IMGFMT_BGR24:
@@ -54,6 +56,12 @@ static unsigned int getfmt(unsigned int outfmt){
static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){
switch(fmt){
+ case IMGFMT_BGR12: ((uint16_t*)(buf + y*stride))[x]=
+ ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);
+ break;
+ case IMGFMT_RGB12: ((uint16_t*)(buf + y*stride))[x]=
+ ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4);
+ break;
case IMGFMT_BGR15: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
break;
case IMGFMT_RGB15: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 6a661c567e..94beeddabd 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -96,6 +96,8 @@ static const unsigned int outfmt_list[]={
IMGFMT_RGB16,
IMGFMT_BGR15,
IMGFMT_RGB15,
+ IMGFMT_BGR12,
+ IMGFMT_RGB12,
IMGFMT_Y800,
IMGFMT_Y8,
IMGFMT_BGR8,
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index a2680cc6d1..2ddd0e4ab6 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -258,6 +258,7 @@ static int query_format(struct vf_instance* vf, unsigned int fmt)
case IMGFMT_BGR24:
case IMGFMT_BGR16:
case IMGFMT_BGR15:
+ case IMGFMT_BGR12:
case IMGFMT_RGB32:
case IMGFMT_RGB24:
case IMGFMT_Y800:
diff --git a/libmpcodecs/vf_tile.c b/libmpcodecs/vf_tile.c
index 9192f5bf5f..0930a00c87 100644
--- a/libmpcodecs/vf_tile.c
+++ b/libmpcodecs/vf_tile.c
@@ -197,16 +197,18 @@ static void uninit(struct vf_instance* vf)
free(vf->priv);
}
-/* rgb/bgr 15->32 supported & some Yxxx */
+/* rgb/bgr 12->32 supported & some Yxxx */
static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
- /* rgb 15 -> 32 bit */
+ /* rgb 12...32 bit */
+ case IMGFMT_RGB12:
case IMGFMT_RGB15:
case IMGFMT_RGB16:
case IMGFMT_RGB24:
case IMGFMT_RGB32:
- /* bgr 15 -> 32 bit */
+ /* bgr 12...32 bit */
+ case IMGFMT_BGR12:
case IMGFMT_BGR15:
case IMGFMT_BGR16:
case IMGFMT_BGR24: