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
f580719b
Commit
f580719b
authored
Sep 02, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale/swscale: Factor bottom to top handling
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
5dcd913a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
32 deletions
+19
-32
swscale.c
libswscale/swscale.c
+19
-32
No files found.
libswscale/swscale.c
View file @
f580719b
...
@@ -761,6 +761,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
...
@@ -761,6 +761,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
uint8_t
*
dst2
[
4
];
uint8_t
*
dst2
[
4
];
uint8_t
*
rgb0_tmp
=
NULL
;
uint8_t
*
rgb0_tmp
=
NULL
;
int
macro_height
=
isBayer
(
c
->
srcFormat
)
?
2
:
(
1
<<
c
->
chrSrcVSubSample
);
int
macro_height
=
isBayer
(
c
->
srcFormat
)
?
2
:
(
1
<<
c
->
chrSrcVSubSample
);
// copy strides, so they can safely be modified
int
srcStride2
[
4
]
=
{
srcStride
[
0
],
srcStride
[
1
],
srcStride
[
2
],
srcStride
[
3
]
};
int
dstStride2
[
4
]
=
{
dstStride
[
0
],
dstStride
[
1
],
dstStride
[
2
],
dstStride
[
3
]
};
int
srcSliceY_internal
=
srcSliceY
;
if
(
!
srcStride
||
!
dstStride
||
!
dst
||
!
srcSlice
)
{
if
(
!
srcStride
||
!
dstStride
||
!
dst
||
!
srcSlice
)
{
av_log
(
c
,
AV_LOG_ERROR
,
"One of the input parameters to sws_scale() is NULL, please check the calling code
\n
"
);
av_log
(
c
,
AV_LOG_ERROR
,
"One of the input parameters to sws_scale() is NULL, please check the calling code
\n
"
);
...
@@ -943,30 +949,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
...
@@ -943,30 +949,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
memset
(
c
->
dither_error
[
i
],
0
,
sizeof
(
c
->
dither_error
[
0
][
0
])
*
(
c
->
dstW
+
2
));
memset
(
c
->
dither_error
[
i
],
0
,
sizeof
(
c
->
dither_error
[
0
][
0
])
*
(
c
->
dstW
+
2
));
if
(
c
->
sliceDir
!=
1
)
{
// copy strides, so they can safely be modified
if
(
c
->
sliceDir
==
1
)
{
// slices go from top to bottom
int
srcStride2
[
4
]
=
{
srcStride
[
0
],
srcStride
[
1
],
srcStride
[
2
],
srcStride
[
3
]
};
int
dstStride2
[
4
]
=
{
dstStride
[
0
],
dstStride
[
1
],
dstStride
[
2
],
dstStride
[
3
]
};
reset_ptr
(
src2
,
c
->
srcFormat
);
reset_ptr
((
void
*
)
dst2
,
c
->
dstFormat
);
/* reset slice direction at end of frame */
if
(
srcSliceY
+
srcSliceH
==
c
->
srcH
)
c
->
sliceDir
=
0
;
ret
=
c
->
swscale
(
c
,
src2
,
srcStride2
,
srcSliceY
,
srcSliceH
,
dst2
,
dstStride2
);
}
else
{
// slices go from bottom to top => we flip the image internally
// slices go from bottom to top => we flip the image internally
int
srcStride2
[
4
]
=
{
-
srcStride
[
0
],
-
srcStride
[
1
],
-
srcStride
[
2
],
for
(
i
=
0
;
i
<
4
;
i
++
)
{
-
srcStride
[
3
]
}
;
srcStride2
[
i
]
*=
-
1
;
int
dstStride2
[
4
]
=
{
-
dstStride
[
0
],
-
dstStride
[
1
],
-
dstStride
[
2
],
dstStride2
[
i
]
*=
-
1
;
-
dstStride
[
3
]
};
}
src2
[
0
]
+=
(
srcSliceH
-
1
)
*
srcStride
[
0
];
src2
[
0
]
+=
(
srcSliceH
-
1
)
*
srcStride
[
0
];
if
(
!
usePal
(
c
->
srcFormat
))
if
(
!
usePal
(
c
->
srcFormat
))
...
@@ -978,16 +966,15 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
...
@@ -978,16 +966,15 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
dst2
[
2
]
+=
((
c
->
dstH
>>
c
->
chrDstVSubSample
)
-
1
)
*
dstStride
[
2
];
dst2
[
2
]
+=
((
c
->
dstH
>>
c
->
chrDstVSubSample
)
-
1
)
*
dstStride
[
2
];
dst2
[
3
]
+=
(
c
->
dstH
-
1
)
*
dstStride
[
3
];
dst2
[
3
]
+=
(
c
->
dstH
-
1
)
*
dstStride
[
3
];
reset_ptr
(
src2
,
c
->
srcFormat
);
srcSliceY_internal
=
c
->
srcH
-
srcSliceY
-
srcSliceH
;
reset_ptr
((
void
*
)
dst2
,
c
->
dstFormat
);
/* reset slice direction at end of frame */
if
(
!
srcSliceY
)
c
->
sliceDir
=
0
;
ret
=
c
->
swscale
(
c
,
src2
,
srcStride2
,
c
->
srcH
-
srcSliceY
-
srcSliceH
,
srcSliceH
,
dst2
,
dstStride2
);
}
}
reset_ptr
(
src2
,
c
->
srcFormat
);
reset_ptr
((
void
*
)
dst2
,
c
->
dstFormat
);
/* reset slice direction at end of frame */
if
(
srcSliceY_internal
+
srcSliceH
==
c
->
srcH
)
c
->
sliceDir
=
0
;
ret
=
c
->
swscale
(
c
,
src2
,
srcStride2
,
srcSliceY_internal
,
srcSliceH
,
dst2
,
dstStride2
);
if
(
c
->
dstXYZ
&&
!
(
c
->
srcXYZ
&&
c
->
srcW
==
c
->
dstW
&&
c
->
srcH
==
c
->
dstH
))
{
if
(
c
->
dstXYZ
&&
!
(
c
->
srcXYZ
&&
c
->
srcW
==
c
->
dstW
&&
c
->
srcH
==
c
->
dstH
))
{
...
...
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