12 lines
32 KiB
Go
Raw Normal View History

2020-08-27 21:45:09 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2020-11-11 18:48:37 +00:00
package classer ;import (_d "github.com/unidoc/unipdf/v3/common";_cb "github.com/unidoc/unipdf/v3/internal/jbig2/basic";_b "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_e "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_g "image";_ce "math";);func (_fcfc *Classer )classifyRankHouseNonOne (_bce *_b .Boxes ,_fda ,_daa ,_ceb *_b .Bitmaps ,_bdbg *_b .Points ,_fgg *_cb .NumSlice ,_bfb int )(_fca error ){const _feb ="\u0043\u006c\u0061\u0073s\u0065\u0072\u002e\u0063\u006c\u0061\u0073\u0073\u0069\u0066y\u0052a\u006e\u006b\u0048\u006f\u0075\u0073\u0065O\u006e\u0065";var (_aec ,_ace ,_dgfg ,_adg float32 ;_dad ,_dagd ,_gdd int ;_decg ,_ceed ,_cae ,_cfb ,_dce *_b .Bitmap ;_bdbc ,_baa bool ;);_ceba :=_b .MakePixelSumTab8 ();for _bdc :=0;_bdc < len (_fda .Values );_bdc ++{if _ceed ,_fca =_daa .GetBitmap (_bdc );_fca !=nil {return _e .Wrap (_fca ,_feb ,"b\u006d\u0073\u0031\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};if _dad ,_fca =_fgg .GetInt (_bdc );_fca !=nil {_d .Log .Trace ("\u0047\u0065t\u0074\u0069\u006e\u0067 \u0046\u0047T\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u0073 \u0061\u0074\u003a\u0020\u0025\u0064\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_bdc ,_fca );};if _cae ,_fca =_ceb .GetBitmap (_bdc );_fca !=nil {return _e .Wrap (_fca ,_feb ,"b\u006d\u0073\u0032\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};if _aec ,_ace ,_fca =_bdbg .GetGeometry (_bdc );_fca !=nil {return _e .Wrapf (_fca ,_feb ,"\u0070t\u0061[\u0069\u005d\u002e\u0047\u0065\u006f\u006d\u0065\u0074\u0072\u0079");};_adgd :=len (_fcfc .UndilatedTemplates .Values );_bdbc =false ;_ffe :=_edd (_fcfc ,_ceed );for _gdd =_ffe .Next ();_gdd > -1;{if _cfb ,_fca =_fcfc .UndilatedTemplates .GetBitmap (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0070\u0069\u0078\u0061\u0074\u002e\u005b\u0069\u0043l\u0061\u0073\u0073\u005d");};if _dagd ,_fca =_fcfc .FgTemplates .GetInt (_gdd );_fca !=nil {_d .Log .Trace ("\u0047\u0065\u0074\u0074\u0069\u006eg\u0020\u0046\u0047\u0054\u0065\u006d\u0070\u006c\u0061\u0074\u0065\u005b\u0025d\u005d\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_gdd ,_fca );};if _dce ,_fca =_fcfc .DilatedTemplates .GetBitmap (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0070\u0069\u0078\u0061\u0074\u0064\u005b\u0069\u0043l\u0061\u0073\u0073\u005d");};if _dgfg ,_adg ,_fca =_fcfc .CentroidPointsTemplates .GetGeometry (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0043\u0065\u006et\u0072\u006f\u0069\u0064P\u006f\u0069\u006e\u0074\u0073\u0054\u0065m\u0070\u006c\u0061\u0074\u0065\u0073\u005b\u0069\u0043\u006c\u0061\u0073\u0073\u005d");};_baa ,_fca =_b .RankHausTest (_ceed ,_cae ,_cfb ,_dce ,_aec -_dgfg ,_ace -_adg ,MaxDiffWidth ,MaxDiffHeight ,_dad ,_dagd ,float32 (_fcfc .Settings .RankHaus ),_ceba );if _fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _baa {_bdbc =true ;if _fca =_fcfc .ClassIDs .Add (_gdd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _fca =_fcfc .ComponentPageNumbers .Add (_bfb );_fca !=nil {return _e .Wrap (_fca ,_feb ,"");};if _fcfc .Settings .KeepClassInstances {_ffc ,_fdg :=_fcfc .ClassInstances .GetBitmaps (_gdd );if _fdg !=nil {return _e .Wrap (_fdg ,_feb ,"\u0063\u002e\u0050\u0069\u0078\u0061\u0061\u002e\u0047\u0065\u0074B\u0069\u0074\u006d\u0061\u0070\u0073\u0028\u0069\u0043\u006ca\u0073\u0073\u0029");};if _decg ,_fdg =_fda .GetBitmap (_bdc );_fdg !=nil {return _e .Wrap (_fdg ,_feb ,"\u0070i\u0078\u0061\u005b\u0069\u005d");};_ffc .Values =append (_ffc .Values ,_decg );_aeaa ,_fdg :=_bce .Get (_bdc );if _fdg !=nil {return _e .Wrap (_fdg ,_feb ,"b\u006f\u0078\u0061\u002e\u0047\u0065\u0074\u0028\u0069\u0029");};_ffc .Boxes =append (_ffc .Boxes ,_aeaa );};break ;};};if !_bdbc {if _fca =_fcfc .ClassIDs .Add (_adgd );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0021\u0066\u006f\u0075\u006e\u0064");};if _fca =_fcfc .ComponentPageNumbers .Add (_bfb );_fca !=nil {return _e .Wrap (_fca ,_feb ,"\u0021\u0066\u006f\u0075\u006e\u0064");};_bebc :=&_b .Bitmaps {};_decg =_fda .Values [_bdc ];_bebc .AddBitmap (_decg );_egea ,_efaf :=_decg .Width ,_decg .Height ;_fcfc .TemplatesSize .Add (uin