Skip to content

Commit

Permalink
[FIX] Fix several memory leaks using Leptonica API for hardcoded subt…
Browse files Browse the repository at this point in the history
…itle extraction (#1105)

* Rewritten Tesseract and Leptonica imports

* Fixed memory leak extracting hardcoded subtitles

* Minor code enhancements and cleanups

* Fixed memory leak using function pixSauvolaBinarize

* Updated changelog
  • Loading branch information
dbarelop authored and cfsmp3 committed Sep 12, 2019
1 parent 8a9d924 commit 7598225
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 146 deletions.
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.89 (TBD)
-----------------
- Fix: ccx_demuxer_mxf.c: Parse framerate from MXF captions to fix caption timings.
- Fix: hardsubx_decoder.c: Fix memory leaks using Leptonica API.
- Fix: linux/Makefile.am: added some sources to enable rpms to be created.

0.88 (2019-05-21)
Expand Down
4 changes: 2 additions & 2 deletions src/lib_ccx/hardsubx.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef ENABLE_HARDSUBX
#include <tesseract/capi.h>
#include <leptonica/allheaders.h>
#include "hardsubx.h"
#include "tesseract/capi.h"
#include "allheaders.h"
#include "ocr.h"
#include "utility.h"

Expand Down
8 changes: 4 additions & 4 deletions src/lib_ccx/hardsubx.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include "allheaders.h"
#include "tesseract/capi.h"
#include <leptonica/allheaders.h>
#include <tesseract/capi.h>

enum hardsubx_color_type
{
Expand Down Expand Up @@ -86,9 +86,9 @@ void _dinit_hardsubx(struct lib_hardsubx_ctx **ctx);
int hardsubx_process_data(struct lib_hardsubx_ctx *ctx);

//hardsubx_decoder.c
int hardsubx_process_frames_linear(struct lib_hardsubx_ctx *ctx, struct encoder_ctx *enc_ctx);
void hardsubx_process_frames_linear(struct lib_hardsubx_ctx *ctx, struct encoder_ctx *enc_ctx);
int hardsubx_process_frames_tickertext(struct lib_hardsubx_ctx *ctx, struct encoder_ctx *enc_ctx);
int hardsubx_process_frames_binary(struct lib_hardsubx_ctx *ctx);
void hardsubx_process_frames_binary(struct lib_hardsubx_ctx *ctx);
char* _process_frame_white_basic(struct lib_hardsubx_ctx *ctx, AVFrame *frame, int width, int height, int index);
char *_process_frame_color_basic(struct lib_hardsubx_ctx *ctx, AVFrame *frame, int width, int height, int index);
void _display_frame(struct lib_hardsubx_ctx *ctx, AVFrame *frame, int width, int height, int timestamp);
Expand Down
2 changes: 1 addition & 1 deletion src/lib_ccx/hardsubx_classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libswscale/swscale.h>
#include "allheaders.h"
#include <leptonica/allheaders.h>
#include "hardsubx.h"

char *get_ocr_text_simple(struct lib_hardsubx_ctx *ctx, PIX *image)
Expand Down
Loading

0 comments on commit 7598225

Please sign in to comment.