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
b405f4e9
Commit
b405f4e9
authored
Jul 14, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: Add support to specify chroma position
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
53c853e0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
10 deletions
+37
-10
options.c
libswscale/options.c
+5
-0
swscale_internal.h
libswscale/swscale_internal.h
+4
-0
utils.c
libswscale/utils.c
+27
-9
version.h
libswscale/version.h
+1
-1
No files found.
libswscale/options.c
View file @
b405f4e9
...
@@ -64,6 +64,11 @@ static const AVOption options[] = {
...
@@ -64,6 +64,11 @@ static const AVOption options[] = {
{
"param0"
,
"scaler param 0"
,
OFFSET
(
param
[
0
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
SWS_PARAM_DEFAULT
},
INT_MIN
,
INT_MAX
,
VE
},
{
"param0"
,
"scaler param 0"
,
OFFSET
(
param
[
0
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
SWS_PARAM_DEFAULT
},
INT_MIN
,
INT_MAX
,
VE
},
{
"param1"
,
"scaler param 1"
,
OFFSET
(
param
[
1
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
SWS_PARAM_DEFAULT
},
INT_MIN
,
INT_MAX
,
VE
},
{
"param1"
,
"scaler param 1"
,
OFFSET
(
param
[
1
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
SWS_PARAM_DEFAULT
},
INT_MIN
,
INT_MAX
,
VE
},
{
"src_v_chr_pos"
,
"source vertical chroma position in luma grid/256"
,
OFFSET
(
src_v_chr_pos
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
512
,
VE
},
{
"src_h_chr_pos"
,
"source horizontal chroma position in luma grid/256"
,
OFFSET
(
src_h_chr_pos
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
512
,
VE
},
{
"dst_v_chr_pos"
,
"source vertical chroma position in luma grid/256"
,
OFFSET
(
dst_v_chr_pos
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
512
,
VE
},
{
"dst_h_chr_pos"
,
"source horizontal chroma position in luma grid/256"
,
OFFSET
(
dst_h_chr_pos
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
512
,
VE
},
{
NULL
}
{
NULL
}
};
};
...
...
libswscale/swscale_internal.h
View file @
b405f4e9
...
@@ -382,6 +382,10 @@ typedef struct SwsContext {
...
@@ -382,6 +382,10 @@ typedef struct SwsContext {
int
dst0Alpha
;
int
dst0Alpha
;
int
srcXYZ
;
int
srcXYZ
;
int
dstXYZ
;
int
dstXYZ
;
int
src_h_chr_pos
;
int
dst_h_chr_pos
;
int
src_v_chr_pos
;
int
dst_v_chr_pos
;
int
yuv2rgb_y_offset
;
int
yuv2rgb_y_offset
;
int
yuv2rgb_y_coeff
;
int
yuv2rgb_y_coeff
;
int
yuv2rgb_v2r_coeff
;
int
yuv2rgb_v2r_coeff
;
...
...
libswscale/utils.c
View file @
b405f4e9
...
@@ -252,12 +252,21 @@ static double getSplineCoeff(double a, double b, double c, double d,
...
@@ -252,12 +252,21 @@ static double getSplineCoeff(double a, double b, double c, double d,
dist
-
1
.
0
);
dist
-
1
.
0
);
}
}
static
av_cold
int
get_local_pos
(
SwsContext
*
s
,
int
chr_subsample
,
int
pos
,
int
dir
)
{
if
(
pos
<
0
)
{
pos
=
(
128
<<
chr_subsample
)
-
128
;
}
pos
+=
128
;
// relative to ideal left edge
return
pos
>>
chr_subsample
;
}
static
av_cold
int
initFilter
(
int16_t
**
outFilter
,
int32_t
**
filterPos
,
static
av_cold
int
initFilter
(
int16_t
**
outFilter
,
int32_t
**
filterPos
,
int
*
outFilterSize
,
int
xInc
,
int
srcW
,
int
*
outFilterSize
,
int
xInc
,
int
srcW
,
int
dstW
,
int
filterAlign
,
int
one
,
int
dstW
,
int
filterAlign
,
int
one
,
int
flags
,
int
cpu_flags
,
int
flags
,
int
cpu_flags
,
SwsVector
*
srcFilter
,
SwsVector
*
dstFilter
,
SwsVector
*
srcFilter
,
SwsVector
*
dstFilter
,
double
param
[
2
])
double
param
[
2
]
,
int
srcPos
,
int
dstPos
)
{
{
int
i
;
int
i
;
int
filterSize
;
int
filterSize
;
...
@@ -273,7 +282,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -273,7 +282,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
// NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
// NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
FF_ALLOC_OR_GOTO
(
NULL
,
*
filterPos
,
(
dstW
+
3
)
*
sizeof
(
**
filterPos
),
fail
);
FF_ALLOC_OR_GOTO
(
NULL
,
*
filterPos
,
(
dstW
+
3
)
*
sizeof
(
**
filterPos
),
fail
);
if
(
FFABS
(
xInc
-
0x10000
)
<
10
)
{
// unscaled
if
(
FFABS
(
xInc
-
0x10000
)
<
10
&&
srcPos
==
dstPos
)
{
// unscaled
int
i
;
int
i
;
filterSize
=
1
;
filterSize
=
1
;
FF_ALLOCZ_OR_GOTO
(
NULL
,
filter
,
FF_ALLOCZ_OR_GOTO
(
NULL
,
filter
,
...
@@ -290,7 +299,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -290,7 +299,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
xInc
/
2
-
0x8000
;
xDstInSrc
=
((
srcPos
*
xInc
)
>>
8
)
-
((
dstPos
*
0x8000
)
>>
7
)
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
xx
=
(
xDstInSrc
-
((
filterSize
-
1
)
<<
15
)
+
(
1
<<
15
))
>>
16
;
int
xx
=
(
xDstInSrc
-
((
filterSize
-
1
)
<<
15
)
+
(
1
<<
15
))
>>
16
;
...
@@ -306,7 +315,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -306,7 +315,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
xInc
/
2
-
0x8000
;
xDstInSrc
=
((
srcPos
*
xInc
)
>>
8
)
-
((
dstPos
*
0x8000
)
>>
7
)
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
xx
=
(
xDstInSrc
-
((
filterSize
-
1
)
<<
15
)
+
(
1
<<
15
))
>>
16
;
int
xx
=
(
xDstInSrc
-
((
filterSize
-
1
)
<<
15
)
+
(
1
<<
15
))
>>
16
;
int
j
;
int
j
;
...
@@ -357,7 +366,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -357,7 +366,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
xInc
-
0x10000
;
xDstInSrc
=
((
srcPos
*
xInc
)
>>
7
)
-
((
dstPos
*
0x10000
)
>>
7
)
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
xx
=
(
xDstInSrc
-
((
filterSize
-
2
)
<<
16
))
/
(
1
<<
17
);
int
xx
=
(
xDstInSrc
-
((
filterSize
-
2
)
<<
16
))
/
(
1
<<
17
);
int
j
;
int
j
;
...
@@ -1392,14 +1401,18 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
...
@@ -1392,14 +1401,18 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
srcW
,
dstW
,
filterAlign
,
1
<<
14
,
srcW
,
dstW
,
filterAlign
,
1
<<
14
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BICUBIC
)
:
flags
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BICUBIC
)
:
flags
,
cpu_flags
,
srcFilter
->
lumH
,
dstFilter
->
lumH
,
cpu_flags
,
srcFilter
->
lumH
,
dstFilter
->
lumH
,
c
->
param
)
<
0
)
c
->
param
,
get_local_pos
(
c
,
0
,
0
,
0
),
get_local_pos
(
c
,
0
,
0
,
0
))
<
0
)
goto
fail
;
goto
fail
;
if
(
initFilter
(
&
c
->
hChrFilter
,
&
c
->
hChrFilterPos
,
if
(
initFilter
(
&
c
->
hChrFilter
,
&
c
->
hChrFilterPos
,
&
c
->
hChrFilterSize
,
c
->
chrXInc
,
&
c
->
hChrFilterSize
,
c
->
chrXInc
,
c
->
chrSrcW
,
c
->
chrDstW
,
filterAlign
,
1
<<
14
,
c
->
chrSrcW
,
c
->
chrDstW
,
filterAlign
,
1
<<
14
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BILINEAR
)
:
flags
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BILINEAR
)
:
flags
,
cpu_flags
,
srcFilter
->
chrH
,
dstFilter
->
chrH
,
cpu_flags
,
srcFilter
->
chrH
,
dstFilter
->
chrH
,
c
->
param
)
<
0
)
c
->
param
,
get_local_pos
(
c
,
c
->
chrSrcHSubSample
,
c
->
src_h_chr_pos
,
0
),
get_local_pos
(
c
,
c
->
chrDstHSubSample
,
c
->
dst_h_chr_pos
,
0
))
<
0
)
goto
fail
;
goto
fail
;
}
}
}
// initialize horizontal stuff
}
// initialize horizontal stuff
...
@@ -1415,14 +1428,19 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
...
@@ -1415,14 +1428,19 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
c
->
lumYInc
,
srcH
,
dstH
,
filterAlign
,
(
1
<<
12
),
c
->
lumYInc
,
srcH
,
dstH
,
filterAlign
,
(
1
<<
12
),
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BICUBIC
)
:
flags
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BICUBIC
)
:
flags
,
cpu_flags
,
srcFilter
->
lumV
,
dstFilter
->
lumV
,
cpu_flags
,
srcFilter
->
lumV
,
dstFilter
->
lumV
,
c
->
param
)
<
0
)
c
->
param
,
get_local_pos
(
c
,
0
,
0
,
1
),
get_local_pos
(
c
,
0
,
0
,
1
))
<
0
)
goto
fail
;
goto
fail
;
if
(
initFilter
(
&
c
->
vChrFilter
,
&
c
->
vChrFilterPos
,
&
c
->
vChrFilterSize
,
if
(
initFilter
(
&
c
->
vChrFilter
,
&
c
->
vChrFilterPos
,
&
c
->
vChrFilterSize
,
c
->
chrYInc
,
c
->
chrSrcH
,
c
->
chrDstH
,
c
->
chrYInc
,
c
->
chrSrcH
,
c
->
chrDstH
,
filterAlign
,
(
1
<<
12
),
filterAlign
,
(
1
<<
12
),
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BILINEAR
)
:
flags
,
(
flags
&
SWS_BICUBLIN
)
?
(
flags
|
SWS_BILINEAR
)
:
flags
,
cpu_flags
,
srcFilter
->
chrV
,
dstFilter
->
chrV
,
cpu_flags
,
srcFilter
->
chrV
,
dstFilter
->
chrV
,
c
->
param
)
<
0
)
c
->
param
,
get_local_pos
(
c
,
c
->
chrSrcVSubSample
,
c
->
src_v_chr_pos
,
1
),
get_local_pos
(
c
,
c
->
chrDstVSubSample
,
c
->
dst_v_chr_pos
,
1
))
<
0
)
goto
fail
;
goto
fail
;
#if HAVE_ALTIVEC
#if HAVE_ALTIVEC
...
...
libswscale/version.h
View file @
b405f4e9
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "libavutil/avutil.h"
#include "libavutil/avutil.h"
#define LIBSWSCALE_VERSION_MAJOR 2
#define LIBSWSCALE_VERSION_MAJOR 2
#define LIBSWSCALE_VERSION_MINOR
3
#define LIBSWSCALE_VERSION_MINOR
4
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
...
...
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