media/libvpx/vp8/decoder/onyxd_int.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /*
     2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     3  *
     4  *  Use of this source code is governed by a BSD-style license
     5  *  that can be found in the LICENSE file in the root of the source
     6  *  tree. An additional intellectual property rights grant can be found
     7  *  in the file PATENTS.  All contributing project authors may
     8  *  be found in the AUTHORS file in the root of the source tree.
     9  */
    12 #ifndef ONYXD_INT_H_
    13 #define ONYXD_INT_H_
    15 #include "vpx_config.h"
    16 #include "vp8/common/onyxd.h"
    17 #include "treereader.h"
    18 #include "vp8/common/onyxc_int.h"
    19 #include "vp8/common/threading.h"
    21 #if CONFIG_ERROR_CONCEALMENT
    22 #include "ec_types.h"
    23 #endif
    25 typedef struct
    26 {
    27     int ithread;
    28     void *ptr1;
    29     void *ptr2;
    30 } DECODETHREAD_DATA;
    32 typedef struct
    33 {
    34     MACROBLOCKD  mbd;
    35 } MB_ROW_DEC;
    38 typedef struct
    39 {
    40     int enabled;
    41     unsigned int count;
    42     const unsigned char *ptrs[MAX_PARTITIONS];
    43     unsigned int sizes[MAX_PARTITIONS];
    44 } FRAGMENT_DATA;
    46 #define MAX_FB_MT_DEC 32
    48 struct frame_buffers
    49 {
    50     /*
    51      * this struct will be populated with frame buffer management
    52      * info in future commits. */
    54     /* enable/disable frame-based threading */
    55     int     use_frame_threads;
    57     /* decoder instances */
    58     struct VP8D_COMP *pbi[MAX_FB_MT_DEC];
    60 };
    62 typedef struct VP8D_COMP
    63 {
    64     DECLARE_ALIGNED(16, MACROBLOCKD, mb);
    66     YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS];
    68     DECLARE_ALIGNED(16, VP8_COMMON, common);
    70     /* the last partition will be used for the modes/mvs */
    71     vp8_reader mbc[MAX_PARTITIONS];
    73     VP8D_CONFIG oxcf;
    75     FRAGMENT_DATA fragments;
    77 #if CONFIG_MULTITHREAD
    78     /* variable for threading */
    80     volatile int b_multithreaded_rd;
    81     int max_threads;
    82     int current_mb_col_main;
    83     unsigned int decoding_thread_count;
    84     int allocated_decoding_thread_count;
    86     int mt_baseline_filter_level[MAX_MB_SEGMENTS];
    87     int sync_range;
    88     int *mt_current_mb_col;                  /* Each row remembers its already decoded column. */
    90     unsigned char **mt_yabove_row;           /* mb_rows x width */
    91     unsigned char **mt_uabove_row;
    92     unsigned char **mt_vabove_row;
    93     unsigned char **mt_yleft_col;            /* mb_rows x 16 */
    94     unsigned char **mt_uleft_col;            /* mb_rows x 8 */
    95     unsigned char **mt_vleft_col;            /* mb_rows x 8 */
    97     MB_ROW_DEC           *mb_row_di;
    98     DECODETHREAD_DATA    *de_thread_data;
   100     pthread_t           *h_decoding_thread;
   101     sem_t               *h_event_start_decoding;
   102     sem_t                h_event_end_decoding;
   103     /* end of threading data */
   104 #endif
   106     int64_t last_time_stamp;
   107     int   ready_for_new_data;
   109     vp8_prob prob_intra;
   110     vp8_prob prob_last;
   111     vp8_prob prob_gf;
   112     vp8_prob prob_skip_false;
   114 #if CONFIG_ERROR_CONCEALMENT
   115     MB_OVERLAP *overlaps;
   116     /* the mb num from which modes and mvs (first partition) are corrupt */
   117     unsigned int mvs_corrupt_from_mb;
   118 #endif
   119     int ec_enabled;
   120     int ec_active;
   121     int decoded_key_frame;
   122     int independent_partitions;
   123     int frame_corrupt_residual;
   125     vp8_decrypt_cb *decrypt_cb;
   126     void *decrypt_state;
   127 } VP8D_COMP;
   129 int vp8_decode_frame(VP8D_COMP *cpi);
   131 int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
   132 int vp8_remove_decoder_instances(struct frame_buffers *fb);
   134 #if CONFIG_DEBUG
   135 #define CHECK_MEM_ERROR(lval,expr) do {\
   136         lval = (expr); \
   137         if(!lval) \
   138             vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
   139                                "Failed to allocate "#lval" at %s:%d", \
   140                                __FILE__,__LINE__);\
   141     } while(0)
   142 #else
   143 #define CHECK_MEM_ERROR(lval,expr) do {\
   144         lval = (expr); \
   145         if(!lval) \
   146             vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
   147                                "Failed to allocate "#lval);\
   148     } while(0)
   149 #endif
   151 #endif  // ONYXD_INT_H_

mercurial