]> granicus.if.org Git - libvpx/blob - vp8/encoder/onyx_int.h
Revert "Restore vp8_sixtap_predict4x4_neon"
[libvpx] / vp8 / encoder / onyx_int.h
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  */
10
11 #ifndef VP8_ENCODER_ONYX_INT_H_
12 #define VP8_ENCODER_ONYX_INT_H_
13
14 #include <stdio.h>
15 #include "vpx_config.h"
16 #include "vp8/common/onyx.h"
17 #include "treewriter.h"
18 #include "tokenize.h"
19 #include "vp8/common/onyxc_int.h"
20 #include "vpx_dsp/variance.h"
21 #include "encodemb.h"
22 #include "vp8/encoder/quantize.h"
23 #include "vp8/common/entropy.h"
24 #include "vp8/common/threading.h"
25 #include "vpx_ports/mem.h"
26 #include "vpx/internal/vpx_codec_internal.h"
27 #include "vpx/vp8.h"
28 #include "mcomp.h"
29 #include "vp8/common/findnearmv.h"
30 #include "lookahead.h"
31 #if CONFIG_TEMPORAL_DENOISING
32 #include "vp8/encoder/denoising.h"
33 #endif
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define MIN_GF_INTERVAL 4
40 #define DEFAULT_GF_INTERVAL 7
41
42 #define KEY_FRAME_CONTEXT 5
43
44 #define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY ? 1 : 25)
45
46 #define AF_THRESH 25
47 #define AF_THRESH2 100
48 #define ARF_DECAY_THRESH 12
49
50 #define MIN_THRESHMULT 32
51 #define MAX_THRESHMULT 512
52
53 #define GF_ZEROMV_ZBIN_BOOST 12
54 #define LF_ZEROMV_ZBIN_BOOST 6
55 #define MV_ZBIN_BOOST 4
56 #define ZBIN_OQ_MAX 192
57
58 #define VP8_TEMPORAL_ALT_REF !CONFIG_REALTIME_ONLY
59
60 typedef struct {
61   int kf_indicated;
62   unsigned int frames_since_key;
63   unsigned int frames_since_golden;
64   int filter_level;
65   int frames_till_gf_update_due;
66   int recent_ref_frame_usage[MAX_REF_FRAMES];
67
68   MV_CONTEXT mvc[2];
69   int mvcosts[2][MVvals + 1];
70
71 #ifdef MODE_STATS
72   int y_modes[5];
73   int uv_modes[4];
74   int b_modes[10];
75   int inter_y_modes[10];
76   int inter_uv_modes[4];
77   int inter_b_modes[10];
78 #endif
79
80   vp8_prob ymode_prob[4], uv_mode_prob[3]; /* interframe intra mode probs */
81   vp8_prob kf_ymode_prob[4], kf_uv_mode_prob[3]; /* keyframe "" */
82
83   int ymode_count[5], uv_mode_count[4]; /* intra MB type cts this frame */
84
85   int count_mb_ref_frame_usage[MAX_REF_FRAMES];
86
87   int this_frame_percent_intra;
88   int last_frame_percent_intra;
89
90 } CODING_CONTEXT;
91
92 typedef struct {
93   double frame;
94   double intra_error;
95   double coded_error;
96   double ssim_weighted_pred_err;
97   double pcnt_inter;
98   double pcnt_motion;
99   double pcnt_second_ref;
100   double pcnt_neutral;
101   double MVr;
102   double mvr_abs;
103   double MVc;
104   double mvc_abs;
105   double MVrv;
106   double MVcv;
107   double mv_in_out_count;
108   double new_mv_count;
109   double duration;
110   double count;
111 } FIRSTPASS_STATS;
112
113 typedef struct {
114   int frames_so_far;
115   double frame_intra_error;
116   double frame_coded_error;
117   double frame_pcnt_inter;
118   double frame_pcnt_motion;
119   double frame_mvr;
120   double frame_mvr_abs;
121   double frame_mvc;
122   double frame_mvc_abs;
123
124 } ONEPASS_FRAMESTATS;
125
126 typedef enum {
127   THR_ZERO1 = 0,
128   THR_DC = 1,
129
130   THR_NEAREST1 = 2,
131   THR_NEAR1 = 3,
132
133   THR_ZERO2 = 4,
134   THR_NEAREST2 = 5,
135
136   THR_ZERO3 = 6,
137   THR_NEAREST3 = 7,
138
139   THR_NEAR2 = 8,
140   THR_NEAR3 = 9,
141
142   THR_V_PRED = 10,
143   THR_H_PRED = 11,
144   THR_TM = 12,
145
146   THR_NEW1 = 13,
147   THR_NEW2 = 14,
148   THR_NEW3 = 15,
149
150   THR_SPLIT1 = 16,
151   THR_SPLIT2 = 17,
152   THR_SPLIT3 = 18,
153
154   THR_B_PRED = 19
155 } THR_MODES;
156
157 typedef enum { DIAMOND = 0, NSTEP = 1, HEX = 2 } SEARCH_METHODS;
158
159 typedef struct {
160   int RD;
161   SEARCH_METHODS search_method;
162   int improved_quant;
163   int improved_dct;
164   int auto_filter;
165   int recode_loop;
166   int iterative_sub_pixel;
167   int half_pixel_search;
168   int quarter_pixel_search;
169   int thresh_mult[MAX_MODES];
170   int max_step_search_steps;
171   int first_step;
172   int optimize_coefficients;
173
174   int use_fastquant_for_pick;
175   int no_skip_block4x4_search;
176   int improved_mv_pred;
177
178 } SPEED_FEATURES;
179
180 typedef struct {
181   MACROBLOCK mb;
182   int segment_counts[MAX_MB_SEGMENTS];
183   int totalrate;
184 } MB_ROW_COMP;
185
186 typedef struct {
187   TOKENEXTRA *start;
188   TOKENEXTRA *stop;
189 } TOKENLIST;
190
191 typedef struct {
192   int ithread;
193   void *ptr1;
194   void *ptr2;
195 } ENCODETHREAD_DATA;
196 typedef struct {
197   int ithread;
198   void *ptr1;
199 } LPFTHREAD_DATA;
200
201 enum {
202   BLOCK_16X8,
203   BLOCK_8X16,
204   BLOCK_8X8,
205   BLOCK_4X4,
206   BLOCK_16X16,
207   BLOCK_MAX_SEGMENTS
208 };
209
210 typedef struct {
211   /* Layer configuration */
212   double framerate;
213   int target_bandwidth;
214
215   /* Layer specific coding parameters */
216   int64_t starting_buffer_level;
217   int64_t optimal_buffer_level;
218   int64_t maximum_buffer_size;
219   int64_t starting_buffer_level_in_ms;
220   int64_t optimal_buffer_level_in_ms;
221   int64_t maximum_buffer_size_in_ms;
222
223   int avg_frame_size_for_layer;
224
225   int64_t buffer_level;
226   int64_t bits_off_target;
227
228   int64_t total_actual_bits;
229   int total_target_vs_actual;
230
231   int worst_quality;
232   int active_worst_quality;
233   int best_quality;
234   int active_best_quality;
235
236   int ni_av_qi;
237   int ni_tot_qi;
238   int ni_frames;
239   int avg_frame_qindex;
240
241   double rate_correction_factor;
242   double key_frame_rate_correction_factor;
243   double gf_rate_correction_factor;
244
245   int zbin_over_quant;
246
247   int inter_frame_target;
248   int64_t total_byte_count;
249
250   int filter_level;
251
252   int last_frame_percent_intra;
253
254   int count_mb_ref_frame_usage[MAX_REF_FRAMES];
255
256 } LAYER_CONTEXT;
257
258 typedef struct VP8_COMP {
259   DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]);
260   DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]);
261   DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]);
262   DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]);
263
264   DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]);
265   DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]);
266   DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]);
267   DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]);
268
269   DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]);
270   DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]);
271   DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]);
272   DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]);
273
274   DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]);
275   DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]);
276   DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]);
277   DECLARE_ALIGNED(16, short, Y1quant_fast[QINDEX_RANGE][16]);
278   DECLARE_ALIGNED(16, short, Y2quant_fast[QINDEX_RANGE][16]);
279   DECLARE_ALIGNED(16, short, UVquant_fast[QINDEX_RANGE][16]);
280
281   MACROBLOCK mb;
282   VP8_COMMON common;
283   vp8_writer bc[9]; /* one boolcoder for each partition */
284
285   VP8_CONFIG oxcf;
286
287   struct lookahead_ctx *lookahead;
288   struct lookahead_entry *source;
289   struct lookahead_entry *alt_ref_source;
290   struct lookahead_entry *last_source;
291
292   YV12_BUFFER_CONFIG *Source;
293   YV12_BUFFER_CONFIG *un_scaled_source;
294   YV12_BUFFER_CONFIG scaled_source;
295   YV12_BUFFER_CONFIG *last_frame_unscaled_source;
296
297   unsigned int frames_till_alt_ref_frame;
298   /* frame in src_buffers has been identified to be encoded as an alt ref */
299   int source_alt_ref_pending;
300   /* an alt ref frame has been encoded and is usable */
301   int source_alt_ref_active;
302   /* source of frame to encode is an exact copy of an alt ref frame */
303   int is_src_frame_alt_ref;
304
305   /* golden frame same as last frame ( short circuit gold searches) */
306   int gold_is_last;
307   /* Alt reference frame same as last ( short circuit altref search) */
308   int alt_is_last;
309   /* don't do both alt and gold search ( just do gold). */
310   int gold_is_alt;
311
312   YV12_BUFFER_CONFIG pick_lf_lvl_frame;
313
314   TOKENEXTRA *tok;
315   unsigned int tok_count;
316
317   unsigned int frames_since_key;
318   unsigned int key_frame_frequency;
319   unsigned int this_key_frame_forced;
320   unsigned int next_key_frame_forced;
321
322   /* Ambient reconstruction err target for force key frames */
323   int ambient_err;
324
325   unsigned int mode_check_freq[MAX_MODES];
326
327   int rd_baseline_thresh[MAX_MODES];
328
329   int RDMULT;
330   int RDDIV;
331
332   CODING_CONTEXT coding_context;
333
334   /* Rate targetting variables */
335   int64_t last_prediction_error;
336   int64_t last_intra_error;
337
338   int this_frame_target;
339   int projected_frame_size;
340   int last_q[2]; /* Separate values for Intra/Inter */
341
342   double rate_correction_factor;
343   double key_frame_rate_correction_factor;
344   double gf_rate_correction_factor;
345
346   int frames_since_golden;
347   /* Count down till next GF */
348   int frames_till_gf_update_due;
349
350   /* GF interval chosen when we coded the last GF */
351   int current_gf_interval;
352
353   /* Total bits overspent becasue of GF boost (cumulative) */
354   int gf_overspend_bits;
355
356   /* Used in the few frames following a GF to recover the extra bits
357    * spent in that GF
358    */
359   int non_gf_bitrate_adjustment;
360
361   /* Extra bits spent on key frames that need to be recovered */
362   int kf_overspend_bits;
363
364   /* Current number of bit s to try and recover on each inter frame. */
365   int kf_bitrate_adjustment;
366   int max_gf_interval;
367   int baseline_gf_interval;
368   int active_arnr_frames;
369
370   int64_t key_frame_count;
371   int prior_key_frame_distance[KEY_FRAME_CONTEXT];
372   /* Current section per frame bandwidth target */
373   int per_frame_bandwidth;
374   /* Average frame size target for clip */
375   int av_per_frame_bandwidth;
376   /* Minimum allocation that should be used for any frame */
377   int min_frame_bandwidth;
378   int inter_frame_target;
379   double output_framerate;
380   int64_t last_time_stamp_seen;
381   int64_t last_end_time_stamp_seen;
382   int64_t first_time_stamp_ever;
383
384   int ni_av_qi;
385   int ni_tot_qi;
386   int ni_frames;
387   int avg_frame_qindex;
388
389   int64_t total_byte_count;
390
391   int buffered_mode;
392
393   double framerate;
394   double ref_framerate;
395   int64_t buffer_level;
396   int64_t bits_off_target;
397
398   int rolling_target_bits;
399   int rolling_actual_bits;
400
401   int long_rolling_target_bits;
402   int long_rolling_actual_bits;
403
404   int64_t total_actual_bits;
405   int total_target_vs_actual; /* debug stats */
406
407   int worst_quality;
408   int active_worst_quality;
409   int best_quality;
410   int active_best_quality;
411
412   int cq_target_quality;
413
414   int drop_frames_allowed; /* Are we permitted to drop frames? */
415   int drop_frame;          /* Drop this frame? */
416
417   vp8_prob frame_coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
418                            [ENTROPY_NODES];
419   char update_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
420
421   unsigned int frame_branch_ct[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
422                               [ENTROPY_NODES][2];
423
424   int gfu_boost;
425   int kf_boost;
426   int last_boost;
427
428   int target_bandwidth;
429   struct vpx_codec_pkt_list *output_pkt_list;
430
431 #if 0
432     /* Experimental code for lagged and one pass */
433     ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS];
434     int one_pass_frame_index;
435 #endif
436
437   int decimation_factor;
438   int decimation_count;
439
440   /* for real time encoding */
441   int avg_encode_time;    /* microsecond */
442   int avg_pick_mode_time; /* microsecond */
443   int Speed;
444   int compressor_speed;
445
446   int auto_gold;
447   int auto_adjust_gold_quantizer;
448   int auto_worst_q;
449   int cpu_used;
450   int pass;
451
452   int prob_intra_coded;
453   int prob_last_coded;
454   int prob_gf_coded;
455   int prob_skip_false;
456   int last_skip_false_probs[3];
457   int last_skip_probs_q[3];
458   int recent_ref_frame_usage[MAX_REF_FRAMES];
459
460   int this_frame_percent_intra;
461   int last_frame_percent_intra;
462
463   int ref_frame_flags;
464
465   SPEED_FEATURES sf;
466
467   /* Count ZEROMV on all reference frames. */
468   int zeromv_count;
469   int lf_zeromv_pct;
470
471   unsigned char *segmentation_map;
472   signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
473   int segment_encode_breakout[MAX_MB_SEGMENTS];
474
475   unsigned char *active_map;
476   unsigned int active_map_enabled;
477
478   /* Video conferencing cyclic refresh mode flags. This is a mode
479    * designed to clean up the background over time in live encoding
480    * scenarious. It uses segmentation.
481    */
482   int cyclic_refresh_mode_enabled;
483   int cyclic_refresh_mode_max_mbs_perframe;
484   int cyclic_refresh_mode_index;
485   int cyclic_refresh_q;
486   signed char *cyclic_refresh_map;
487   // Count on how many (consecutive) times a macroblock uses ZER0MV_LAST.
488   unsigned char *consec_zero_last;
489   // Counter that is reset when a block is checked for a mode-bias against
490   // ZEROMV_LASTREF.
491   unsigned char *consec_zero_last_mvbias;
492
493   // Frame counter for the temporal pattern. Counter is rest when the temporal
494   // layers are changed dynamically (run-time change).
495   unsigned int temporal_pattern_counter;
496   // Temporal layer id.
497   int temporal_layer_id;
498
499   // Measure of average squared difference between source and denoised signal.
500   int mse_source_denoised;
501
502   int force_maxqp;
503
504 #if CONFIG_MULTITHREAD
505   /* multithread data */
506   int *mt_current_mb_col;
507   int mt_sync_range;
508   int b_multi_threaded;
509   int encoding_thread_count;
510   int b_lpf_running;
511
512   pthread_t *h_encoding_thread;
513   pthread_t h_filter_thread;
514
515   MB_ROW_COMP *mb_row_ei;
516   ENCODETHREAD_DATA *en_thread_data;
517   LPFTHREAD_DATA lpf_thread_data;
518
519   /* events */
520   sem_t *h_event_start_encoding;
521   sem_t h_event_end_encoding;
522   sem_t h_event_start_lpf;
523   sem_t h_event_end_lpf;
524 #endif
525
526   TOKENLIST *tplist;
527   unsigned int partition_sz[MAX_PARTITIONS];
528   unsigned char *partition_d[MAX_PARTITIONS];
529   unsigned char *partition_d_end[MAX_PARTITIONS];
530
531   fractional_mv_step_fp *find_fractional_mv_step;
532   vp8_full_search_fn_t full_search_sad;
533   vp8_refining_search_fn_t refining_search_sad;
534   vp8_diamond_search_fn_t diamond_search_sad;
535   vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
536   uint64_t time_receive_data;
537   uint64_t time_compress_data;
538   uint64_t time_pick_lpf;
539   uint64_t time_encode_mb_row;
540
541   int base_skip_false_prob[128];
542
543   FRAME_CONTEXT lfc_n; /* last frame entropy */
544   FRAME_CONTEXT lfc_a; /* last alt ref entropy */
545   FRAME_CONTEXT lfc_g; /* last gold ref entropy */
546
547   struct twopass_rc {
548     unsigned int section_intra_rating;
549     double section_max_qfactor;
550     unsigned int next_iiratio;
551     unsigned int this_iiratio;
552     FIRSTPASS_STATS total_stats;
553     FIRSTPASS_STATS this_frame_stats;
554     FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start;
555     FIRSTPASS_STATS total_left_stats;
556     int first_pass_done;
557     int64_t bits_left;
558     int64_t clip_bits_total;
559     double avg_iiratio;
560     double modified_error_total;
561     double modified_error_used;
562     double modified_error_left;
563     double kf_intra_err_min;
564     double gf_intra_err_min;
565     int frames_to_key;
566     int maxq_max_limit;
567     int maxq_min_limit;
568     int gf_decay_rate;
569     int static_scene_max_gf_interval;
570     int kf_bits;
571     /* Remaining error from uncoded frames in a gf group. */
572     int gf_group_error_left;
573     /* Projected total bits available for a key frame group of frames */
574     int64_t kf_group_bits;
575     /* Error score of frames still to be coded in kf group */
576     int64_t kf_group_error_left;
577     /* Projected Bits available for a group including 1 GF or ARF */
578     int64_t gf_group_bits;
579     /* Bits for the golden frame or ARF */
580     int gf_bits;
581     int alt_extra_bits;
582     double est_max_qcorrection_factor;
583   } twopass;
584
585 #if VP8_TEMPORAL_ALT_REF
586   YV12_BUFFER_CONFIG alt_ref_buffer;
587   YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
588   int fixed_divide[512];
589 #endif
590
591 #if CONFIG_INTERNAL_STATS
592   int count;
593   double total_y;
594   double total_u;
595   double total_v;
596   double total;
597   double total_sq_error;
598   double totalp_y;
599   double totalp_u;
600   double totalp_v;
601   double totalp;
602   double total_sq_error2;
603   int bytes;
604   double summed_quality;
605   double summed_weights;
606   unsigned int tot_recode_hits;
607
608   int b_calculate_ssimg;
609 #endif
610   int b_calculate_psnr;
611
612   /* Per MB activity measurement */
613   unsigned int activity_avg;
614   unsigned int *mb_activity_map;
615
616   /* Record of which MBs still refer to last golden frame either
617    * directly or through 0,0
618    */
619   unsigned char *gf_active_flags;
620   int gf_active_count;
621
622   int output_partition;
623
624   /* Store last frame's MV info for next frame MV prediction */
625   int_mv *lfmv;
626   int *lf_ref_frame_sign_bias;
627   int *lf_ref_frame;
628
629   /* force next frame to intra when kf_auto says so */
630   int force_next_frame_intra;
631
632   int droppable;
633
634   int initial_width;
635   int initial_height;
636
637 #if CONFIG_TEMPORAL_DENOISING
638   VP8_DENOISER denoiser;
639 #endif
640
641   /* Coding layer state variables */
642   unsigned int current_layer;
643   LAYER_CONTEXT layer_context[VPX_TS_MAX_LAYERS];
644
645   int64_t frames_in_layer[VPX_TS_MAX_LAYERS];
646   int64_t bytes_in_layer[VPX_TS_MAX_LAYERS];
647   double sum_psnr[VPX_TS_MAX_LAYERS];
648   double sum_psnr_p[VPX_TS_MAX_LAYERS];
649   double total_error2[VPX_TS_MAX_LAYERS];
650   double total_error2_p[VPX_TS_MAX_LAYERS];
651   double sum_ssim[VPX_TS_MAX_LAYERS];
652   double sum_weights[VPX_TS_MAX_LAYERS];
653
654   double total_ssimg_y_in_layer[VPX_TS_MAX_LAYERS];
655   double total_ssimg_u_in_layer[VPX_TS_MAX_LAYERS];
656   double total_ssimg_v_in_layer[VPX_TS_MAX_LAYERS];
657   double total_ssimg_all_in_layer[VPX_TS_MAX_LAYERS];
658
659 #if CONFIG_MULTI_RES_ENCODING
660   /* Number of MBs per row at lower-resolution level */
661   int mr_low_res_mb_cols;
662   /* Indicate if lower-res mv info is available */
663   unsigned char mr_low_res_mv_avail;
664 #endif
665   /* The frame number of each reference frames */
666   unsigned int current_ref_frames[MAX_REF_FRAMES];
667   // Closest reference frame to current frame.
668   MV_REFERENCE_FRAME closest_reference_frame;
669
670   struct rd_costs_struct {
671     int mvcosts[2][MVvals + 1];
672     int mvsadcosts[2][MVfpvals + 1];
673     int mbmode_cost[2][MB_MODE_COUNT];
674     int intra_uv_mode_cost[2][MB_MODE_COUNT];
675     int bmode_costs[10][10][10];
676     int inter_bmode_costs[B_MODE_COUNT];
677     int token_costs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
678                    [MAX_ENTROPY_TOKENS];
679   } rd_costs;
680 } VP8_COMP;
681
682 void vp8_initialize_enc(void);
683
684 void vp8_alloc_compressor_data(VP8_COMP *cpi);
685 int vp8_reverse_trans(int x);
686 void vp8_new_framerate(VP8_COMP *cpi, double framerate);
687 void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm);
688
689 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
690                         unsigned char *dest_end, unsigned long *size);
691
692 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCK *, TOKENEXTRA **);
693
694 void vp8_set_speed_features(VP8_COMP *cpi);
695
696 #if CONFIG_DEBUG
697 #define CHECK_MEM_ERROR(lval, expr)                                         \
698   do {                                                                      \
699     lval = (expr);                                                          \
700     if (!lval)                                                              \
701       vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,           \
702                          "Failed to allocate " #lval " at %s:%d", __FILE__, \
703                          __LINE__);                                         \
704   } while (0)
705 #else
706 #define CHECK_MEM_ERROR(lval, expr)                               \
707   do {                                                            \
708     lval = (expr);                                                \
709     if (!lval)                                                    \
710       vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR, \
711                          "Failed to allocate " #lval);            \
712   } while (0)
713 #endif
714 #ifdef __cplusplus
715 }  // extern "C"
716 #endif
717
718 #endif  // VP8_ENCODER_ONYX_INT_H_