Skip to content

Commit

Permalink
Merge pull request #2648 from mhfan/master
Browse files Browse the repository at this point in the history
fix failure and warning on GPAC_FIXED_POINT
  • Loading branch information
jeanlf committed Dec 12, 2023
2 parents ee257ba + 9c4dfa1 commit 40bcdf2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/evg/ftgrays.c
Expand Up @@ -586,7 +586,7 @@ static void gray_hline(EVGRasterCtx *raster, TCoord x, TCoord y, TPos area, in

span = raster->gray_spans;
} else {
if (count==raster->alloc_gray_spans) {
if ((u32) count==raster->alloc_gray_spans) {
raster->alloc_gray_spans*=2;
raster->gray_spans = gf_realloc(raster->gray_spans, sizeof(EVG_Span)*raster->alloc_gray_spans);
span = raster->gray_spans + count - 1;
Expand Down
6 changes: 3 additions & 3 deletions src/evg/raster_yuv.c
Expand Up @@ -594,7 +594,7 @@ GF_Err evg_surface_clear_yuv420p(GF_EVGSurface *_surf, GF_IRect rc, GF_Color col

gf_evg_rgb_to_yuv(surf, col, &cy, &cb, &cr);

if (!rc.x && !rc.y && (rc.width==_surf->width) && (rc.height==_surf->height)) {
if (!rc.x && !rc.y && ((u32) rc.width==_surf->width) && ((u32) rc.height==_surf->height)) {
memset(pY, cy, _surf->pitch_y * _surf->height);
memset(pU, cb, _surf->pitch_y/2 * _surf->height/2);
memset(pV, cr, _surf->pitch_y/2 * _surf->height/2);
Expand Down Expand Up @@ -891,7 +891,7 @@ GF_Err evg_surface_clear_yuv422p(GF_EVGSurface *_surf, GF_IRect rc, GF_Color col

gf_evg_rgb_to_yuv(surf, col, &cy, &cb, &cr);

if (!rc.x && !rc.y && (rc.width==_surf->width) && (rc.height==_surf->height)) {
if (!rc.x && !rc.y && ((u32) rc.width==_surf->width) && ((u32) rc.height==_surf->height)) {
memset(pY, cy, _surf->pitch_y * _surf->height);
memset(pU, cb, _surf->pitch_y/2 * _surf->height);
memset(pV, cr, _surf->pitch_y/2 * _surf->height);
Expand Down Expand Up @@ -1074,7 +1074,7 @@ GF_Err evg_surface_clear_yuv444p(GF_EVGSurface *_surf, GF_IRect rc, GF_Color col

gf_evg_rgb_to_yuv(surf, col, &cy, &cb, &cr);

if (!rc.x && !rc.y && (rc.width==_surf->width) && (rc.height==_surf->height)) {
if (!rc.x && !rc.y && ((u32) rc.width==_surf->width) && ((u32) rc.height==_surf->height)) {
memset(pY, cy, _surf->pitch_y * _surf->height);
memset(pU, cb, _surf->pitch_y * _surf->height);
memset(pV, cr, _surf->pitch_y * _surf->height);
Expand Down
4 changes: 2 additions & 2 deletions src/evg/stencil.c
Expand Up @@ -324,8 +324,8 @@ GF_Color gf_evg_stencil_get_brush_color(GF_EVGStencil * st)
//we map texture coords, pt1 is {0,0} pt2 is {1,0} pt3 is {0,1}
//y flip is done by switching the points in evg_raster_render_path_3d
#define PERSP_APPLY \
Float ix = ((Float) pbc2) / persp_denum;\
Float iy = ((Float) pbc3) / persp_denum;\
Fixed ix = FLT2FIX(pbc2 / persp_denum);\
Fixed iy = FLT2FIX(pbc3 / persp_denum);\
pbc2 += pbc2_inc;\
pbc3 += pbc3_inc;\
persp_denum += pers_denum_inc;
Expand Down
14 changes: 7 additions & 7 deletions src/utils/math.c
Expand Up @@ -1275,9 +1275,9 @@ GF_Vec gf_vec_cross_p(GF_Vec *v1, GF_Vec *v2)
res.z<<=16;
return res;
}
res.x = gf_mulfix(v1.y, v2.z) - gf_mulfix(v2.y, v1.z);
res.y = gf_mulfix(v2.x, v1.z) - gf_mulfix(v1.x, v2.z);
res.z = gf_mulfix(v1.x, v2.y) - gf_mulfix(v2.x, v1.y);
res.x = gf_mulfix(v1->y, v2->z) - gf_mulfix(v2->y, v1->z);
res.y = gf_mulfix(v2->x, v1->z) - gf_mulfix(v1->x, v2->z);
res.z = gf_mulfix(v1->x, v2->y) - gf_mulfix(v2->x, v1->y);

#endif
return res;
Expand Down Expand Up @@ -2090,8 +2090,8 @@ Bool gf_mx_inverse_4x4(GF_Matrix *mx)
}

/* choose pivot - or die */
if (fabs(r3[1]) > fabs(r2[1])) SWAP_ROWS(r3, r2);
if (fabs(r2[1]) > fabs(r1[1])) SWAP_ROWS(r2, r1);
if (ABS(r3[1]) > ABS(r2[1])) SWAP_ROWS(r3, r2);
if (ABS(r2[1]) > ABS(r1[1])) SWAP_ROWS(r2, r1);
if (r1[1]==0) return GF_FALSE;

/* eliminate second variable */
Expand Down Expand Up @@ -2123,7 +2123,7 @@ Bool gf_mx_inverse_4x4(GF_Matrix *mx)
}

/* choose pivot - or die */
if (fabs(r3[2]) > fabs(r2[2])) SWAP_ROWS(r3, r2);
if (ABS(r3[2]) > ABS(r2[2])) SWAP_ROWS(r3, r2);
if (r2[2]==0) return GF_FALSE;

/* eliminate third variable */
Expand Down Expand Up @@ -2229,7 +2229,7 @@ Bool gf_plane_intersect_plane(GF_Plane *plane, GF_Plane *with, GF_Vec *linepoint
Fixed fn01 = gf_vec_dot(plane->normal, with->normal);
Fixed fn11 = gf_vec_len(with->normal);
Fixed det = gf_mulfix(fn00,fn11) - gf_mulfix(fn01,fn01);
if (fabs(det) > FIX_EPSILON) {
if (ABS(det) > FIX_EPSILON) {
Fixed fc0, fc1;
GF_Vec v1, v2;
fc0 = gf_divfix( gf_mulfix(fn11, -plane->d) + gf_mulfix(fn01, with->d) , det);
Expand Down
4 changes: 1 addition & 3 deletions src/utils/path2d.c
Expand Up @@ -166,7 +166,6 @@ GF_Err gf_path_add_line_to_vec(GF_Path *gp, GF_Point2D *pt) {
GF_EXPORT
GF_Err gf_path_close(GF_Path *gp)
{
Fixed diff;
GF_Point2D start, end;
if (!gp || !gp->n_contours) return GF_BAD_PARAM;

Expand All @@ -175,8 +174,7 @@ GF_Err gf_path_close(GF_Path *gp)
end = gp->points[gp->n_points-1];
end.x -= start.x;
end.y -= start.y;
diff = gf_mulfix(end.x, end.x) + gf_mulfix(end.y, end.y);
if (ABS(diff) > FIX_ONE/1000) {
if (FIX_ONE/100 < ABS(end.x) || FIX_ONE/100 < ABS(end.y)) {
GF_Err e = gf_path_add_line_to(gp, start.x, start.y);
if (e) return e;
}
Expand Down

0 comments on commit 40bcdf2

Please sign in to comment.