History

cavs: Move inline functions only used in one file out of the header

Diego Biurrun committed 14 years ago

Commit a6d9f9e1 parent ef07ac13 files · +48 −48Browse files

Unified · Split

3 files
  1. libavcodec/cavs.c +9 −0
  2. libavcodec/cavs.h +0 −48
  3. libavcodec/cavsdec.c +39 −0
libavcodec/cavs.c+9−0
@@ -328,6 +328,15 @@ static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) · 327 unmodified lines
328328
329329 #undef LOWPASS
330330
331+static inline void modify_pred(const int8_t *mod_table, int *mode)
332+{
333+ *mode = mod_table[*mode];
334+ if(*mode < 0) {
335+ av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
336+ *mode = 0;
337+ }
338+}
339+
331340 void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
332341 /* save pred modes before they get modified */
333342 h->pred_mode_Y[3] = h->pred_mode_Y[5];
libavcodec/cavs.h+0−48
@@ -229,25 +229,6 @@ extern const uint8_t ff_cavs_partition_flags[30]; · 228 unmodified lines
229229 extern const cavs_vector ff_cavs_intra_mv;
230230 extern const cavs_vector ff_cavs_dir_mv;
231231
232−static inline void modify_pred(const int8_t *mod_table, int *mode)
233−{
234− *mode = mod_table[*mode];
235− if(*mode < 0) {
236− av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
237− *mode = 0;
238− }
239−}
240−
241−static inline void set_intra_mode_default(AVSContext *h) {
242− if(h->stream_revision > 0) {
243− h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
244− h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL;
245− } else {
246− h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP;
247− h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP;
248− }
249−}
250−
251232 static inline void set_mvs(cavs_vector *mv, enum cavs_block size) {
252233 switch(size) {
253234 case BLK_16X16:
@@ -262,35 +243,6 @@ static inline void set_mvs(cavs_vector *mv, enum cavs_block size) { · 8 unmodified lines
262243 }
263244 }
264245
265−static inline void set_mv_intra(AVSContext *h) {
266− h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
267− set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
268− h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
269− set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
270− if(h->pic_type != AV_PICTURE_TYPE_B)
271− h->col_type_base[h->mbidx] = I_8X8;
272−}
273−
274−static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
275− DCTELEM *dst, int mul, int shift, int coeff_num) {
276− int round = 1 << (shift - 1);
277− int pos = -1;
278− const uint8_t *scantab = h->scantable.permutated;
279−
280− /* inverse scan and dequantization */
281− while(--coeff_num >= 0){
282− pos += run_buf[coeff_num];
283− if(pos > 63) {
284− av_log(h->s.avctx, AV_LOG_ERROR,
285− "position out of block bounds at pic %d MB(%d,%d)\n",
286− h->picture.poc, h->mbx, h->mby);
287− return -1;
288− }
289− dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
290− }
291− return 0;
292−}
293−
294246 void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type);
295247 void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top, uint8_t **left,
296248 int block);
libavcodec/cavsdec.c+39−0
@@ -511,6 +511,26 @@ static inline int get_ue_code(GetBitContext *gb, int order) { · 510 unmodified lines
511511 return get_ue_golomb(gb);
512512 }
513513
514+static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
515+ DCTELEM *dst, int mul, int shift, int coeff_num) {
516+ int round = 1 << (shift - 1);
517+ int pos = -1;
518+ const uint8_t *scantab = h->scantable.permutated;
519+
520+ /* inverse scan and dequantization */
521+ while(--coeff_num >= 0){
522+ pos += run_buf[coeff_num];
523+ if(pos > 63) {
524+ av_log(h->s.avctx, AV_LOG_ERROR,
525+ "position out of block bounds at pic %d MB(%d,%d)\n",
526+ h->picture.poc, h->mbx, h->mby);
527+ return -1;
528+ }
529+ dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
530+ }
531+ return 0;
532+}
533+
514534 /**
515535 * decode coefficients from one 8x8 block, dequantize, inverse transform
516536 * and add them to sample block
@@ -597,6 +617,15 @@ static inline int decode_residual_inter(AVSContext *h) { · 80 unmodified lines
597617 *
598618 ****************************************************************************/
599619
620+static inline void set_mv_intra(AVSContext *h) {
621+ h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
622+ set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
623+ h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
624+ set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
625+ if(h->pic_type != AV_PICTURE_TYPE_B)
626+ h->col_type_base[h->mbidx] = I_8X8;
627+}
628+
600629 static int decode_mb_i(AVSContext *h, int cbp_code) {
601630 GetBitContext *gb = &h->s.gb;
602631 unsigned pred_mode_uv;
@@ -664,6 +693,16 @@ static int decode_mb_i(AVSContext *h, int cbp_code) { · 61 unmodified lines
664693 return 0;
665694 }
666695
696+static inline void set_intra_mode_default(AVSContext *h) {
697+ if(h->stream_revision > 0) {
698+ h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
699+ h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL;
700+ } else {
701+ h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP;
702+ h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP;
703+ }
704+}
705+
667706 static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
668707 GetBitContext *gb = &h->s.gb;
669708 int ref[4];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t