static int mpeg_to_dp(Data_Obj *dp,Mpeg_Hdr *mpeg_hp) { dp->dt_prec = PREC_UBY; dp->dt_tdim = mpeg_hp->depth; dp->dt_cols = mpeg_hp->width; dp->dt_rows = mpeg_hp->height; dp->dt_frames = mpeg_hp->frames; dp->dt_seqs = 1; dp->dt_cinc = 1; dp->dt_pinc = 1; dp->dt_rinc = dp->dt_pinc*dp->dt_cols; dp->dt_finc = dp->dt_rinc*dp->dt_rows; dp->dt_sinc = dp->dt_finc*dp->dt_frames; dp->dt_parent = NO_OBJ; dp->dt_children = NO_LIST; dp->dt_ap = ram_area; /* the default */ dp->dt_data = NULL; dp->dt_nelts = dp->dt_tdim * dp->dt_cols * dp->dt_rows * dp->dt_frames * dp->dt_seqs; auto_shape_flags(&dp->dt_shape,dp); return(0); }
//int _wav_to_dp(QSP_ARG_DECL Data_Obj *dp,Wav_Header *hd_p) FIO_FT_TO_DP_FUNC(wav,Wav_Header) { Precision * prec_p; dimension_t total_samples, samples_per_channel; switch( hd_p->wh_bits_per_sample ){ case 8: prec_p=PREC_FOR_CODE(PREC_UBY); break; case 16: prec_p=PREC_FOR_CODE(PREC_IN); break; default: sprintf(ERROR_STRING, "wav_to_dp: unexpected # of bits per sample %d", hd_p->wh_bits_per_sample); warn(ERROR_STRING); return(-1); } SET_OBJ_PREC_PTR(dp, prec_p); SET_OBJ_COMPS(dp, hd_p->wh_n_channels ); total_samples = (dimension_t) (hd_p->wh_datasize / PREC_SIZE( prec_p )); samples_per_channel = total_samples / OBJ_COMPS(dp); SET_OBJ_COLS(dp, samples_per_channel); SET_OBJ_ROWS(dp, 1); SET_OBJ_FRAMES(dp, 1); SET_OBJ_SEQS(dp, 1); SET_OBJ_COMP_INC(dp, 1); SET_OBJ_PXL_INC(dp, 1); SET_OBJ_ROW_INC(dp, 1); SET_OBJ_FRM_INC(dp, 1); SET_OBJ_SEQ_INC(dp, 1); SET_OBJ_PARENT(dp, NULL); SET_OBJ_CHILDREN(dp, NULL); SET_OBJ_AREA(dp, ram_area_p); /* the default */ /* dp->dt_data = hd_p->image; */ /* where do we allocate data??? */ SET_OBJ_N_TYPE_ELTS(dp, OBJ_COMPS(dp) * OBJ_COLS(dp) * OBJ_ROWS(dp) * OBJ_FRAMES(dp) * OBJ_SEQS(dp) ); auto_shape_flags(OBJ_SHAPE(dp)); return 0; }
void _gen_xpose(QSP_ARG_DECL Data_Obj *dp,int dim1,int dim2) { dimension_t tmp_dim; incr_t tmp_inc; assert( dim1 >= 0 && dim1 < N_DIMENSIONS ); assert( dim2 >= 0 && dim2 < N_DIMENSIONS ); EXCHANGE_DIMS(OBJ_TYPE_DIMS(dp),dim1,dim2) EXCHANGE_DIMS(OBJ_MACH_DIMS(dp),dim1,dim2) EXCHANGE_INCS(OBJ_TYPE_INCS(dp),dim1,dim2) EXCHANGE_INCS(OBJ_MACH_INCS(dp),dim1,dim2) /* should this be CAUTIOUS??? */ if( auto_shape_flags(OBJ_SHAPE(dp)) < 0 ) warn("gen_xpose: RATS!?"); check_contiguity(dp); }