|
|
@ -24,6 +24,7 @@
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
#include "paddle/fluid/operators/detection/gpc.h"
|
|
|
|
#include "paddle/fluid/operators/detection/gpc.h"
|
|
|
|
|
|
|
|
#include "paddle/fluid/platform/enforce.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace gpc {
|
|
|
|
namespace gpc {
|
|
|
|
|
|
|
|
|
|
|
@ -689,6 +690,7 @@ static bbox *create_contour_bboxes(gpc_polygon *p) {
|
|
|
|
|
|
|
|
|
|
|
|
gpc_malloc<bbox>(box, p->num_contours * sizeof(bbox),
|
|
|
|
gpc_malloc<bbox>(box, p->num_contours * sizeof(bbox),
|
|
|
|
const_cast<char *>("Bounding box creation"));
|
|
|
|
const_cast<char *>("Bounding box creation"));
|
|
|
|
|
|
|
|
PADDLE_ENFORCE_NOT_NULL(box);
|
|
|
|
|
|
|
|
|
|
|
|
/* Construct contour bounding boxes */
|
|
|
|
/* Construct contour bounding boxes */
|
|
|
|
for (c = 0; c < p->num_contours; c++) {
|
|
|
|
for (c = 0; c < p->num_contours; c++) {
|
|
|
@ -852,6 +854,7 @@ void gpc_add_contour(gpc_polygon *p, gpc_vertex_list *new_contour, int hole) {
|
|
|
|
/* Create an extended hole array */
|
|
|
|
/* Create an extended hole array */
|
|
|
|
gpc_malloc<int>(extended_hole, (p->num_contours + 1) * sizeof(int),
|
|
|
|
gpc_malloc<int>(extended_hole, (p->num_contours + 1) * sizeof(int),
|
|
|
|
const_cast<char *>("contour hole addition"));
|
|
|
|
const_cast<char *>("contour hole addition"));
|
|
|
|
|
|
|
|
PADDLE_ENFORCE_NOT_NULL(extended_hole);
|
|
|
|
|
|
|
|
|
|
|
|
/* Create an extended contour array */
|
|
|
|
/* Create an extended contour array */
|
|
|
|
gpc_malloc<gpc_vertex_list>(extended_contour,
|
|
|
|
gpc_malloc<gpc_vertex_list>(extended_contour,
|
|
|
@ -969,6 +972,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
|
|
|
|
/* Build scanbeam table from scanbeam tree */
|
|
|
|
/* Build scanbeam table from scanbeam tree */
|
|
|
|
gpc_malloc<double>(sbt, sbt_entries * sizeof(double),
|
|
|
|
gpc_malloc<double>(sbt, sbt_entries * sizeof(double),
|
|
|
|
const_cast<char *>("sbt creation"));
|
|
|
|
const_cast<char *>("sbt creation"));
|
|
|
|
|
|
|
|
PADDLE_ENFORCE_NOT_NULL(sbt);
|
|
|
|
build_sbt(&scanbeam, sbt, sbtree);
|
|
|
|
build_sbt(&scanbeam, sbt, sbtree);
|
|
|
|
scanbeam = 0;
|
|
|
|
scanbeam = 0;
|
|
|
|
free_sbtree(&sbtree);
|
|
|
|
free_sbtree(&sbtree);
|
|
|
@ -1604,6 +1608,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
|
|
|
|
/* Build scanbeam table from scanbeam tree */
|
|
|
|
/* Build scanbeam table from scanbeam tree */
|
|
|
|
gpc_malloc<double>(sbt, sbt_entries * sizeof(double),
|
|
|
|
gpc_malloc<double>(sbt, sbt_entries * sizeof(double),
|
|
|
|
const_cast<char *>("sbt creation"));
|
|
|
|
const_cast<char *>("sbt creation"));
|
|
|
|
|
|
|
|
PADDLE_ENFORCE_NOT_NULL(sbt);
|
|
|
|
build_sbt(&scanbeam, sbt, sbtree);
|
|
|
|
build_sbt(&scanbeam, sbt, sbtree);
|
|
|
|
scanbeam = 0;
|
|
|
|
scanbeam = 0;
|
|
|
|
free_sbtree(&sbtree);
|
|
|
|
free_sbtree(&sbtree);
|
|
|
|