Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
74d9b213
Commit
74d9b213
authored
Dec 09, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cljrenc: add AVOption to disable dither
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
a1c676c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
cljr.c
libavcodec/cljr.c
+23
-1
No files found.
libavcodec/cljr.c
View file @
74d9b213
...
...
@@ -25,12 +25,15 @@
*/
#include "avcodec.h"
#include "libavutil/opt.h"
#include "get_bits.h"
#include "put_bits.h"
typedef
struct
CLJRContext
{
AVClass
*
avclass
;
AVCodecContext
*
avctx
;
AVFrame
picture
;
int
dither_type
;
}
CLJRContext
;
static
av_cold
int
common_init
(
AVCodecContext
*
avctx
)
...
...
@@ -129,6 +132,7 @@ AVCodec ff_cljr_decoder = {
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
)
{
CLJRContext
*
a
=
avctx
->
priv_data
;
PutBitContext
pb
;
AVFrame
*
p
=
data
;
int
x
,
y
;
...
...
@@ -144,6 +148,10 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
uint8_t
*
cb
=
&
p
->
data
[
1
][
y
*
p
->
linesize
[
1
]];
uint8_t
*
cr
=
&
p
->
data
[
2
][
y
*
p
->
linesize
[
2
]];
for
(
x
=
0
;
x
<
avctx
->
width
;
x
+=
4
)
{
switch
(
a
->
dither_type
)
{
case
0
:
dither
=
0x492A0000
;
break
;
case
1
:
dither
=
dither
*
1664525
+
1013904223
;
break
;
}
put_bits
(
&
pb
,
5
,
(
luma
[
3
]
+
(
dither
>>
29
)
)
>>
3
);
put_bits
(
&
pb
,
5
,
(
luma
[
2
]
+
((
dither
>>
26
)
&
7
))
>>
3
);
put_bits
(
&
pb
,
5
,
(
luma
[
1
]
+
((
dither
>>
23
)
&
7
))
>>
3
);
...
...
@@ -151,7 +159,6 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
luma
+=
4
;
put_bits
(
&
pb
,
6
,
(
*
(
cb
++
)
+
((
dither
>>
18
)
&
3
))
>>
2
);
put_bits
(
&
pb
,
6
,
(
*
(
cr
++
)
+
((
dither
>>
16
)
&
3
))
>>
2
);
dither
=
dither
*
1664525
+
1013904223
;
}
}
...
...
@@ -160,6 +167,20 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
return
put_bits_count
(
&
pb
)
/
8
;
}
#define OFFSET(x) offsetof(CLJRContext, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
options
[]
=
{
{
"dither_type"
,
"Dither type"
,
OFFSET
(
dither_type
),
AV_OPT_TYPE_INT
,
{
.
dbl
=
1
},
0
,
2
,
VE
},
{
NULL
},
};
static
const
AVClass
class
=
{
.
class_name
=
"cljr encoder"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVCodec
ff_cljr_encoder
=
{
.
name
=
"cljr"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
...
...
@@ -170,5 +191,6 @@ AVCodec ff_cljr_encoder = {
.
pix_fmts
=
(
const
enum
PixelFormat
[])
{
PIX_FMT_YUV411P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Cirrus Logic AccuPak"
),
.
priv_class
=
&
class
,
};
#endif
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