Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
22a27953
Commit
22a27953
authored
Jul 17, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yuv2rgb: implement 15/16bit ordered dither
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1d903a5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
14 deletions
+58
-14
output.c
libswscale/output.c
+2
-2
yuv2rgb.c
libswscale/yuv2rgb.c
+56
-12
No files found.
libswscale/output.c
View file @
22a27953
...
@@ -36,13 +36,13 @@
...
@@ -36,13 +36,13 @@
#include "swscale.h"
#include "swscale.h"
#include "swscale_internal.h"
#include "swscale_internal.h"
DECLARE_ALIGNED
(
8
,
static
const
uint8_t
,
dither_2x2_4
)[][
8
]
=
{
DECLARE_ALIGNED
(
8
,
const
uint8_t
,
dither_2x2_4
)[][
8
]
=
{
{
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
},
{
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
},
{
2
,
0
,
2
,
0
,
2
,
0
,
2
,
0
,
},
{
2
,
0
,
2
,
0
,
2
,
0
,
2
,
0
,
},
{
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
},
{
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
},
};
};
DECLARE_ALIGNED
(
8
,
static
const
uint8_t
,
dither_2x2_8
)[][
8
]
=
{
DECLARE_ALIGNED
(
8
,
const
uint8_t
,
dither_2x2_8
)[][
8
]
=
{
{
6
,
2
,
6
,
2
,
6
,
2
,
6
,
2
,
},
{
6
,
2
,
6
,
2
,
6
,
2
,
6
,
2
,
},
{
0
,
4
,
0
,
4
,
0
,
4
,
0
,
4
,
},
{
0
,
4
,
0
,
4
,
0
,
4
,
0
,
4
,
},
{
6
,
2
,
6
,
2
,
6
,
2
,
6
,
2
,
},
{
6
,
2
,
6
,
2
,
6
,
2
,
6
,
2
,
},
...
...
libswscale/yuv2rgb.c
View file @
22a27953
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
#include "swscale_internal.h"
#include "swscale_internal.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixdesc.h"
extern
const
uint8_t
dither_2x2_4
[
2
][
8
];
extern
const
uint8_t
dither_2x2_8
[
2
][
8
];
extern
const
uint8_t
dither_4x4_16
[
4
][
8
];
extern
const
uint8_t
dither_4x4_16
[
4
][
8
];
extern
const
uint8_t
dither_8x8_32
[
8
][
8
];
extern
const
uint8_t
dither_8x8_32
[
8
][
8
];
extern
const
uint8_t
dither_8x8_73
[
8
][
8
];
extern
const
uint8_t
dither_8x8_73
[
8
][
8
];
...
@@ -355,24 +357,65 @@ ENDYUV2RGBLINE(24)
...
@@ -355,24 +357,65 @@ ENDYUV2RGBLINE(24)
PUTBGR24
(
dst_1
,
py_1
,
1
);
PUTBGR24
(
dst_1
,
py_1
,
1
);
ENDYUV2RGBFUNC
()
ENDYUV2RGBFUNC
()
// This is exactly the same code as yuv2rgb_c_32 except for the types of
YUV2RGBFUNC
(
yuv2rgb_c_16_ordered_dither
,
uint16_t
,
0
)
// r, g, b, dst_1, dst_2
const
uint8_t
*
d16
=
dither_2x2_8
[
y
&
1
];
YUV2RGBFUNC
(
yuv2rgb_c_16
,
uint16_t
,
0
)
const
uint8_t
*
e16
=
dither_2x2_4
[
y
&
1
];
const
uint8_t
*
f16
=
dither_2x2_8
[(
y
&
1
)
^
1
];
#define PUTRGB16(dst, src, i, o) \
Y = src[2 * i]; \
dst[2 * i] = r[Y + d16[0 + o]] + \
g[Y + e16[0 + o]] + \
b[Y + f16[0 + o]]; \
Y = src[2 * i + 1]; \
dst[2 * i + 1] = r[Y + d16[1 + o]] + \
g[Y + e16[1 + o]] + \
b[Y + f16[1 + o]];
LOADCHROMA
(
0
);
LOADCHROMA
(
0
);
PUTRGB
(
dst_1
,
py_1
,
0
);
PUTRGB
16
(
dst_1
,
py_1
,
0
,
0
);
PUTRGB
(
dst_2
,
py_2
,
0
);
PUTRGB
16
(
dst_2
,
py_2
,
0
,
0
+
8
);
LOADCHROMA
(
1
);
LOADCHROMA
(
1
);
PUTRGB
(
dst_2
,
py_2
,
1
);
PUTRGB
16
(
dst_2
,
py_2
,
1
,
2
+
8
);
PUTRGB
(
dst_1
,
py_1
,
1
);
PUTRGB
16
(
dst_1
,
py_1
,
1
,
2
);
LOADCHROMA
(
2
);
LOADCHROMA
(
2
);
PUTRGB
(
dst_1
,
py_1
,
2
);
PUTRGB
16
(
dst_1
,
py_1
,
2
,
4
);
PUTRGB
(
dst_2
,
py_2
,
2
);
PUTRGB
16
(
dst_2
,
py_2
,
2
,
4
+
8
);
LOADCHROMA
(
3
);
LOADCHROMA
(
3
);
PUTRGB
(
dst_2
,
py_2
,
3
);
PUTRGB16
(
dst_2
,
py_2
,
3
,
6
+
8
);
PUTRGB
(
dst_1
,
py_1
,
3
);
PUTRGB16
(
dst_1
,
py_1
,
3
,
6
);
CLOSEYUV2RGBFUNC
(
8
)
YUV2RGBFUNC
(
yuv2rgb_c_15_ordered_dither
,
uint16_t
,
0
)
const
uint8_t
*
d16
=
dither_2x2_8
[
y
&
1
];
const
uint8_t
*
e16
=
dither_2x2_8
[(
y
&
1
)
^
1
];
#define PUTRGB15(dst, src, i, o) \
Y = src[2 * i]; \
dst[2 * i] = r[Y + d16[0 + o]] + \
g[Y + d16[1 + o]] + \
b[Y + e16[0 + o]]; \
Y = src[2 * i + 1]; \
dst[2 * i + 1] = r[Y + d16[1 + o]] + \
g[Y + d16[0 + o]] + \
b[Y + e16[1 + o]];
LOADCHROMA
(
0
);
PUTRGB15
(
dst_1
,
py_1
,
0
,
0
);
PUTRGB15
(
dst_2
,
py_2
,
0
,
0
+
8
);
LOADCHROMA
(
1
);
PUTRGB15
(
dst_2
,
py_2
,
1
,
2
+
8
);
PUTRGB15
(
dst_1
,
py_1
,
1
,
2
);
LOADCHROMA
(
2
);
PUTRGB15
(
dst_1
,
py_1
,
2
,
4
);
PUTRGB15
(
dst_2
,
py_2
,
2
,
4
+
8
);
LOADCHROMA
(
3
);
PUTRGB15
(
dst_2
,
py_2
,
3
,
6
+
8
);
PUTRGB15
(
dst_1
,
py_1
,
3
,
6
);
CLOSEYUV2RGBFUNC
(
8
)
CLOSEYUV2RGBFUNC
(
8
)
// r, g, b, dst_1, dst_2
// r, g, b, dst_1, dst_2
...
@@ -569,9 +612,10 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
...
@@ -569,9 +612,10 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
return
yuv2rgb_c_24_bgr
;
return
yuv2rgb_c_24_bgr
;
case
PIX_FMT_RGB565
:
case
PIX_FMT_RGB565
:
case
PIX_FMT_BGR565
:
case
PIX_FMT_BGR565
:
return
yuv2rgb_c_16_ordered_dither
;
case
PIX_FMT_RGB555
:
case
PIX_FMT_RGB555
:
case
PIX_FMT_BGR555
:
case
PIX_FMT_BGR555
:
return
yuv2rgb_c_1
6
;
return
yuv2rgb_c_1
5_ordered_dither
;
case
PIX_FMT_RGB444
:
case
PIX_FMT_RGB444
:
case
PIX_FMT_BGR444
:
case
PIX_FMT_BGR444
:
return
yuv2rgb_c_12_ordered_dither
;
return
yuv2rgb_c_12_ordered_dither
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment