Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Issue 12211067: Change prototypes to yuv_convert_simd_x86 yasm and equivalent C to portably sign extend int args (Closed)

Created:
7 years, 10 months ago by wolenetz
Modified:
7 years, 10 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org, jschuh, scherkus (not reviewing)
Visibility:
Public.

Description

Change prototypes to yuv_convert_simd_x86 yasm and equivalent C to portably sign extend int args Inspection of stack prepared by caller shows it is indeed copying dword, not qword, for 32-bit arguments on Win64, and the background stack is not zeroed. Incorrect function result, access violations or worse (not-immediately caught side effect of corrupted memory within process address space) could easily result from current win64 usage of these routines. One solution, implemented here, is to change the function prototypes for the yasm routines to take ptrdiff_t arguments instead of int args. The C version of the equivalent code needs matching prototype (due to the choose proc routines), so they are updated too. Another, probably slightly less performant, solution would be to change the asm routines to conditionally sign-extend when loading int (32-bit) parameters on x64. None of these routines currently use int passed in directly as register; I don't know if zero-extension of registers would be required if they did. Yet another solution would be to switch to VS2012 and redo the yasm routines using compiler intrinsics completely (not supported in VS2010). Note, some other media_unittests, namely those involving ffmpeg, currently give access violation on Win64. There is a separate ffmpeg fix in progress https://gerrit.chromium.org/gerrit/#/c/43063/. With PS1 or PS2 applied along with the ffmpeg fix, Win64 media_unittests pass. Detail: The following are sign-extended in prototype: simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertARGBToYUVRow_SSSE3 simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertRGBToYUVRow_SSSE3 simd/convert_yuv_to_rgb_mmx.asm:%define SYMBOL ConvertYUVToRGB32Row_MMX simd/convert_yuv_to_rgb_sse.asm:%define SYMBOL ConvertYUVToRGB32Row_SSE simd/scale_yuv_to_rgb_mmx.asm:%define SYMBOL ScaleYUVToRGB32Row_MMX simd/scale_yuv_to_rgb_sse.asm:%define SYMBOL ScaleYUVToRGB32Row_SSE simd/scale_yuv_to_rgb_sse2_x64.asm:%define SYMBOL ScaleYUVToRGB32Row_SSE2_X64 simd/linear_scale_yuv_to_rgb_mmx.asm:%define SYMBOL LinearScaleYUVToRGB32Row_MMX simd/linear_scale_yuv_to_rgb_sse.asm:%define SYMBOL LinearScaleYUVToRGB32Row_SSE simd/linear_scale_yuv_to_rgb_mmx_x64.asm:%define SYMBOL LinearScaleYUVToRGB32Row_MMX_X64 The following C versions and the corresponding typedefs also needed updating to match: ConvertYUVToRGB32Row_C ScaleYUVToRGB32Row_C LinearScaleYUVToRGB32Row_C The following yasm routines have no C prototype, nor do they appear to be used anywhere. I updated their comments though to match the same prototype change that would be necessary. simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertARGBToYUVEven_SSSE3 simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertARGBToYUVOdd_SSSE3 simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertRGBToYUVEven_SSSE3 simd/convert_rgb_to_yuv_ssse3.asm:%define SYMBOL ConvertRGBToYUVOdd_SSSE3 BUG=174160 TEST=with https://gerrit.chromium.org/gerrit/#/c/43063/ also applied, all win64 media_unittests non-disabled test cases pass R=hclam@chromium.org R=dalecurtis@chromium.org R=rbultje@chromium.org CC=jschuh@chromium.org CC=scherkus@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=182407

Patch Set 1 #

Patch Set 2 : Use ptrdiff_t to portably sign-extend yuv_convert yasm routines' int args #

Total comments: 2

Patch Set 3 : Remove extra line #

Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -47 lines) Patch
M media/base/simd/convert_rgb_to_yuv_ssse3.h View 1 1 chunk +8 lines, -2 lines 0 comments Download
M media/base/simd/convert_rgb_to_yuv_ssse3.asm View 1 6 chunks +6 lines, -6 lines 0 comments Download
M media/base/simd/convert_yuv_to_rgb.h View 1 2 2 chunks +30 lines, -22 lines 0 comments Download
M media/base/simd/convert_yuv_to_rgb_c.cc View 1 3 chunks +5 lines, -5 lines 0 comments Download
M media/base/simd/convert_yuv_to_rgb_mmx.asm View 1 1 chunk +1 line, -1 line 0 comments Download
M media/base/simd/convert_yuv_to_rgb_sse.asm View 1 1 chunk +1 line, -1 line 0 comments Download
M media/base/simd/linear_scale_yuv_to_rgb_mmx.asm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm View 1 1 chunk +6 lines, -0 lines 0 comments Download
M media/base/simd/linear_scale_yuv_to_rgb_sse.asm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/simd/scale_yuv_to_rgb_mmx.asm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/simd/scale_yuv_to_rgb_sse.asm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/simd/scale_yuv_to_rgb_sse2_x64.asm View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
wolenetz
Please review. Thanks, Matt
7 years, 10 months ago (2013-02-07 06:04:34 UTC) #1
DaleCurtis
On 2013/02/07 06:04:34, wolenetz wrote: > Please review. > > Thanks, > Matt Do Ronald's ...
7 years, 10 months ago (2013-02-07 21:12:13 UTC) #2
wolenetz
On 2013/02/07 21:12:13, DaleCurtis wrote: > On 2013/02/07 06:04:34, wolenetz wrote: > > Please review. ...
7 years, 10 months ago (2013-02-07 21:31:06 UTC) #3
wolenetz
Please review PS2. rbultje@, dalecurtis@ and hclam@: please review all pieces of PS2. Thanks! Matt
7 years, 10 months ago (2013-02-12 19:48:22 UTC) #4
wolenetz
I'll pend an upload of PS3 with the whitespace fix on any other review comments ...
7 years, 10 months ago (2013-02-12 19:52:12 UTC) #5
DaleCurtis
ooc, I don't suppose size_t is zero extended? it would make a more logical choice.
7 years, 10 months ago (2013-02-12 19:52:33 UTC) #6
wolenetz
On 2013/02/12 19:52:33, DaleCurtis wrote: > ooc, I don't suppose size_t is zero extended? it ...
7 years, 10 months ago (2013-02-12 20:02:21 UTC) #7
wolenetz
On 2013/02/12 20:02:21, wolenetz wrote: > On 2013/02/12 19:52:33, DaleCurtis wrote: > > ooc, I ...
7 years, 10 months ago (2013-02-12 20:53:43 UTC) #8
rbultje1
ptrdiff_t is syntactically better, since you're incrementing a pointer by a number that is a ...
7 years, 10 months ago (2013-02-12 21:39:44 UTC) #9
DaleCurtis
this lgtm to me given the above arguments.
7 years, 10 months ago (2013-02-12 21:42:05 UTC) #10
wolenetz
PS3 is uploaded. hclam@ and rbultje@: please review all Thanks! Matt https://codereview.chromium.org/12211067/diff/4001/media/base/simd/convert_yuv_to_rgb.h File media/base/simd/convert_yuv_to_rgb.h (right): ...
7 years, 10 months ago (2013-02-12 22:30:05 UTC) #11
rbultje1
how are the *_x64 files different from the non-*_x64 files?
7 years, 10 months ago (2013-02-12 22:35:03 UTC) #12
wolenetz
On 2013/02/12 22:35:03, rbultje1 wrote: > how are the *_x64 files different from the non-*_x64 ...
7 years, 10 months ago (2013-02-12 23:23:12 UTC) #13
Alpha Left Google
The _x64 files are specifically optimized for x64 that use more registers or xmm registers. ...
7 years, 10 months ago (2013-02-13 00:14:24 UTC) #14
wolenetz
On 2013/02/13 00:14:24, Alpha wrote: > The _x64 files are specifically optimized for x64 that ...
7 years, 10 months ago (2013-02-13 18:25:52 UTC) #15
Alpha Left Google
LGTM.
7 years, 10 months ago (2013-02-13 18:28:40 UTC) #16
rbultje1
lgtm too.
7 years, 10 months ago (2013-02-13 18:29:45 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wolenetz@chromium.org/12211067/11001
7 years, 10 months ago (2013-02-13 18:31:59 UTC) #18
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 10 months ago (2013-02-13 19:10:44 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wolenetz@chromium.org/12211067/11001
7 years, 10 months ago (2013-02-13 19:44:13 UTC) #20
commit-bot: I haz the power
7 years, 10 months ago (2013-02-14 07:33:00 UTC) #21
Message was sent while issue was closed.
Change committed as 182407

Powered by Google App Engine
This is Rietveld 408576698